summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2020-04-24 14:47:53 +0200
committerVladislav Vaintroub <wlad@mariadb.com>2020-04-24 14:47:53 +0200
commit01d4948a122712f2fc0a85c8af439619a96ceab4 (patch)
tree8313400b7c5c2cc7e80c860b8c11666747cd0b2a
parent79280cf5dd22082373595aa0dc6178e2483727ca (diff)
downloadmariadb-git-bb-10.5-MDEV-22359.tar.gz
MDEV-22364 Windows : allow WITH_ASAN on 32bit clang and MSVCbb-10.5-MDEV-22359
-rw-r--r--cmake/os/Windows.cmake20
-rw-r--r--extra/mariabackup/xbstream_write.cc2
-rw-r--r--win/upgrade_wizard/CMakeLists.txt2
3 files changed, 14 insertions, 10 deletions
diff --git a/cmake/os/Windows.cmake b/cmake/os/Windows.cmake
index 9c66b455497..6efebbfb33c 100644
--- a/cmake/os/Windows.cmake
+++ b/cmake/os/Windows.cmake
@@ -65,7 +65,9 @@ ENDIF()
FUNCTION(ENABLE_ASAN)
IF(NOT CLANG_CL)
- MESSAGE(FATAL_ERROR "clang-cl is necessary to enable asan")
+ IF(NOT MSVC OR NOT CMAKE_SIZEOF_VOID_P EQUAL 4)
+ MESSAGE(FATAL_ERROR "clang-cl, or MSVC 32bit is necessary to enable asan")
+ ENDIF()
ENDIF()
# currently, asan is broken with static CRT.
IF(NOT(MSVC_CRT_TYPE STREQUAL "/MD"))
@@ -73,19 +75,21 @@ FUNCTION(ENABLE_ASAN)
MESSAGE(FATAL_ERROR "-DWITH_ASAN cmake parameter also requires -DMSVC_CRT_TYPE=/MD OR DYNAMIC_UCRT_LINK=ON")
ENDIF()
ENDIF()
+ # After installation, clang lib directory should be added to PATH
+ # (e.g C:/Program Files/LLVM/lib/clang/10.0.0/lib/windows)
IF(CMAKE_SIZEOF_VOID_P EQUAL 4)
- MESSAGE(FATAL_ERROR "-DWITH_ASAN on Windows requires 64bit build")
+ SET(CLANG_ARCH i386)
+ ELSE()
+ SET(CLANG_ARCH x86_64)
ENDIF()
- # After installation, clang lib directory should be added to PATH
- # (e.g C:/Program Files/LLVM/lib/clang/5.0.1/lib/windows)
- FIND_LIBRARY(CLANG_RT_ASAN_DYNAMIC clang_rt.asan_dynamic-x86_64.lib)
+ FIND_LIBRARY(CLANG_RT_ASAN_DYNAMIC clang_rt.asan_dynamic-${CLANG_ARCH}.lib)
IF(NOT CLANG_RT_ASAN_DYNAMIC)
- MESSAGE(FATAL_ERROR "Can't enable ASAN : missing clang_rt.asan_dynamic-x86_64.lib")
+ MESSAGE(FATAL_ERROR "Can't enable ASAN : missing clang_rt.asan_dynamic-${CLANG_ARCH}.lib")
ENDIF()
- FIND_LIBRARY(CLANG_RT_ASAN_DYNAMIC_THUNK clang_rt.asan_dynamic_runtime_thunk-x86_64.lib)
+ FIND_LIBRARY(CLANG_RT_ASAN_DYNAMIC_THUNK clang_rt.asan_dynamic_runtime_thunk-${CLANG_ARCH}.lib)
IF(NOT CLANG_RT_ASAN_DYNAMIC_THUNK)
- MESSAGE(FATAL_ERROR "Can't enable ASAN : missing clang_rt.asan_dynamic_runtime_thunk-x86_64.lib")
+ MESSAGE(FATAL_ERROR "Can't enable ASAN : missing clang_rt.asan_dynamic_runtime_thunk-${CLANG_ARCH}.lib")
ENDIF()
STRING(APPEND CMAKE_C_FLAGS " -fsanitize=address")
diff --git a/extra/mariabackup/xbstream_write.cc b/extra/mariabackup/xbstream_write.cc
index b6fd9c294a5..5ebfde40a08 100644
--- a/extra/mariabackup/xbstream_write.cc
+++ b/extra/mariabackup/xbstream_write.cc
@@ -280,7 +280,7 @@ xb_stream_write_eof(xb_wstream_file_t *file)
xb_ad(ptr <= tmpbuf + sizeof(tmpbuf));
if (file->write(file, file->userdata, tmpbuf,
- (ulonglong) (ptr - tmpbuf)) == -1)
+ (size_t) (ptr - tmpbuf)) == -1)
goto err;
pthread_mutex_unlock(&stream->mutex);
diff --git a/win/upgrade_wizard/CMakeLists.txt b/win/upgrade_wizard/CMakeLists.txt
index 510f770b798..d1bf1b39f89 100644
--- a/win/upgrade_wizard/CMakeLists.txt
+++ b/win/upgrade_wizard/CMakeLists.txt
@@ -1,7 +1,7 @@
IF(NOT MSVC)
RETURN()
ENDIF()
-IF(CMAKE_C_COMPILER_ID MATCHES Clang)
+IF(CMAKE_C_COMPILER_ID MATCHES Clang OR WITH_ASAN)
# MFC stuff does not compile with clang
RETURN()
ENDIF()