From ffd84a0f60f918a48e6e2f24e37e7c53291c0373 Mon Sep 17 00:00:00 2001 From: Max Filippov Date: Thu, 15 Sep 2022 12:30:50 -0700 Subject: static pie: fix building static PDE When uclibc is built with static PIE support the _dl_load_base variable shared between the libc-tls.c and reloc_static_pie.c creates the dependency that requires linking reloc_static_pie.o into static position-dependent executables resulting in the following build errors: gcc -static test.c -o test ...ld: ...usr/lib/libc.a(reloc_static_pie.os):(.text+0x0): undefined reference to `_DYNAMIC' Move _dl_load_base definition to libc-tls.c to resolve this dependency and fix static PDE build. Signed-off-by: Max Filippov --- libc/misc/internals/reloc_static_pie.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libc/misc') diff --git a/libc/misc/internals/reloc_static_pie.c b/libc/misc/internals/reloc_static_pie.c index c0027de6f..ce42cb9b3 100644 --- a/libc/misc/internals/reloc_static_pie.c +++ b/libc/misc/internals/reloc_static_pie.c @@ -25,7 +25,7 @@ #include #endif -ElfW(Addr) _dl_load_base = NULL; +extern ElfW(Addr) _dl_load_base; void reloc_static_pie (ElfW(Addr) load_addr); @@ -107,4 +107,4 @@ reloc_static_pie(ElfW(Addr) load_addr) #endif } _dl_load_base = load_addr; -} \ No newline at end of file +} -- cgit v1.2.3