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

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 3 12:03:11 PST 2016


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


On 3 March 2016 at 13:27, George Rimar <grimar at accesssoftek.com> wrote:
> grimar created this revision.
> grimar added reviewers: ruiu, rafael.
> grimar added subscribers: llvm-commits, grimar.
>
> This patch implements DT_TEXTREL/DF_TEXTREL flags. Actually I am not sure in current implementation and would be happy to know the side opinion about it.
> Problem of that feature is that somehow we should know that relocation should cause a modification of read only segment.
>
> To do that I am checking that relocation OKind field is DynamicReloc<ELFT>::Off_Sec. Looks it is safe and correct way to use it for that ?
> Also for simplification I am not iterating through sections in LOADs and just checking the read/write flag of output sections when adding relocations during Writer<ELFT>::scanRelocs().
>
> DT_TEXTREL description:
> This member's absence signifies that no relocation entry should cause a modification to a non-writable segment, as specified by the segment permissions in the program header table. If this member is present, one or more relocation entries might request modifications to a non-writable segment, and the dynamic linker can prepare accordingly. This entry is at level 2. Its use has been superseded by the DF_TEXTREL flag.
>
> http://reviews.llvm.org/D17857
>
> Files:
>   ELF/OutputSections.cpp
>   ELF/OutputSections.h
>   test/ELF/textrel.s
>   test/ELF/tls-opt-iele-i686-nopic.s
>


More information about the llvm-commits mailing list