[PATCH] ld: Always place note sections as orphan sections

Nick Clifton nickc@redhat.com
Thu Nov 7 14:45:11 GMT 2024


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.

Cheers
   Nick

-------------- next part --------------
A non-text attachment was scrubbed...
Name: note-sections.patch
Type: text/x-patch
Size: 2322 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20241107/c637c544/attachment-0001.bin>


More information about the Binutils mailing list