Skip to content

Commit 46df47f

Browse files
committed
Use self-contained with windows-gnullvm
1 parent 3756602 commit 46df47f

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
@@ -1318,7 +1319,7 @@ pub fn ignored_for_lto(sess: &Session, info: &CrateInfo, cnum: CrateNum) -> bool
13181319
}
13191320

13201321
/// This functions tries to determine the appropriate linker (and corresponding LinkerFlavor) to use
1321-
pub fn linker_and_flavor(sess: &Session) -> (PathBuf, LinkerFlavor) {
1322+
pub fn linker_and_flavor(sess: &Session, self_contained: bool) -> (PathBuf, LinkerFlavor) {
13221323
fn infer_from(
13231324
sess: &Session,
13241325
linker: Option<PathBuf>,
@@ -1415,6 +1416,15 @@ pub fn linker_and_flavor(sess: &Session) -> (PathBuf, LinkerFlavor) {
14151416
return ret;
14161417
}
14171418

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

0 commit comments

Comments
 (0)