[LLVMdev] llvm cross compilation and simplescalar simulation for ARM

shiqiang lishiqianglist at 163.com
Wed May 6 19:13:03 PDT 2015


Hi, 

I want to explorer affection of compiler on low power. 
For the project background, I tend to process this work via LLVM, rather than GCC. And the Target is ARM.

For this purpose, clang(3.2) + arm-gcc + simplescalar-arm(and panalyzer) seems to be a good choice. But I encounter several problems in the processing of setup the environment.

----------------------------------
1. Firstly, arm toolchain is built via ‘buildroot-2012.08’: arm-linux-gcc,  I compile MiBench step by step or on one step as follows:
clang -emit-llvm —target=arm -O3 -c susan.c -o susan.bc
llc -march=arm -filetype=asm susan.bc -o susan.s
arm-linux-gcc -static -L/arm-toolchain/lib/path susan.s -lm -o susan.out
or:
clang -static -gcc-toolchain /arm-toolchain/path -target arm-linux -sysroot=/arm-toolchain/sysroot/path susan.c -o susan.out -lm

but I encounter the problem about ‘uclibc’. There is no ‘_IO_getc’ in libc.a of uclibc, but clang&llc compile ‘getc’ in C source to ‘_IO_getc’ in assembler.
I tried to use newer version of buildroot which support ‘glibc’ (like 'buildroot-2014.11'), but the newer version doesn’t support to set the ’Target ABI’ to ‘OABI’, someone says OABI rather EABI is necessary if want the executable run on simplescalar. So I don’t know how to solve this issue.

----------------------------------
2. Then, I change the toolchain from ‘buildroot’ to ’Sourcery CodeBench’: arm-none-linux-gnueabi-gcc, I compile ’susan’ in MiBench as the above commands.
I get the executable application (susan.out) successfully. That is to say, I can cross compile arm application via clang/llc/arm-none-linux-gnueabi-gcc!!!
However, I get a fatal error when I run susan.out on simplescalar-arm:
fatal: non-specultative fault (2) detected @ XXXXXXX

I searched the reason via google, someone says that the toolchain is too new for simplescalar-arm. 
It seems this method is failure, as well.

----------------------------------
3. I tried several other arm-toolchains, such as arm-linux-gcc-4.4.3 from FriendlyARM, arm-gcc-2.95.3 recommended by simplescalar-arm official, but I encountered the similar problems as the above.

----------------------------------
4. I find a same issue in llvmdev maillist: http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-September/053740.html <http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-September/053740.html> (And also some other similar topics via Google)
The topic is “clang cross compilation and SimpleScalar simulation”.
But there is no solution in the issue.


My Question is:
1. If I do compiler related low power experiment via llvm(3.2) + arm-gcc + simplescalar-arm(and panalyzer), how could I setup the environment?? Does anyone has  the experience and can give some instructions?
2. If I process the job via LLVM + ARM, but not simplescalar-arm, is there any other simulator to run arm application?? The simulator should has a mature power model.

Thanks
-Shiqiang





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


More information about the llvm-dev mailing list