[PATCH] elf: Support multiple PT_GNU_RELRO segments
H.J. Lu
hjl.tools@gmail.com
Mon Jul 6 21:15:21 GMT 2026
On Tue, Jul 7, 2026 at 5:11 AM Justin Rivera <jnrivera@google.com> wrote:
>
> Hello,
>
> While this patch appears to be working as intended, I had a question
> regarding any additions to the test suite for testing RELRO behavior.
>
> This patch modifies elf/tst-relro-symbols.py, which can statically check
> ELF headers. However, there don't seem to be any dynamic checks that would
> work for multiple RELRO segments. We were able to do some ad-hoc testing
> with some hand-written assembly, but getting something working within the
> test suite seemed to be a bit trickier. (Often ran into
> `/usr/bin/ld: foo.so: warning: unable to allocate any sections to PT_GNU_RELRO segment`
> without some additional patching hack, for example).
>
> Are there any suggestions on how to best test the behavior changed by this patch?
We should add the linker support first. Linker can have an option
to generate multiple PT_GNU_RELRO segments for small binaries.
H.J.
More information about the Libc-alpha
mailing list