Skip to content

Commit df6243f

Browse files
committed
In symbol tables, rewrite st_value for STT_SECTION entries
1 parent bf03aff commit df6243f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/patchelf.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -846,6 +846,10 @@ void ElfFile<ElfFileParamNames>::rewriteHeaders(Elf_Addr phdrAddress)
846846
unsigned int newIndex = findSection3(section); // inefficient
847847
//debug("rewriting symbol %d: index = %d (%s) -> %d\n", entry, shndx, section.c_str(), newIndex);
848848
wri(sym->st_shndx, newIndex);
849+
/* Rewrite st_value. FIXME: we should do this for all
850+
types, but most don't actually change. */
851+
if (ELF32_ST_TYPE(rdi(sym->st_info)) == STT_SECTION)
852+
wri(sym->st_value, rdi(shdrs[newIndex].sh_addr));
849853
}
850854
}
851855
}

0 commit comments

Comments
 (0)