[LLVMdev] Getting started question.

Chris Lattner sabre at nondot.org
Mon Jun 11 14:58:40 PDT 2007


On Mon, 11 Jun 2007 Alireza.Moshtaghi at microchip.com wrote:
> I downloaded and installed the front-end (llvm-gcc 4), and downloaded,
> configured, and built llvm-2.0 using -prefix=[myllvmPath] and
> -with-llvmgccdir=[llvm-gccPath]

ok

> When I try to use sparc as target, llvm-gcc does not recognize it. I
> used -march=sparc and it gives two errors:

Unfortunately, llvm-gcc works like GCC, not like LLVM.  As such, you have 
to hard code in the target to use in the binary.  For llvm-gcc this means 
that you have to configure llvm-gcc itself as a cross compiler from your 
host linux box to your target sparc box.  The standard GCC cross compiler 
options should work.

Alternatively, if you want to get a taste of sparc code, you can do things 
like this:

$ llvm-gcc x.c -O3 -c -o - -emit-llvm | llc -march=sparc

However, this won't necessarily match the sparc ABIs, data layout, etc, so 
it is really only suitable for taste testing the sparc backend :)

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/



More information about the llvm-dev mailing list