[PATCH] ld: Always place note sections as orphan sections
H.J. Lu
hjl.tools@gmail.com
Thu Nov 7 22:12:58 GMT 2024
On Thu, Nov 7, 2024 at 10:45 PM Nick Clifton <nickc@redhat.com> wrote:
>
> Hi H.J.,
>
> > Since ldelf_place_orphan will properly place orphaned note sections,
> > always place note sections as orphaned sections so that note sections
> > will be placed in the same PT_LOAD segment together with .rodata section,
> > instead of a separate PT_LOAD segment.
>
> I like the idea of moving the note sections into the same segment as the
> .rodata section, but I also like the idea of linker scripts explicitly
> handling known sections, rather than assuming that, for example, the orphan
> section handling code will not change in the future.
>
> So how about something like the attached (untested) patch which moves the
> known note sections from misc-sections.sc to elf.sc ? This should achieve
> your aims whilst also making sure that (known) notes will always be placed
> after the read only data.
>
It works for me.
Thanks.
--
H.J.
More information about the Binutils
mailing list