[llvm] a59bb21 - [ifs] Added missing DT_STRSZ to the .dynamic section
Haowei Wu via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 13 21:06:02 PST 2022
Author: Haowei Wu
Date: 2022-02-13T21:05:52-08:00
New Revision: a59bb21bf85ebf5fda18f331ea6ff433a4ad73aa
URL: https://github.com/llvm/llvm-project/commit/a59bb21bf85ebf5fda18f331ea6ff433a4ad73aa
DIFF: https://github.com/llvm/llvm-project/commit/a59bb21bf85ebf5fda18f331ea6ff433a4ad73aa.diff
LOG: [ifs] Added missing DT_STRSZ to the .dynamic section
This patch adds DT_STRSZ into the dynamic section, which was absent
previously. This was a bug and caused failures in other tools.
Differential Revision: https://reviews.llvm.org/D117058
Added:
Modified:
llvm/lib/InterfaceStub/ELFObjHandler.cpp
llvm/test/tools/llvm-ifs/write-stub.test
Removed:
################################################################################
diff --git a/llvm/lib/InterfaceStub/ELFObjHandler.cpp b/llvm/lib/InterfaceStub/ELFObjHandler.cpp
index cb72f57f7bde0..d2a13428b02a9 100644
--- a/llvm/lib/InterfaceStub/ELFObjHandler.cpp
+++ b/llvm/lib/InterfaceStub/ELFObjHandler.cpp
@@ -226,6 +226,7 @@ template <class ELFT> class ELFStubBuilder {
// Poplulate dynamic table.
size_t DynSymIndex = DynTab.Content.addAddr(DT_SYMTAB, 0);
size_t DynStrIndex = DynTab.Content.addAddr(DT_STRTAB, 0);
+ DynTab.Content.addValue(DT_STRSZ, DynSym.Size);
for (const std::string &Lib : Stub.NeededLibs)
DynTab.Content.addValue(DT_NEEDED, DynStr.Content.getOffset(Lib));
if (Stub.SoName)
diff --git a/llvm/test/tools/llvm-ifs/write-stub.test b/llvm/test/tools/llvm-ifs/write-stub.test
index 53b9cc7f325c1..d0c0219d64b7d 100644
--- a/llvm/test/tools/llvm-ifs/write-stub.test
+++ b/llvm/test/tools/llvm-ifs/write-stub.test
@@ -142,10 +142,11 @@ Symbols:
# CHECK-NEXT: EntrySize: 0
# CHECK-NEXT: }
-# CHECK: DynamicSection [ (4 entries)
+# CHECK: DynamicSection [ (5 entries)
# CHECK-NEXT: Tag Type Name/Value
# CHECK-NEXT: 0x[[DYNTABZ]]0000006 SYMTAB
# CHECK-NEXT: 0x[[DYNTABZ]]0000005 STRTAB
+# CHECK-NEXT: 0x[[DYNTABZ]]000000A STRSZ
# CHECK-NEXT: 0x[[DYNTABZ]]0000001 NEEDED Shared library: [libc.so.6]
# CHECK-NEXT: 0x[[DYNTABZ]]0000000 NULL
# CHECK-NEXT: ]
More information about the llvm-commits
mailing list