Skip to content

Commit 51e37d9

Browse files
author
George Rimar
committedNov 13, 2015
[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 llvm-svn: 253018
1 parent e1a89c2 commit 51e37d9

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed
 

‎lld/ELF/Writer.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,8 @@ StringRef Writer<ELFT>::getOutputSectionName(StringRef S) const {
491491
return ".text";
492492
if (S.startswith(".rodata."))
493493
return ".rodata";
494+
if (S.startswith(".data.rel.ro"))
495+
return ".data.rel.ro";
494496
if (S.startswith(".data."))
495497
return ".data";
496498
if (S.startswith(".bss."))

‎lld/test/elf2/section-name.s

+7
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ _start:
1717
.section .bss,"",@nobits
1818
.section .foo.a,"aw"
1919
.section .foo,"aw"
20+
.section .data.rel.ro,"aw",%progbits
21+
.section .data.rel.ro.a,"aw",%progbits
22+
.section .data.rel.ro.local,"aw",%progbits
23+
.section .data.rel.ro.local.a,"aw",%progbits
2024

2125
// CHECK-NOT: Name: .rodata.a
2226
// CHECK: Name: .rodata
@@ -26,5 +30,8 @@ _start:
2630
// CHECK: Name: .data
2731
// CHECK: Name: .foo.a
2832
// CHECK: Name: .foo
33+
// CHECK-NOT: Name: .data.rel.ro.a
34+
// CHECK-NOT: Name: .data.rel.ro.local.a
35+
// CHECK: Name: .data.rel.ro
2936
// CHECK-NOT: Name: .bss.a
3037
// CHECK: Name: .bss

0 commit comments

Comments
 (0)
Please sign in to comment.