From 2d4243ce60bcd7a9f64c2ce670bc456f2c7da708 Mon Sep 17 00:00:00 2001 From: Kevin Cernekee Date: Sun, 24 Jul 2011 01:19:12 -0700 Subject: ldso/mips: Enable bootstrap relocations _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 Signed-off-by: Carmelo Amoroso --- ldso/ldso/dl-startup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ldso/ldso/dl-startup.c b/ldso/ldso/dl-startup.c index fa7972d90..75ea564c2 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. */ -- cgit v1.2.3