[PATCH 2/5] ld: Add lto and none-lto input support for ld -r

H.J. Lu hjl.tools@gmail.com
Mon Oct 26 13:48:31 GMT 2020


On Sun, Oct 25, 2020 at 5:43 PM Alan Modra <amodra@gmail.com> wrote:
>
> On Wed, Oct 21, 2020 at 04:35:08AM -0700, H.J. Lu via Binutils wrote:
> >       (cmdline_emit_object_only_section): Likewise.
>
> This is really "run the linker again to produce another output" isn't
> it?  So, why not actually run the linker again rather than duplicating
> (and complicating) a whole lot of code.  See for example spuelf.em
> spu_elf_relink.
>

For a relocatable link, I scan all input files, objects and archives, to build
2 lists, cmdline_object_only_file_list and cmdline_object_only_archive_list.
They are used to determine which object files at the command line and
archive members in archives at the command line should be extracted to
the object only output.  To relink, I need to pass these 2 lists to the linker
to rebuild these 2 lists.  I will do it if my patches will be approved after it.

-- 
H.J.


More information about the Binutils mailing list