aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2021-05-29 14:24:53 -0700
committerGitHub <noreply@github.com>2021-05-30 00:24:53 +0300
commitc6ec13e6bfe5292181370e47b813212eb193a0fb (patch)
treeb83d8ce869bc31be4b51219e530443ff79a93a81
parent25fa2d4f7ba0978d8a224cf2cba3d697a3bbfb3d (diff)
downloadmeson-c6ec13e6bfe5292181370e47b813212eb193a0fb.zip
meson-c6ec13e6bfe5292181370e47b813212eb193a0fb.tar.gz
meson-c6ec13e6bfe5292181370e47b813212eb193a0fb.tar.bz2
Only try to get RSP syntax if RSP is supported (#8804)
-rw-r--r--mesonbuild/backend/ninjabackend.py36
-rw-r--r--mesonbuild/linkers.py2
2 files changed, 24 insertions, 14 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index 6bd7ba6..4e826ee 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -1840,6 +1840,17 @@ int dummy;
# Introspection information
self.create_target_source_introspection(target, swiftc, compile_args + header_imports + module_includes, relsrc, rel_generated)
+ def _rsp_options(self, tool: T.Union['Compiler', 'StaticLinker', 'DynamicLinker']) -> T.Dict[str, T.Union[bool, RSPFileSyntax]]:
+ """Helper method to get rsp options.
+
+ rsp_file_syntax() is only guaranteed to be implemented if
+ can_linker_accept_rsp() returns True.
+ """
+ options = dict(rspable=tool.can_linker_accept_rsp())
+ if options['rspable']:
+ options['rspfile_quote_style'] = tool.rsp_file_syntax()
+ return options
+
def generate_static_link_rules(self):
num_pools = self.environment.coredata.options[OptionKey('backend_max_links')].value
if 'java' in self.environment.coredata.compilers.host:
@@ -1868,10 +1879,9 @@ int dummy;
pool = 'pool = link_pool'
else:
pool = None
- self.add_rule(NinjaRule(rule, cmdlist, args, description,
- rspable=static_linker.can_linker_accept_rsp(),
- rspfile_quote_style=static_linker.rsp_file_syntax(),
- extra=pool))
+
+ options = self._rsp_options(static_linker)
+ self.add_rule(NinjaRule(rule, cmdlist, args, description, **options, extra=pool))
def generate_dynamic_link_rules(self):
num_pools = self.environment.coredata.options[OptionKey('backend_max_links')].value
@@ -1891,10 +1901,9 @@ int dummy;
pool = 'pool = link_pool'
else:
pool = None
- self.add_rule(NinjaRule(rule, command, args, description,
- rspable=compiler.can_linker_accept_rsp(),
- rspfile_quote_style=compiler.rsp_file_syntax(),
- extra=pool))
+
+ options = self._rsp_options(compiler)
+ self.add_rule(NinjaRule(rule, command, args, description, **options, extra=pool))
args = self.environment.get_build_command() + \
['--internal',
@@ -1977,8 +1986,10 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485'''))
command = compiler.get_exelist()
args = ['$ARGS'] + NinjaCommandArg.list(compiler.get_output_args('$out'), Quoting.none) + compiler.get_compile_only_args() + ['$in']
description = 'Compiling LLVM IR object $in'
- self.add_rule(NinjaRule(rule, command, args, description,
- rspable=compiler.can_linker_accept_rsp()))
+
+ options = self._rsp_options(compiler)
+
+ self.add_rule(NinjaRule(rule, command, args, description, **options))
self.created_llvm_ir_rule[compiler.for_machine] = True
def generate_compile_rule_for(self, langname, compiler):
@@ -2014,9 +2025,8 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485'''))
else:
deps = 'gcc'
depfile = '$DEPFILE'
- self.add_rule(NinjaRule(rule, command, args, description,
- rspable=compiler.can_linker_accept_rsp(),
- rspfile_quote_style=compiler.rsp_file_syntax(),
+ options = self._rsp_options(compiler)
+ self.add_rule(NinjaRule(rule, command, args, description, **options,
deps=deps, depfile=depfile))
def generate_pch_rule_for(self, langname, compiler):
diff --git a/mesonbuild/linkers.py b/mesonbuild/linkers.py
index acb2c44..7b938ac 100644
--- a/mesonbuild/linkers.py
+++ b/mesonbuild/linkers.py
@@ -112,7 +112,7 @@ class StaticLinker:
be implemented
"""
assert not self.can_linker_accept_rsp(), f'{self.id} linker accepts RSP, but doesn\' provide a supported format, this is a bug'
- raise mesonlib.EnvironmentException(f'{self.id} does no implemnt rsp format, this shouldn\'t be called')
+ raise mesonlib.EnvironmentException(f'{self.id} does not implemnt rsp format, this shouldn\'t be called')
class VisualStudioLikeLinker: