aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/mixins
diff options
context:
space:
mode:
authorTatsuyuki Ishi <ishitatsuyuki@gmail.com>2022-06-11 01:00:31 +0900
committerEli Schwartz <eschwartz93@gmail.com>2022-10-13 04:18:13 -0400
commit673dca5c0716d4e9527c055a8a20fa11e1893c5b (patch)
tree4782cbc7ae47202568da95e3b68ec6cdd7a1b8c6 /mesonbuild/compilers/mixins
parenta0032480d6707cdfda75987178a7c8ec0c33cbe9 (diff)
downloadmeson-673dca5c0716d4e9527c055a8a20fa11e1893c5b.zip
meson-673dca5c0716d4e9527c055a8a20fa11e1893c5b.tar.gz
meson-673dca5c0716d4e9527c055a8a20fa11e1893c5b.tar.bz2
Add b_thinlto_cache for automatically configuring incremental ThinLTO
Diffstat (limited to 'mesonbuild/compilers/mixins')
-rw-r--r--mesonbuild/compilers/mixins/clang.py10
-rw-r--r--mesonbuild/compilers/mixins/islinker.py3
2 files changed, 10 insertions, 3 deletions
diff --git a/mesonbuild/compilers/mixins/clang.py b/mesonbuild/compilers/mixins/clang.py
index f9b66d5..35de264 100644
--- a/mesonbuild/compilers/mixins/clang.py
+++ b/mesonbuild/compilers/mixins/clang.py
@@ -53,7 +53,8 @@ class ClangCompiler(GnuLikeCompiler):
super().__init__()
self.defines = defines or {}
self.base_options.update(
- {OptionKey('b_colorout'), OptionKey('b_lto_threads'), OptionKey('b_lto_mode')})
+ {OptionKey('b_colorout'), OptionKey('b_lto_threads'), OptionKey('b_lto_mode'), OptionKey('b_thinlto_cache'),
+ OptionKey('b_thinlto_cache_dir')})
# TODO: this really should be part of the linker base_options, but
# linkers don't have base_options.
@@ -163,8 +164,13 @@ class ClangCompiler(GnuLikeCompiler):
args.extend(super().get_lto_compile_args(threads=threads))
return args
- def get_lto_link_args(self, *, threads: int = 0, mode: str = 'default') -> T.List[str]:
+ def get_lto_link_args(self, *, threads: int = 0, mode: str = 'default',
+ thinlto_cache_dir: T.Optional[str] = None) -> T.List[str]:
args = self.get_lto_compile_args(threads=threads, mode=mode)
+ if mode == 'thin' and thinlto_cache_dir is not None:
+ # We check for ThinLTO linker support above in get_lto_compile_args, and all of them support
+ # get_thinlto_cache_args as well
+ args.extend(self.linker.get_thinlto_cache_args(thinlto_cache_dir))
# 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'):
diff --git a/mesonbuild/compilers/mixins/islinker.py b/mesonbuild/compilers/mixins/islinker.py
index 9513aa5..738b456 100644
--- a/mesonbuild/compilers/mixins/islinker.py
+++ b/mesonbuild/compilers/mixins/islinker.py
@@ -48,7 +48,8 @@ class BasicLinkerIsCompilerMixin(Compiler):
def sanitizer_link_args(self, value: str) -> T.List[str]:
return []
- def get_lto_link_args(self, *, threads: int = 0, mode: str = 'default') -> T.List[str]:
+ def get_lto_link_args(self, *, threads: int = 0, mode: str = 'default',
+ thinlto_cache_dir: T.Optional[str] = None) -> T.List[str]:
return []
def can_linker_accept_rsp(self) -> bool: