From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/9238 Path: news.gmane.org!not-for-mail From: Felix Fietkau Newsgroups: gmane.linux.lib.musl.general Subject: [PATCH] ldso: fix GDB dynamic linker info on MIPS Date: Sat, 30 Jan 2016 19:20:19 +0100 Message-ID: <1454178019-24877-1-git-send-email-nbd@openwrt.org> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1454178056 29023 80.91.229.3 (30 Jan 2016 18:20:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 30 Jan 2016 18:20:56 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-9251-gllmg-musl=m.gmane.org@lists.openwall.com Sat Jan 30 19:20:41 2016 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1aPa8W-0003b9-FS for gllmg-musl@m.gmane.org; Sat, 30 Jan 2016 19:20:40 +0100 Original-Received: (qmail 22054 invoked by uid 550); 30 Jan 2016 18:20:37 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 22019 invoked from network); 30 Jan 2016 18:20:33 -0000 X-Mailer: git-send-email 2.2.2 Xref: news.gmane.org gmane.linux.lib.musl.general:9238 Archived-At: GDB is looking for a pointer to the ldso debug info in the data of the .rld_map section. Signed-off-by: Felix Fietkau --- arch/mips/reloc.h | 1 + src/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/src/ldso/dynlink.c b/src/ldso/dynlink.c index 93e7d67..dd85eea 100644 --- a/src/ldso/dynlink.c +++ b/src/ldso/dynlink.c @@ -1584,11 +1584,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