LLVM Cross-Compiler: Difference between revisions

Rewrote cited forum posts into something more fitting for a wiki page
[unchecked revision][unchecked revision]
No edit summary
(Rewrote cited forum posts into something more fitting for a wiki page)
Line 19:
</source>
 
After building you will have a compiler able to output multiple output formats regardless of your current platform, you can specify x86 ELF output format (for example) to clang using "-ccc-host-triple i686-pc-linux-gnu".
 
For example, for ARM, you can use
<source lang="bash">
-march=armv7-a -mfloat-abi=soft -ccc-host-triple arm-elf
</source>
Since 3.1, it can be shortened to
<source lang="bash">
-target armv7--eabi -mcpu=cortex-a9
</source>
 
 
TODO: beware that clang is both a cross-compiler and a host-compiler and you would have to specify some options to disable host functionality.
Line 28 ⟶ 38:
 
TODO: integrate libc++ build instructions
 
 
 
pitfall@osdev.forum wrote:
 
As far as I know, you can use -ccc-host-triple <your target output format> option with -march=<your target architecture> to cross-compile with LLVM. It's been a while since I used LLVM/CLang, but I think this'll work with some investigation.
 
Here's an example quoted for some obscure mailing lists illustrating what I wrote :
<source lang="bash">
-march=armv7-a -mfloat-abi=soft -ccc-host-triple arm-elf
</source>
 
JamesM@osdev.forum wrote:
 
Or since 3.1 you can just shorten this to:
 
<source lang="bash">
-target armv7--eabi -mcpu=cortex-a9
</source>
 
It is recommended to build post-3.1 clang as there are some crash bugs fixed.
Anonymous user