This is the mail archive of the
mailing list for the binutils project.
Re: PATCH: 2 stage BFD linker for LTO plugin
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Ian Lance Taylor <iant at google dot com>
- Cc: Dave Korn <dave dot korn dot cygwin at gmail dot com>, Cary Coutant <ccoutant at google dot com>, GCC Development <gcc at gcc dot gnu dot org>, Binutils <binutils at sourceware dot org>
- Date: Tue, 18 Jan 2011 17:38:15 -0800
- Subject: Re: PATCH: 2 stage BFD linker for LTO plugin
- References: <AANLkTikv7BJPnkcgvh-JgnqJ2sKpB07GQm5U-Rzkcp9e@mail.gmail.com> <AANLkTi=GW_Qt1NSf5OymHsKxcy4UY3d0Xv9V4xOG5JF4@mail.gmail.com> <AANLkTikm27JbKTgwGG_+Ev8ZDesiy4sxGeJ0f96n+1pN@mail.gmail.com> <AANLkTin+Ag09_9DbWdJ71WOg+bqcBGepcThkXAwHX0dN@mail.gmail.com> <AANLkTimNK6MyDq=1Z5CsUz4HxgeMKq4oG7nUM7W09UCb@mail.gmail.com> <AANLkTintqbVr0VjBfU+2k_iYM-E9ss8AEAnV8wyrGhJN@mail.gmail.com> <4CFD1C22.email@example.com> <AANLkTi=uSGqX8bi0ZLKoqnrqKEXNUof6LXemfX6Uf6uw@mail.gmail.com> <4CFD2933.firstname.lastname@example.org> <AANLkTinjJzQL4zmtJqaX=BUPX8vPz-aXfVvhkH5WYgYk@mail.gmail.com> <20101206232928.GA15607@bubble.grove.modra.org> <email@example.com> <firstname.lastname@example.org>
On Tue, Jan 18, 2011 at 4:27 PM, Ian Lance Taylor <email@example.com> wrote:
> After some discussion on IRC, here is another approach to resolving the
> issue with static linking and LTO.
> In this approach, the linker keeps track of all archives found after the
> first file claimed by the plugin. ?If the plugin adds any object files,
> and the object files refer to any symbols which are not yet defined,
> then the linker will scan all the saved archives, in order, for a
> definition of the symbol. ?If a definition is found, the linker will
> pull in the appropriate object from the archive. ?If that object, in
> turn, has any undefined symbols, the linker will pull in the appropriate
> object from that archive or any later ones, and so forth. ?The linker
> will honor --start-group/--end-group while rescanning.
> This should ensure that any previously unseen undefined symbols
> introduced by the compiler are handled correctly. ?I think it is
> appropriate to do this unconditionally when using plugins, as there is
> no other reasonable way to handle undefined symbols in a file added by a
> I've appended a patch to gold which implements this approach. ?The patch
> is reasonably efficient and introduces no unnecessary file I/O. ?With
> this patch to gold, and no change to gcc, the problematic -static test
> cases which I know about pass. ?Also all the current lto.exp tests pass.
> All those tests also pass if I edit the gcc LTO plugin to ignore the
> -pass-through option, as that option is not necessary when the linker
> implements this approach.
I think -pass-through is a hack and linker should simply ignore it.
> As this patch does not require any changes to gcc, and fixes some cases
> which are clearly bugs, I plan to commit this patch to binutils mainline
> and to binutils 2.21 branch after a few days if I don't hear any
It sounds a real progress.
BTW, can you check if the modified gold works on