Provide build_oai/cmake option to build with memory sanitizer

This commit is contained in:
Robert Schmidt
2023-07-03 14:07:38 +02:00
parent 10d2af11b8
commit 03fe3b508e
3 changed files with 68 additions and 0 deletions
+9
View File
@@ -167,6 +167,10 @@ Options:
Enable the address sanitizer on all targets
--sanitize-undefined | -fsanitize=undefined
Enable the undefined behavior sanitizer on all targets
--sanitize-memory | -fsanitize=memory
Enable the memory sanitizer on all targets. Requires clang, and is
incompatible with ASan/UBSan. To build, issue:
CC=/usr/bin/clang CXX=/usr/bin/clang++ ./build_oai ... --sanitize-memory
-h | --help
Print this help"
}
@@ -413,6 +417,11 @@ function main() {
--sanitize-undefined | -fundefined=address)
CMAKE_CMD="$CMAKE_CMD -DSANITIZE_UNDEFINED=True"
shift;;
--sanitize-memory | -fsanitize=memory)
echo_warning "Note: memory sanitizer\n* requires clang (tested: v17)\n* is incompatible with address/undefined behavior sanitizer\n* requires cmake_targets/tools/memsan.patch"
sleep 5
CMAKE_CMD="$CMAKE_CMD -DSANITIZE_MEMORY=ON -DSANITIZE_ADDRESS=OFF -DSANITIZE_UNDEFINED=OFF"
shift;;
-h | --help)
print_help
exit 1;;