[PATCH] D52830: [ELF] - Set sh_info and sh_link for .rela.plt sections.
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 11 01:27:41 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL344226: [ELF] - Set sh_info and sh_link for .rela.plt sections. (authored by grimar, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D52830?vs=168970&id=169165#toc
Repository:
rL LLVM
https://reviews.llvm.org/D52830
Files:
lld/trunk/ELF/SyntheticSections.cpp
lld/trunk/test/ELF/aarch64-gnu-ifunc.s
lld/trunk/test/ELF/dynamic-reloc.s
lld/trunk/test/ELF/gnu-ifunc-i386.s
lld/trunk/test/ELF/gnu-ifunc.s
Index: lld/trunk/test/ELF/gnu-ifunc-i386.s
===================================================================
--- lld/trunk/test/ELF/gnu-ifunc-i386.s
+++ lld/trunk/test/ELF/gnu-ifunc-i386.s
@@ -15,8 +15,8 @@
// CHECK-NEXT: Address: [[RELA:.*]]
// CHECK-NEXT: Offset: 0xD4
// CHECK-NEXT: Size: 16
-// CHECK-NEXT: Link: 0
-// CHECK-NEXT: Info: 0
+// CHECK-NEXT: Link: 6
+// CHECK-NEXT: Info: 4
// CHECK-NEXT: AddressAlignment: 4
// CHECK-NEXT: EntrySize: 8
// CHECK-NEXT: }
Index: lld/trunk/test/ELF/gnu-ifunc.s
===================================================================
--- lld/trunk/test/ELF/gnu-ifunc.s
+++ lld/trunk/test/ELF/gnu-ifunc.s
@@ -15,11 +15,16 @@
// CHECK-NEXT: Address: [[RELA:.*]]
// CHECK-NEXT: Offset: 0x158
// CHECK-NEXT: Size: 48
-// CHECK-NEXT: Link: 0
-// CHECK-NEXT: Info: 0
+// CHECK-NEXT: Link: [[SYMTAB:.*]]
+// CHECK-NEXT: Info: [[GOTPLT:.*]]
// CHECK-NEXT: AddressAlignment: 8
// CHECK-NEXT: EntrySize: 24
// CHECK-NEXT: }
+// CHECK: Index: [[GOTPLT]]
+// CHECK-NEXT: Name: .got.plt
+// CHECK: Index: [[SYMTAB]]
+// CHECK-NEXT: Name: .symtab
+// CHECK-NEXT: Type: SHT_SYMTAB
// CHECK: Relocations [
// CHECK-NEXT: Section ({{.*}}) .rela.plt {
// CHECK-NEXT: 0x202000 R_X86_64_IRELATIVE
Index: lld/trunk/test/ELF/aarch64-gnu-ifunc.s
===================================================================
--- lld/trunk/test/ELF/aarch64-gnu-ifunc.s
+++ lld/trunk/test/ELF/aarch64-gnu-ifunc.s
@@ -15,8 +15,8 @@
// CHECK-NEXT: Address: [[RELA:.*]]
// CHECK-NEXT: Offset: 0x158
// CHECK-NEXT: Size: 48
-// CHECK-NEXT: Link: 0
-// CHECK-NEXT: Info: 0
+// CHECK-NEXT: Link: 6
+// CHECK-NEXT: Info: 4
// CHECK-NEXT: AddressAlignment: 8
// CHECK-NEXT: EntrySize: 24
// CHECK-NEXT: }
Index: lld/trunk/test/ELF/dynamic-reloc.s
===================================================================
--- lld/trunk/test/ELF/dynamic-reloc.s
+++ lld/trunk/test/ELF/dynamic-reloc.s
@@ -18,7 +18,7 @@
// CHECK-NEXT: Offset:
// CHECK-NEXT: Size: [[RELASIZE:.*]]
// CHECK-NEXT: Link: 1
-// CHECK-NEXT: Info: 0
+// CHECK-NEXT: Info: 7
// CHECK-NEXT: AddressAlignment: 8
// CHECK-NEXT: EntrySize: 24
Index: lld/trunk/ELF/SyntheticSections.cpp
===================================================================
--- lld/trunk/ELF/SyntheticSections.cpp
+++ lld/trunk/ELF/SyntheticSections.cpp
@@ -1493,9 +1493,12 @@
void RelocationBaseSection::finalizeContents() {
// If all relocations are R_*_RELATIVE they don't refer to any
// dynamic symbol and we don't need a dynamic symbol table. If that
- // is the case, just use 0 as the link.
- getParent()->Link =
- In.DynSymTab ? In.DynSymTab->getParent()->SectionIndex : 0;
+ // is the case, just use the index of the regular symbol table section.
+ getParent()->Link = In.DynSymTab ? In.DynSymTab->getParent()->SectionIndex
+ : In.SymTab->getParent()->SectionIndex;
+
+ if (In.RelaIplt == this || In.RelaPlt == this)
+ getParent()->Info = In.GotPlt->getParent()->SectionIndex;
}
RelrBaseSection::RelrBaseSection()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52830.169165.patch
Type: text/x-patch
Size: 3102 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181011/e8827a22/attachment.bin>
More information about the llvm-commits
mailing list