[LLVMdev] cross-compiling with llvm

Robert L. Bocchino Jr. bocchino at uiuc.edu
Tue Mar 7 10:58:32 PST 2006


> 1. Is it possible at all to cross-compile with llvm?

Yes, this is possible.  I've cross-compiled from x86 to MIPS using  
LLVM.  However, the codes I compiled using this technique did not  
always run correctly.  You may have better luck with PPC.

> 2. I allready have a gcc cross-compiler for power-pc, do i need  
> this or
>    does llvm contain its own? How can i tell llvm to use it?

LLVM has no MIPS backend, so when I did this, I used the C backend to  
transform the LLVM bytecode to C, then put the result through a gcc  
MIPS cross compiler.  LLVM does have a PPC backend, however, so I  
don't think you need to do this.  I think you want to build llvm-gcc  
on x86 as a PPC cross compiler, use it to compile to LLVM bytecode,  
and then use the PPC backend to generate PPC code.  To generate PPC  
code from foo.bc, you say llc -march=powerpc < foo.c > foo.

> 3. Is there any howto for doing the cross-compiling? I think i need
>    to compile the gcc-front-end for this task, but i don't know the
>    options for the configuration script.

Building llvm-gcc as a cross compiler is tricky and not documented.   
I'm away from Urbana right now, but when I get back tomorrow I'll  
take a look at what I did for MIPS and see if I can reconstruct it  
for you.

Rob

Robert L. Bocchino Jr.
Ph.D. Student
University of Illinois, Urbana-Champaign

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20060307/bb468d9a/attachment.html>


More information about the llvm-dev mailing list