[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
Mon Nov 9 06:57:06 PST 2015
rafael added inline comments.
================
Comment at: ELF/Writer.cpp:379
@@ -378,1 +378,3 @@
+ bool AIsData = A->getName() == ".data";
+ bool BIsData = B->getName() == ".data";
----------------
This needs a comment and should probably be more explicit. Something like
bool AIsRelRo = helperfunc(...)
bool BIsRelRo = helperfunc(...)
if (AIsRelRo != BIsRelRo)
return AIsRelRo;
================
Comment at: ELF/Writer.cpp:744
@@ +743,3 @@
+ // read-only but .got.plt will be writeable.
+ bool CloseGnuRo = (Sec == Out<ELFT>::GotPlt && !Config->ZNow) ||
+ (Sec == Out<ELFT>::Bss) ||
----------------
You should be able to write this as
if (cur is rw and sec is relro)
Add sec to relro segment.
The "is relro" check should use the same helper function that is used in the sorting.
http://reviews.llvm.org/D14218
More information about the llvm-commits
mailing list