[PATCH v3 13/18] PR ld/24600: LD: Add options to control mapless archive acceptance
Maciej W. Rozycki
macro@redhat.com
Tue Jan 13 01:43:15 GMT 2026
On Tue, 9 Dec 2025, Jan Beulich wrote:
> > @@ -798,7 +813,7 @@ const char *const bfd_errmsgs[] =
> > N_("invalid operation"),
> > N_("memory exhausted"),
> > N_("no symbols"),
> > - N_("archive has no index; run ranlib to add one"),
> > + N_("archive has no index; run ranlib to add one or use --link-mapless"),
>
> With --link-mapless being the default, would the suggestion better be to avoid
> use of --no-link-mapless?
There's no need to avoid as the last setting wins. And indeed stuffing
`--link-mapless' at the end will do and may be the easiest way in reality,
e.g. via user LDFLAGS overriding Makefile system defaults. Given that
it's just an error message I'd leave it up to the user to figure out how
to get the `--link-mapless' arrangement the most suitable way if needed.
> > @@ -2373,6 +2374,12 @@ library during a library search. This o
> > Turn off the effect of the @option{--whole-archive} option for subsequent
> > archive files.
> >
> > +@kindex --no-link-mapless
> > +@item --no-link-mapless
> > +Reject archives that lack an index aka symbol map for all the subsequent
> > +archives referred on the command line. If such a file is encountered,
> > +a link error occurs. This is the traditional behavior.
> > +
> > @cindex output file after errors
> > @kindex --noinhibit-exec
> > @item --noinhibit-exec
> > @@ -3182,6 +3189,12 @@ Second, don't forget to use @option{-Wl,
> > list of archives, because gcc will add its own list of archives to
> > your link and you may not want this flag to affect those as well.
> >
> > +@kindex --link-mapless
> > +@item --link-mapless
> > +Accept archives that lack an index aka symbol map for all the subsequent
> > +archives referred on the command line. If missing, such an index is made
> > +internally on the fly at performance cost. This is the default.
>
> Why does this appear so late in the table, among the options ...
The options are put next to `--no-whole-archive' and `--whole-archive'
respectively, to keep archive-related settings together.
> > @kindex --wrap=@var{symbol}
> > @item --wrap=@var{symbol}
> > Use a wrapper function for @var{symbol}. Any undefined reference to
>
> ... starting with 'w' (and their negative forms)?
The placement of this option seems unrelated. There seems no alphabetic
order implied or specified for this option list if this is what you mean.
> Then again sorting looks to
> have been broken badly enough that I can't even suggest a good alternative
> place. Hence my request is only to keep positive and negative options together.
I'd rather keep the options next to the respective `--no-whole-archive'
and `--whole-archive' ones. Please feel free to do any housekeeping here
separately.
Maciej
More information about the Binutils
mailing list