[llvm-dev] [lld] Treat .openbsd.randomdata as read-only

Mark Kettenis via llvm-dev llvm-dev at lists.llvm.org
Mon Dec 19 11:48:14 PST 2016


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.  The diff below makes ldd do the same.

Index: ELF/Writer.cpp
===================================================================
--- ELF/Writer.cpp	(revision 290066)
+++ ELF/Writer.cpp	(working copy)
@@ -504,7 +504,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>


More information about the llvm-dev mailing list