diff options
| -rw-r--r-- | mesonbuild/compilers/mixins/gnu.py | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/mesonbuild/compilers/mixins/gnu.py b/mesonbuild/compilers/mixins/gnu.py index ed937338f..90492bf82 100644 --- a/mesonbuild/compilers/mixins/gnu.py +++ b/mesonbuild/compilers/mixins/gnu.py @@ -620,15 +620,21 @@ class GnuCompiler(GnuLikeCompiler): return [prelink_name], ['-r', '-o', prelink_name] + obj_list def get_lto_compile_args(self, *, threads: int = 0, mode: str = 'default') -> T.List[str]: + args: T.List[str] = [] + if threads == 0: if self._has_lto_auto_support: - return ['-flto=auto'] - # This matches gcc's behavior of using the number of cpus, but - # obeying meson's MESON_NUM_PROCESSES convention. - return [f'-flto={mesonlib.determine_worker_count()}'] + args.append('-flto=auto') + else: + # This matches gcc's behavior of using the number of cpus, but + # obeying meson's MESON_NUM_PROCESSES convention. + args.append(f'-flto={mesonlib.determine_worker_count()}') elif threads > 0: - return [f'-flto={threads}'] - return super().get_lto_compile_args(threads=threads) + args.append(f'-flto={threads}') + else: + args.extend(super().get_lto_compile_args(threads=threads)) + + return args @classmethod def use_linker_args(cls, linker: str, version: str) -> T.List[str]: |
