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 <jcmvb...@gmail.com>
---
 libc/misc/internals/reloc_static_pie.c | 3 +++
 1 file changed, 3 insertions(+)

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;
 }
-- 
2.30.2

_______________________________________________
devel mailing list -- devel@uclibc-ng.org
To unsubscribe send an email to devel-le...@uclibc-ng.org

Reply via email to