Skip to content

Commit 5bdd64a

Browse files
committed
Fix -C linker=rust-lld
1 parent acd3e2c commit 5bdd64a

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
@@ -1775,8 +1775,16 @@ fn link_output_kind(sess: &Session, crate_type: CrateType) -> LinkOutputKind {
17751775

17761776
// Returns true if linker is located within sysroot
17771777
fn detect_self_contained_mingw(sess: &Session) -> bool {
1778-
let linker = if let Some(linker) = &sess.target.linker {
1779-
Path::new(linker.as_ref())
1778+
// FIXME: this sort of duplicates `infer_from()` inside `linker_and_flavor()`
1779+
let path_buf = sess
1780+
.opts
1781+
.cg
1782+
.linker
1783+
.as_ref()
1784+
.map(|l| l.as_path())
1785+
.or_else(|| sess.target.linker.as_ref().map(|linker| Path::new(linker.as_ref())));
1786+
let linker = if let Some(linker) = path_buf {
1787+
linker
17801788
} else {
17811789
return false;
17821790
};

0 commit comments

Comments
 (0)