[LLVMdev] Using llc to compile a .ll into a .s for ARM

Matthew Huck matthew.huck at gmail.com
Mon Jun 21 21:45:37 PDT 2010

  I've battled with this now for a good many hours, and I was wondering if
someone could point in the right direction. What I want to do is with
the kaleidoscope tutorial code, take the IR from a run where I've just done

def test(x) 42.0*x;

resulting in the file test.ll

; ModuleID = 'my cool jit'

define double @test(double %x) {
  %multmp = fmul double %x, 4.200000e+01          ; <double> [#uses=1]
  ret double %multmp

and the use llvm-ar to compile that test.ll to a test.bc and then compile
that to a .S which I can pass to the Android NDK to compile.

I've tried (to cut a long day short!)
Compiling llvm with the "--target=arm-eabi" and "--target=arm-elf-linux-gnu"
Calling llc with -march=thumb and -march=arm (I'm trying to create a asm
file for the android NDK gcc)

I'm able to get the NDK to get close (by using thumb, and manually editing
the asm a bit, but it still complains about ___mulfp being undefined.

So questions:
Do I have to somehow get LLVM to use the binutils in the NDK?
Do I have to do a full Canadian Cross, and actually host the final thing on
the android?

Oh, I'm currently doing all this on Snow Leopard (but did try Ubunutu), and
have tried both LLVM1.6 and LLVM1.7, and I'm using NDKr4



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

More information about the llvm-dev mailing list