Skip to content

Commit 2da20cd

Browse files
committed
Correct .dynstr finding of getDynamicStrTab()
More info: #125679 (comment) Signed-off-by: Ruoyu Qiu <[email protected]>
1 parent 57bac14 commit 2da20cd

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

llvm/test/tools/llvm-objdump/ELF/private-headers.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ Sections:
3030
- Name: .dynamic
3131
Type: SHT_DYNAMIC
3232
Flags: [ SHF_ALLOC ]
33+
Link: 1
3334
Entries:
3435
- Tag: DT_NEEDED
3536
Value: 0x1

llvm/tools/llvm-objdump/ELFDump.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ static Expected<StringRef> getDynamicStrTab(const ELFFile<ELFT> &Elf) {
7878
return SectionsOrError.takeError();
7979

8080
for (const typename ELFT::Shdr &Sec : *SectionsOrError) {
81-
if (Sec.sh_type == ELF::SHT_DYNSYM)
82-
return Elf.getStringTableForSymtab(Sec);
81+
if (Sec.sh_type == ELF::SHT_DYNAMIC)
82+
return Elf.getLinkAsStrtab(Sec);
8383
}
8484

8585
return createError("dynamic string table not found");

0 commit comments

Comments
 (0)