bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/23350] multiple prevailing defs for unused variable in lto mode


From: zenith432 at users dot sourceforge.net
Subject: [Bug ld/23350] multiple prevailing defs for unused variable in lto mode
Date: Mon, 09 Jul 2018 19:26:20 +0000

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

--- Comment #4 from zenith432 at users dot sourceforge.net ---
What difference does it make?  This is undefined behavior.  It doesn't link
-fno-lto either.

gcc -c main.i && gcc -c lib.i && ar rusc lib.a lib.o
gcc main.o lib.a lib.a

/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crt1.o: in
function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status

Find an example where the -fno-lto link succeeds.

ld is loading the object files in the libraries because it's searching for
main.
If I add a main() to lib.i it links successfully with -flto - the 2nd load of
lib.a sets the duplicate symbol resolutions to PREEMPTED_IR.  The error with
-flto is only if main is not found - which is also an error in -fno-lto.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]