-
Notifications
You must be signed in to change notification settings - Fork 704
Enhance WAMR_BUILD_SANITIZER
to support multiple sanitizers
#4489
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
I'm not entirely sure if we're following the same approach with command line options, but it seems that ";" is more commonly used than "," in the CMake world for representing a list. I mean https://cmake.org/cmake/help/v3.14/command/list.html#introduction |
I think while ";" is cmake's internal list separator, "," provides better user experience as it doesn't require shell escaping or quotes. moreover, comma-delimited parameters align with industry conventions used by compilers like gcc/clang: |
build-scripts/config_common.cmake
Outdated
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover=all -fno-sanitize=alignment") | ||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined") | ||
endif() | ||
if(sanitizer STREQUAL "asan") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if(sanitizer STREQUAL "asan") | |
elseif(sanitizer STREQUAL "asan") |
build-scripts/config_common.cmake
Outdated
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address") | ||
endif() | ||
endif() | ||
if(sanitizer STREQUAL "tsan") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if(sanitizer STREQUAL "tsan") | |
elseif(sanitizer STREQUAL "tsan") |
build-scripts/config_common.cmake
Outdated
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fno-omit-frame-pointer -fsanitize=thread -fno-sanitize-recover=all") | ||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=thread") | ||
endif() | ||
if(sanitizer STREQUAL "posan") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if(sanitizer STREQUAL "posan") | |
elseif(sanitizer STREQUAL "posan") |
build-scripts/config_common.cmake
Outdated
if(NOT sanitizer IN_LIST SUPPORTED_SANITIZERS) | ||
list(APPEND INVALID_SANITIZERS "${sanitizer}") | ||
endif() | ||
if(sanitizer STREQUAL "ubsan") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if(sanitizer STREQUAL "ubsan") | |
elseif(sanitizer STREQUAL "ubsan") |
Support combining compatible sanitizers,
Usage examples:
cmake -DWAMR_BUILD_SANITIZER=ubsan,posan ../
cmake -DWAMR_BUILD_SANITIZER=ubsan ../