[LLVMdev] Cross compiling to ARM using LLC {Help}

NaJeM ErMeLeH ermeleh at hotmail.com
Tue Dec 17 05:40:33 PST 2013


Hello,

I'm trying to cross compile the MiBench benchmarks using LLC and ARM cross compiler the binaries generated will be used on pandaboard or the qemu-arm emulator.

I have faced multiple issues during the compilation process, here are the commands used.

# generate LLVM-IR for dijkstra_large.c
$gcc -S -flto -o dijkstra_large.bc -fplugin=${DRAGONEGG} dijkstra_large.c
# generate TARGET object file for dijkstra_large.bc
$./llc -march=arm -mcpu=cortex-a9 dijkstra_large.bc -o dijkstra_large.o -filetype=obj -O3
# Generate executalbe using Target's toolchain
$arm-linux-gcc -static dijkstra_large.o -o dijkstra_large

The first issue is that the arguments that I use as an input to dijkstra benchmark do not get inserted in their appropriate position in the [argv] array. In order to run the benchmark the command is ./dijkstra_large input.dat. using this command I got the argv[1] = null which should be input.dat. If I add another extra argument between the benchmark binary name and the input.dat arugment like (./dijkstra_large xxx input.dat) the benchmark works without any error and the argv[1] equals the input.dat. This issue is preventing me from using other benchmarks which needs multiple arguments to run. 

The second issue is that when I use "arm-linux-gnueabihf-gcc" cross compiler instead of the arm-linux-gcc I get the following error

 "/usr/lib/gcc/arm-linux-gnueabihf/4.6/../../../../arm-linux-gnueabihf/bin/ld: error: a.out uses VFP register arguments, dijkstra_large.o does not
/usr/lib/gcc/arm-linux-gnueabihf/4.6/../../../../arm-linux-gnueabihf/bin/ld: failed to merge target specific data of file dijkstra_large.o
collect2: ld returned 1 exit status"

I have tried to change the -mfloat-abi to hard or soft but still getting the same error message. Is there any other options that forces the llvm to use VFP registers?

Also it would be nice if anyone can point me to a tutorial which shows how to build LLVM cross compiler using the clang.

Thanks,
Najem.
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131217/f33fea9a/attachment.html>


More information about the llvm-dev mailing list