autospec icon indicating copy to clipboard operation
autospec copied to clipboard

clang needs -flto when linking

Open rakuco opened this issue 6 years ago • 0 comments

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.

rakuco avatar May 24 '19 14:05 rakuco