[LSAN] Make sure HWASAN tests are linked with lld

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D144289
This commit is contained in:
Kirill Stoimenov 2023-02-17 19:33:20 +00:00
parent b2b50980de
commit 5c1aabde67

View File

@ -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']