rustbuild: Build tests with LLD if use-lld = true
was passed
This commit is contained in:
parent
5d74e88006
commit
77d11c3ce2
@ -755,7 +755,7 @@ pub fn rustdoc_cmd(&self, compiler: Compiler) -> Command {
|
||||
cmd.env_remove("MAKEFLAGS");
|
||||
cmd.env_remove("MFLAGS");
|
||||
|
||||
if let Some(linker) = self.linker(compiler.host, true) {
|
||||
if let Some(linker) = self.linker(compiler.host) {
|
||||
cmd.env("RUSTC_TARGET_LINKER", linker);
|
||||
}
|
||||
cmd
|
||||
@ -1041,11 +1041,11 @@ pub fn cargo(
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(host_linker) = self.linker(compiler.host, true) {
|
||||
if let Some(host_linker) = self.linker(compiler.host) {
|
||||
cargo.env("RUSTC_HOST_LINKER", host_linker);
|
||||
}
|
||||
|
||||
if let Some(target_linker) = self.linker(target, true) {
|
||||
if let Some(target_linker) = self.linker(target) {
|
||||
let target = crate::envify(&target.triple);
|
||||
cargo.env(&format!("CARGO_TARGET_{}_LINKER", target), target_linker);
|
||||
}
|
||||
|
@ -850,7 +850,7 @@ fn cxx(&self, target: TargetSelection) -> Result<&Path, String> {
|
||||
}
|
||||
|
||||
/// Returns the path to the linker for the given target if it needs to be overridden.
|
||||
fn linker(&self, target: TargetSelection, can_use_lld: bool) -> Option<&Path> {
|
||||
fn linker(&self, target: TargetSelection) -> Option<&Path> {
|
||||
if let Some(linker) = self.config.target_config.get(&target).and_then(|c| c.linker.as_ref())
|
||||
{
|
||||
Some(linker)
|
||||
@ -863,12 +863,9 @@ fn linker(&self, target: TargetSelection, can_use_lld: bool) -> Option<&Path> {
|
||||
&& !target.contains("msvc")
|
||||
{
|
||||
Some(self.cc(target))
|
||||
} else if target.contains("msvc")
|
||||
&& can_use_lld
|
||||
&& self.config.use_lld
|
||||
&& self.build == target
|
||||
{
|
||||
// Currently we support using LLD directly via `rust.use_lld` option only with MSVC
|
||||
} else if target.contains("msvc") && self.config.use_lld && self.build == target {
|
||||
// `rust.use_lld` means using LLD directly only for MSVC, for other targets it only
|
||||
// adds `-fuse-ld=lld` to already selected linker.
|
||||
Some(&self.initial_lld)
|
||||
} else {
|
||||
None
|
||||
|
@ -600,7 +600,7 @@ fn run(self, builder: &Builder<'_>) {
|
||||
.env("CFG_RELEASE_CHANNEL", &builder.config.channel)
|
||||
.env("RUSTDOC_REAL", builder.rustdoc(self.compiler))
|
||||
.env("RUSTC_BOOTSTRAP", "1");
|
||||
if let Some(linker) = builder.linker(self.compiler.host, true) {
|
||||
if let Some(linker) = builder.linker(self.compiler.host) {
|
||||
cmd.env("RUSTC_TARGET_LINKER", linker);
|
||||
}
|
||||
try_run(builder, &mut cmd);
|
||||
@ -1061,8 +1061,7 @@ fn run(self, builder: &Builder<'_>) {
|
||||
flags.push("-Zunstable-options".to_string());
|
||||
flags.push(builder.config.cmd.rustc_args().join(" "));
|
||||
|
||||
// Don't use LLD here since we want to test that rustc finds and uses a linker by itself.
|
||||
if let Some(linker) = builder.linker(target, false) {
|
||||
if let Some(linker) = builder.linker(target) {
|
||||
cmd.arg("--linker").arg(linker);
|
||||
}
|
||||
|
||||
|
@ -11,8 +11,8 @@ BARE_RUSTDOC := $(HOST_RPATH_ENV) '$(RUSTDOC)'
|
||||
RUSTC := $(BARE_RUSTC) --out-dir $(TMPDIR) -L $(TMPDIR) $(RUSTFLAGS)
|
||||
RUSTDOC := $(BARE_RUSTDOC) -L $(TARGET_RPATH_DIR)
|
||||
ifdef RUSTC_LINKER
|
||||
RUSTC := $(RUSTC) -Clinker=$(RUSTC_LINKER)
|
||||
RUSTDOC := $(RUSTDOC) -Clinker=$(RUSTC_LINKER)
|
||||
RUSTC := $(RUSTC) -Clinker='$(RUSTC_LINKER)'
|
||||
RUSTDOC := $(RUSTDOC) -Clinker='$(RUSTC_LINKER)'
|
||||
endif
|
||||
#CC := $(CC) -L $(TMPDIR)
|
||||
HTMLDOCCK := '$(PYTHON)' '$(S)/src/etc/htmldocck.py'
|
||||
|
Loading…
Reference in New Issue
Block a user