DynamicLoader: Don't write to pltgot if it does not exist

This makes `tcc` compile runnable executables
This commit is contained in:
Bananymous 2024-12-04 21:11:43 +02:00
parent 49133dce48
commit 3a465cb94f
1 changed files with 3 additions and 0 deletions

View File

@ -567,6 +567,9 @@ static void handle_dynamic(LoadedElf& elf)
syscall(SYS_CLOSE, library_fd);
}
if (pltgot == 0)
return;
// setup required GOT entries
reinterpret_cast<uintptr_t*>(pltgot)[0] = reinterpret_cast<uintptr_t>(elf.dynamics);
reinterpret_cast<uintptr_t*>(pltgot)[1] = reinterpret_cast<uintptr_t>(&elf);