[llvm] Correct .dynstr finding of getDynamicStrTab() (PR #127975)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 20 01:14:07 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-binary-utilities
Author: Ruoyu Qiu (cabbaken)
<details>
<summary>Changes</summary>
More info: https://github.com/llvm/llvm-project/pull/125679#discussion_r1961333454
---
Full diff: https://github.com/llvm/llvm-project/pull/127975.diff
2 Files Affected:
- (modified) llvm/test/tools/llvm-objdump/ELF/private-headers.test (+1)
- (modified) llvm/tools/llvm-objdump/ELFDump.cpp (+2-2)
``````````diff
diff --git a/llvm/test/tools/llvm-objdump/ELF/private-headers.test b/llvm/test/tools/llvm-objdump/ELF/private-headers.test
index eefdc8440385c..c90cf59f4ed7d 100644
--- a/llvm/test/tools/llvm-objdump/ELF/private-headers.test
+++ b/llvm/test/tools/llvm-objdump/ELF/private-headers.test
@@ -30,6 +30,7 @@ Sections:
- Name: .dynamic
Type: SHT_DYNAMIC
Flags: [ SHF_ALLOC ]
+ Link: 1
Entries:
- Tag: DT_NEEDED
Value: 0x1
diff --git a/llvm/tools/llvm-objdump/ELFDump.cpp b/llvm/tools/llvm-objdump/ELFDump.cpp
index e9e5b059f1786..bce308c870ddf 100644
--- a/llvm/tools/llvm-objdump/ELFDump.cpp
+++ b/llvm/tools/llvm-objdump/ELFDump.cpp
@@ -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");
``````````
</details>
https://github.com/llvm/llvm-project/pull/127975
More information about the llvm-commits
mailing list