[Bug lto/88396] New: -flto -Wl,--whole-archive causes "multiple definition" errors in elfutils (only for bfd, not gold)
slyfox at inbox dot ru
gcc-bugzilla@gcc.gnu.org
Thu Dec 6 23:25:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88396
Bug ID: 88396
Summary: -flto -Wl,--whole-archive causes "multiple definition"
errors in elfutils (only for bfd, not gold)
Product: gcc
Version: 8.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: lto
Assignee: unassigned at gcc dot gnu.org
Reporter: slyfox at inbox dot ru
CC: marxin at gcc dot gnu.org
Target Milestone: ---
Original example is a build failure of elfutils-0.175 against CFLAGS=-flto at:
https://bugs.gentoo.org/616038
Extracted minimal reproducer looks like that:
$ cat libdw.map
ELFUTILS_0.143 {
global:
dwarf_bytesize;
};
$ cat dwarf_bytesize.os.c
void dwarf_bytesize (void) {}
asm (".symver dwarf_bytesize,dwarf_bytesize@@@ELFUTILS_0.143");
Reproducer:
$ gcc -flto -c dwarf_bytesize.os.c -o dwarf_bytesize.os -fPIC
$ gcc-ar cr libdw_pic.a dwarf_bytesize.os
$ gcc-ranlib libdw_pic.a
$ gcc -flto -o libdw.so -shared -Wl,--version-script,libdw.map,--no-undefined
-Wl,--whole-archive libdw_pic.a -Wl,--no-whole-archive -fuse-ld=bfd
/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/../../../../x86_64-pc-linux-gnu/bin/ld.bfd:
/tmp/ccYR58eH.ltrans0.ltrans.o:(*IND*+0x0): multiple definition of
`dwarf_bytesize'; dwarf_bytesize.os (symbol from plugin):(.text+0x0): first
defined here
I'm not sure if it's an ld or gcc bug.
More information about the Gcc-bugs
mailing list