Skip to content

Commit acd3e2c

Browse files
committed
Use self-contained with windows-gnullvm
1 parent 9c62bae commit acd3e2c

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>,
@@ -1417,6 +1418,15 @@ pub fn linker_and_flavor(sess: &Session) -> (PathBuf, LinkerFlavor) {
14171418
return ret;
14181419
}
14191420

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

0 commit comments

Comments
 (0)