Skip to content

Commit a59bb21

Browse files
committed
[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
1 parent 7f51a9e commit a59bb21

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

llvm/lib/InterfaceStub/ELFObjHandler.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ template <class ELFT> class ELFStubBuilder {
226226
// Poplulate dynamic table.
227227
size_t DynSymIndex = DynTab.Content.addAddr(DT_SYMTAB, 0);
228228
size_t DynStrIndex = DynTab.Content.addAddr(DT_STRTAB, 0);
229+
DynTab.Content.addValue(DT_STRSZ, DynSym.Size);
229230
for (const std::string &Lib : Stub.NeededLibs)
230231
DynTab.Content.addValue(DT_NEEDED, DynStr.Content.getOffset(Lib));
231232
if (Stub.SoName)

llvm/test/tools/llvm-ifs/write-stub.test

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,11 @@ Symbols:
142142
# CHECK-NEXT: EntrySize: 0
143143
# CHECK-NEXT: }
144144

145-
# CHECK: DynamicSection [ (4 entries)
145+
# CHECK: DynamicSection [ (5 entries)
146146
# CHECK-NEXT: Tag Type Name/Value
147147
# CHECK-NEXT: 0x[[DYNTABZ]]0000006 SYMTAB
148148
# CHECK-NEXT: 0x[[DYNTABZ]]0000005 STRTAB
149+
# CHECK-NEXT: 0x[[DYNTABZ]]000000A STRSZ
149150
# CHECK-NEXT: 0x[[DYNTABZ]]0000001 NEEDED Shared library: [libc.so.6]
150151
# CHECK-NEXT: 0x[[DYNTABZ]]0000000 NULL
151152
# CHECK-NEXT: ]

0 commit comments

Comments
 (0)