[PATCH] D38580: [ELF] - Do not produce broken .dynamic section with --no-rosegment
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 5 04:28:07 PDT 2017
grimar updated this revision to Diff 117796.
grimar added a comment.
- Simplified testcase.
https://reviews.llvm.org/D38580
Files:
ELF/SyntheticSections.cpp
test/ELF/dynamic-no-rosegment.s
Index: test/ELF/dynamic-no-rosegment.s
===================================================================
--- test/ELF/dynamic-no-rosegment.s
+++ test/ELF/dynamic-no-rosegment.s
@@ -0,0 +1,14 @@
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
+# RUN: ld.lld -shared --no-rosegment -z rodynamic -o %t %t.o
+# RUN: llvm-readobj -dynamic-table -s %t | FileCheck %s
+
+# CHECK: DynamicSection [ (6 entries)
+# CHECK-NEXT: Tag Type Name/Value
+# CHECK-NEXT: 0x0000000000000006 SYMTAB 0x120
+# CHECK-NEXT: 0x000000000000000B SYMENT 24 (bytes)
+# CHECK-NEXT: 0x0000000000000005 STRTAB 0x1A8
+# CHECK-NEXT: 0x000000000000000A STRSZ 1 (bytes)
+# CHECK-NEXT: 0x0000000000000004 HASH 0x138
+# CHECK-NEXT: 0x0000000000000000 NULL 0x0
+# CHECK-NEXT: ]
Index: ELF/SyntheticSections.cpp
===================================================================
--- ELF/SyntheticSections.cpp
+++ ELF/SyntheticSections.cpp
@@ -1171,10 +1171,10 @@
add({DT_MIPS_RLD_MAP, InX::MipsRldMap});
}
- getParent()->Link = this->Link;
+ add({DT_NULL, 0ULL});
- // +1 for DT_NULL
- this->Size = (Entries.size() + 1) * this->Entsize;
+ getParent()->Link = this->Link;
+ this->Size = Entries.size() * this->Entsize;
}
template <class ELFT> void DynamicSection<ELFT>::writeTo(uint8_t *Buf) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38580.117796.patch
Type: text/x-patch
Size: 1452 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171005/0e81a1b9/attachment.bin>
More information about the llvm-commits
mailing list