aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/mixins/clang.py
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2021-11-15 07:38:33 -0500
committerJussi Pakkanen <jpakkane@gmail.com>2021-11-15 22:00:53 +0200
commitee5428d64ffee9cbe3e66c7f2a72732ed211aaab (patch)
tree3d8fecbf17d38561de5cc07e5de127477a4c73de /mesonbuild/compilers/mixins/clang.py
parent5b08fd4b33cfa5a66340001da6264f8c0943c860 (diff)
downloadmeson-ee5428d64ffee9cbe3e66c7f2a72732ed211aaab.zip
meson-ee5428d64ffee9cbe3e66c7f2a72732ed211aaab.tar.gz
meson-ee5428d64ffee9cbe3e66c7f2a72732ed211aaab.tar.bz2
only pass clang LTO arguments when they are needed
If the LTO threads == 0 clang will default to the same argument we manually pass, which meant we dropped support for admittedly ancient versions of clang that didn't yet add that option. Drop the extraneous argument, and add a specific error condition when too old versions of clang are detected. Fixes #9569
Diffstat (limited to 'mesonbuild/compilers/mixins/clang.py')
-rw-r--r--mesonbuild/compilers/mixins/clang.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/mesonbuild/compilers/mixins/clang.py b/mesonbuild/compilers/mixins/clang.py
index 94aa9a2..1391297 100644
--- a/mesonbuild/compilers/mixins/clang.py
+++ b/mesonbuild/compilers/mixins/clang.py
@@ -156,7 +156,9 @@ class ClangCompiler(GnuLikeCompiler):
def get_lto_link_args(self, *, threads: int = 0, mode: str = 'default') -> T.List[str]:
args = self.get_lto_compile_args(threads=threads, mode=mode)
- # In clang -flto=0 means auto
- if threads >= 0:
+ # In clang -flto-jobs=0 means auto, and is the default if unspecified, just like in meson
+ if threads > 0:
+ if not mesonlib.version_compare(self.version, '>=4.0.0'):
+ raise mesonlib.MesonException('clang support for LTO threads requires clang >=4.0')
args.append(f'-flto-jobs={threads}')
return args