summaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/mixins/gnu.py
diff options
context:
space:
mode:
Diffstat (limited to 'mesonbuild/compilers/mixins/gnu.py')
-rw-r--r--mesonbuild/compilers/mixins/gnu.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/mesonbuild/compilers/mixins/gnu.py b/mesonbuild/compilers/mixins/gnu.py
index 91e07e560..2613038a7 100644
--- a/mesonbuild/compilers/mixins/gnu.py
+++ b/mesonbuild/compilers/mixins/gnu.py
@@ -1,4 +1,4 @@
-# Copyright 2019 The meson development team
+# Copyright 2019-2022 The meson development team
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -306,7 +306,7 @@ class GnuLikeCompiler(Compiler, metaclass=abc.ABCMeta):
return ['-I' + path]
@classmethod
- def use_linker_args(cls, linker: str) -> T.List[str]:
+ def use_linker_args(cls, linker: str, version: str) -> T.List[str]:
if linker not in {'gold', 'bfd', 'lld'}:
raise mesonlib.MesonException(
f'Unsupported linker, only bfd, gold, and lld are supported, not {linker}.')
@@ -389,3 +389,9 @@ class GnuCompiler(GnuLikeCompiler):
elif threads > 0:
return [f'-flto={threads}']
return super().get_lto_compile_args(threads=threads)
+
+ @classmethod
+ def use_linker_args(cls, linker: str, version: str) -> T.List[str]:
+ if linker == 'mold' and mesonlib.version_compare(version, '>=12.0.1'):
+ return ['-fuse-ld=mold']
+ return super().use_linker_args(linker, version)