Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 7 Nov 2018 15:04:42 +0000 (UTC)
From:      Alex Richardson <arichardson@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r340218 - in head: libexec/rtld-elf sys/sys
Message-ID:  <201811071504.wA7F4g8c040674@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: arichardson
Date: Wed Nov  7 15:04:41 2018
New Revision: 340218
URL: https://svnweb.freebsd.org/changeset/base/340218

Log:
  Handle the DT_MIPS_RLD_MAP_REL dynamic tag in RTLD
  
  This dynamic tag contains the location of the .rld_map section relative to
  the location of the dynamic tag. For PIE MIPS binaries DT_MIPS_RLD_MAP can
  not be used since it contains an absolute address. Without this change
  GDB can not find the function program counters in other libraries and once
  I apply this change I can successfully run info sharedlibraries again.
  
  Reviewed By:	kib
  Differential Revision: https://reviews.freebsd.org/D17867

Modified:
  head/libexec/rtld-elf/rtld.c
  head/sys/sys/elf_common.h

Modified: head/libexec/rtld-elf/rtld.c
==============================================================================
--- head/libexec/rtld-elf/rtld.c	Wed Nov  7 12:08:26 2018	(r340217)
+++ head/libexec/rtld-elf/rtld.c	Wed Nov  7 15:04:41 2018	(r340218)
@@ -1264,6 +1264,13 @@ digest_dynamic1(Obj_Entry *obj, int early, const Elf_D
 		*((Elf_Addr *)(dynp->d_un.d_ptr)) = (Elf_Addr) &r_debug;
 		break;
 
+	case DT_MIPS_RLD_MAP_REL:
+		// The MIPS_RLD_MAP_REL tag stores the offset to the .rld_map
+		// section relative to the address of the tag itself.
+		*((Elf_Addr *)(__DECONST(char*, dynp) + dynp->d_un.d_val)) =
+		    (Elf_Addr) &r_debug;
+		break;
+
 	case DT_MIPS_PLTGOT:
 		obj->mips_pltgot = (Elf_Addr *)(obj->relocbase +
 		    dynp->d_un.d_ptr);

Modified: head/sys/sys/elf_common.h
==============================================================================
--- head/sys/sys/elf_common.h	Wed Nov  7 12:08:26 2018	(r340217)
+++ head/sys/sys/elf_common.h	Wed Nov  7 15:04:41 2018	(r340218)
@@ -707,6 +707,7 @@ typedef struct {
 #define	DT_MIPS_PLTGOT			0x70000032
 #define	DT_MIPS_RLD_OBJ_UPDATE		0x70000033
 #define	DT_MIPS_RWPLT			0x70000034
+#define	DT_MIPS_RLD_MAP_REL		0x70000035
 
 #define	DT_PPC_GOT			0x70000000
 #define	DT_PPC_TLSOPT			0x70000001



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201811071504.wA7F4g8c040674>