This is the mail archive of the
mailing list for the binutils project.
Re: [PATCH] PR ld/20103: Skip an archive element if not added by linker
- From: Alan Modra <amodra at gmail dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: Binutils <binutils at sourceware dot org>
- Date: Mon, 23 May 2016 23:59:54 +0930
- Subject: Re: [PATCH] PR ld/20103: Skip an archive element if not added by linker
- Authentication-results: sourceware.org; auth=none
- References: <20160518022408 dot GA28694 at intel dot com> <20160518064916 dot GN24091 at bubble dot grove dot modra dot org> <CAMe9rOo+h-nmtv9VuJPJdmCy8=-wm5+ihpcCvsKCYnXQ5aDXSw at mail dot gmail dot com>
On Wed, May 18, 2016 at 05:10:55AM -0700, H.J. Lu wrote:
> On Tue, May 17, 2016 at 11:49 PM, Alan Modra <firstname.lastname@example.org> wrote:
> > On Tue, May 17, 2016 at 07:24:08PM -0700, H.J. Lu wrote:
> >> During archive rescan to resolve symbol references for files added by
> >> LTO, linker add_archive_element callback is called to check if an
> >> archive element should added. After all IR symbols have been claimed,
> >> linker won't claim new IR symbols and shouldn't add the LTO archive
> >> element. This patch updates linker add_archive_element callback to
> >> return FALSE when seeing an LTO archive element during rescan and
> >> changes ELF linker to skip such archive element. Other linker backends
> >> may also need similar update.
> >> Tested on x86. OK for master?
> > Not without a lot more explanation and justification why this is
> > correct, in particular the plugin_call_claim_file change.
> plugin_call_claim_file is only called from plugin_object_p to check
> if an input is IR, not really claim symbols. which is done by
> plugin_call_all_symbols_read, which sets no_more_claiming. Whether
> an input is an IR file is independent of if there is more IR symbols to
> During archive rescan, if plugin_object_p rejects an IR archive element,
> linker will treat it as a non-IR element, which leads to error. In stead
> plugin_object_p should always accept an IR object, We won't claim the
> IR symbols when no_more_claiming is set. My change just makes linker
> consistent on whether an input file is an IR file.
OK, I've now had a look at everything and I think your patch is OK
if you edit every file that calls add_archive_element. You can't
change a pass/fail return status to add/don't add and not change all
users of the function.
Australia Development Lab, IBM