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 code change, I added testcase.
Differential revision: https://reviews.llvm.org/D27974
llvm-svn: 290174
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>
// 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
.zero 4
.section .foo,"aw"
.section .bss,"",@nobits
+
+.section .openbsd.randomdata, "aw"
+.quad 0