https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65544
--- Comment #3 from Thomas Pöchtrager <t.poechtrager at gmail dot com> --- (In reply to Richard Biener from comment #2) > Can you verify if the cross compiler uses a linker-plugin by specifying > -fuse-linker-plugin? Without that errors like this are unfortunately > expected. The problem persits with -fuse-linker-plugin. $ i686-w64-mingw32-g++ test.cpp -fuse-linker-plugin -flto -static-libstdc++ -v Using built-in specs. COLLECT_GCC=i686-w64-mingw32-g++ COLLECT_LTO_WRAPPER=/opt/compiler/mingw-w64/libexec/gcc/i686-w64-mingw32/4.9.2/lto-wrapper Target: i686-w64-mingw32 Configured with: ../configure --prefix=/opt/compiler/mingw-w64 --target=i686-w64-mingw32 --with-gnu-ld --with-gnu-as --enable-languages=c,c++,lto --disable-multilib --enable-lto --enable-threads=posix Thread model: posix gcc version 4.9.2 (GCC) COLLECT_GCC_OPTIONS='-fuse-linker-plugin' '-flto' '-v' '-shared-libgcc' '-mtune=generic' '-march=pentiumpro' /opt/compiler/mingw-w64/libexec/gcc/i686-w64-mingw32/4.9.2/cc1plus -quiet -v -D_REENTRANT test.cpp -quiet -dumpbase test.cpp -mtune=generic -march=pentiumpro -auxbase test -version -fuse-linker-plugin -flto -o /tmp/ccnj4m7D.s GNU C++ (GCC) version 4.9.2 (i686-w64-mingw32) compiled by GNU C version 4.9.1, GMP version 6.0.0, MPFR version 3.1.2-p3, MPC version 1.0.2 warning: MPFR header version 3.1.2-p3 differs from library version 3.1.2-p11. warning: MPC header version 1.0.2 differs from library version 1.0.3. GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 ignoring nonexistent directory "/opt/compiler/mingw-w64/lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/sys-include" #include "..." search starts here: #include <...> search starts here: /opt/compiler/mingw-w64/lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/include/c++/4.9.2 /opt/compiler/mingw-w64/lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/include/c++/4.9.2/i686-w64-mingw32 /opt/compiler/mingw-w64/lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/include/c++/4.9.2/backward /opt/compiler/mingw-w64/lib/gcc/i686-w64-mingw32/4.9.2/include /opt/compiler/mingw-w64/lib/gcc/i686-w64-mingw32/4.9.2/include-fixed /opt/compiler/mingw-w64/lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/include End of search list. GNU C++ (GCC) version 4.9.2 (i686-w64-mingw32) compiled by GNU C version 4.9.1, GMP version 6.0.0, MPFR version 3.1.2-p3, MPC version 1.0.2 warning: MPFR header version 3.1.2-p3 differs from library version 3.1.2-p11. warning: MPC header version 1.0.2 differs from library version 1.0.3. GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: a4174c607d6c7ea8e319dc3ef635686f COLLECT_GCC_OPTIONS='-fuse-linker-plugin' '-flto' '-v' '-shared-libgcc' '-mtune=generic' '-march=pentiumpro' /opt/compiler/mingw-w64/lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/bin/as -v -o /tmp/ccy6gCyh.o /tmp/ccnj4m7D.s GNU assembler version 2.25 (i686-w64-mingw32) using BFD version (GNU Binutils) 2.25 COMPILER_PATH=/opt/compiler/mingw-w64/libexec/gcc/i686-w64-mingw32/4.9.2/:/opt/compiler/mingw-w64/libexec/gcc/i686-w64-mingw32/4.9.2/:/opt/compiler/mingw-w64/libexec/gcc/i686-w64-mingw32/:/opt/compiler/mingw-w64/lib/gcc/i686-w64-mingw32/4.9.2/:/opt/compiler/mingw-w64/lib/gcc/i686-w64-mingw32/:/opt/compiler/mingw-w64/lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/bin/ LIBRARY_PATH=/opt/compiler/mingw-w64/lib/gcc/i686-w64-mingw32/4.9.2/:/opt/compiler/mingw-w64/lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/lib/../lib/:/opt/compiler/mingw-w64/lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/lib/ COLLECT_GCC_OPTIONS='-fuse-linker-plugin' '-flto' '-v' '-shared-libgcc' '-mtune=generic' '-march=pentiumpro' /opt/compiler/mingw-w64/libexec/gcc/i686-w64-mingw32/4.9.2/collect2 -plugin /opt/compiler/mingw-w64/libexec/gcc/i686-w64-mingw32/4.9.2/liblto_plugin.so -plugin-opt=/opt/compiler/mingw-w64/libexec/gcc/i686-w64-mingw32/4.9.2/lto-wrapper -plugin-opt=-fresolution=/tmp/ccFrtw0U.res -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -plugin-opt=-pass-through=-lpthread -plugin-opt=-pass-through=-ladvapi32 -plugin-opt=-pass-through=-lshell32 -plugin-opt=-pass-through=-luser32 -plugin-opt=-pass-through=-lkernel32 -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -flto -m i386pe -Bdynamic /opt/compiler/mingw-w64/lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/lib/../lib/crt2.o /opt/compiler/mingw-w64/lib/gcc/i686-w64-mingw32/4.9.2/crtbegin.o -L/opt/compiler/mingw-w64/lib/gcc/i686-w64-mingw32/4.9.2 -L/opt/compiler/mingw-w64/lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/lib/../lib -L/opt/compiler/mingw-w64/lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/lib /tmp/ccy6gCyh.o -Bstatic -lstdc++ -Bdynamic -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt -lpthread -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt /opt/compiler/mingw-w64/lib/gcc/i686-w64-mingw32/4.9.2/crtend.o i686-w64-mingw32-g++ @/tmp/ccZ86xan.args Using built-in specs. COLLECT_GCC=i686-w64-mingw32-g++ Target: i686-w64-mingw32 Configured with: ../configure --prefix=/opt/compiler/mingw-w64 --target=i686-w64-mingw32 --with-gnu-ld --with-gnu-as --enable-languages=c,c++,lto --disable-multilib --enable-lto --enable-threads=posix Thread model: posix gcc version 4.9.2 (GCC) COLLECT_GCC_OPTIONS='-c' '-fexceptions' '-fno-trapv' '-fno-strict-overflow' '-mtune=generic' '-march=pentiumpro' '-fuse-linker-plugin' '-v' '-shared-libgcc' '-mtune=generic' '-march=pentiumpro' '-fltrans-output-list=/tmp/cc3wRNFJ.ltrans.out' '-fwpa' '-fresolution=/tmp/ccFrtw0U.res' '-shared-libgcc' /opt/compiler/mingw-w64/libexec/gcc/i686-w64-mingw32/4.9.2/lto1 -quiet -dumpbase ccy6gCyh.o -mtune=generic -march=pentiumpro -mtune=generic -march=pentiumpro -auxbase ccy6gCyh -version -fexceptions -fno-trapv -fno-strict-overflow -fuse-linker-plugin -fltrans-output-list=/tmp/cc3wRNFJ.ltrans.out -fwpa -fresolution=/tmp/ccFrtw0U.res @/tmp/ccQ6SiBJ GNU GIMPLE (GCC) version 4.9.2 (i686-w64-mingw32) compiled by GNU C version 4.9.1, GMP version 6.0.0, MPFR version 3.1.2-p3, MPC version 1.0.2 warning: MPFR header version 3.1.2-p3 differs from library version 3.1.2-p11. warning: MPC header version 1.0.2 differs from library version 1.0.3. GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 GNU GIMPLE (GCC) version 4.9.2 (i686-w64-mingw32) compiled by GNU C version 4.9.1, GMP version 6.0.0, MPFR version 3.1.2-p3, MPC version 1.0.2 warning: MPFR header version 3.1.2-p3 differs from library version 3.1.2-p11. warning: MPC header version 1.0.2 differs from library version 1.0.3. GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 COMPILER_PATH=/opt/compiler/mingw-w64/libexec/gcc/i686-w64-mingw32/4.9.2/:/opt/compiler/mingw-w64/libexec/gcc/i686-w64-mingw32/4.9.2/:/opt/compiler/mingw-w64/libexec/gcc/i686-w64-mingw32/:/opt/compiler/mingw-w64/lib/gcc/i686-w64-mingw32/4.9.2/:/opt/compiler/mingw-w64/lib/gcc/i686-w64-mingw32/:/opt/compiler/mingw-w64/lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/bin/:/opt/compiler/mingw-w64/libexec/gcc/i686-w64-mingw32/4.9.2/:/opt/compiler/mingw-w64/libexec/gcc/i686-w64-mingw32/4.9.2/:/opt/compiler/mingw-w64/libexec/gcc/i686-w64-mingw32/:/opt/compiler/mingw-w64/lib/gcc/i686-w64-mingw32/4.9.2/:/opt/compiler/mingw-w64/lib/gcc/i686-w64-mingw32/:/opt/compiler/mingw-w64/lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/bin/ LIBRARY_PATH=/opt/compiler/mingw-w64/lib/gcc/i686-w64-mingw32/4.9.2/:/opt/compiler/mingw-w64/lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/lib/../lib/:/opt/compiler/mingw-w64/lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/lib/ COLLECT_GCC_OPTIONS='-c' '-fexceptions' '-fno-trapv' '-fno-strict-overflow' '-mtune=generic' '-march=pentiumpro' '-fuse-linker-plugin' '-v' '-shared-libgcc' '-mtune=generic' '-march=pentiumpro' '-fltrans-output-list=/tmp/cc3wRNFJ.ltrans.out' '-fwpa' '-fresolution=/tmp/ccFrtw0U.res' '-shared-libgcc' i686-w64-mingw32-g++ @/tmp/ccLYvNbE.args Using built-in specs. COLLECT_GCC=i686-w64-mingw32-g++ Target: i686-w64-mingw32 Configured with: ../configure --prefix=/opt/compiler/mingw-w64 --target=i686-w64-mingw32 --with-gnu-ld --with-gnu-as --enable-languages=c,c++,lto --disable-multilib --enable-lto --enable-threads=posix Thread model: posix gcc version 4.9.2 (GCC) COLLECT_GCC_OPTIONS='-c' '-fexceptions' '-fno-trapv' '-fno-strict-overflow' '-mtune=generic' '-march=pentiumpro' '-fuse-linker-plugin' '-v' '-shared-libgcc' '-mtune=generic' '-march=pentiumpro' '-fltrans-output-list=/tmp/cc3wRNFJ.ltrans.out' '-fltrans' '-o' '/tmp/cc3wRNFJ.ltrans0.ltrans.o' '-shared-libgcc' /opt/compiler/mingw-w64/libexec/gcc/i686-w64-mingw32/4.9.2/lto1 -quiet -dumpbase cc3wRNFJ.ltrans0.o -mtune=generic -march=pentiumpro -mtune=generic -march=pentiumpro -auxbase-strip /tmp/cc3wRNFJ.ltrans0.ltrans.o -version -fexceptions -fno-trapv -fno-strict-overflow -fuse-linker-plugin -fltrans-output-list=/tmp/cc3wRNFJ.ltrans.out -fltrans @/tmp/ccMz2RJJ -o /tmp/ccXAazgn.s GNU GIMPLE (GCC) version 4.9.2 (i686-w64-mingw32) compiled by GNU C version 4.9.1, GMP version 6.0.0, MPFR version 3.1.2-p3, MPC version 1.0.2 warning: MPFR header version 3.1.2-p3 differs from library version 3.1.2-p11. warning: MPC header version 1.0.2 differs from library version 1.0.3. GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 GNU GIMPLE (GCC) version 4.9.2 (i686-w64-mingw32) compiled by GNU C version 4.9.1, GMP version 6.0.0, MPFR version 3.1.2-p3, MPC version 1.0.2 warning: MPFR header version 3.1.2-p3 differs from library version 3.1.2-p11. warning: MPC header version 1.0.2 differs from library version 1.0.3. GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 COLLECT_GCC_OPTIONS='-c' '-fexceptions' '-fno-trapv' '-fno-strict-overflow' '-mtune=generic' '-march=pentiumpro' '-fuse-linker-plugin' '-v' '-shared-libgcc' '-mtune=generic' '-march=pentiumpro' '-fltrans-output-list=/tmp/cc3wRNFJ.ltrans.out' '-fltrans' '-o' '/tmp/cc3wRNFJ.ltrans0.ltrans.o' '-shared-libgcc' /opt/compiler/mingw-w64/lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/bin/as -v -o /tmp/cc3wRNFJ.ltrans0.ltrans.o /tmp/ccXAazgn.s GNU assembler version 2.25 (i686-w64-mingw32) using BFD version (GNU Binutils) 2.25 COMPILER_PATH=/opt/compiler/mingw-w64/libexec/gcc/i686-w64-mingw32/4.9.2/:/opt/compiler/mingw-w64/libexec/gcc/i686-w64-mingw32/4.9.2/:/opt/compiler/mingw-w64/libexec/gcc/i686-w64-mingw32/:/opt/compiler/mingw-w64/lib/gcc/i686-w64-mingw32/4.9.2/:/opt/compiler/mingw-w64/lib/gcc/i686-w64-mingw32/:/opt/compiler/mingw-w64/lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/bin/:/opt/compiler/mingw-w64/libexec/gcc/i686-w64-mingw32/4.9.2/:/opt/compiler/mingw-w64/libexec/gcc/i686-w64-mingw32/4.9.2/:/opt/compiler/mingw-w64/libexec/gcc/i686-w64-mingw32/:/opt/compiler/mingw-w64/lib/gcc/i686-w64-mingw32/4.9.2/:/opt/compiler/mingw-w64/lib/gcc/i686-w64-mingw32/:/opt/compiler/mingw-w64/lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/bin/ LIBRARY_PATH=/opt/compiler/mingw-w64/lib/gcc/i686-w64-mingw32/4.9.2/:/opt/compiler/mingw-w64/lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/lib/../lib/:/opt/compiler/mingw-w64/lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/lib/ COLLECT_GCC_OPTIONS='-c' '-fexceptions' '-fno-trapv' '-fno-strict-overflow' '-mtune=generic' '-march=pentiumpro' '-fuse-linker-plugin' '-v' '-shared-libgcc' '-mtune=generic' '-march=pentiumpro' '-fltrans-output-list=/tmp/cc3wRNFJ.ltrans.out' '-fltrans' '-o' '/tmp/cc3wRNFJ.ltrans0.ltrans.o' '-shared-libgcc' `__ZdlPv' referenced in section `.text$_ZNSt9exceptionD0Ev' of /opt/compiler/mingw-w64/lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/lib/../lib/libstdc++.a(eh_exception.o): defined in discarded section `.text' of /tmp/ccy6gCyh.o (symbol from plugin) `__ZdlPv' referenced in section `.text$_ZNSt13bad_exceptionD0Ev' of /opt/compiler/mingw-w64/lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/lib/../lib/libstdc++.a(eh_exception.o): defined in discarded section `.text' of /tmp/ccy6gCyh.o (symbol from plugin) `__ZdlPv' referenced in section `.text$_ZN10__cxxabiv115__forced_unwindD0Ev' of /opt/compiler/mingw-w64/lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/lib/../lib/libstdc++.a(eh_exception.o): defined in discarded section `.text' of /tmp/ccy6gCyh.o (symbol from plugin) `__ZdlPv' referenced in section `.text$_ZN10__cxxabiv119__foreign_exceptionD0Ev' of /opt/compiler/mingw-w64/lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/lib/../lib/libstdc++.a(eh_exception.o): defined in discarded section `.text' of /tmp/ccy6gCyh.o (symbol from plugin) `__ZdlPv' referenced in section `.text$_ZN9__gnu_cxx24__concurrence_lock_errorD0Ev[__ZN9__gnu_cxx24__concurrence_lock_errorD0Ev]' of /opt/compiler/mingw-w64/lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/lib/../lib/libstdc++.a(eh_alloc.o): defined in discarded section `.text' of /tmp/ccy6gCyh.o (symbol from plugin) `__ZdlPv' referenced in section `.text$_ZN9__gnu_cxx26__concurrence_unlock_errorD0Ev[__ZN9__gnu_cxx26__concurrence_unlock_errorD0Ev]' of /opt/compiler/mingw-w64/lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/lib/../lib/libstdc++.a(eh_alloc.o): defined in discarded section `.text' of /tmp/ccy6gCyh.o (symbol from plugin) `__ZdlPv' referenced in section `.text$_ZN10__cxxabiv120__si_class_type_infoD0Ev' of /opt/compiler/mingw-w64/lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/lib/../lib/libstdc++.a(si_class_type_info.o): defined in discarded section `.text' of /tmp/ccy6gCyh.o (symbol from plugin) `__ZdlPv' referenced in section `.text$_ZNSt9type_infoD0Ev' of /opt/compiler/mingw-w64/lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/lib/../lib/libstdc++.a(tinfo.o): defined in discarded section `.text' of /tmp/ccy6gCyh.o (symbol from plugin) `__ZdlPv' referenced in section `.text$_ZN10__cxxabiv117__class_type_infoD0Ev' of /opt/compiler/mingw-w64/lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/lib/../lib/libstdc++.a(class_type_info.o): defined in discarded section `.text' of /tmp/ccy6gCyh.o (symbol from plugin) collect2: error: ld returned 1 exit status