From 6c1467db272c4700ae79f74c3541f6ccc4814138 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Tue, 16 Feb 2021 12:01:36 -0800 Subject: compilers: Only insert -flto-jobs in clang's link arguments Clang has a hand `-Wunused-command-line-argument` switch, which when turned to an error, gets very grump about `-flto-jobs=0` being set in the compiler arguments (although `-flto=` belongs there). We'll refactor a bit to put that only in the link arguments. GCC doesn't have this probably because, a) it doesn't have an equivalent warning, and b) it uses `-flto=<$numthreads. Fixes: #8347 --- mesonbuild/compilers/compilers.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'mesonbuild/compilers/compilers.py') diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index 8171758..a4823e2 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -375,7 +375,9 @@ def get_base_link_args(options: 'KeyedOptionDictType', linker: 'Compiler', args = [] # type: T.List[str] try: if options[OptionKey('b_lto')].value: - args.extend(linker.get_lto_link_args()) + args.extend(linker.get_lto_link_args( + threads=get_option_value(options, OptionKey('b_lto_threads'), 0), + mode=get_option_value(options, OptionKey('b_lto_mode'), 'default'))) except KeyError: pass try: @@ -950,7 +952,7 @@ class Compiler(metaclass=abc.ABCMeta): 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]: + def get_lto_link_args(self, *, threads: int = 0, mode: str = 'default') -> T.List[str]: return self.linker.get_lto_args() def sanitizer_compile_args(self, value: str) -> T.List[str]: -- cgit v1.1