clang command line options to select target CPU

Can somebody please help out a poor noob...

I'm aware that support for CPUs other than X86 and ARM is experimental, but I'm considering targeting an embedded CPU with clang/llvm and I would like to inspect the code quality produced for the msp430, Microblaze, MIPS etc for a small test case.

I've built clang 3.0 from source with support for all targets

llc -- version yields

Low Level Virtual Machine (
   llvm version 3.0
   Optimized build.
   Built Mar 11 2012 (07:46:13).
   Host: i386-pc-linux-gnu
   Host CPU: amdfam10

   Registered Targets:
     alpha - Alpha [experimental]
     arm - ARM
     bfin - Analog Devices Blackfin [experimental]
     c - C backend
     mblaze - MBlaze
     mips - Mips
     msp430 - MSP430 [experimental]
     thumb - Thumb
     x86 - 32-bit X86: Pentium-Pro and above
     x86-64 - 64-bit X86: EM64T and AMD64
     xcore - XCore

Following the clang man page target option info ...

clang -arch msp430 -S t.c

rewards me with
clang: warning: argument unused during compilation: '-arch msp430'
I also tried

clang -arch=msp430 -S t.c

with the same outcome.

clang -march=msp430 -S t.c

gives ...
error: unknown target CPU 'msp430'

I've tried a few other targets all with similar outcomes.

Can anybody steer me in the right direction ?

Thanks in advance,
Paul S.


Can anybody steer me in the right direction ?

In 3.0 you might try -ccc-host-triple=msp430-elf

Thanks Anton,

I'm running on Ubuntu 10.04 and when I try

clang -ccc-host-triple=msp430-elf -S t.c

the response is ...

clang: error: unsupported option '-ccc-host-triple=msp430-elf'

Is there any way I can query clang for a valid list of host triples ?

Cheers, Paul


Remove the = and use a space instead.


the response is ...
clang: error: unsupported option '-ccc-host-triple=msp430-elf'

Uhm, sorry, -ccc-host-triple msp430-elf

Thanks guys - that did it.

In case I need to find info on other targets - Is there anywhere I could have found this documented ?

Cheers, Paul.