about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-12-29 22:21:16 +0000
committerbors <bors@rust-lang.org>2022-12-29 22:21:16 +0000
commit2c7536eaae59b44ff5259183ca98384129d69dd0 (patch)
treee959074255f6e8c881bd5c6deb8c966732c9acd7 /src
parentad8ae0504c54bc2bd8306abfcfe8546c1bb16a49 (diff)
parent480297d216cbaad9527b7004222cd6c1faaa5e74 (diff)
downloadrust-2c7536eaae59b44ff5259183ca98384129d69dd0.tar.gz
rust-2c7536eaae59b44ff5259183ca98384129d69dd0.zip
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
https://github.com/rust-lang/rust/commit/d1291dc8b4ac9a98ff1d286402559e4ba5d68488 and
https://github.com/rust-lang/rust/commit/1532fd8cd0db93f469e414f9da31ef083a44fcba
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/bootstrap.py3
-rwxr-xr-xsrc/bootstrap/configure.py4
2 files changed, 6 insertions, 1 deletions
diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
index 2d5018d934e..9cf43fc7a21 100644
--- a/src/bootstrap/bootstrap.py
+++ b/src/bootstrap/bootstrap.py
@@ -753,6 +753,9 @@ class RustBuild(object):
             target_features += ["-crt-static"]
         if target_features:
             env["RUSTFLAGS"] += " -C target-feature=" + (",".join(target_features))
+        target_linker = self.get_toml("linker", build_section)
+        if target_linker is not None:
+            env["RUSTFLAGS"] += " -C linker=" + target_linker
         env["RUSTFLAGS"] += " -Wrust_2018_idioms -Wunused_lifetimes"
         env["RUSTFLAGS"] += " -Wsemicolon_in_expressions_from_macros"
         if self.get_toml("deny-warnings", "rust") != "false":
diff --git a/src/bootstrap/configure.py b/src/bootstrap/configure.py
index 6b139decb55..31cc4aa57bb 100755
--- a/src/bootstrap/configure.py
+++ b/src/bootstrap/configure.py
@@ -405,7 +405,9 @@ if 'target' in config:
         configured_targets.append(target)
 for target in configured_targets:
     targets[target] = sections['target'][:]
-    targets[target][0] = targets[target][0].replace("x86_64-unknown-linux-gnu", "'{}'".format(target))
+    # 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.
+    # Avoid using quotes unless it's necessary.
+    targets[target][0] = targets[target][0].replace("x86_64-unknown-linux-gnu", "'{}'".format(target) if "." in target else target)
 
 
 def is_number(value):