[lto][patch] Temporary fix for undefined symbols when linking with archives containing LTO objects

Diego Novillo dnovillo@google.com
Thu Nov 27 08:19:00 GMT 2008


On Wed, Nov 26, 2008 at 19:02, Cary Coutant <ccoutant@google.com> wrote:

> Collect2 is scanning all the input files with nm, which scans archives
> as well as regular objects. For any archive libraries that do contain
> LTO symbols, collect2 counts them as LTO files and passes them to WPA,
> then *leaves them out* of the final link (assuming that WPA has
> replaced them with real .o files). I've added a quick check in
> scan_prog_file to make sure that the file is ELF before counting it as
> an LTO object.

Oops.  Good catch.

> A more ambitious fix would be to unpack the archive and send the
> member .o files to WPA, but that can come later if we deem it
> necessary for collect2 to handle that case. As I understand it, it was
> a deliberate decision to restrict collect2 to regular objects,
> assuming that the linker plugin will take care of it eventually.

Agreed.  The other option is to make WPA understand .a files, though
it may be easier to unpack them beforehand.


> 2008-11-26  Cary Coutant  <ccoutant@google.com>
>
>        * collect2.c (is_elf): New function.
>        (scan_prog_file): Require LTO object to be in ELF format.

OK.


Diego.



More information about the Gcc-patches mailing list