[PATCH] D57274: ELF: Set sh_info on RelaIplt to point to the IgotPlt output section.
Peter Collingbourne via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 25 17:40:37 PST 2019
pcc created this revision.
pcc added reviewers: ruiu, peter.smith.
Herald added subscribers: kristof.beyls, arichardson, javed.absar, emaste.
Herald added a reviewer: espindola.
Previously we were setting it to the GotPlt output section, which is
incorrect on ARM where this section is in .got. In static binaries
this can lead to sh_link being set to -1 (because there is no .got.plt)
which results in various tools rejecting the output file.
Repository:
rL LLVM
https://reviews.llvm.org/D57274
Files:
lld/ELF/SyntheticSections.cpp
lld/test/ELF/arm-gnu-ifunc.s
Index: lld/test/ELF/arm-gnu-ifunc.s
===================================================================
--- lld/test/ELF/arm-gnu-ifunc.s
+++ lld/test/ELF/arm-gnu-ifunc.s
@@ -35,6 +35,8 @@
// CHECK-NEXT: Address: 0x100F4
// CHECK-NEXT: Offset: 0xF4
// CHECK-NEXT: Size: 16
+// CHECK-NEXT: Link:
+// CHECK-NEXT: Info: 4
// CHECK: Name: .plt
// CHECK-NEXT: Type: SHT_PROGBITS
// CHECK-NEXT: Flags [
@@ -44,7 +46,8 @@
// CHECK-NEXT: Address: 0x11020
// CHECK-NEXT: Offset: 0x1020
// CHECK-NEXT: Size: 32
-// CHECK: Name: .got
+// CHECK: Index: 4
+// CHECK-NEXT: Name: .got
// CHECK-NEXT: Type: SHT_PROGBITS
// CHECK-NEXT: Flags [
// CHECK-NEXT: SHF_ALLOC
Index: lld/ELF/SyntheticSections.cpp
===================================================================
--- lld/ELF/SyntheticSections.cpp
+++ lld/ELF/SyntheticSections.cpp
@@ -1512,8 +1512,10 @@
else
getParent()->Link = 0;
- if (In.RelaIplt == this || In.RelaPlt == this)
+ if (In.RelaPlt == this)
getParent()->Info = In.GotPlt->getParent()->SectionIndex;
+ if (In.RelaIplt == this)
+ getParent()->Info = In.IgotPlt->getParent()->SectionIndex;
}
RelrBaseSection::RelrBaseSection()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57274.183672.patch
Type: text/x-patch
Size: 1255 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190126/c827f63f/attachment.bin>
More information about the llvm-commits
mailing list