diff --git a/compiler-rt/test/asan/lit.cfg.py b/compiler-rt/test/asan/lit.cfg.py index 2da511103da7c..3da073332c458 100644 --- a/compiler-rt/test/asan/lit.cfg.py +++ b/compiler-rt/test/asan/lit.cfg.py @@ -25,8 +25,13 @@ def get_required_attr(config, attr_name): default_asan_opts = list(config.default_sanitizer_opts) # On Darwin, leak checking is not enabled by default. Enable on macOS -# tests to prevent regressions -if config.host_os == "Darwin" and config.apple_platform == "osx": +# tests to prevent regressions. +# Currently, detect_leaks for asan tests only work on Intel MacOS. +if ( + config.host_os == "Darwin" + and config.apple_platform == "osx" + and config.target_arch == "x86_64" +): default_asan_opts += ["detect_leaks=1"] default_asan_opts_str = ":".join(default_asan_opts) @@ -273,7 +278,11 @@ def build_invocation(compile_flags, with_lto=False): and (not config.android) and (config.target_arch in ["x86_64", "i386", "riscv64", "loongarch64"]) ) -leak_detection_mac = (config.host_os == "Darwin") and (config.apple_platform == "osx") +leak_detection_mac = ( + (config.host_os == "Darwin") + and (config.apple_platform == "osx") + and (config.target_arch == "x86_64") +) leak_detection_netbsd = (config.host_os == "NetBSD") and ( config.target_arch in ["x86_64", "i386"] )