|
|
Message-Id: <1454184614-95536-1-git-send-email-nbd@openwrt.org>
Date: Sat, 30 Jan 2016 21:10:14 +0100
From: Felix Fietkau <nbd@...nwrt.org>
To: musl@...ts.openwall.com
Subject: [PATCH v2] 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@...nwrt.org>
---
arch/mips/reloc.h | 1 +
ldso/dynlink.c | 9 ++++++++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/arch/mips/reloc.h b/arch/mips/reloc.h
index 9b40e3d..e9cb209 100644
--- a/arch/mips/reloc.h
+++ b/arch/mips/reloc.h
@@ -25,6 +25,7 @@
#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 f497542..948815d 100644
--- a/ldso/dynlink.c
+++ b/ldso/dynlink.c
@@ -1582,11 +1582,18 @@ _Noreturn void __dls3(size_t *sp)
load_deps(&app);
make_global(&app);
+ for (i=0; app.dynv[i]; i+=2) {
#ifndef DYNAMIC_IS_RO
- for (i=0; app.dynv[i]; i+=2)
if (app.dynv[i]==DT_DEBUG)
app.dynv[i+1] = (size_t)&debug;
#endif
+#ifdef DT_DEBUG_INDIRECT
+ if (app.dynv[i]==DT_DEBUG_INDIRECT) {
+ size_t *ptr = (size_t *) app.dynv[i+1];
+ *ptr = (size_t)&debug;
+ }
+#endif
+ }
/* The main program must be relocated LAST since it may contin
* copy relocations which depend on libraries' relocations. */
--
2.2.2
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.