Skip to content

Commit 77d11c3

Browse files
committed
rustbuild: Build tests with LLD if use-lld = true was passed
1 parent 5d74e88 commit 77d11c3

File tree

4 files changed

+11
-15
lines changed

4 files changed

+11
-15
lines changed

src/bootstrap/builder.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,7 @@ impl<'a> Builder<'a> {
755755
cmd.env_remove("MAKEFLAGS");
756756
cmd.env_remove("MFLAGS");
757757

758-
if let Some(linker) = self.linker(compiler.host, true) {
758+
if let Some(linker) = self.linker(compiler.host) {
759759
cmd.env("RUSTC_TARGET_LINKER", linker);
760760
}
761761
cmd
@@ -1041,11 +1041,11 @@ impl<'a> Builder<'a> {
10411041
}
10421042
}
10431043

1044-
if let Some(host_linker) = self.linker(compiler.host, true) {
1044+
if let Some(host_linker) = self.linker(compiler.host) {
10451045
cargo.env("RUSTC_HOST_LINKER", host_linker);
10461046
}
10471047

1048-
if let Some(target_linker) = self.linker(target, true) {
1048+
if let Some(target_linker) = self.linker(target) {
10491049
let target = crate::envify(&target.triple);
10501050
cargo.env(&format!("CARGO_TARGET_{}_LINKER", target), target_linker);
10511051
}

src/bootstrap/lib.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,7 @@ impl Build {
850850
}
851851

852852
/// Returns the path to the linker for the given target if it needs to be overridden.
853-
fn linker(&self, target: TargetSelection, can_use_lld: bool) -> Option<&Path> {
853+
fn linker(&self, target: TargetSelection) -> Option<&Path> {
854854
if let Some(linker) = self.config.target_config.get(&target).and_then(|c| c.linker.as_ref())
855855
{
856856
Some(linker)
@@ -863,12 +863,9 @@ impl Build {
863863
&& !target.contains("msvc")
864864
{
865865
Some(self.cc(target))
866-
} else if target.contains("msvc")
867-
&& can_use_lld
868-
&& self.config.use_lld
869-
&& self.build == target
870-
{
871-
// Currently we support using LLD directly via `rust.use_lld` option only with MSVC
866+
} else if target.contains("msvc") && self.config.use_lld && self.build == target {
867+
// `rust.use_lld` means using LLD directly only for MSVC, for other targets it only
868+
// adds `-fuse-ld=lld` to already selected linker.
872869
Some(&self.initial_lld)
873870
} else {
874871
None

src/bootstrap/test.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ impl Step for RustdocTheme {
600600
.env("CFG_RELEASE_CHANNEL", &builder.config.channel)
601601
.env("RUSTDOC_REAL", builder.rustdoc(self.compiler))
602602
.env("RUSTC_BOOTSTRAP", "1");
603-
if let Some(linker) = builder.linker(self.compiler.host, true) {
603+
if let Some(linker) = builder.linker(self.compiler.host) {
604604
cmd.env("RUSTC_TARGET_LINKER", linker);
605605
}
606606
try_run(builder, &mut cmd);
@@ -1061,8 +1061,7 @@ impl Step for Compiletest {
10611061
flags.push("-Zunstable-options".to_string());
10621062
flags.push(builder.config.cmd.rustc_args().join(" "));
10631063

1064-
// Don't use LLD here since we want to test that rustc finds and uses a linker by itself.
1065-
if let Some(linker) = builder.linker(target, false) {
1064+
if let Some(linker) = builder.linker(target) {
10661065
cmd.arg("--linker").arg(linker);
10671066
}
10681067

src/test/run-make-fulldeps/tools.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ BARE_RUSTDOC := $(HOST_RPATH_ENV) '$(RUSTDOC)'
1111
RUSTC := $(BARE_RUSTC) --out-dir $(TMPDIR) -L $(TMPDIR) $(RUSTFLAGS)
1212
RUSTDOC := $(BARE_RUSTDOC) -L $(TARGET_RPATH_DIR)
1313
ifdef RUSTC_LINKER
14-
RUSTC := $(RUSTC) -Clinker=$(RUSTC_LINKER)
15-
RUSTDOC := $(RUSTDOC) -Clinker=$(RUSTC_LINKER)
14+
RUSTC := $(RUSTC) -Clinker='$(RUSTC_LINKER)'
15+
RUSTDOC := $(RUSTDOC) -Clinker='$(RUSTC_LINKER)'
1616
endif
1717
#CC := $(CC) -L $(TMPDIR)
1818
HTMLDOCCK := '$(PYTHON)' '$(S)/src/etc/htmldocck.py'

0 commit comments

Comments
 (0)