[libcxx-commits] [libcxx] 54176d1 - libcxx 'LLVM_USE_SANITIZER=Address; Undefined'

Brian Gesiak via libcxx-commits libcxx-commits at lists.llvm.org
Sat Apr 4 13:29:42 PDT 2020


Author: Brian Gesiak
Date: 2020-04-04T16:28:41-04:00
New Revision: 54176d1766f25bc03ddb1a8932a380f6543d5150

URL: https://github.com/llvm/llvm-project/commit/54176d1766f25bc03ddb1a8932a380f6543d5150
DIFF: https://github.com/llvm/llvm-project/commit/54176d1766f25bc03ddb1a8932a380f6543d5150.diff

LOG: libcxx 'LLVM_USE_SANITIZER=Address;Undefined'

Summary:
Allow users to simultaneously enable address and undefined behavior
sanitizers, in the same manner that LLVM's 'HandleLLVMOptions.cmake'
allows.

Prior to this patch, `cmake -DLLVM_USE_SANITIZER="Address;Undefined"`
would succeed and the build would build most of the LLVM project with
`-fsanitize=address,undefined`, but a warning would be printed by
libcxx's CMake, and the build would use neither sanitizer. This
patch results in no warning being printed, and both sanitizers are used
in building libcxx.

Reviewers: jroelofs, EricWF, ldionne, #libc!

Subscribers: mgorny, dexonsmith, llvm-commits, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D77466

Added: 
    

Modified: 
    libcxx/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt
index a4297002644f..cab3f7b14036 100644
--- a/libcxx/CMakeLists.txt
+++ b/libcxx/CMakeLists.txt
@@ -677,6 +677,9 @@ function(get_sanitizer_flags OUT_VAR  USE_SANITIZER)
       endif()
     elseif (USE_SANITIZER STREQUAL "Undefined")
       append_flags(SANITIZER_FLAGS "-fsanitize=undefined -fno-sanitize=vptr,function -fno-sanitize-recover=all")
+    elseif (USE_SANITIZER STREQUAL "Address;Undefined" OR
+            USE_SANITIZER STREQUAL "Undefined;Address")
+      append_flags(SANITIZER_FLAGS "-fsanitize=address,undefined -fno-sanitize=vptr,function -fno-sanitize-recover=all")
     elseif (USE_SANITIZER STREQUAL "Thread")
       append_flags(SANITIZER_FLAGS -fsanitize=thread)
     else()


        


More information about the libcxx-commits mailing list