LLVM/Clang cross-compiling for ARM
damjan.marion at gmail.com
Fri Apr 15 14:31:35 UTC 2011
On Apr 14, 2011, at 1:06 PM, Vassilis Laganakos wrote:
> Hi Damjan, Mark,
> ----- Original Message -----
>> From:Damjan Marion <damjan.marion at gmail.com>
>> To:Mark Tinguely <marktinguely at gmail.com>
>> Cc:Vassilis Laganakos <vassilis.laganakos at yahoo.com>; "freebsd-arm at freebsd.org" <freebsd-arm at freebsd.org>
>> Sent:Thursday, April 14, 2011 8:13 AM
>> Subject:Re: LLVM/Clang cross-compiling for ARM
>> Hi Mark,
>> Seems that clang from current (made by i386 buildworld) is able to build ARM
>> # clang -v
>> FreeBSD clang version 2.9 (trunk 126547) 20110226
>> Target: i386-undermydesk-freebsd9.0
>> Thread model: posix
> That's the same I get when I build llvm/clang as a cross-compiler, and I thought that
> something was wrong. I'd expect that to be: "arm-unknown-freebsd9.0", but it
> seems from your test bellow that it does generate ARM code.
Seems that this just shows host architecture.
> Well you proved the opposite from what we assumed, since this looks like ARM assembly to me :)
> Anyone knows if something has changed in http://wiki.freebsd.org/BuildingFreeBSDWithClang
> since it was last edited?
My understanding is that clang/LLVM architecture is build from day one to support cross compilation so same clang executable can build code for multiple targets. You can see the list of supported architectures with "llc --version"
For specific architecture you can see list of all variants and features with "llvm-as < /dev/null | llc -march=arm -mcpu=help"
Unfortunately llc and llvm-as are not built as part of buildworld. According to folks from freebsd-clang IRC channel llc and llvm-as are not built because there is no use of them.
> Damjan, if you find some more info about this with llvm/clang, could you please post
> the links here? :)
I dont have any special reference, but looking into source code might help :)
BTW According to #freebsd-clang folks cross-compilation might work just by renaming or symlinking clang to arm-freebsd-clang triple (or similar). They are also looking for feedback.
More information about the freebsd-arm