From 3a465cb94f3c18c380cec96a3a1e432803ab12f0 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Wed, 4 Dec 2024 21:11:43 +0200 Subject: [PATCH] DynamicLoader: Don't write to pltgot if it does not exist This makes `tcc` compile runnable executables --- userspace/programs/DynamicLoader/main.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/userspace/programs/DynamicLoader/main.cpp b/userspace/programs/DynamicLoader/main.cpp index 3bd6547ff2..537163c53d 100644 --- a/userspace/programs/DynamicLoader/main.cpp +++ b/userspace/programs/DynamicLoader/main.cpp @@ -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(pltgot)[0] = reinterpret_cast(elf.dynamics); reinterpret_cast(pltgot)[1] = reinterpret_cast(&elf);