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

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 3 12:11:01 PST 2016


grimar added a comment.

In http://reviews.llvm.org/D17857#367522, @rafael wrote:

> Is this actually needed?
>
> It was noticed in freebsd because we were incorrectly creating text
>  relocations. Short of bugs, is it actually common to have relocations
>  pointing to text these days?
>
> Cheers,
> Rafael


Doesn't all R_*_RELATIVE relocations are doing that ? I think they are used still at least for some targets. But I dont know actually how much it is needed.


================
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;
----------------
davide wrote:
> 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.
Yep, I mentioned that simplification in commit message. I think it can work and does not need the one more iteration. I am not completely sure though.


http://reviews.llvm.org/D17857





More information about the llvm-commits mailing list