[LLVMdev] Using LLVM as a crosscompiler

Reid Spencer rspencer at reidspencer.com
Sun Apr 1 13:16:06 PDT 2007


On Sun, 2007-04-01 at 21:26 +0200, Koen Kooi wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hi,
> 
> After hearing Chris' talk at bossaconference I wanted to see if I could use LLVM (and/or
> llvm-gcc) as a crosscompiler for ARM. The documentation beautifully outlines how to build
> it for your host and how to crosscompile it, but not how to build it as a cross-compiler.
> 
> So my question is: How should I build llvm and llvm-gcc4 to have it cross-compile from x86
> to ARM/EABI?

For the LLVM build, just build it on an x86 host and make sure the ARM
target is enabled. You can do that with the --enable-targets=ARM option
to configure. The default is to build all targets which will work fine
too.

For the llvm-gcc build, you just build it like you would any GCC
cross-compiler. That is, you use the --target option on the configure
line for llvm-gcc. The value of the --target option should be the target
triple that you want to cross compile too. I don't know the details but
it should be something like --target=arm-iphone-darwin.

This --target option in llvm-gcc will cause llvm-gcc to emit a
"target=arm-iphone-darwin" directive in the output to LLVM. This will
cause LLVM to select the ARM backend and any subtargets for
"iphone-darwin".

Please note, the "iphone-darwin" part is fictional. I don't know the
correct full target triple for your target but it at least starts with
"arm".

Reid.

> 
> regards,
> 
> Koen
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.5 (Darwin)
> 
> iD8DBQFGEAdjMkyGM64RGpERAgsOAKCKHyT0N8NVsyk0e+yMUCrqSD9CywCeKG7P
> UT6nehh6gaxySsa3ujr2qcc=
> =NwUP
> -----END PGP SIGNATURE-----
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list