aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/compilers.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2020-12-10 14:16:45 -0800
committerDylan Baker <dylan@pnwbakers.com>2021-02-02 12:42:48 -0800
commit6f532b72c85e38880cf7953098bb91e8f3feb696 (patch)
treeb0bbd5e653904f54b03439e851a092763b4ef87f /mesonbuild/compilers/compilers.py
parentbffc94b08f713cc9916009575664b132aee76bcf (diff)
downloadmeson-6f532b72c85e38880cf7953098bb91e8f3feb696.zip
meson-6f532b72c85e38880cf7953098bb91e8f3feb696.tar.gz
meson-6f532b72c85e38880cf7953098bb91e8f3feb696.tar.bz2
Add support for LLVM's thinLTO
This uses a separate option, b_lto_mode. It works in conjunction with b_lto_threads. Fixes #7493
Diffstat (limited to 'mesonbuild/compilers/compilers.py')
-rw-r--r--mesonbuild/compilers/compilers.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py
index 07569a7..08db6d7 100644
--- a/mesonbuild/compilers/compilers.py
+++ b/mesonbuild/compilers/compilers.py
@@ -270,6 +270,9 @@ base_options: 'KeyedOptionDictType' = {
OptionKey('b_lto'): coredata.UserBooleanOption('Use link time optimization', False),
OptionKey('b_lto'): coredata.UserBooleanOption('Use link time optimization', False),
OptionKey('b_lto_threads'): coredata.UserIntegerOption('Use multiple threads for Link Time Optimization', (None, None,0)),
+ OptionKey('b_lto_mode'): coredata.UserComboOption('Select between different LTO modes.',
+ ['default', 'thin'],
+ 'default'),
OptionKey('b_sanitize'): coredata.UserComboOption('Code sanitizer to use',
['none', 'address', 'thread', 'undefined', 'memory', 'address,undefined'],
'none'),
@@ -320,7 +323,8 @@ def get_base_compile_args(options: 'KeyedOptionDictType', compiler: 'Compiler')
try:
if options[OptionKey('b_lto')].value:
args.extend(compiler.get_lto_compile_args(
- threads=get_option_value(options, OptionKey('b_lto_threads'), 0)))
+ threads=get_option_value(options, OptionKey('b_lto_threads'), 0),
+ mode=get_option_value(options, OptionKey('b_lto_mode'), 'default')))
except KeyError:
pass
try:
@@ -942,7 +946,7 @@ class Compiler(metaclass=abc.ABCMeta):
ret.append(arg)
return ret
- def get_lto_compile_args(self, *, threads: int = 0) -> T.List[str]:
+ def get_lto_compile_args(self, *, threads: int = 0, mode: str = 'default') -> T.List[str]:
return []
def get_lto_link_args(self) -> T.List[str]: