[zorg] r224727 - Use libc++ for ASan builds on sanitizer-fast, sanitizer-bootstrap.

Sergey Matveev earthdok at google.com
Mon Dec 22 12:23:23 PST 2014


Author: smatveev
Date: Mon Dec 22 14:23:23 2014
New Revision: 224727

URL: http://llvm.org/viewvc/llvm-project?rev=224727&view=rev
Log:
Use libc++ for ASan builds on sanitizer-fast, sanitizer-bootstrap.

Modified:
    zorg/trunk/zorg/buildbot/builders/sanitizers/buildbot_bootstrap.sh
    zorg/trunk/zorg/buildbot/builders/sanitizers/buildbot_fast.sh
    zorg/trunk/zorg/buildbot/builders/sanitizers/buildbot_functions.sh

Modified: zorg/trunk/zorg/buildbot/builders/sanitizers/buildbot_bootstrap.sh
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/zorg/buildbot/builders/sanitizers/buildbot_bootstrap.sh?rev=224727&r1=224726&r2=224727&view=diff
==============================================================================
--- zorg/trunk/zorg/buildbot/builders/sanitizers/buildbot_bootstrap.sh (original)
+++ zorg/trunk/zorg/buildbot/builders/sanitizers/buildbot_bootstrap.sh Mon Dec 22 14:23:23 2014
@@ -15,6 +15,7 @@ STAGE1_DIR=llvm_build0
 STAGE2_ASAN_DIR=llvm_build_asan
 STAGE2_MSAN_DIR=llvm_build_msan
 STAGE2_LIBCXX_MSAN_DIR=libcxx_build_msan
+STAGE2_LIBCXX_ASAN_DIR=libcxx_build_asan
 STAGE2_UBSAN_DIR=llvm_build_ubsan
 STAGE3_ASAN_DIR=llvm_build2_asan
 STAGE3_MSAN_DIR=llvm_build2_msan
@@ -32,6 +33,7 @@ fi
 # Anyway, incremental builds of stage2 and stage3 compilers don't make sense.
 # Clobber the build trees.
 rm -rf ${STAGE2_LIBCXX_MSAN_DIR}
+rm -rf ${STAGE2_LIBCXX_ASAN_DIR}
 rm -rf ${STAGE2_MSAN_DIR}
 rm -rf ${STAGE3_MSAN_DIR}
 rm -rf ${STAGE2_ASAN_DIR}

Modified: zorg/trunk/zorg/buildbot/builders/sanitizers/buildbot_fast.sh
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/zorg/buildbot/builders/sanitizers/buildbot_fast.sh?rev=224727&r1=224726&r2=224727&view=diff
==============================================================================
--- zorg/trunk/zorg/buildbot/builders/sanitizers/buildbot_fast.sh (original)
+++ zorg/trunk/zorg/buildbot/builders/sanitizers/buildbot_fast.sh Mon Dec 22 14:23:23 2014
@@ -15,6 +15,7 @@ STAGE1_DIR=llvm_build0
 STAGE2_ASAN_DIR=llvm_build_asan
 STAGE2_MSAN_DIR=llvm_build_msan
 STAGE2_LIBCXX_MSAN_DIR=libcxx_build_msan
+STAGE2_LIBCXX_ASAN_DIR=libcxx_build_asan
 HOST_CLANG_REVISION=223108
 MAKE_JOBS=${MAX_MAKE_JOBS:-16}
 LLVM=$ROOT/llvm
@@ -47,6 +48,7 @@ else
   # incremental builds of stage2 don't make sense if stage1 compiler has
   # changed. Clobber the build trees.
   rm -rf ${STAGE2_LIBCXX_MSAN_DIR}
+  rm -rf ${STAGE2_LIBCXX_ASAN_DIR}
   rm -rf ${STAGE2_MSAN_DIR}
   rm -rf ${STAGE2_ASAN_DIR}
 

Modified: zorg/trunk/zorg/buildbot/builders/sanitizers/buildbot_functions.sh
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/zorg/buildbot/builders/sanitizers/buildbot_functions.sh?rev=224727&r1=224726&r2=224727&view=diff
==============================================================================
--- zorg/trunk/zorg/buildbot/builders/sanitizers/buildbot_functions.sh (original)
+++ zorg/trunk/zorg/buildbot/builders/sanitizers/buildbot_functions.sh Mon Dec 22 14:23:23 2014
@@ -151,15 +151,35 @@ function build_stage2_msan {
 }
 
 function build_stage2_asan {
+  echo @@@BUILD_STEP build libcxx/asan@@@
+  
+  common_stage2_variables
+  export ASAN_SYMBOLIZER_PATH="${llvm_symbolizer_path}"
+  
+  mkdir -p ${STAGE2_LIBCXX_ASAN_DIR}
+  (cd ${STAGE2_LIBCXX_ASAN_DIR} && \
+    cmake \
+      ${cmake_stage2_common_options} \
+      -DLLVM_USE_SANITIZER=Address \
+      $LLVM && \
+    ninja cxx cxxabi) || echo @@@STEP_FAILURE@@@
+
+  
   echo @@@BUILD_STEP build clang/asan@@@
 
-  common_stage2_variables
   # Turn on init-order checker as ASan runtime option.
-  export ASAN_SYMBOLIZER_PATH="${llvm_symbolizer_path}"
   export ASAN_OPTIONS="check_initialization_order=true:detect_stack_use_after_return=1:detect_leaks=1"
+  local asan_ldflags="-lc++abi -Wl,--rpath=${ROOT}/${STAGE2_LIBCXX_ASAN_DIR}/lib -L${ROOT}/${STAGE2_LIBCXX_ASAN_DIR}/lib"
+  # See http://llvm.org/bugs/show_bug.cgi?id=19071, http://www.cmake.org/Bug/view.php?id=15264
+  local cmake_bug_workaround_cflags="$asan_ldflags -fsanitize=address"
+  local asan_cflags="-I${ROOT}/${STAGE2_LIBCXX_ASAN_DIR}/include -I${ROOT}/${STAGE2_LIBCXX_ASAN_DIR}/include/c++/v1 $cmake_bug_workaround_cflags"
   local cmake_asan_options=" \
     ${cmake_stage2_common_options} \
     -DLLVM_USE_SANITIZER=Address \
+    -DLLVM_ENABLE_LIBCXX=ON \
+    -DCMAKE_C_FLAGS=\"${asan_cflags}\" \
+    -DCMAKE_CXX_FLAGS=\"${asan_cflags}\" \
+    -DCMAKE_EXE_LINKER_FLAGS=\"${asan_ldflags}\" \
     "
   mkdir -p ${STAGE2_ASAN_DIR}
   (cd ${STAGE2_ASAN_DIR} && \





More information about the llvm-commits mailing list