diff mbox series

[uclibc-ng-devel,2/5] static pie: replicate PERFORM_BOOTSTRAP_GOT conditions from dl-startup.c

Message ID 20220909183009.4111393-3-jcmvbkbc@gmail.com
State Superseded
Headers show
Series add static PIE support for xtensa | expand

Commit Message

Max Filippov Sept. 9, 2022, 6:30 p.m. UTC
Code in reloc_static_pie.c is largely based on DL_START function from
dl-startup.c, but it's missing the condition that disables the rest of
relocation when PERFORM_BOOTSTRAP_GOT macro is defined. As a result when
building reloc_static_pie.c for xtensa it applies relative relocations
twice.
Replicate PERFORM_BOOTSTRAP_GOT conditions from dl-startup.c in
reloc_static_pie.c to allow using PERFORM_BOOTSTRAP_GOT macro as is.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
 libc/misc/internals/reloc_static_pie.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/libc/misc/internals/reloc_static_pie.c b/libc/misc/internals/reloc_static_pie.c
index ce42cb9b30df..9f5366cc6ab7 100644
--- a/libc/misc/internals/reloc_static_pie.c
+++ b/libc/misc/internals/reloc_static_pie.c
@@ -54,6 +54,8 @@  reloc_static_pie(ElfW(Addr) load_addr)
 #endif
 
 
+#if !defined(PERFORM_BOOTSTRAP_GOT) || defined(__avr32__) || defined(__mips__)
+
 #if defined(ELF_MACHINE_PLTREL_OVERLAP)
 # define INDX_MAX 1
 #else
@@ -106,5 +108,6 @@  reloc_static_pie(ElfW(Addr) load_addr)
 			}
 #endif
     }
+#endif
     _dl_load_base = load_addr;
 }