http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45375
--- Comment #65 from Markus Trippelsdorf <markus at trippelsdorf dot de> 2011-04-03 11:32:08 UTC --- (In reply to comment #62) > and since it doesn't fail at link time, this is debug info bug, not LTO, so if > you get a testcase, please open a new PR. You're right, it builds fine without "-g" (ac_add_options --disable-debug-symbols). But the build now fails early when elfhack is enabled: with gold: c++ -o elfhack -fno-rtti -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wcast-align -Wno-invalid-offsetof -Wno-variadic-macros -Werror=return-type -Wno-long-long -march=native -fpermissive -flto=4 -fuse-linker-plugin -fwhole-program -fno-strict-aliasing -fshort-wchar -pthread -pipe -fexceptions -DNDEBUG -DTRIMMED -g -O3 -lpthread -Wl,-O1,--hash-style=gnu,--as-needed,--no-keep-memory -Wl,-rpath-link,/var/tmp/mozilla-central/moz-build-dir/dist/bin -Wl,-rpath-link,/usr/lib host_elf.o host_elfhack.o /usr/lib/gcc/x86_64-pc-linux-gnu/4.6.0/../../../../x86_64-pc-linux-gnu/bin/ld: /tmp/ccGQbukN.ltrans3.ltrans.o: in function _ZN8Elf_Ehdr9serializeERSt14basic_ofstreamIcSt11char_traitsIcEEcc.local.402:/var/tmp/mozilla-central/build/unix/elfhack/elfxx.h:239: error: undefined reference to 'void Elf_Ehdr_Traits::swap<big_endian, Elf64_Ehdr, serializable<Elf_Ehdr_Traits> >(serializable<Elf_Ehdr_Traits>&, Elf64_Ehdr&)' /usr/lib/gcc/x86_64-pc-linux-gnu/4.6.0/../../../../x86_64-pc-linux-gnu/bin/ld: /tmp/ccGQbukN.ltrans3.ltrans.o: in function _ZN8Elf_Ehdr9serializeERSt14basic_ofstreamIcSt11char_traitsIcEEcc.local.402:/var/tmp/mozilla-central/build/unix/elfhack/elfxx.h:228: error: undefined reference to 'void Elf_Ehdr_Traits::swap<big_endian, Elf32_Ehdr, serializable<Elf_Ehdr_Traits> >(serializable<Elf_Ehdr_Traits>&, Elf32_Ehdr&)' collect2: ld returned 1 exit status make[7]: *** [elfhack] Error 1 or with gnu-ld: In function `serialize': /var/tmp/mozilla-central/build/unix/elfhack/elfxx.h:239: undefined reference to `void Elf_Ehdr_Traits::swap<big_endian, Elf64_Ehdr, serializable<Elf_Ehdr_Traits> >(serializable<Elf_Ehdr_Traits>&, Elf64_Ehdr&)' /var/tmp/mozilla-central/build/unix/elfhack/elfxx.h:228: undefined reference to `void Elf_Ehdr_Traits::swap<big_endian, Elf32_Ehdr, serializable<Elf_Ehdr_Traits> >(serializable<Elf_Ehdr_Traits>&, Elf32_Ehdr&)' collect2: ld returned 1 exit status see also: https://bugzilla.mozilla.org/show_bug.cgi?id=647458 (but it does look more like a gcc lto bug to me)