Suo
Suo

Reputation: 89

How and where does clang use llvm?

When using command like this:

clang -### -O3 -a.c

And then, it will output the followings:

clang version 1.1 (branches/release_27)
Target: x86_64-unknown-linux-gnu
Thread model: posix
 "/tensorflow/bin/llvm+clang-2.7/bin/clang" "-cc1" "-triple" "x86_64-unknown-linux-gnu" "-S" "-disable-free" "-main-file-name" "a.c" "-mrelocation-model" "static" "-mdisable-fp-elim" "-mconstructor-aliases" "-munwind-tables" "-target-cpu" "x86-64" "-resource-dir" "/tensorflow/bin/llvm+clang-2.7/lib/clang/1.1" "-O3" "-fmessage-length" "141" "-fgnu-runtime" "-fdiagnostics-show-option" "-fcolor-diagnostics" "-o" "/tmp/cc-w9Hpfd.s" "-x" "c" "a.c"
 "/usr/bin/gcc" "-O3" "-c" "-m64" "-o" "/tmp/cc-8haDzc.o" "-x" "assembler" "/tmp/cc-w9Hpfd.s"
 "/usr/bin/gcc" "-O3" "-m64" "-o" "a.out" "/tmp/cc-8haDzc.o"

So, we can see that the early version of llvm(llvm-2.7) uses gcc's assembler and linker.

But how, when and where, clang uses llvm?

Does clang use llvm in clang -cc1?

How to prove it? (Either documentation or command line output can be the evidence. But I can not find it.)

I think llvm+clang is a flexible toochain, I can find many ways to generate an executable from a C program.

Thanks in advance.

Upvotes: 0

Views: 528

Answers (1)

David Ranieri
David Ranieri

Reputation: 41017

Use:

clang -v -o demo a.c

-v gives you a lot information, including the llvm version used in /usr/lib

Upvotes: 1

Related Questions