aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2019-08-27 23:34:29 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2019-08-27 23:34:29 +0300
commit1a20cc0baa0ad89ce80207bb863f8172b7c17c97 (patch)
tree1d7c201c02f9e4758f27e228b113917812aa5c62
parenta107eab2949cf9750ed88a634118b31666c16c7a (diff)
downloadmeson-clangsanitize.zip
meson-clangsanitize.tar.gz
meson-clangsanitize.tar.bz2
Fix Clang windows linker detection.clangsanitize
-rw-r--r--mesonbuild/compilers/c.py5
-rw-r--r--mesonbuild/environment.py8
2 files changed, 12 insertions, 1 deletions
diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py
index 1ec9146..86de70b 100644
--- a/mesonbuild/compilers/c.py
+++ b/mesonbuild/compilers/c.py
@@ -287,6 +287,11 @@ class ClangClCCompiler(VisualStudioLikeCompiler, VisualStudioLikeCCompilerMixin,
VisualStudioLikeCompiler.__init__(self, target)
self.id = 'clang-cl'
+ def sanitizer_compile_args(self, value: str) -> typing.List[str]:
+ if value == 'none':
+ return []
+ args = ['-fsanitize=' + value]
+ return args
class IntelClCCompiler(IntelVisualStudioLikeCompiler, VisualStudioLikeCCompilerMixin, CCompiler):
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
index 2675bca..a35efff 100644
--- a/mesonbuild/environment.py
+++ b/mesonbuild/environment.py
@@ -683,6 +683,8 @@ class Environment:
v = search_version(o)
if o.startswith('LLD'):
linker = LLVMDynamicLinker(compiler, for_machine, 'lld', version=v) # type: DynamicLinker
+ elif 'pc-windows-msvc' in o:
+ linker = LLVMDynamicLinker(compiler, for_machine, 'ld.lld', version=v) # type: DynamicLinker
# first is for apple clang, second is for real gcc
elif e.endswith('(use -v to see invocation)\n') or 'macosx_version' in e:
if isinstance(prefix, str):
@@ -825,15 +827,18 @@ class Environment:
linker = ClangClDynamicLinker(for_machine, version=version)
return cls(compiler, version, for_machine, is_cross, exe_wrap, target, linker=linker)
if 'clang' in out:
+ linker = None
if 'Apple' in out or self.machines[for_machine].is_darwin():
compiler_type = CompilerType.CLANG_OSX
elif 'windows' in out or self.machines[for_machine].is_windows():
compiler_type = CompilerType.CLANG_MINGW
+ linker = self._guess_nix_linker(compiler, for_machine, prefix='')
else:
compiler_type = CompilerType.CLANG_STANDARD
cls = ClangCCompiler if lang == 'c' else ClangCPPCompiler
- linker = self._guess_nix_linker(compiler, for_machine)
+ if linker is None:
+ linker = self._guess_nix_linker(compiler, for_machine)
return cls(ccache + compiler, version, compiler_type, for_machine, is_cross, exe_wrap, full_version=full_version, linker=linker)
if 'Intel(R) C++ Intel(R)' in err:
version = search_version(err)
@@ -1057,6 +1062,7 @@ class Environment:
compiler_type = CompilerType.CLANG_MINGW
else:
compiler_type = CompilerType.CLANG_STANDARD
+
linker = self._guess_nix_linker(compiler, for_machine)
return comp(ccache + compiler, version, compiler_type, for_machine, is_cross, exe_wrap, linker=linker)
self._handle_exceptions(popen_exceptions, compilers)