[PATCH] D17857: [ELF] - DT_TEXTREL/DF_TEXTREL flags implemented.

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 3 10:54:51 PST 2016


davide added a subscriber: davide.

================
Comment at: ELF/OutputSections.cpp:245
@@ +244,3 @@
+  if (Reloc.OKind == DynamicReloc<ELFT>::Off_Sec)
+    if (!(Reloc.OffsetSec->OutSec->getFlags() & SHF_WRITE))
+      this->TextRel = true;
----------------
I'm not entirely sure this is correct. Ideally you should scan through the list of segments that have dynamic rels and set the flag if flags & PF_W and type == PT_LOAD.

================
Comment at: ELF/OutputSections.cpp:621
@@ +620,3 @@
+  if (Out<ELFT>::RelaDyn->TextRel) {
+    Add({DT_TEXTREL, (uint64_t)0});
+    DtFlags |= DF_TEXTREL;
----------------
So, DT_TEXTREL tag is not needed. It's for compatibility with older loaders, which is unlikely we're going to support anyway. I'd like to keep it away until somebody asks for it.


http://reviews.llvm.org/D17857





More information about the llvm-commits mailing list