Просмотр исходного кода

Fix build with static-pie but without nptl threads

since ffd84a0f6 the `_dl_load_base` variable is defined in the nptl code
and as such its existance is now gated behind UCLIBC_HAS_THREADS_NATIVE.
When building without that config (e.g. allnoconfig) an unresolved symbol
linking error occurs. Add a check to the static pie code reponsible for
setting that variable to only attempt to initialize it if nessecary.

Fixes: ffd84a0f6 ("static pie: fix building static PDE")
Signed-off-by: Charles Mirabile <cmirabil@redhat.com>
Charles Mirabile 1 месяц назад
Родитель
Сommit
3b73b01e4d
1 измененных файлов с 4 добавлено и 0 удалено
  1. 4 0
      libc/misc/internals/reloc_static_pie.c

+ 4 - 0
libc/misc/internals/reloc_static_pie.c

@@ -25,7 +25,9 @@
 #include <dl-startup.h>
 #endif
 
+#ifdef __UCLIBC_HAS_THREADS_NATIVE__
 extern ElfW(Addr) _dl_load_base;
+#endif
 
 void
 reloc_static_pie (ElfW(Addr) load_addr);
@@ -111,5 +113,7 @@ reloc_static_pie(ElfW(Addr) load_addr)
 			(void)rel_size;
 #endif
     }
+#ifdef __UCLIBC_HAS_THREADS_NATIVE__
     _dl_load_base = load_addr;
+#endif
 }