[PATCH] D27974: [ELF] - Treat .openbsd.randomdata as relro section
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 20 02:41:54 PST 2016
grimar created this revision.
grimar added reviewers: ruiu, rafael.
grimar added subscribers: llvm-commits, grimar, evgeny777.
That was requested by Mark Kettenis in llvm-dev:
"It is the intention that .openbsd.randomdata sections are made
read-only after initialization. The native (ld.bfd based) OpenBSD
toolchain accomplishes this by including .openbsd.randomdata into the
PT_GNU_RELRO segment."
He suggested diff code change, I added testcase.
https://reviews.llvm.org/D27974
Files:
ELF/Writer.cpp
test/ELF/relro.s
Index: test/ELF/relro.s
===================================================================
--- test/ELF/relro.s
+++ test/ELF/relro.s
@@ -19,8 +19,8 @@
// CHECK-NEXT: GNU_RELRO
// CHECK: Section to Segment mapping:
-// FULLRELRO: 05 .dynamic .got .got.plt {{$}}
-// PARTRELRO: 05 .dynamic .got {{$}}
+// FULLRELRO: 05 .openbsd.randomdata .dynamic .got .got.plt {{$}}
+// PARTRELRO: 05 .openbsd.randomdata .dynamic .got {{$}}
// NORELRO-NOT: GNU_RELRO
@@ -36,3 +36,6 @@
.zero 4
.section .foo,"aw"
.section .bss,"", at nobits
+
+.section .openbsd.randomdata, "aw"
+.quad 0
Index: ELF/Writer.cpp
===================================================================
--- ELF/Writer.cpp
+++ ELF/Writer.cpp
@@ -508,7 +508,7 @@
return true;
StringRef S = Sec->getName();
return S == ".data.rel.ro" || S == ".ctors" || S == ".dtors" || S == ".jcr" ||
- S == ".eh_frame";
+ S == ".eh_frame" || S == ".openbsd.randomdata";
}
template <class ELFT>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27974.82077.patch
Type: text/x-patch
Size: 995 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161220/25d36182/attachment.bin>
More information about the llvm-commits
mailing list