[git commit] ldso/mips: Enable bootstrap relocations

Carmelo Amoroso carmelo.amoroso at st.com
Wed Jul 27 07:40:37 UTC 2011


commit: http://git.uclibc.org/uClibc/commit/?id=2d4243ce60bcd7a9f64c2ce670bc456f2c7da708
branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/master

_dl_reltypes_tab[] is an array of pointers to constant strings:

Contents of section .data:
 20000 01000000 02000000 00000000 00000000  ................
 20010 70e50000 7ce50000 88e50000 94e50000  p...|...........
       ^^^^^^^^ ^^^^^^^^ ^^^^^^^^ ^^^^^^^^

(pointers are LE)

Contents of section .rodata:
 e570 525f4d49 50535f4e 4f4e4500 525f4d49  R_MIPS_NONE.R_MI
 e580 50535f31 36000000 525f4d49 50535f33  PS_16...R_MIPS_3
 e590 32000000 525f4d49 50535f52 454c3332  2...R_MIPS_REL32

These pointers require relocation:

DYNAMIC RELOCATION RECORDS
OFFSET   TYPE              VALUE
00000000 R_MIPS_NONE       *ABS*
0001fffc R_MIPS_REL32      *ABS*
00020010 R_MIPS_REL32      *ABS*
00020014 R_MIPS_REL32      *ABS*
00020018 R_MIPS_REL32      *ABS*

On MIPS, only GOT relocations are currently handled by ldso during
startup.  The net effect is that when running with "LD_DEBUG=reloc",
ldso itself crashes before the program even starts.  This is caused
by _dl_dprintf() dereferencing an unadjusted string pointer such as
0xe570.

This patch enables the missing relocations and allows LD_DEBUG to work
as designed.

Signed-off-by: Kevin Cernekee <cernekee at gmail.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso at st.com>
---
 ldso/ldso/dl-startup.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/ldso/ldso/dl-startup.c b/ldso/ldso/dl-startup.c
index fa7972d..75ea564 100644
--- a/ldso/ldso/dl-startup.c
+++ b/ldso/ldso/dl-startup.c
@@ -251,7 +251,7 @@ DL_START(unsigned long args)
 	PERFORM_BOOTSTRAP_GOT(tpnt);
 #endif
 
-#if !defined(PERFORM_BOOTSTRAP_GOT) || defined(__avr32__)
+#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. */
-- 
1.7.3.4



More information about the uClibc-cvs mailing list