https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78795
Bug ID: 78795 Summary: LTO causes undefined reference errors when linking with GMP "make check" Product: gcc Version: 6.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: lto Assignee: unassigned at gcc dot gnu.org Reporter: vincent-gcc at vinc17 dot net Target Milestone: --- With GCC 4.9.4 and 6.2.1 under GNU/Linux (Debian/sid), when I build GMP 6.1.1 with --disable-shared CFLAGS="-march=native -O3 -flto=jobserve -fuse-linker-plugin" then "make check", I get errors like: /tmp/ccw6C9Xr.ltrans0.ltrans.o: In function `main': <artificial>:(.text.startup+0xb): undefined reference to `tests_start' <artificial>:(.text.startup+0x11): undefined reference to `mp_trace_base' <artificial>:(.text.startup+0x35): undefined reference to `__gmpn_random' <artificial>:(.text.startup+0x3f): undefined reference to `ref_bswap_limb' <artificial>:(.text.startup+0x74): undefined reference to `mpn_trace' <artificial>:(.text.startup+0x88): undefined reference to `mpn_trace' <artificial>:(.text.startup+0x9c): undefined reference to `mpn_trace' <artificial>:(.text.startup+0xa6): undefined reference to `tests_end' collect2: error: ld returned 1 exit status These errors are similar to those from bug 69953, but with 2 differences: bug 69953 is about C++ (compiled with g++, vs gcc here) and it is known to work with GCC 4.9.2.