Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
1f952df4
Commit
1f952df4
authored
May 18, 2020
by
Vladislav Vaintroub
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-22612 Fix -DWITH_ASAN=1 on Windows.
parent
9f8e5558
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
36 deletions
+46
-36
cmake/os/Windows.cmake
cmake/os/Windows.cmake
+41
-26
cmake/pcre.cmake
cmake/pcre.cmake
+4
-1
win/upgrade_wizard/CMakeLists.txt
win/upgrade_wizard/CMakeLists.txt
+1
-9
No files found.
cmake/os/Windows.cmake
View file @
1f952df4
...
...
@@ -63,9 +63,9 @@ IF(MINGW AND CMAKE_SIZEOF_VOID_P EQUAL 4)
ADD_DEFINITIONS
(
-march=i486
)
ENDIF
()
FUNCTION
(
ENABLE_ASAN
)
IF
(
NOT
CLANG_CL
)
MESSAGE
(
FATAL_ERROR
"clang-cl
is necessary to enable a
san"
)
MACRO
(
ENABLE_SANITIZERS
)
IF
(
NOT
MSVC
)
MESSAGE
(
FATAL_ERROR
"clang-cl
or MSVC necessary to enable asan/ub
san"
)
ENDIF
()
# currently, asan is broken with static CRT.
IF
(
NOT
(
MSVC_CRT_TYPE STREQUAL
"/MD"
))
...
...
@@ -74,25 +74,38 @@ FUNCTION(ENABLE_ASAN)
ENDIF
()
ENDIF
()
IF
(
CMAKE_SIZEOF_VOID_P EQUAL 4
)
MESSAGE
(
FATAL_ERROR
"-DWITH_ASAN on Windows requires 64bit build"
)
SET
(
ASAN_ARCH i386
)
ELSE
()
IF
(
NOT CLANG_CL
)
MESSAGE
(
FATAL_ERROR
"sanitizers do not yet work on MSVC x64, try 32 bit or clang-cl"
)
ENDIF
()
SET
(
ASAN_ARCH x86_64
)
ENDIF
()
# After installation, clang lib directory should be added to PATH
# 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
)
IF
(
NOT CLANG_RT_ASAN_DYNAMIC
)
MESSAGE
(
FATAL_ERROR
"Can't enable ASAN : missing clang_rt.asan_dynamic-x86_64.lib"
)
SET
(
SANITIZER_LIBS
)
SET
(
SANITIZER_LINK_LIBRARIES
)
SET
(
SANITIZER_COMPILE_FLAGS
)
IF
(
WITH_ASAN
)
LIST
(
APPEND SANITIZER_LIBS
clang_rt.asan_dynamic-
${
ASAN_ARCH
}
.lib clang_rt.asan_dynamic_runtime_thunk-
${
ASAN_ARCH
}
.lib
)
STRING
(
APPEND SANITIZER_COMPILE_FLAGS
" -fsanitize=address"
)
ENDIF
()
FIND_LIBRARY
(
CLANG_RT_ASAN_DYNAMIC_THUNK clang_rt.asan_dynamic_runtime_thunk-x86_64.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"
)
IF
(
WITH_UBSAN
)
STRING
(
APPEND SANITIZER_COMPILE_FLAGS
" -fsanitize=undefined -fno-sanitize=alignment"
)
ENDIF
()
FOREACH
(
lib
${
SANITIZER_LIBS
}
)
FIND_LIBRARY
(
${
lib
}
_fullpath
${
lib
}
)
IF
(
NOT
${
lib
}
_fullpath
)
MESSAGE
(
FATAL_ERROR
"Can't enable sanitizer : missing
${
lib
}
"
)
ENDIF
()
LIST
(
APPEND CMAKE_REQUIRED_LIBRARIES
${${
lib
}
_fullpath
}
)
STRING
(
APPEND CMAKE_C_STANDARD_LIBRARIES
"
\"
${${
lib
}
_fullpath
}
\"
"
)
STRING
(
APPEND CMAKE_CXX_STANDARD_LIBRARIES
"
\"
${${
lib
}
_fullpath
}
\"
"
)
ENDFOREACH
()
STRING
(
APPEND CMAKE_C_FLAGS
" -fsanitize=address"
)
STRING
(
APPEND CMAKE_CXX_FLAGS
" -fsanitize=address"
)
LINK_LIBRARIES
(
${
CLANG_RT_ASAN_DYNAMIC
}
${
CLANG_RT_ASAN_DYNAMIC_THUNK
}
)
ENDFUNCTION
()
ENDMACRO
()
IF
(
MSVC
)
...
...
@@ -120,12 +133,6 @@ IF(MSVC)
OPTION
(
DYNAMIC_UCRT_LINK
"Link Universal CRT dynamically, if MSVC_CRT_TYPE=/MT"
ON
)
SET
(
DYNAMIC_UCRT_LINKER_OPTION
" /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib"
)
IF
(
WITH_ASAN
)
# Workaround something Linux specific
SET
(
SECURITY_HARDENED 0 CACHE INTERNAL
""
FORCE
)
ENABLE_ASAN
()
ENDIF
()
# Enable debug info also in Release build,
# and create PDB to be able to analyze crashes.
FOREACH
(
type EXE SHARED MODULE
)
...
...
@@ -141,7 +148,9 @@ IF(MSVC)
FOREACH
(
lang C CXX
)
SET
(
CMAKE_
${
lang
}
_FLAGS_RELEASE
"
${
CMAKE_
${
lang
}
_FLAGS_RELEASE
}
/Zi"
)
ENDFOREACH
()
FOREACH
(
flag
FOREACH
(
flag
CMAKE_C_FLAGS CMAKE_CXX_FLAGS
CMAKE_C_FLAGS_INIT CMAKE_CXX_FLAGS_INIT
CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_DEBUG_INIT
CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO
...
...
@@ -155,6 +164,12 @@ IF(MSVC)
ENDIF
()
ENDFOREACH
()
IF
(
WITH_ASAN OR WITH_UBSAN
)
# Workaround something Linux specific
SET
(
SECURITY_HARDENED 0 CACHE INTERNAL
""
FORCE
)
ENABLE_SANITIZERS
()
ENDIF
()
IF
(
CLANG_CL
)
SET
(
CLANG_CL_FLAGS
"-Wno-unknown-warning-option -Wno-unused-private-field \
...
...
@@ -163,8 +178,8 @@ IF(MSVC)
-Wno-deprecated-register -Wno-missing-braces \
-Wno-unused-function -Wno-unused-local-typedef -msse4.2 "
)
S
ET
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
${
CLANG_CL_FLAGS
}
"
)
S
ET
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
${
CLANG_CL_FLAGS
}
"
)
S
TRING
(
APPEND CMAKE_C_FLAGS
"
${
CLANG_CL_FLAGS
}
${
MSVC_CRT_TYPE
}
"
)
S
TRING
(
APPEND CMAKE_CXX_FLAGS
"
${
CLANG_CL_FLAGS
}
${
MSVC_CRT_TYPE
}
"
)
ENDIF
()
FOREACH
(
type EXE SHARED MODULE
)
...
...
cmake/pcre.cmake
View file @
1f952df4
...
...
@@ -24,11 +24,13 @@ MACRO(BUNDLE_PCRE2)
SET
(
byproducts
${
byproducts
}
BUILD_BYPRODUCTS
${
file
}
${
file_d
}
)
SET_TARGET_PROPERTIES
(
${
lib
}
PROPERTIES IMPORTED_LOCATION
${
file
}
)
ENDFOREACH
()
FOREACH
(
v
""
"_DEBUG"
"_RELWITHDEBINFO"
"_RELEASE"
"_MIN
ZIS
EREL"
)
FOREACH
(
v
""
"_DEBUG"
"_RELWITHDEBINFO"
"_RELEASE"
"_MIN
SIZ
EREL"
)
STRING
(
REPLACE
"/WX"
""
pcre2_flags
${
v
}
"
${
CMAKE_C_FLAGS
${
v
}}
"
)
IF
(
MSVC
)
# Suppress a warning
STRING
(
APPEND pcre2_flags
${
v
}
" /wd4244 "
)
# Need this only for ASAN support
SET
(
stdlibs
"-DCMAKE_C_STANDARD_LIBRARIES=
${
CMAKE_C_STANDARD_LIBRARIES
}
"
)
ENDIF
()
ENDFOREACH
()
ExternalProject_Add
(
...
...
@@ -48,6 +50,7 @@ MACRO(BUNDLE_PCRE2)
"-DCMAKE_C_FLAGS_RELEASE=
${
pcre2_flags_RELEASE
}
"
"-DCMAKE_C_FLAGS_MINSIZEREL=
${
pcre2_flags_MINSIZEREL
}
"
"-DCMAKE_C_COMPILER=
${
CMAKE_C_COMPILER
}
"
${
stdlibs
}
${
byproducts
}
)
SET_TARGET_PROPERTIES
(
pcre2 PROPERTIES EXCLUDE_FROM_ALL TRUE
)
...
...
win/upgrade_wizard/CMakeLists.txt
View file @
1f952df4
IF
(
NOT MSVC
)
RETURN
()
ENDIF
()
IF
(
CMAKE_C_COMPILER_ID MATCHES Clang
)
# MFC stuff does not compile with clang
RETURN
()
ENDIF
()
IF
(
CMAKE_USING_VC_FREE_TOOLS
)
# No MFC, so it cannot be built
IF
((
NOT MSVC
)
OR CLANG_CL OR WITH_ASAN
)
RETURN
()
ENDIF
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment