@@ -1650,7 +1650,9 @@ impl<'test> TestCx<'test> {
1650
1650
( true , None )
1651
1651
} else if self . config . target . contains ( "cloudabi" )
1652
1652
|| self . config . target . contains ( "emscripten" )
1653
- || ( self . config . target . contains ( "musl" ) && !aux_props. force_host )
1653
+ || ( self . config . target . contains ( "musl" )
1654
+ && !aux_props. force_host
1655
+ && !self . config . host . contains ( "musl" ) )
1654
1656
|| self . config . target . contains ( "wasm32" )
1655
1657
|| self . config . target . contains ( "nvptx" )
1656
1658
{
@@ -1932,6 +1934,11 @@ impl<'test> TestCx<'test> {
1932
1934
}
1933
1935
}
1934
1936
1937
+ // Use dynamic musl for tests because static doesn't allow creating dylibs
1938
+ if self . config . host . contains ( "musl" ) {
1939
+ rustc. arg ( "-Ctarget-feature=-crt-static" ) ;
1940
+ }
1941
+
1935
1942
rustc. args ( & self . props . compile_flags ) ;
1936
1943
1937
1944
rustc
@@ -2725,6 +2732,12 @@ impl<'test> TestCx<'test> {
2725
2732
// compiler flags set in the test cases:
2726
2733
cmd. env_remove ( "RUSTFLAGS" ) ;
2727
2734
2735
+ // Use dynamic musl for tests because static doesn't allow creating dylibs
2736
+ if self . config . host . contains ( "musl" ) {
2737
+ cmd. env ( "RUSTFLAGS" , "-Ctarget-feature=-crt-static" )
2738
+ . env ( "IS_MUSL_HOST" , "1" ) ;
2739
+ }
2740
+
2728
2741
if self . config . target . contains ( "msvc" ) && self . config . cc != "" {
2729
2742
// We need to pass a path to `lib.exe`, so assume that `cc` is `cl.exe`
2730
2743
// and that `lib.exe` lives next to it.
0 commit comments