diff --git a/compiler-rt/test/sanitizer_common/CMakeLists.txt b/compiler-rt/test/sanitizer_common/CMakeLists.txt --- a/compiler-rt/test/sanitizer_common/CMakeLists.txt +++ b/compiler-rt/test/sanitizer_common/CMakeLists.txt @@ -7,7 +7,7 @@ # FIXME(dliew): We should switch to COMPILER_RT_SANITIZERS_TO_BUILD instead of # the hard coded `SUPPORTED_TOOLS_INIT` list once we know that the other # sanitizers work. -set(SUPPORTED_TOOLS_INIT asan lsan msan tsan ubsan) +set(SUPPORTED_TOOLS_INIT asan hwasan lsan msan tsan ubsan) set(SUPPORTED_TOOLS) foreach(SANITIZER_TOOL ${SUPPORTED_TOOLS_INIT}) string(TOUPPER ${SANITIZER_TOOL} SANITIZER_TOOL_UPPER) @@ -97,7 +97,6 @@ endif() endforeach() endforeach() - # Unit tests. if(COMPILER_RT_INCLUDE_TESTS) configure_lit_site_cfg( diff --git a/compiler-rt/test/sanitizer_common/lit.common.cfg.py b/compiler-rt/test/sanitizer_common/lit.common.cfg.py --- a/compiler-rt/test/sanitizer_common/lit.common.cfg.py +++ b/compiler-rt/test/sanitizer_common/lit.common.cfg.py @@ -7,9 +7,15 @@ default_tool_options = [] collect_stack_traces = "" +target_arch = getattr(config, 'target_arch', None) if config.tool_name == "asan": tool_cflags = ["-fsanitize=address"] tool_options = "ASAN_OPTIONS" +elif config.tool_name == "hwasan": + tool_cflags = ["-fsanitize=hwaddress"] + if target_arch == "x86_64": + tool_cflags = tool_cflags + [ '-fsanitize-hwaddress-experimental-aliasing'] + tool_options = "HWASAN_OPTIONS" elif config.tool_name == "tsan": tool_cflags = ["-fsanitize=thread"] tool_options = "TSAN_OPTIONS"