[PATCH] elf: Discard input .note.gnu.build-id sections
Alan Modra
amodra@gmail.com
Wed Dec 1 11:55:12 GMT 2021
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.
--
Alan Modra
Australia Development Lab, IBM
More information about the Binutils
mailing list