@@ -1602,15 +1602,18 @@ impl<'test> TestCx<'test> {
16021602 None
16031603 } else if self . config . target . contains ( "cloudabi" )
16041604 || self . config . target . contains ( "emscripten" )
1605+ || ( self . config . target . contains ( "musl" ) && !aux_props. force_host )
16051606 || self . config . target . contains ( "wasm32" )
16061607 {
16071608 // We primarily compile all auxiliary libraries as dynamic libraries
16081609 // to avoid code size bloat and large binaries as much as possible
16091610 // for the test suite (otherwise including libstd statically in all
16101611 // executables takes up quite a bit of space).
16111612 //
1612- // For targets like Emscripten, however, there is no support for
1613- // dynamic libraries so we just go back to building a normal library.
1613+ // For targets like MUSL or Emscripten, however, there is no support for
1614+ // dynamic libraries so we just go back to building a normal library. Note,
1615+ // however, that for MUSL if the library is built with `force_host` then
1616+ // it's ok to be a dylib as the host should always support dylibs.
16141617 Some ( "lib" )
16151618 } else {
16161619 Some ( "dylib" )
@@ -1842,36 +1845,19 @@ impl<'test> TestCx<'test> {
18421845 None => { }
18431846 }
18441847
1845- // Musl toolchain is build on linux-gnu host
1846- // but with proper setup it can behave almost* like native linux-musl.
1847- // One difference is "cc" which will link to glibc; force musl cc.
18481848 if self . props . force_host {
18491849 self . maybe_add_external_args ( & mut rustc,
18501850 self . split_maybe_args ( & self . config . host_rustcflags ) ) ;
1851- if self . config . target . contains ( "musl" ) {
1852- if let Some ( ref linker) = self . config . linker {
1853- rustc. arg ( format ! ( "-Clinker={}" , linker) ) ;
1854- }
1855- }
18561851 } else {
18571852 self . maybe_add_external_args ( & mut rustc,
18581853 self . split_maybe_args ( & self . config . target_rustcflags ) ) ;
18591854 if !is_rustdoc {
18601855 if let Some ( ref linker) = self . config . linker {
18611856 rustc. arg ( format ! ( "-Clinker={}" , linker) ) ;
18621857 }
1863- } else if self . config . target . contains ( "musl" ) {
1864- if let Some ( ref linker) = self . config . linker {
1865- rustc. arg ( format ! ( "--linker={}" , linker) ) ;
1866- }
18671858 }
18681859 }
18691860
1870- // Use dynamic musl for tests because static doesn't allow creating dylibs
1871- if self . config . target . contains ( "musl" ) {
1872- rustc. arg ( "-Ctarget-feature=-crt-static" ) ;
1873- }
1874-
18751861 rustc. args ( & self . props . compile_flags ) ;
18761862
18771863 rustc
@@ -2655,12 +2641,6 @@ impl<'test> TestCx<'test> {
26552641 // compiler flags set in the test cases:
26562642 cmd. env_remove ( "RUSTFLAGS" ) ;
26572643
2658- // Use dynamic musl for tests because static doesn't allow creating dylibs
2659- if self . config . target . contains ( "musl" ) {
2660- cmd. env ( "RUSTFLAGS" , "-Ctarget-feature=-crt-static" )
2661- . env ( "IS_MUSL_HOST" , "1" ) ;
2662- }
2663-
26642644 if self . config . target . contains ( "msvc" ) && self . config . cc != "" {
26652645 // We need to pass a path to `lib.exe`, so assume that `cc` is `cl.exe`
26662646 // and that `lib.exe` lives next to it.
@@ -2683,13 +2663,8 @@ impl<'test> TestCx<'test> {
26832663 . env ( "CC" , format ! ( "'{}' {}" , self . config. cc, cflags) )
26842664 . env ( "CXX" , format ! ( "'{}'" , & self . config. cxx) ) ;
26852665 } else {
2686- let cflags = if self . config . target . contains ( "musl" ) {
2687- self . config . cflags . replace ( "-static" , "" )
2688- } else {
2689- self . config . cflags . to_string ( )
2690- } ;
2691- cmd. env ( "CC" , format ! ( "{} {}" , self . config. cc, cflags) )
2692- . env ( "CXX" , format ! ( "{} {}" , self . config. cxx, cflags) )
2666+ cmd. env ( "CC" , format ! ( "{} {}" , self . config. cc, self . config. cflags) )
2667+ . env ( "CXX" , format ! ( "{} {}" , self . config. cxx, self . config. cflags) )
26932668 . env ( "AR" , & self . config . ar ) ;
26942669
26952670 if self . config . target . contains ( "windows" ) {
0 commit comments