Provide build_oai option UBSan
This commit is contained in:
@@ -271,6 +271,12 @@ if (SANITIZE_ADDRESS)
|
|||||||
# wrong in the pthread library, or something subtly wrong in this CMakeLists.txt. Use Ubuntu 20.04 instead.
|
# wrong in the pthread library, or something subtly wrong in this CMakeLists.txt. Use Ubuntu 20.04 instead.
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
add_boolean_option(SANITIZE_UNDEFINED False "enable the undefined behavior sanitizer (UBSan)")
|
||||||
|
if (SANITIZE_UNDEFINED)
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined -fno-sanitize-recover=all")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined -fno-sanitize-recover=all")
|
||||||
|
endif ()
|
||||||
|
|
||||||
add_definitions("-DASN_DISABLE_OER_SUPPORT")
|
add_definitions("-DASN_DISABLE_OER_SUPPORT")
|
||||||
|
|
||||||
#########################
|
#########################
|
||||||
|
|||||||
+11
-1
@@ -171,8 +171,12 @@ Options:
|
|||||||
Skip build for shared libraries to reduce compilation time when building frequently for debugging purposes
|
Skip build for shared libraries to reduce compilation time when building frequently for debugging purposes
|
||||||
--ninja
|
--ninja
|
||||||
Tell cmake to use the Ninja build system. Without, will generate make files
|
Tell cmake to use the Ninja build system. Without, will generate make files
|
||||||
|
--sanitize
|
||||||
|
Shortcut for usage of --sanitize-address --sanitize-undefined
|
||||||
--sanitize-address | -fsanitize=address
|
--sanitize-address | -fsanitize=address
|
||||||
Enable the address sanitizer on all targets
|
Enable the address sanitizer on all targets
|
||||||
|
--sanitize-undefined | -fsanitize=undefined
|
||||||
|
Enable the undefined behavior sanitizer on all targets
|
||||||
--ittiSIM
|
--ittiSIM
|
||||||
Makes the itti simulator
|
Makes the itti simulator
|
||||||
-h | --help
|
-h | --help
|
||||||
@@ -451,10 +455,16 @@ function main() {
|
|||||||
CMAKE_CMD="$CMAKE_CMD -GNinja"
|
CMAKE_CMD="$CMAKE_CMD -GNinja"
|
||||||
MAKE_CMD=ninja
|
MAKE_CMD=ninja
|
||||||
shift;;
|
shift;;
|
||||||
|
--sanitize)
|
||||||
|
CMAKE_CMD="$CMAKE_CMD -DSANITIZE_ADDRESS=True -DSANITIZE_UNDEFINED=True"
|
||||||
|
shift;;
|
||||||
--sanitize-address | -fsanitize=address)
|
--sanitize-address | -fsanitize=address)
|
||||||
grep -sq "Ubuntu 18.04" /etc/os-release && echo_error "Bug in OS with this option, see CMakeLists.txt"
|
grep -sq "Ubuntu 18.04" /etc/os-release && echo_error "Bug in OS with this option, see CMakeLists.txt"
|
||||||
CMAKE_CMD="$CMAKE_CMD -DSANITIZE_ADDRESS=True"
|
CMAKE_CMD="$CMAKE_CMD -DSANITIZE_ADDRESS=True"
|
||||||
shift;;
|
shift;;
|
||||||
|
--sanitize-undefined | -fundefined=address)
|
||||||
|
CMAKE_CMD="$CMAKE_CMD -DSANITIZE_UNDEFINED=True"
|
||||||
|
shift;;
|
||||||
--ittiSIM)
|
--ittiSIM)
|
||||||
ittiSIM=1
|
ittiSIM=1
|
||||||
CMAKE_CMD="$CMAKE_CMD -DITTI_SIM=True"
|
CMAKE_CMD="$CMAKE_CMD -DITTI_SIM=True"
|
||||||
|
|||||||
Reference in New Issue
Block a user