[PATCH] x86: Drop an empty .relr.dyn from segments given by PHDRS
mintsuki
mintsuki@protonmail.com
Sat Nov 21 07:56:33 GMT 2026
Yes, I can confirm that. I believe the code itself (tests aside) falls into the "not legally significant" clause, and I wrote and reviewed it, following LLM's advice, and hold the copyright on it anyways, if relevant, and I am willing to submit it to the FSF.
When it comes to the tests, I reviewed them but did not write them line by line, and I am not sure what the policy here is, but I am willing to remove the tests part if it is a concern, and submit an updated version of this patch without them, if advised to do so.
On Friday, November 20th, 2026 at 2:27 PM, Jan Beulich <jbeulich@suse.com> wrote:
> On 14.11.2026 07:49, mintsuki wrote:
> > With -z pack-relative-relocs, ld reports this when the output needs no
> > relative relocations and the linker script has PHDRS:
> >
> > ld: a.out: section `.relr.dyn' can't be allocated in segment 0
> > LOAD: .text .interp .note.gnu.property .dynsym .dynstr .hash .gnu.hash .relr.dyn .dynamic
> >
> > _bfd_elf_x86_size_relative_relocs removes the empty .relr.dyn output
> > section from the section list, but unlike
> > strip_excluded_output_sections, maybe_strip_output in elf64-ppc.c and
> > _bfd_elf_final_link, which also remove output sections, it does not
> > set SEC_EXCLUDE on it. Without PHDRS that does no harm, as the segment
> > map is built from the section list after the removal. A segment map
> > from PHDRS is set up by lang_record_phdrs before .relr.dyn is sized,
> > though, and elf_modify_segment_map only drops excluded sections from
> > it. The removed section stays in its segment, where
> > assign_file_positions_for_load_sections reports it, and when it is the
> > last section there, the segment is extended to its aligned address.
> >
> > Set SEC_EXCLUDE on it before removing it, as those do.
> >
> > bfd/
> > * elfxx-x86.c (_bfd_elf_x86_size_relative_relocs): Set SEC_EXCLUDE
> > on the empty .relr.dyn output section before removing it.
> >
> > ld/
> > * testsuite/ld-i386/dt-relr-3.d: New file.
> > * testsuite/ld-i386/i386.exp: Run dt-relr-3.
> > * testsuite/ld-x86-64/dt-relr-3-x32.d: New file.
> > * testsuite/ld-x86-64/dt-relr-3.d: Likewise.
> > * testsuite/ld-x86-64/dt-relr-3.t: Likewise.
> > * testsuite/ld-x86-64/x86-64.exp: Run dt-relr-3 and dt-relr-3-x32.
> >
> > Generated-By: Claude Opus 5.5 (claude-opus-5-5)
> > Signed-off-by: Mintsuki <mintsuki@protonmail.com>
>
> While the patch is okay, I fear it violates [1]. Can you please explicitly
> confirm that, despite the patch having been generated by Opus, you hold the
> copyright on the patch and you're willing to submit it to the FSF?
>
> Jan
>
> [1] https://sourceware.org/binutils/wiki/LLM_Generated_Content
>
More information about the Binutils
mailing list