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

Eric Fiselier via libcxx-commits libcxx-commits at lists.llvm.org
Sat Apr 4 19:20:02 PDT 2020


We should really lift this logic into an LLVM cmake module, so we don't
have to duplicate it everywhere.

On Sat., Apr. 4, 2020, 4:29 p.m. Brian Gesiak via libcxx-commits, <
libcxx-commits at lists.llvm.org> wrote:

>
> 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()
>
>
>
> _______________________________________________
> libcxx-commits mailing list
> libcxx-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/libcxx-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200404/f1e72213/attachment-0001.html>


More information about the libcxx-commits mailing list