This is the mail archive of the
binutils@sourceware.org
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: binutils at sourceware dot org
- Cc: Alan Modra <amodra at gmail dot com>
- Date: Thu, 14 Apr 2011 23:08:11 -0700
- Subject: Re: PATCH: 2 stage BFD linker for LTO plugin
- References: <AANLkTin+Ag09_9DbWdJ71WOg+bqcBGepcThkXAwHX0dN@mail.gmail.com> <AANLkTimNK6MyDq=1Z5CsUz4HxgeMKq4oG7nUM7W09UCb@mail.gmail.com> <AANLkTintqbVr0VjBfU+2k_iYM-E9ss8AEAnV8wyrGhJN@mail.gmail.com> <4CFD1C22.3090900@gmail.com> <AANLkTi=uSGqX8bi0ZLKoqnrqKEXNUof6LXemfX6Uf6uw@mail.gmail.com> <4CFD2933.6040800@gmail.com> <AANLkTinjJzQL4zmtJqaX=BUPX8vPz-aXfVvhkH5WYgYk@mail.gmail.com> <20101206232928.GA15607@bubble.grove.modra.org> <mcr39q14c0i.fsf@google.com> <mcrr5c9buv5.fsf@google.com> <20110415042015.GE19947@bubble.grove.modra.org>
On Thu, Apr 14, 2011 at 9:20 PM, Alan Modra <amodra@gmail.com> wrote:
> On Tue, Jan 18, 2011 at 04:27:42PM -0800, Ian Lance Taylor 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 quite simple patch does the same for GNU ld, except that I don't
> bother to differentiate between archives found before the first
> claimed file and those after. ?I'll address that with a followup patch.
>
>
> ? ? ? ?PR ld/12672
> ? ? ? ?* ldlang.c (enum open_bfd_mode): New.
> ? ? ? ?(open_input_bfds): Replace "force" param with "mode". ?Reload
> ? ? ? ?archives for rescan. ?Update all callers.
> ? ? ? ?(lang_process): Make another open_input_bfds pass for plugins.
There are many LTO tests on davek/lto branch at
http://git.kernel.org/?p=devel/binutils/hjl/x86.git;a=summary
--
H.J.