diff --git a/infra/base-images/base-clang/checkout_build_install_llvm.sh b/infra/base-images/base-clang/checkout_build_install_llvm.sh index aa1e05107..8a96aa607 100755 --- a/infra/base-images/base-clang/checkout_build_install_llvm.sh +++ b/infra/base-images/base-clang/checkout_build_install_llvm.sh @@ -25,7 +25,7 @@ cd $SRC/llvm/projects && git clone --depth 1 http://llvm.org/git/compiler-rt.git cd $SRC/llvm/projects && git clone --depth 1 http://llvm.org/git/libcxx.git cd $SRC/llvm/projects && git clone --depth 1 http://llvm.org/git/libcxxabi.git -# Build & Install +# Build & install mkdir -p $WORK/llvm cd $WORK/llvm cmake -G "Ninja" \ @@ -36,6 +36,18 @@ ninja ninja install rm -rf $WORK/llvm +mkdir -p $WORK/msan +cd $WORK/msan +cmake -G "Ninja" \ + -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ \ + -DLLVM_USE_SANITIZER=Memory -DCMAKE_INSTALL_PREFIX=/usr/msan/ \ + -DLIBCXX_ENABLE_SHARED=OFF -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON \ + -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD="X86" \ + $SRC/llvm +ninja cxx +ninja install-cxx +rm -rf $WORK/msan + # Copy libfuzzer sources mkdir $SRC/libfuzzer cp -r $SRC/llvm/lib/Fuzzer/* $SRC/libfuzzer/ diff --git a/infra/base-images/base-libfuzzer/compile b/infra/base-images/base-libfuzzer/compile index 76b1f9644..50b490b0e 100755 --- a/infra/base-images/base-libfuzzer/compile +++ b/infra/base-images/base-libfuzzer/compile @@ -24,9 +24,17 @@ fi bash compile_${FUZZING_ENGINE} +if [[ $SANITIZER_FLAGS = *sanitize=memory* ]] +then + # Take all libraries from lib/msan + export CXXFLAGS_EXTRA="-L/usr/msan/lib $CXXFLAGS_EXTRA" + ls -alR /usr/msan/lib +fi + export CFLAGS="$CFLAGS $SANITIZER_FLAGS $COVERAGE_FLAGS" export CXXFLAGS="$CFLAGS $CXXFLAGS_EXTRA" + echo "CC=$CC" echo "CXX=$CXX" echo "CFLAGS=$CFLAGS"