[LLVMdev] llvm shipping with android ndk for building ghc cross compiler

Nathan Hüsken nathan.huesken at posteo.de
Sat Jan 12 01:17:28 PST 2013


Hey,

I am trying to build a haskell cross compiler to android by building the
glasgow haskell compiler with target=arm-linux-androideabi.

It builds, but the executables the compiler produces segfaults on my
android device. This is probably not llvm related, but I want to rule
that out.
I used the llvm version shipped with ubuntu 12.10 for the build.

I was wondering if maybe I have to use llvm from the android ndk. If I
do that, compilation fails with the error message at the end of this mail.

1. Do I habe to use llvm shipped with the android ndk, or does it not
matter and I can use llvm from ubuntu?
2. The error message means, that the haskell calling convention is not
supported, correct? Is there some good reason llvm shipping with android
ndk does not support it?

Thanks!
Nathan


The error message with which compilation fails when using llvm from the
android ndk:

Unsupported calling convention
UNREACHABLE executed at
/ssd/ndk-toolchain/src/llvm-3.1/llvm/lib/Target/ARM/ARMISelLowering.cpp:1142!
0  llc       0x08a8cbf8
1  llc       0x08a8d124
2            0x55577400 __kernel_sigreturn + 0
3            0x55577430 __kernel_vsyscall + 16
4  libc.so.6 0x5571525f gsignal + 79
5  libc.so.6 0x557187b5 abort + 373
6  llc       0x08a7426c
7  llc       0x0821437c
llvm::ARMTargetLowering::CCAssignFnForNode(llvm::CallingConv::ID, bool,
bool) const + 92
8  llc       0x08219e60
llvm::ARMTargetLowering::LowerFormalArguments(llvm::SDValue,
llvm::CallingConv::ID, bool, llvm::SmallVectorImpl<llvm::ISD::InputArg>
const&, llvm::DebugLoc, llvm::SelectionDAG&,
llvm::SmallVectorImpl<llvm::SDValue>&) const + 256
9  llc       0x0849676b
llvm::SelectionDAGISel::LowerArguments(llvm::BasicBlock const*) + 2539
10 llc       0x084d5a36
llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) + 8726
11 llc       0x084d69a4
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) + 1204
12 llc       0x0862373a
llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 186
13 llc       0x08a18152
llvm::FPPassManager::runOnFunction(llvm::Function&) + 578
14 llc       0x08a1824c llvm::FPPassManager::runOnModule(llvm::Module&) + 76
15 llc       0x08a17cad llvm::MPPassManager::runOnModule(llvm::Module&)
+ 541
16 llc       0x08a17e60 llvm::PassManagerImpl::run(llvm::Module&) + 160
17 llc       0x08a17f06 llvm::PassManager::run(llvm::Module&) + 38
18 llc       0x081322ce main + 3390
19 libc.so.6 0x557004b3 __libc_start_main + 243
20 llc       0x0813e9b9
Stack dump:
0.	Program arguments:
/home/ls/src/android-ndk/toolchains/llvm-3.1/prebuilt/linux-x86/bin/llc
-O2 -relocation-model=static /tmp/ghc2647_0/ghc2647_0.bc -o
/tmp/ghc2647_0/ghc2647_0.lm_s --enable-tbaa=true
1.	Running pass 'Function Pass Manager' on module
'/tmp/ghc2647_0/ghc2647_0.bc'.
2.	Running pass 'ARM Instruction Selection' on function
'@ghczmprim_GHCziTypes_Czh_info'



More information about the llvm-dev mailing list