How do I force clang to use llvm assembler instead of system?

I am working on LLVM / Clang fork (for AVR). How do I force the Clang driver to use the LLVM assembler instead of the system one?

MBA-Anton: bin asmirnov $. / Clang ++ -I / Applications / avr.app / Contents / Resources / Java / hardware / avr / core / avr -I / Applications / avr.app / Contents / Resources / Java / hardware / avr / variant / standard / var / folders / 64 / fwfkm1k51zbd4_c5lwpsbljh0000gn / T / build5450310618632673119.tmp / Blink.cpp -o / tmp / Blink.avr.hex -I / Applications / avr.app // Contents / Resources / Java / hardware / tools / avr / avr / include / --target = avr -O1 -v

And it uses the LLVM clang compiler (not system, correct):

clang version 3.6.0 (https://github.com/4ntoine/clang.git 0d08deedd548d964f63cf896ae9acb8d878a5fd8)     (https://github.com/dylanmckay/avr-llvm.git 447b58bced825fa7bea31f3882f277535cc9fca6)
Target: avr
Thread model: posix
"/Users/asmirnov/Documents/dev/src/llvm_dylan/installed/bin/clang" -cc1 ...

      

But the system assembler is (wrong):

"/ usr / bin / as" -o ...

It must use LLVM llvm-as

because it "knows" the purpose of the AVR (opcodes, etc.). How can I get it to use the LLVM assembler?

+3


source to share


1 answer


You can use clang to emit LLVM IR code with option -emit-llvm

.

Let's say you want to compile a C file to LLVM IR:



clang -emit-llvm -c file.c

It will create an LLVM bytecode file file.bc

. You will be able to compile the file with llc .

0


source







All Articles