[LLVMdev] Using LLVM as a crosscompiler

Koen Kooi koen at dominion.kabel.utwente.nl
Sun Apr 1 13:24:05 PDT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Reid Spencer schreef:
> On Sun, 2007-04-01 at 21:26 +0200, Koen Kooi wrote:
> 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.

OK, that's easy I already have that working :)


>> 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.

Is llvm-gcc4 a modified gcc? I have a big pile of patches to unbreak various part of gcc
4.1.x for ARM. E.g.
http://www.openembedded.org/repo/org.openembedded.dev/packages/gcc/gcc-4.1.2/unbreak-armv4t.patch
to make gcc stop emitting armv5te instructions for armv4t cpus. Will llvm-gcc4 require the
same patches.

>> 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".

'xscale' would also be an option, but lets not get into un(der)documented features in gcc ;)

It would probably be 'arm-<target vendor>-linuxgnueabi' for the things I'm interested in
(The neo1973 phone for example).

After having dealt with gcc as crosscompiler for the past years I get the "It can't be
this easy to setup" feeling, but I'll find out tomorrow.

Thanks for your speedy replies!

regards,

Koen
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Darwin)

iD8DBQFGEBTlMkyGM64RGpERAsMhAJ0SjJnRJKS8XBaij1h0p0uiur5kzACfbnFm
riI+LdmQD6o6N5JKUU7+yBA=
=Y/fp
-----END PGP SIGNATURE-----



More information about the llvm-dev mailing list