diff options
author | Konstantin Baladurin <k.baladurin@partner.samsung.com> | 2017-12-09 13:57:20 +0300 |
---|---|---|
committer | Jan Vorlicek <janvorli@microsoft.com> | 2017-12-09 11:57:20 +0100 |
commit | 1724c75e6edff5d9008a5696f0eff586f3d93761 (patch) | |
tree | 20477acce6a09b444189abceee3f0c0acb15a764 /functions.cmake | |
parent | 2b3fd06adc01ce05b121d586830ab628d9bdad84 (diff) | |
download | coreclr-1724c75e6edff5d9008a5696f0eff586f3d93761.tar.gz coreclr-1724c75e6edff5d9008a5696f0eff586f3d93761.tar.bz2 coreclr-1724c75e6edff5d9008a5696f0eff586f3d93761.zip |
Fix build with Asan (#15372)
- verify_dependencies: disable checking dependencies for Asan build
because in this case shared libraries can have undefined symbols
(if static linking with compiler-rt is used).
- enablesanitizers.sh: remove excess quotes for ASAN_OPTIONS and
UBSAN_OPTIONS environment variable because otherwise Asan cannot
parse flags. Also doesn't export ASAN_SYMBOLIZER_PATH for clang > 3.6.
Diffstat (limited to 'functions.cmake')
-rw-r--r-- | functions.cmake | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/functions.cmake b/functions.cmake index afa3d6ebf6..15d0cd929c 100644 --- a/functions.cmake +++ b/functions.cmake @@ -242,9 +242,23 @@ function(_install) endfunction() function(verify_dependencies targetName errorMessage) + set(SANITIZER_BUILD OFF) + + if (CLR_CMAKE_PLATFORM_UNIX) + if (UPPERCASE_CMAKE_BUILD_TYPE STREQUAL DEBUG OR UPPERCASE_CMAKE_BUILD_TYPE STREQUAL CHECKED) + string(FIND "$ENV{DEBUG_SANITIZERS}" "asan" __ASAN_POS) + string(FIND "$ENV{DEBUG_SANITIZERS}" "ubsan" __UBSAN_POS) + if ((${__ASAN_POS} GREATER -1) OR (${__UBSAN_POS} GREATER -1)) + set(SANITIZER_BUILD ON) + endif() + endif() + endif() + # We don't need to verify dependencies on OSX, since missing dependencies # result in link error over there. - if (NOT CLR_CMAKE_PLATFORM_DARWIN AND NOT CLR_CMAKE_PLATFORM_ANDROID) + # Also don't verify dependencies for Asan build because in this case shared + # libraries can contain undefined symbols + if (NOT CLR_CMAKE_PLATFORM_DARWIN AND NOT CLR_CMAKE_PLATFORM_ANDROID AND NOT SANITIZER_BUILD) add_custom_command( TARGET ${targetName} POST_BUILD |