This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]