diff mbox series

[uclibc-ng-devel,v2,2/5] ldso: clean up PERFORM_BOOTSTRAP_GOT ifdeferry

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

Commit Message

Max Filippov Sept. 15, 2022, 7:30 p.m. UTC
3 architectures currently define PERFORM_BOOTSTRAP_GOT: avr32, mips and
xtensa. A block of code that applies relative relocations in the
DL_START is disabled when PERFORM_BOOTSTRAP_GOT is defined, unless it's
avr32 or mips, effectively disabling it only for xtensa.
This may be simplified by removing the call to elf_machine_relative from
the xtensa PERFORM_BOOTSTRAP_GOT and always using common code.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
Changes v1->v2:
- new patch

 ldso/ldso/dl-startup.c        |  3 ---
 ldso/ldso/xtensa/dl-startup.h | 11 -----------
 2 files changed, 14 deletions(-)
diff mbox series

Patch

diff --git a/ldso/ldso/dl-startup.c b/ldso/ldso/dl-startup.c
index 24b046c62b0b..a1b3d49fdd39 100644
--- a/ldso/ldso/dl-startup.c
+++ b/ldso/ldso/dl-startup.c
@@ -255,8 +255,6 @@  DL_START(unsigned long args)
 	PERFORM_BOOTSTRAP_GOT(tpnt);
 #endif
 
-#if !defined(PERFORM_BOOTSTRAP_GOT) || defined(__avr32__) || defined(__mips__)
-
 	/* OK, now do the relocations.  We do not do a lazy binding here, so
 	   that once we are done, we have considerably more flexibility. */
 	SEND_EARLY_STDERR_DEBUG("About to do library loader relocations\n");
@@ -337,7 +335,6 @@  DL_START(unsigned long args)
 #endif
 		}
 	}
-#endif
 
 	SEND_STDERR_DEBUG("Done relocating ldso; we can now use globals and make function calls!\n");
 
diff --git a/ldso/ldso/xtensa/dl-startup.h b/ldso/ldso/xtensa/dl-startup.h
index db223feadc90..92877aa016fb 100644
--- a/ldso/ldso/xtensa/dl-startup.h
+++ b/ldso/ldso/xtensa/dl-startup.h
@@ -92,8 +92,6 @@  __asm__ (
 do { \
 	xtensa_got_location *got_loc; \
 	unsigned long l_addr = tpnt->loadaddr; \
-	Elf32_Word relative_count; \
-	unsigned long rel_addr; \
 	Elf32_Addr prev_got_start = 0, prev_got_end = 0; \
 	int x; \
 \
@@ -125,13 +123,4 @@  do { \
 					  prev_got_end - prev_got_start, \
 					  PROT_READ | PROT_WRITE | PROT_EXEC); \
 	} \
-\
-	/* The following is a stripped down version of the code following \
-	   the invocation of PERFORM_BOOTSTRAP_GOT in dl-startup.c.	 That \
-	   code is skipped when PERFORM_BOOTSTRAP_GOT is defined, so it has \
-	   to be done here instead.	 */ \
-	relative_count = tpnt->dynamic_info[DT_RELCONT_IDX]; \
-	rel_addr = tpnt->dynamic_info[DT_RELOC_TABLE_ADDR]; \
-	if (rel_addr) \
-	  elf_machine_relative(load_addr, rel_addr, relative_count); \
 } while (0)