[PATCH] elf: Support multiple PT_GNU_RELRO segments
Adhemerval Zanella Netto
adhemerval.zanella@linaro.org
Thu Jul 9 11:56:06 GMT 2026
On 09/07/26 08:47, Florian Weimer wrote:
> * Adhemerval Zanella Netto:
>
>> On 09/07/26 05:43, Florian Weimer wrote:
>>> * Adhemerval Zanella Netto:
>>>
>>>> One possibility is to create the tests (ET_EXEC/ET_DYN) with some extra dummy
>>>> DT_NEEDED tags by linking with -Wl,--as-needed and some libraries, and then
>>>> post-processing it and replace it with PT_GNU_RELRO tags.
>>>
>>> I don't see how this would work. We can try to create extra PT_NOTE
>>> segments (perhaps by varying alignment?), and turn those into
>>> PT_GNU_RELRO via post-processing.
>>
>> The idea is just to create extra DT_* entries, the shared libraries are just
>> placeholders. But as H.J has noted, ld.bfd already supports --spare-dynamic-tags=
>> (not sure which version, but we can add a configure script).
>
> I'm not sure this reserves space in the right area of the ELF object.
Scratch that, we need extra ElfXX_Phdr and not a ElfXX_Dyn. The PT_NOTE does seems
a better way to hack this.
More information about the Libc-alpha
mailing list