[Bug lto/88396] New: -flto -Wl,--whole-archive causes "multiple definition" errors in elfutils (only for bfd, not gold)

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug lto/88396] New: -flto -Wl,--whole-archive causes "multiple definition" errors in elfutils (only for bfd, not gold)

kargl at gcc dot gnu.org
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.
Reply | Threaded
Open this post in threaded view
|

[Bug lto/88396] -flto -Wl,--whole-archive causes "multiple definition" errors in elfutils (only for bfd, not gold)

kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88396

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
>I'm not sure if it's an ld or gcc bug.

Since it works with gold, this is more likely an BFD ld issue.

What version of binutils are you trying with?
Reply | Threaded
Open this post in threaded view
|

[Bug lto/88396] -flto -Wl,--whole-archive causes "multiple definition" errors in elfutils (only for bfd, not gold)

kargl at gcc dot gnu.org
In reply to this post by kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88396

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Maybe at one point related to
https://sourceware.org/bugzilla/show_bug.cgi?id=12319 .
Reply | Threaded
Open this post in threaded view
|

[Bug lto/88396] -flto -Wl,--whole-archive causes "multiple definition" errors in elfutils (only for bfd, not gold)

kargl at gcc dot gnu.org
In reply to this post by kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88396

--- Comment #3 from Sergei Trofimovich <slyfox at inbox dot ru> ---
(In reply to Andrew Pinski from comment #1)
> >I'm not sure if it's an ld or gcc bug.
>
> Since it works with gold, this is more likely an BFD ld issue.
>
> What version of binutils are you trying with?

Using binutils-2.31.1 / gcc-8.2.0 [1] here.

(In reply to Andrew Pinski from comment #2)
> Maybe at one point related to
> https://sourceware.org/bugzilla/show_bug.cgi?id=12319 .

Aha, thank you!! I'll file another bug against binutils/ld refering this one.

[1]: 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)(In reply to Andrew Pinski from comment
#2)
Reply | Threaded
Open this post in threaded view
|

[Bug lto/88396] -flto -Wl,--whole-archive causes "multiple definition" errors in elfutils (only for bfd, not gold)

kargl at gcc dot gnu.org
In reply to this post by kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88396

--- Comment #4 from Sergei Trofimovich <slyfox at inbox dot ru> ---
Created attachment 45175
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45175&action=edit
gcc-lto-616038.tar.gz
Reply | Threaded
Open this post in threaded view
|

[Bug lto/88396] -flto -Wl,--whole-archive causes "multiple definition" errors in elfutils (only for bfd, not gold)

kargl at gcc dot gnu.org
In reply to this post by kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88396

--- Comment #5 from Sergei Trofimovich <slyfox at inbox dot ru> ---
Filed the bug on binutils side as well:
    https://sourceware.org/PR23958
Reply | Threaded
Open this post in threaded view
|

[Bug lto/88396] -flto -Wl,--whole-archive causes "multiple definition" errors in elfutils (only for bfd, not gold)

kargl at gcc dot gnu.org
In reply to this post by kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88396

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
           See Also|                            |https://sourceware.org/bugz
                   |                            |illa/show_bug.cgi?id=23958
         Resolution|---                         |MOVED

--- Comment #6 from H.J. Lu <hjl.tools at gmail dot com> ---
Moved to

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

and fixed for binutils 2.32.