Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions packages/cli/src/build/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,20 @@ impl BuildRequest {
let mut custom_linker = cargo_config.linker(triple.to_string()).ok().flatten();
let mut rustflags = cargo_config2::Flags::default();

// Remove "rust-lld" as a custom linker on Windows, since that is already the linker we
// default to.
if let Some(linker) = custom_linker.as_ref() {
if (linker == "rust-lld" || linker == "rust-lld.exe") && cfg!(windows) {
// When using "rust-lld.exe" as linker on windows, it still needs to have a flavor
// given to it. rustc appears to be passing `-flavor "link"` when none is set by the
// user. If no flavor is given, it fails with 'lld is a generic driver'.
// We already use the existing lld-link by default on windows, so we can simply set the
// `custom_linker` to `None` in these cases, since we end up using "lld-link" anyway
// which is the same as "rust-lld.exe -flavor link".
custom_linker = None;
}
}

// Make sure to take into account the RUSTFLAGS env var and the CARGO_TARGET_<triple>_RUSTFLAGS
for env in [
"RUSTFLAGS".to_string(),
Expand Down