c - Half way cross-compilation leveraging LLVM - Compile faster on the Raspberry Pi -
the raspberry pi takes lot of time compile c code. want accelerate compilation. compilation error.
to that, , because code on pc, want use pc, use llvm (shipped cygwin) produce llvm assembly language version of executable. , then, send raspberry pi final conversion native (arm) executable.
i hoping executable lot faster because compile llvm language code in parallel on multi-core machine before linking (llvm-link). last step on raspberry pi itself, translating llvm language executable binary short, hope.
let's take example code:
#include <stdio.h> int main(){ printf("0"); return 0; }
then on pc, run
clang a.c -emit-llvm -s
this produces file called a.s llvm language version of .c file
and then, send a.s raspberry pi , run on command llc -filetype=obj a.s
generate a.s.o object file.
but when want create executable on rasp pi object file, error:
clang a.s.o -o a.out /usr/bin/ld: error: a.out uses vfp register arguments, a.s.o not /usr/bin/ld: failed merge target specific data of file a.s.o clang: error: linker command failed exit code 1 (use -v see invocation)
i tried using following flags -marm -mfloat-abi=hard -mfpu=vfp
clang on last step fails same errors. know how solve error or have suggestions me using llvm speed compilation process?
thanks in advance
llvm ir not portable. contains sorts of things spercific machine (is int 32 bit or 64 bit, sizeof , calling conventions). in order work need pass clang arguments if doing full cross compile. @ point because clang full cross compilier might compile object files.
so compile object files clang -target armv6-linux-gnueabi -integrated-as -marm -mfloat-abi=hard -mfpu=vfpu -c
on pc link on pi using ld.
edit:
since mention cygwin clang integrated assembler doesn't work best option output arm assembly with: clang -target armv6-linux-gnueabi -marm -mfloat-abi=hard -mfpu=vfpu -s
Comments
Post a Comment