Skip to content

Commit 66b6bc0

Browse files
committed
Fix -C linker=rust-lld
1 parent dd203d6 commit 66b6bc0

File tree

1 file changed

+10
-2
lines changed
  • compiler/rustc_codegen_ssa/src/back

1 file changed

+10
-2
lines changed

compiler/rustc_codegen_ssa/src/back/link.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1771,8 +1771,16 @@ fn link_output_kind(sess: &Session, crate_type: CrateType) -> LinkOutputKind {
17711771

17721772
// Returns true if linker is located within sysroot
17731773
fn detect_self_contained_mingw(sess: &Session) -> bool {
1774-
let linker = if let Some(linker) = &sess.target.linker {
1775-
Path::new(linker.as_ref())
1774+
// FIXME: this sort of duplicates `infer_from()` inside `linker_and_flavor()`
1775+
let path_buf = sess
1776+
.opts
1777+
.cg
1778+
.linker
1779+
.as_ref()
1780+
.map(|l| l.as_path())
1781+
.or_else(|| sess.target.linker.as_ref().map(|linker| Path::new(linker.as_ref())));
1782+
let linker = if let Some(linker) = path_buf {
1783+
linker
17761784
} else {
17771785
return false;
17781786
};

0 commit comments

Comments
 (0)