https://sourceware.org/bugzilla/show_bug.cgi?id=23935

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |hjl.tools at gmail dot com
         Resolution|---                         |INVALID

--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Vladislav Ivanishin from comment #0)

>     /usr/bin/ld: /tmp/ccvITLI4.ltrans0.ltrans.o: in function `main':
>     <artificial>:(.text+0xc): undefined reference to `puts'
> 
> Notice the -ffat-lto-objects switch.  Without it, libfoo.a would contain only
> LTO bytecode and both linkers would error out.  It seems, the logic is off
> somewhere taking "contains LTO bytecode" for "contains only LTO bytecode".

I think it is a gcc bug:

[hjl@gnu-cfl-1 pr23935]$ gcc -c -flto -ffat-lto-objects prog.c
[hjl@gnu-cfl-1 pr23935]$ gcc-nm prog.o
00000000 T main
[hjl@gnu-cfl-1 pr23935]$ nm prog.o
0000000000000001 C __gnu_lto_v1
0000000000000000 T main
                 U puts
[hjl@gnu-cfl-1 pr23935]$ clang -flto -c prog.c
[hjl@gnu-cfl-1 pr23935]$ llvm-nm prog.o
---------------- T main
                 U printf
[hjl@gnu-cfl-1 pr23935]$ 

Reference to puts fin prog.o is missing from IR symbol table.  In fact, ld
is consistent for with and without -ffat-lto-objects.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to