diff options
author | Felix Fietkau <nbd@openwrt.org> | 2016-01-30 21:14:05 +0100 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2016-01-30 20:55:22 -0500 |
commit | c18d05f0e8909ec54252b251c441b5dd903268f8 (patch) | |
tree | fcd14fe46d4ffb07c89c698404392449c05ec120 | |
parent | 831e9d9efa61566a25c1dcdbd28f55daeea4dd32 (diff) | |
download | musl-c18d05f0e8909ec54252b251c441b5dd903268f8.tar.gz musl-c18d05f0e8909ec54252b251c441b5dd903268f8.tar.bz2 musl-c18d05f0e8909ec54252b251c441b5dd903268f8.tar.xz musl-c18d05f0e8909ec54252b251c441b5dd903268f8.zip |
ldso: fix GDB dynamic linker info on MIPS
GDB is looking for a pointer to the ldso debug info in the data of the
..rld_map section.
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
-rw-r--r-- | arch/mips/reloc.h | 2 | ||||
-rw-r--r-- | ldso/dynlink.c | 11 | ||||
-rw-r--r-- | src/internal/dynlink.h | 4 |
3 files changed, 12 insertions, 5 deletions
diff --git a/arch/mips/reloc.h b/arch/mips/reloc.h index 9b40e3da..8c52df09 100644 --- a/arch/mips/reloc.h +++ b/arch/mips/reloc.h @@ -24,7 +24,7 @@ #define REL_TPOFF R_MIPS_TLS_TPREL32 #define NEED_MIPS_GOT_RELOCS 1 -#define DYNAMIC_IS_RO 1 +#define DT_DEBUG_INDIRECT DT_MIPS_RLD_MAP #define ARCH_SYM_REJECT_UND(s) (!((s)->st_other & STO_MIPS_PLT)) #define CRTJMP(pc,sp) __asm__ __volatile__( \ diff --git a/ldso/dynlink.c b/ldso/dynlink.c index f497542e..87f3b7f8 100644 --- a/ldso/dynlink.c +++ b/ldso/dynlink.c @@ -1582,11 +1582,14 @@ _Noreturn void __dls3(size_t *sp) load_deps(&app); make_global(&app); -#ifndef DYNAMIC_IS_RO - for (i=0; app.dynv[i]; i+=2) - if (app.dynv[i]==DT_DEBUG) + for (i=0; app.dynv[i]; i+=2) { + if (!DT_DEBUG_INDIRECT && app.dynv[i]==DT_DEBUG) app.dynv[i+1] = (size_t)&debug; -#endif + if (DT_DEBUG_INDIRECT && app.dynv[i]==DT_DEBUG_INDIRECT) { + size_t *ptr = (size_t *) app.dynv[i+1]; + *ptr = (size_t)&debug; + } + } /* The main program must be relocated LAST since it may contin * copy relocations which depend on libraries' relocations. */ diff --git a/src/internal/dynlink.h b/src/internal/dynlink.h index 9c494e43..48890b2d 100644 --- a/src/internal/dynlink.h +++ b/src/internal/dynlink.h @@ -83,6 +83,10 @@ struct fdpic_dummy_loadmap { #define NEED_MIPS_GOT_RELOCS 0 #endif +#ifndef DT_DEBUG_INDIRECT +#define DT_DEBUG_INDIRECT 0 +#endif + #define AUX_CNT 32 #define DYN_CNT 32 |