[lld] r253018 - [ELF2] - dont merge .data.rel.ro/.data.rel.ro.local into .data section.
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 12 23:56:28 PST 2015
Author: grimar
Date: Fri Nov 13 01:56:27 2015
New Revision: 253018
URL: http://llvm.org/viewvc/llvm-project?rev=253018&view=rev
Log:
[ELF2] - dont merge .data.rel.ro/.data.rel.ro.local into .data section.
This sections can be protected with relro after resolving relocations by dynamic linker.
Differential revision: http://reviews.llvm.org/D14567
Modified:
lld/trunk/ELF/Writer.cpp
lld/trunk/test/elf2/section-name.s
Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=253018&r1=253017&r2=253018&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Fri Nov 13 01:56:27 2015
@@ -491,6 +491,8 @@ StringRef Writer<ELFT>::getOutputSection
return ".text";
if (S.startswith(".rodata."))
return ".rodata";
+ if (S.startswith(".data.rel.ro"))
+ return ".data.rel.ro";
if (S.startswith(".data."))
return ".data";
if (S.startswith(".bss."))
Modified: lld/trunk/test/elf2/section-name.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/section-name.s?rev=253018&r1=253017&r2=253018&view=diff
==============================================================================
--- lld/trunk/test/elf2/section-name.s (original)
+++ lld/trunk/test/elf2/section-name.s Fri Nov 13 01:56:27 2015
@@ -17,6 +17,10 @@ _start:
.section .bss,"", at nobits
.section .foo.a,"aw"
.section .foo,"aw"
+.section .data.rel.ro,"aw",%progbits
+.section .data.rel.ro.a,"aw",%progbits
+.section .data.rel.ro.local,"aw",%progbits
+.section .data.rel.ro.local.a,"aw",%progbits
// CHECK-NOT: Name: .rodata.a
// CHECK: Name: .rodata
@@ -26,5 +30,8 @@ _start:
// CHECK: Name: .data
// CHECK: Name: .foo.a
// CHECK: Name: .foo
+// CHECK-NOT: Name: .data.rel.ro.a
+// CHECK-NOT: Name: .data.rel.ro.local.a
+// CHECK: Name: .data.rel.ro
// CHECK-NOT: Name: .bss.a
// CHECK: Name: .bss
More information about the llvm-commits
mailing list