Introduce -DLLVM_USE_SANITIZER=Undefined CMake option to build UBSan-ified version...
authorAlexey Samsonov <vonosmas@gmail.com>
Fri, 29 Aug 2014 00:50:36 +0000 (00:50 +0000)
committerAlexey Samsonov <vonosmas@gmail.com>
Fri, 29 Aug 2014 00:50:36 +0000 (00:50 +0000)
I've fixed most of the simple bugs and currently "check-llvm" test suite
has 26 failures, and "check-clang" suite has 5 failures.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216701 91177308-0d34-0410-b5e6-96231b3b80d8

cmake/modules/HandleLLVMOptions.cmake
docs/CMake.rst
test/lit.cfg

index d17ce11fe9f22a56fc28af3de62d16f755edc02f..2fcdfbefd1564ba7bd018ad909e38d0be3fc426e 100644 (file)
@@ -363,6 +363,10 @@ if(LLVM_USE_SANITIZER)
       if(LLVM_USE_SANITIZER STREQUAL "MemoryWithOrigins")
         append("-fsanitize-memory-track-origins" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
       endif()
+    elseif (LLVM_USE_SANITIZER STREQUAL "Undefined")
+      append_common_sanitizer_flags()
+      append("-fsanitize=undefined -fno-sanitize=vptr -fno-sanitize-recover"
+              CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
     else()
       message(WARNING "Unsupported value of LLVM_USE_SANITIZER: ${LLVM_USE_SANITIZER}")
     endif()
index 1da123419dcdc1021e6751310c4161d72073d748..4a5165b7a13e66e90ed6892181522b9151e1a785 100644 (file)
@@ -288,8 +288,8 @@ LLVM-specific variables
 
 **LLVM_USE_SANITIZER**:STRING
   Define the sanitizer used to build LLVM binaries and tests. Possible values
-  are ``Address``, ``Memory`` and ``MemoryWithOrigins``. Defaults to empty
-  string.
+  are ``Address``, ``Memory``, ``MemoryWithOrigins`` and ``Undefined``.
+  Defaults to empty string.
 
 **LLVM_BUILD_DOCS**:BOOL
   Enables all enabled documentation targets (i.e. Doxgyen and Sphinx targets) to
index b5a982c02d5b234c9764bac540534753d6e40d87..fefba5257cbbb8e16501f2862d2bb41fdc83720f 100644 (file)
@@ -96,7 +96,7 @@ for symbolizer in ['ASAN_SYMBOLIZER_PATH', 'MSAN_SYMBOLIZER_PATH']:
         config.environment[symbolizer] = os.environ[symbolizer]
 
 # Propagate options for sanitizers.
-for options in ['ASAN_OPTIONS']:
+for options in ['ASAN_OPTIONS', 'UBSAN_OPTIONS']:
     if options in os.environ:
         config.environment[options] = os.environ[options]