PATCH: 2 stage BFD linker for LTO plugin

H.J. Lu hjl.tools@gmail.com
Fri Apr 15 06:08:00 GMT 2011


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.



More information about the Binutils mailing list