build llvm-symbolizer for arm target
build llvm-symbolizer for arm target
下载llvm/clang/compiler-rt源码
svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
cd llvm
R=$(svn info | grep Revision: | awk '{print $2}')
(cd tools && svn co -r $R http://llvm.org/svn/llvm-project/cfe/trunk clang)
(cd projects && svn co -r $R http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt)
编译llvm-symbolizer
cmake -DCMAKE_SYSROOT=~/toolchain/arm-2019.09/arm-linux-gnueabi/libc/ -DCMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN=~/toolchain/arm-2019.09 -DCMAKE_ASM_COMPILER_TARGET="arm-linux-gnueabi" -DCMAKE_C_COMPILER_TARGET="arm-linux-gnueabi" -DCMAKE_C_COMPILER=~/toolchain/arm-2019.09/bin/arm-linux-gnueabi-gcc -DCMAKE_CXX_COMPILER=~/toolchain/arm-2019.09/bin/arm-linux-gnueabi-g++ -DLLVM_TARGETS_TO_BUILD=ARM -DLLVM_TARGET_ARCH=ARM -DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabi -DCLANG_TABLEGEN=~/llvm_9.0.0/test_llvm/bin/clang-tblgen -DLLVM_TABLEGEN=~/llvm_9.0.0/test_llvm/bin/llvm-tblgen -DCMAKE_CROSSCOMPILING=True -DCMAKE_INSTALL_PREFIX=~/llvm-symbolizer_for_arm -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=true -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON ../llvm
make -j32 llvm-symbolizer
编译成功,生成的llvm-symbolizer在bin目录下
参考链接
https://llvm.org/docs/HowToCrossCompileLLVM.html
https://github.com/google/sanitizers/wiki/AddressSanitizerHowToBuild