Skip to content

Commit 2c7536e

Browse files
committed
Auto merge of #105920 - MarcusCalhoun-Lopez:respect_set, r=jyn514
Respect --set=target.platform when building rustbuild itself `--set=target.platform.cc` and `--set=target.platform.cxx` are ignored if target is quoted. `--set=target.platform.linker` is ignored if RUSTFLAGS is not set. Undo parts of d1291dc and 1532fd8
2 parents ad8ae05 + 480297d commit 2c7536e

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/bootstrap/bootstrap.py

+3
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,9 @@ def build_bootstrap(self, color):
753753
target_features += ["-crt-static"]
754754
if target_features:
755755
env["RUSTFLAGS"] += " -C target-feature=" + (",".join(target_features))
756+
target_linker = self.get_toml("linker", build_section)
757+
if target_linker is not None:
758+
env["RUSTFLAGS"] += " -C linker=" + target_linker
756759
env["RUSTFLAGS"] += " -Wrust_2018_idioms -Wunused_lifetimes"
757760
env["RUSTFLAGS"] += " -Wsemicolon_in_expressions_from_macros"
758761
if self.get_toml("deny-warnings", "rust") != "false":

src/bootstrap/configure.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,9 @@ def set(key, value):
405405
configured_targets.append(target)
406406
for target in configured_targets:
407407
targets[target] = sections['target'][:]
408-
targets[target][0] = targets[target][0].replace("x86_64-unknown-linux-gnu", "'{}'".format(target))
408+
# For `.` to be valid TOML, it needs to be quoted. But `bootstrap.py` doesn't use a proper TOML parser and fails to parse the target.
409+
# Avoid using quotes unless it's necessary.
410+
targets[target][0] = targets[target][0].replace("x86_64-unknown-linux-gnu", "'{}'".format(target) if "." in target else target)
409411

410412

411413
def is_number(value):

0 commit comments

Comments
 (0)