http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57613
Bug ID: 57613 Summary: [LTO] error "multiple definition symbol" for local symbol Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: lto Assignee: unassigned at gcc dot gnu.org Reporter: dimhen at gmail dot com $ cat foo.i void foo() { } $ gcc -fpreprocessed -flto -c foo.i $ ld -m elf_x86_64 -r -o hidden.o --whole-archive foo.o --no-whole-archive $ objcopy -G bar hidden.o $ cp hidden.o hidden2.o $ gcc -flto hidden.o hidden2.o hidden2.o (symbol from plugin): In function `foo': (.text+0x0): multiple definition of `foo' hidden.o (symbol from plugin):(.text+0x0): first defined here /lib/../lib64/crt1.o: In function `_start': (.text+0x20): undefined reference to `main' collect2: error: ld returned 1 exit status $ nm hidden.o 0000000000000000 t foo 0000000000000001 C __gnu_lto_v1 $ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/local/gcc_current/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: /home/dimhen/src/gcc_current/configure --prefix=/usr/local/gcc_current --with-multilib-list=m64 --enable-checking=yes,df,fold,rtl,tree --enable-languages=c,c++,lto --enable-plugin --with-tune=native --with-arch=native --enable-version-specific-runtime-libs Thread model: posix gcc version 4.9.0 20130614 (experimental) [trunk revision 200088] (GCC) gcc-4.8.1 from Fedora 19 FAIL too $ gcc -v Using built-in specs. COLLECT_GCC=/usr/bin/gcc COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.1/lto-wrapper Target: x86_64-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-isl=/builddir/build/BUILD/gcc-4.8.1-20130603/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.1-20130603/obj-x86_64-redhat-linux/cloog-install --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux Thread model: posix gcc version 4.8.1 20130603 (Red Hat 4.8.1-1) (GCC)