autospec
autospec copied to clipboard
clang needs -flto when linking
Consider the following excerpt:
clang++ -flto -c hello.cc
clang++ hello.o -o hello
this fails with
hello.o: file not recognized: file format not recognized
which is caused by hello.o being an LLVM IR file rather than a traditional .o file when -flto is used. It turns out that passing -flto when linking everything works fine.
A lot of software ends up working fine because they end up passing C{XX}FLAGS when linking, but that's not guaranteed.