[PATCH v2] Limit BFD_SUPPORTS_PLUGINS check to plugin.h and targets.c

Alan Modra amodra@gmail.com
Mon Aug 18 01:32:53 GMT 2025


On Sun, Aug 17, 2025 at 07:58:45AM -0700, H.J. Lu wrote:
> On Sun, Aug 17, 2025 at 6:00 AM Alan Modra <amodra@gmail.com> wrote:
> >
> > On Sat, Aug 16, 2025 at 03:05:49PM -0700, H.J. Lu wrote:
> > > Minimize the BFD_SUPPORTS_PLUGINS check to make code more readable and
> > > maintainable by:
> > >
> > > 1. Update bfd_check_format_matches to require the plugin target for slim
> > > LTO IR object if it isn't a linker input.
> >
> > I already said I didn't like this part.  You haven't given me any
> > reason to change my mind.
> 
> Only linker doesn't use the BFD plugin target on slim IR objects.  Everyone
> else should use the BFD plugin target on slim IR objects.

That is just an assertion.

>  There is no need for
> ar, nm, objcopy to use the BFD plugin target explicitly.

The plugin target needs to be used so that archive maps pick up LTO IR
symbols, and so that nm displays LTO IR symbols by default.  It is
true that we might be able to enable the plugin target inside BFD.  I
thought about doing that in check_format, something along the lines of
checking for a plugin target match first before the current target if
bfd_object and target_defaulted and not a linker input.  I decided
against doing that, because I wanted to make incremental changes in
removing plugin archive support.  I also wanted to minimise the number
of places that do something special for LTO IR, and document those
that are necessary with comments giving the reason.

Removing all of the places in binutils/ that set the target to
"plugin" was on my list of things to do, but that should not be a
special case for slim LTO only.  We usually want to see LTO IR symbols
for fat LTO, don't we?

Also, minimising BFD_SUPPORTS_PLUGINS should be a separate patch.  I
quite like that part of your change BTW.

-- 
Alan Modra


More information about the Binutils mailing list