summaryrefslogtreecommitdiff
path: root/mesonbuild/compilers
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2025-10-13 12:19:21 +0200
committerDylan Baker <dylan@pnwbakers.com>2025-10-14 09:22:08 -0700
commit7bae4ed773f9ecca1e0e737461bf5e5aabb68812 (patch)
tree32be5d2dca8ec5302d04ecc80bf31cd6a4cc9f03 /mesonbuild/compilers
parent5cc1ee7f90da50f40a3263f9e63d9e356dda197c (diff)
downloadmeson-7bae4ed773f9ecca1e0e737461bf5e5aabb68812.tar.gz
compilers: clang: pass /nodefaultlib
Work around https://github.com/llvm/llvm-project/issues/129881. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'mesonbuild/compilers')
-rw-r--r--mesonbuild/compilers/mixins/clang.py25
1 files changed, 16 insertions, 9 deletions
diff --git a/mesonbuild/compilers/mixins/clang.py b/mesonbuild/compilers/mixins/clang.py
index 3b22ec388..8351672a1 100644
--- a/mesonbuild/compilers/mixins/clang.py
+++ b/mesonbuild/compilers/mixins/clang.py
@@ -54,23 +54,26 @@ class ClangCompiler(GnuLikeCompiler):
id = 'clang'
- # -fms-runtime-lib is not supported together with -c, emulate it
+ # -fms-runtime-lib is a compilation option which sets up an automatic dependency
+ # from the .o files to the final link product
CRT_D_ARGS: T.Dict[str, T.List[str]] = {
'none': [],
- 'md': ['-D_MT', '-D_DLL'],
- 'mdd': ['-D_MT', '-D_DLL', '-D_DEBUG'],
- 'mt': ['-D_MT'],
- 'mtd': ['-D_MT', '-D_DEBUG'],
- }
-
- CRT_ARGS: T.Dict[str, T.List[str]] = {
- 'none': [],
'md': ['-fms-runtime-lib=dll'],
'mdd': ['-fms-runtime-lib=dll_dbg'],
'mt': ['-fms-runtime-lib=static'],
'mtd': ['-fms-runtime-lib=static_dbg'],
}
+ # disable libcmt to avoid warnings, as that is the default and clang
+ # adds it by default.
+ CRT_ARGS: T.Dict[str, T.List[str]] = {
+ 'none': [],
+ 'md': ['-Wl,/nodefaultlib:libcmt'],
+ 'mdd': ['-Wl,/nodefaultlib:libcmt'],
+ 'mt': [],
+ 'mtd': ['-Wl,/nodefaultlib:libcmt'],
+ }
+
def __init__(self, defines: T.Optional[T.Dict[str, str]]):
super().__init__()
self.defines = defines or {}
@@ -88,10 +91,14 @@ class ClangCompiler(GnuLikeCompiler):
self.can_compile_suffixes.add('ll')
def get_crt_compile_args(self, crt_val: str, buildtype: str) -> T.List[str]:
+ if not isinstance(self.linker, VisualStudioLikeLinkerMixin):
+ return []
crt_val = self.get_crt_val(crt_val, buildtype)
return self.CRT_D_ARGS[crt_val]
def get_crt_link_args(self, crt_val: str, buildtype: str) -> T.List[str]:
+ if not isinstance(self.linker, VisualStudioLikeLinkerMixin):
+ return []
crt_val = self.get_crt_val(crt_val, buildtype)
return self.CRT_ARGS[crt_val]