This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug lto/88396] New: -flto -Wl,--whole-archive causes "multiple definition" errors in elfutils (only for bfd, not gold)
- From: "slyfox at inbox dot ru" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 06 Dec 2018 23:25:25 +0000
- Subject: [Bug lto/88396] New: -flto -Wl,--whole-archive causes "multiple definition" errors in elfutils (only for bfd, not gold)
- Auto-submitted: auto-generated
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.
- Follow-Ups:
- [Bug lto/88396] -flto -Wl,--whole-archive causes "multiple definition" errors in elfutils (only for bfd, not gold)
- From: pinskia at gcc dot gnu.org
- [Bug lto/88396] -flto -Wl,--whole-archive causes "multiple definition" errors in elfutils (only for bfd, not gold)
- From: pinskia at gcc dot gnu.org
- [Bug lto/88396] -flto -Wl,--whole-archive causes "multiple definition" errors in elfutils (only for bfd, not gold)
- From: slyfox at inbox dot ru
- [Bug lto/88396] -flto -Wl,--whole-archive causes "multiple definition" errors in elfutils (only for bfd, not gold)
- From: slyfox at inbox dot ru
- [Bug lto/88396] -flto -Wl,--whole-archive causes "multiple definition" errors in elfutils (only for bfd, not gold)
- From: slyfox at inbox dot ru
- [Bug lto/88396] -flto -Wl,--whole-archive causes "multiple definition" errors in elfutils (only for bfd, not gold)
- From: hjl.tools at gmail dot com