Provide build_oai/cmake option to build with memory sanitizer
This commit is contained in:
@@ -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;;
|
||||
|
||||
Reference in New Issue
Block a user