[PATCH] D39242: [ELF] - Stop naming relocation sections with first input section name.
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 27 04:39:08 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL316760: [ELF] - Stop naming relocation sections with first input section name. (authored by grimar).
Changed prior to commit:
https://reviews.llvm.org/D39242?vs=120389&id=120571#toc
Repository:
rL LLVM
https://reviews.llvm.org/D39242
Files:
lld/trunk/ELF/Writer.cpp
lld/trunk/test/ELF/emit-relocs-merge.s
lld/trunk/test/ELF/emit-relocs.s
Index: lld/trunk/test/ELF/emit-relocs-merge.s
===================================================================
--- lld/trunk/test/ELF/emit-relocs-merge.s
+++ lld/trunk/test/ELF/emit-relocs-merge.s
@@ -8,7 +8,7 @@
# CHECK-NEXT: 0x1000 R_X86_64_64 zed 0x0
# CHECK-NEXT: 0x1008 R_X86_64_64 zed 0x0
# CHECK-NEXT: }
-# CHECK-NEXT: Section ({{.*}}) .rela.data.foo {
+# CHECK-NEXT: Section ({{.*}}) .rela.data {
# CHECK-NEXT: 0x1000 R_X86_64_64 zed 0x0
# CHECK-NEXT: 0x1008 R_X86_64_64 zed 0x0
# CHECK-NEXT: }
Index: lld/trunk/test/ELF/emit-relocs.s
===================================================================
--- lld/trunk/test/ELF/emit-relocs.s
+++ lld/trunk/test/ELF/emit-relocs.s
@@ -83,7 +83,7 @@
# CHECK-NEXT: }
# CHECK-NEXT: ]
-.section .text,"ax", at progbits,unique,0
+.section .text.fn,"ax", at progbits,unique,0
.globl fn
.type fn, at function
fn:
@@ -94,7 +94,7 @@
callq fn at PLT
nop
-.section .text,"ax", at progbits,unique,1
+.section .text.fn2,"ax", at progbits,unique,1
.globl fn2
.type fn2, at function
fn2:
Index: lld/trunk/ELF/Writer.cpp
===================================================================
--- lld/trunk/ELF/Writer.cpp
+++ lld/trunk/ELF/Writer.cpp
@@ -98,6 +98,14 @@
if (Config->Relocatable)
return Name;
+ // This is for --emit-relocs. If .text.foo is emitted as .text, we want to
+ // emit .rela.text.foo as .rel.text for consistency (this is not technically
+ // required, but not doing it is odd). This code guarantees that.
+ if (Name.startswith(".rel."))
+ return Saver.save(".rel" + getOutputSectionName(Name.substr(4)));
+ if (Name.startswith(".rela."))
+ return Saver.save(".rela" + getOutputSectionName(Name.substr(5)));
+
for (StringRef V :
{".text.", ".rodata.", ".data.rel.ro.", ".data.", ".bss.rel.ro.",
".bss.", ".init_array.", ".fini_array.", ".ctors.", ".dtors.", ".tbss.",
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39242.120571.patch
Type: text/x-patch
Size: 1901 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171027/2a81fe1f/attachment.bin>
More information about the llvm-commits
mailing list