From 5c1aabde675849498e5f3620aef1e8750ed58036 Mon Sep 17 00:00:00 2001 From: Kirill Stoimenov Date: Fri, 17 Feb 2023 19:33:20 +0000 Subject: [PATCH] [LSAN] Make sure HWASAN tests are linked with lld Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D144289 --- compiler-rt/test/lsan/lit.common.cfg.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/compiler-rt/test/lsan/lit.common.cfg.py b/compiler-rt/test/lsan/lit.common.cfg.py index 92f6f6b..c3df68f 100644 --- a/compiler-rt/test/lsan/lit.common.cfg.py +++ b/compiler-rt/test/lsan/lit.common.cfg.py @@ -34,7 +34,7 @@ elif lsan_lit_test_mode == "AddressSanitizer": config.substitutions.insert(0, ('%run', config.netbsd_noaslr_prefix)) elif lsan_lit_test_mode == "HWAddressSanitizer": config.name = "LeakSanitizer-HWAddressSanitizer" - lsan_cflags = ["-fsanitize=hwaddress"] + lsan_cflags = ["-fsanitize=hwaddress", "-fuse-ld=lld"] if target_arch == "x86_64": lsan_cflags = lsan_cflags + [ '-fsanitize-hwaddress-experimental-aliasing'] config.available_features.add('hwasan') @@ -98,4 +98,9 @@ if not (supported_android or supported_linux or supported_darwin or supported_ne if re.search('mthumb', config.target_cflags) is not None: config.unsupported = True +# HWASAN tests require lld because without D65857, ld.bfd and ld.gold would +# generate a corrupted binary. Mark them unsupported if lld is not available. +if 'hwasan' in config.available_features and not config.has_lld: + config.unsupported = True + config.suffixes = ['.c', '.cpp', '.mm'] -- 2.7.4