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.