Assuming you have a C file a.c
and want to get a.ll
and a.o
.
An intuitive way is that
$ clang -flto -S a.c
$ mv a.s a.ll
$ clang -flto -c a.c
But the second clang
looks waste of CPU; you generate an LLVM assembly language and then you generate an object file through LLVM assembly language without using the generated assembly file.
Let me break down the second command into small pieces..
$ clang -flto -S a.c
$ mv a.s a.ll
$ llc a.ll
$ gcc -c a.s
In GCC
$ gcc -c --save-temps a.c
oh... very easy...
No comments:
Post a Comment