[LLVMdev] Cross-compiler to arm

Hanbing Li hanbing.li at inria.fr
Thu Nov 6 09:21:49 PST 2014


Hi list, 

I want to use LLVM to compile the C code to arm. 
Host: Mac OS X 10.10 
Target: Pandaboard, armv7l, ubuntu 

I found some useful information but not worked yet. 

I tried like this: 


$ clang -fomit-frame-pointer -ggdb -emit-llvm --target=armv7l-unknown-linux-eabi -mcpu=cortex-a9 —mfpu=neon -mfloat-abi=softfp --sysroot=/... test.c -c -o test.bc 

--> 

clang-3.5: error: no such file or directory: '—mfpu=neon' 

clang-3.5: error: -emit-llvm cannot be used when linking 

clang-3.5: error: no such file or directory: '—-sysroot=...' 




when I tried like this: 

$ clang -fomit-frame-pointer -ggdb -emit-llvm --target=armv7l-unknown-linux-eabi -mcpu=cortex-a9 test.c -c -o test.bc 

It worked. Then I did: 

$ llc test.bc -o test.s 

And sent the test.s to the pandaboard. On the board, I did: 

$ as -o test.o test.s 

$ ld -e main -o a.out test.o 



$ ./a.out 

--> 

Segmentation fault (core dumped) 

This is what I got. 

The test.c is very simple. Even like 

int main(){ 

int i=0; 

return 0; 

} 

Still no work. 




BTW, someone said: Toolchain on host : sudo apt-get install gcc-arm-linux-gnueabi 

How to realize this in MacOS?(port or brew)? I also found something here: https://launchpad.net/gcc-arm-embedded/+download . 


Is this the same thing or not? 




Does anyone know how to cross-compile from MacOS to arm? Or tell me what's wrong with my operations! Any suggestion or information is appreciated! 




Thanks, 

Hanbing 





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


More information about the llvm-dev mailing list