[LLVMdev] compiler-rt for ARM-Linux with CMake?

Greg Fitzgerald garious at gmail.com
Tue Dec 17 14:09:19 PST 2013


How do I cross-compile compiler-rt for ARM-Linux with CMake?

Given a directory with sub-directories named 'llvm', 'compiler-rt',
and 'release' (which is a clang build directory), this build succeeds:

$ mkdir -p release-rt
$ cd release-rt
$ cmake ../llvm -G Ninja \
  -DCMAKE_INSTALL_PREFIX=ship \
  -DCMAKE_BUILD_TYPE=Release \
  -DLLVM_ENABLE_ASSERTIONS=ON \
  -DLLVM_TARGETS_TO_BUILD=ARM \
  -DLLVM_DEFAULT_TARGET_TRIPLE=arm-none-linux-gnueabi \
  -DLLVM_TARGET_ARCH=arm-none-linux-gnueabi \
  -DCMAKE_C_COMPILER=`which arm-none-linux-gnueabi-gcc` \
  -DCMAKE_CXX_COMPILER=`which arm-none-linux-gnueabi-g++` \
  -DLLVM_EXTERNAL_COMPILER_RT_SOURCE_DIR=../compiler-rt \
  -DCMAKE_CROSSCOMPILING=True \
  -DLLVM_TABLEGEN=`pwd`/../release/ship/bin/llvm-tblgen
$ ninja install

As a sanity-check, I was expecting to see a 'lib' directory for the
sanitizers in 'lib/clang/3.5', but there's only an 'include'
directory.

For Android, I've used the toolchain file in llvm/cmake, but for
ARM-Linux I'm attempting a variation of the cross-compiled clang
build:

http://llvm.org/docs/HowToCrossCompileLLVM.html

Are there compiler-rt-specific instructions somewhere?

Thanks,
Greg



More information about the llvm-dev mailing list