Skip to content

Commit 1eeac38

Browse files
authored
Merge pull request #379 from a-m-joseph/pr/dt_mips_rld_map_rel-comment
patchelf.cc: add comment explaining calculation for DT_MIPS_RLD_MAP_REL
2 parents be0cc30 + 84275a0 commit 1eeac38

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/patchelf.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,6 +1024,16 @@ void ElfFile<ElfFileParamNames>::rewriteHeaders(Elf_Addr phdrAddress)
10241024
pointer, relative to the address of the tag */
10251025
auto shdr = tryFindSectionHeader(".rld_map");
10261026
if (shdr) {
1027+
/*
1028+
* "When correct, (DT_MIPS_RLD_MAP_REL + tag offset + executable base address) equals DT_MIPS_RLD_MAP"
1029+
* -- https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=820334#5
1030+
*
1031+
* Equivalently,
1032+
*
1033+
* DT_MIPS_RLD_MAP_REL + tag offset + executable base address == DT_MIPS_RLD_MAP
1034+
* DT_MIPS_RLD_MAP_REL + executable base address == DT_MIPS_RLD_MAP - tag_offset
1035+
* DT_MIPS_RLD_MAP_REL == DT_MIPS_RLD_MAP - tag_offset - executable base address
1036+
*/
10271037
auto rld_map_addr = findSectionHeader(".rld_map").sh_addr;
10281038
auto dyn_offset = ((char*)dyn) - ((char*)dyn_table);
10291039
dyn->d_un.d_ptr = rld_map_addr - dyn_offset - (*shdrDynamic).get().sh_addr;

0 commit comments

Comments
 (0)