Skip to content

Commit 9a3f812

Browse files
authored
Unrolled build for #144235
Rollup merge of #144235 - Gelbpunkt:run-make-musl, r=jieyouxu Fix run-make tests on musl hosts On musl hosts, we already set `-Ctarget-feature=-crt-static` and `IS_MUSL_HOST=1` in compiletest. However, in order for the run-make tests to compile fine on musl hosts, we need to propagate this flag in our rustc invocations to ensure we can generate cdylibs.
2 parents e05ab47 + a546a7c commit 9a3f812

File tree

1 file changed

+8
-1
lines changed
  • src/tools/run-make-support/src/external_deps

1 file changed

+8
-1
lines changed

src/tools/run-make-support/src/external_deps/rustc.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,20 @@ impl Rustc {
5252
// `rustc` invocation constructor methods
5353

5454
/// Construct a new `rustc` invocation. This will automatically set the library
55-
/// search path as `-L cwd()` and also the compilation target.
55+
/// search path as `-L cwd()`, configure the compilation target and enable
56+
/// dynamic linkage by default on musl hosts.
5657
/// Use [`bare_rustc`] to avoid this.
5758
#[track_caller]
5859
pub fn new() -> Self {
5960
let mut cmd = setup_common();
6061
cmd.arg("-L").arg(cwd());
6162

63+
// FIXME: On musl hosts, we currently default to static linkage, while
64+
// for running run-make tests, we rely on dynamic linkage by default
65+
if std::env::var("IS_MUSL_HOST").is_ok_and(|i| i == "1") {
66+
cmd.arg("-Ctarget-feature=-crt-static");
67+
}
68+
6269
// Automatically default to cross-compilation
6370
Self { cmd, target: Some(target()) }
6471
}

0 commit comments

Comments
 (0)