summaryrefslogtreecommitdiffstats
path: root/llvm/utils
diff options
context:
space:
mode:
authorFrancis Ricci <francisjricci@gmail.com>2017-10-10 17:21:32 +0000
committerFrancis Ricci <francisjricci@gmail.com>2017-10-10 17:21:32 +0000
commit072eff0930ee651433bd5e756f8e76549425ae10 (patch)
tree9699e6751f91990f1b47cbacc3fcc6a820214dec /llvm/utils
parent232cdb48fc14b6a2e8d6af1b531beba78eaeabd9 (diff)
downloadbcm5719-llvm-072eff0930ee651433bd5e756f8e76549425ae10.tar.gz
bcm5719-llvm-072eff0930ee651433bd5e756f8e76549425ae10.zip
[lit] Only enable LSan on darwin when clang supports it
Summary: LSan on darwin doesn't exist on older versions of clang, causing non-boostrapped sanitized buildbots to fail Reviewers: kubamracek, qcolombet, sqlbyme, zturner, modocache Reviewed By: zturner Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D38703 llvm-svn: 315333
Diffstat (limited to 'llvm/utils')
-rw-r--r--llvm/utils/lit/lit/llvm/config.py30
1 files changed, 29 insertions, 1 deletions
diff --git a/llvm/utils/lit/lit/llvm/config.py b/llvm/utils/lit/lit/llvm/config.py
index 87851b3cb1a..634f294c7f4 100644
--- a/llvm/utils/lit/lit/llvm/config.py
+++ b/llvm/utils/lit/lit/llvm/config.py
@@ -80,7 +80,8 @@ class LLVMConfig(object):
if target_triple:
if re.match(r'^x86_64.*-apple', target_triple):
- if 'address' in sanitizers:
+ host_cxx = getattr(config, 'host_cxx', None)
+ if 'address' in sanitizers and self.get_clang_has_lsan(host_cxx, target_triple):
self.with_environment(
'ASAN_OPTIONS', 'detect_leaks=1', append_path=True)
if re.match(r'^x86_64.*-linux', target_triple):
@@ -200,6 +201,33 @@ class LLVMConfig(object):
# Ensure the result is an ascii string, across Python2.5+ - Python3.
return clang_dir
+ # On macOS, LSan is only supported on clang versions 5 and higher
+ def get_clang_has_lsan(self, clang, triple):
+ if not clang:
+ self.lit_config.warning(
+ "config.host_cxx is unset but test suite is configured to use sanitizers.")
+ return False
+
+ clang_binary = clang.split()[0]
+ version_string, _ = self.get_process_output([clang_binary, '--version'])
+ if not 'clang' in version_string:
+ self.lit_config.warning(
+ "compiler '%s' does not appear to be clang, " % clang_binary +
+ "but test suite is configured to use sanitizers.")
+ return False
+
+ if re.match(r'.*-linux', triple):
+ return True
+
+ if re.match(r'^x86_64.*-apple', triple):
+ version_number = int(re.search(r'version ([0-9]+)\.', version_string).group(1))
+ if 'Apple LLVM' in version_string:
+ return version_number >= 9
+ else:
+ return version_number >= 5
+
+ return False
+
def make_itanium_abi_triple(self, triple):
m = re.match(r'(\w+)-(\w+)-(\w+)', triple)
if not m:
OpenPOWER on IntegriCloud