[PATCH v2] elf: Discard input .note.gnu.build-id sections
H.J. Lu
hjl.tools@gmail.com
Wed Dec 1 11:58:05 GMT 2021
On Wed, Dec 1, 2021 at 3:55 AM Alan Modra <amodra@gmail.com> wrote:
>
> On Tue, Nov 30, 2021 at 11:56:10PM -0800, Fangrui Song wrote:
> > On 2021-12-01, Alan Modra via Binutils wrote:
> > > On Tue, Nov 30, 2021 at 08:46:04PM -0800, H.J. Lu via Binutils wrote:
> > > > 1. Discard input .note.gnu.build-id , excluding the first one.
> > > > 2. Clear the build ID field before writing.
> > > > 3. Use the input .note.gnu.build-id section if available.
> > >
> > > It's simpler to mark all input .note.gnu.build-id sections with
> > > SEC_EXCLUDE then use bfd_make_section_anyway_with_flags to create a
> > > new section. That way you'll avoid any problems that might occur when
> > > trying to use an existing section. For example, the size might change
> > > with a change in build-id style, leading to section contents buffer
> > > overflow.
> >
> > For --build-id=none final link, should .note.gnu.build-id input sections
> > be combined? This is the currently ld.bfd (and ld.lld)'s behavior.
>
> That's an interesting question. We often supply an option such as
> --build-id=none in order to turn off a project-wide default for
> particular files. So --build-id=none ought to behave the same as not
> supplying any --build-id option. What I'm saying is that the option
> --build-id=none shouldn't necessarily mean "no build id", but we could
> go that way if we also dropped .note.gnu.build-id sections when no
> --build-id option was given. I'm in favour of doing that.
>
Here is the v2 patch:
1. Use bfd_make_section_anyway_with_flags to create the output
.note.gnu.build-id section.
2. Discard input .note.gnu.build-id sections.
OK for master?
Thanks.
--
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: v2-0001-elf-Discard-input-.note.gnu.build-id-sections.patch
Type: text/x-patch
Size: 6777 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20211201/ec3c628a/attachment.bin>
More information about the Binutils
mailing list