mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-25 13:36:08 +00:00
[llvm-objdump]Correct .dynstr finding of getDynamicStrTab() (#127975)
The dynamic string table used by the dynamic section is referenced by the sh_link field of that section, so we should use that directly, rather than going via the dynamic symbol table. More info: https://github.com/llvm/llvm-project/pull/125679#discussion_r1961333454 Signed-off-by: Ruoyu Qiu <cabbaken@outlook.com>
This commit is contained in:
parent
3dc159431b
commit
5a2bee04d0
@ -30,6 +30,7 @@ Sections:
|
||||
- Name: .dynamic
|
||||
Type: SHT_DYNAMIC
|
||||
Flags: [ SHF_ALLOC ]
|
||||
Link: 1
|
||||
Entries:
|
||||
- Tag: DT_NEEDED
|
||||
Value: 0x1
|
||||
|
@ -78,8 +78,8 @@ static Expected<StringRef> getDynamicStrTab(const ELFFile<ELFT> &Elf) {
|
||||
return SectionsOrError.takeError();
|
||||
|
||||
for (const typename ELFT::Shdr &Sec : *SectionsOrError) {
|
||||
if (Sec.sh_type == ELF::SHT_DYNSYM)
|
||||
return Elf.getStringTableForSymtab(Sec);
|
||||
if (Sec.sh_type == ELF::SHT_DYNAMIC)
|
||||
return Elf.getLinkAsStrtab(Sec);
|
||||
}
|
||||
|
||||
return createError("dynamic string table not found");
|
||||
|
Loading…
x
Reference in New Issue
Block a user