Skip to content

Commit dd203d6

Browse files
committed
Use self-contained with windows-gnullvm
1 parent 908e720 commit dd203d6

File tree

1 file changed

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

1 file changed

+12
-2
lines changed

compiler/rustc_codegen_ssa/src/back/link.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,8 @@ fn link_natively(
686686
) {
687687
info!("preparing {:?} to {:?}", crate_type, out_filename);
688688
let self_contained_components = self_contained_components(sess, crate_type);
689-
let (linker_path, flavor) = linker_and_flavor(sess);
689+
let (linker_path, flavor) =
690+
linker_and_flavor(sess, self_contained_components.is_linker_enabled());
690691

691692
// On AIX, we ship all libraries as .a big_af archive
692693
// the expected format is lib<name>.a(libname.so) for the actual
@@ -1314,7 +1315,7 @@ pub fn ignored_for_lto(sess: &Session, info: &CrateInfo, cnum: CrateNum) -> bool
13141315
}
13151316

13161317
/// This functions tries to determine the appropriate linker (and corresponding LinkerFlavor) to use
1317-
pub fn linker_and_flavor(sess: &Session) -> (PathBuf, LinkerFlavor) {
1318+
pub fn linker_and_flavor(sess: &Session, self_contained: bool) -> (PathBuf, LinkerFlavor) {
13181319
fn infer_from(
13191320
sess: &Session,
13201321
linker: Option<PathBuf>,
@@ -1413,6 +1414,15 @@ pub fn linker_and_flavor(sess: &Session) -> (PathBuf, LinkerFlavor) {
14131414
return ret;
14141415
}
14151416

1417+
// FIXME: do it better
1418+
if sess.target.os == "windows"
1419+
&& sess.target.env == "gnu"
1420+
&& sess.target.abi == "llvm"
1421+
&& self_contained
1422+
{
1423+
return (PathBuf::from("rust-lld.exe"), LinkerFlavor::Gnu(Cc::No, Lld::Yes));
1424+
}
1425+
14161426
if let Some(ret) = infer_from(
14171427
sess,
14181428
sess.target.linker.as_deref().map(PathBuf::from),

0 commit comments

Comments
 (0)