[PATCH] D14218: [ELF2] Implements -z relro: create an ELF "PT_GNU_RELRO" segment header in the object.

Rafael Ávila de Espíndola via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 10 14:03:40 PST 2015


rafael added inline comments.

================
Comment at: ELF/Writer.cpp:327
@@ +326,3 @@
+    return Config->ZNow;
+  return (Sec->getName() != ".data" && Sec->getType() != SHT_NOBITS);
+}
----------------
This has to be a whitelist.

If a .o file has a section name "foobar", we cannot assume that it is relro.

================
Comment at: ELF/Writer.cpp:692
@@ +691,3 @@
+                               OutputSectionBase<ELFT> *Sec, uintX_t VA) {
+
+  if (!Config->ZRelro || !(Cur->p_flags & PF_W))
----------------
delete the empty line.


http://reviews.llvm.org/D14218





More information about the llvm-commits mailing list