@@ -1650,7 +1650,9 @@ impl<'test> TestCx<'test> {
16501650 ( true , None )
16511651 } else if self . config . target . contains ( "cloudabi" )
16521652 || 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" ) )
16541656 || self . config . target . contains ( "wasm32" )
16551657 || self . config . target . contains ( "nvptx" )
16561658 {
@@ -1932,6 +1934,11 @@ impl<'test> TestCx<'test> {
19321934 }
19331935 }
19341936
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+
19351942 rustc. args ( & self . props . compile_flags ) ;
19361943
19371944 rustc
@@ -2725,6 +2732,12 @@ impl<'test> TestCx<'test> {
27252732 // compiler flags set in the test cases:
27262733 cmd. env_remove ( "RUSTFLAGS" ) ;
27272734
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+
27282741 if self . config . target . contains ( "msvc" ) && self . config . cc != "" {
27292742 // We need to pass a path to `lib.exe`, so assume that `cc` is `cl.exe`
27302743 // and that `lib.exe` lives next to it.
0 commit comments