https://sourceware.org/bugzilla/show_bug.cgi?id=23958
Bug ID: 23958 Summary: -flto -Wl,--whole-archive causes "multiple definition" errors in elfutils (only for bfd, not gold) Product: binutils Version: 2.31 Status: UNCONFIRMED Severity: normal Priority: P2 Component: ld Assignee: unassigned at sourceware dot org Reporter: slyfox at inbox dot ru Target Milestone: --- Created attachment 11435 --> https://sourceware.org/bugzilla/attachment.cgi?id=11435&action=edit gcc-lto-616038.tar.gz Original example is a build failure of elfutils-0.175 against CFLAGS=-flto at: https://bugs.gentoo.org/616038 In case it's a gcc bug I also files: https://gcc.gnu.org/PR88396 Angrew suspects it might be related to https://sourceware.org/PR12319 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 Using binutils-2.31.1 / gcc-8.2.0 here. $ gcc -v Using built-in specs. COLLECT_GCC=/usr/bin/gcc COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/8.2.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /tmp/portage-tmpdir/portage/sys-devel/gcc-8.2.0-r5/work/gcc-8.2.0/configure --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/8.2.0 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/8.2.0 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/8.2.0/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/8.2.0/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/include/g++-v8 --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/8.2.0/python --enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --enable-nls --without-included-gettext --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 8.2.0-r5 p1.6' --disable-esp --enable-libstdcxx-time --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-multilib --with-multilib-list=m32,m64 --disable-altivec --disable-fixed-point --enable-targets=all --enable-libgomp --disable-libmudflap --disable-libssp --disable-libmpx --disable-systemtap --enable-vtable-verify --enable-libvtv --enable-lto --with-isl --disable-isl-version-check --enable-libsanitizer --enable-default-pie --enable-default-ssp Thread model: posix gcc version 8.2.0 (Gentoo 8.2.0-r5 p1.6) -- 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