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
This commit is contained in:
Alex Richardson 2018-11-07 15:04:41 +00:00
parent 768893cdb5
commit 57fe7128b7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=340218
2 changed files with 8 additions and 0 deletions

View File

@ -1264,6 +1264,13 @@ digest_dynamic1(Obj_Entry *obj, int early, const Elf_Dyn **dyn_rpath,
*((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);

View File

@ -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