@@ -1602,15 +1602,18 @@ impl<'test> TestCx<'test> {
1602
1602
None
1603
1603
} else if self . config . target . contains ( "cloudabi" )
1604
1604
|| self . config . target . contains ( "emscripten" )
1605
+ || ( self . config . target . contains ( "musl" ) && !aux_props. force_host )
1605
1606
|| self . config . target . contains ( "wasm32" )
1606
1607
{
1607
1608
// We primarily compile all auxiliary libraries as dynamic libraries
1608
1609
// to avoid code size bloat and large binaries as much as possible
1609
1610
// for the test suite (otherwise including libstd statically in all
1610
1611
// executables takes up quite a bit of space).
1611
1612
//
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.
1614
1617
Some ( "lib" )
1615
1618
} else {
1616
1619
Some ( "dylib" )
@@ -1842,36 +1845,19 @@ impl<'test> TestCx<'test> {
1842
1845
None => { }
1843
1846
}
1844
1847
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.
1848
1848
if self . props . force_host {
1849
1849
self . maybe_add_external_args ( & mut rustc,
1850
1850
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
- }
1856
1851
} else {
1857
1852
self . maybe_add_external_args ( & mut rustc,
1858
1853
self . split_maybe_args ( & self . config . target_rustcflags ) ) ;
1859
1854
if !is_rustdoc {
1860
1855
if let Some ( ref linker) = self . config . linker {
1861
1856
rustc. arg ( format ! ( "-Clinker={}" , linker) ) ;
1862
1857
}
1863
- } else if self . config . target . contains ( "musl" ) {
1864
- if let Some ( ref linker) = self . config . linker {
1865
- rustc. arg ( format ! ( "--linker={}" , linker) ) ;
1866
- }
1867
1858
}
1868
1859
}
1869
1860
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
-
1875
1861
rustc. args ( & self . props . compile_flags ) ;
1876
1862
1877
1863
rustc
@@ -2655,12 +2641,6 @@ impl<'test> TestCx<'test> {
2655
2641
// compiler flags set in the test cases:
2656
2642
cmd. env_remove ( "RUSTFLAGS" ) ;
2657
2643
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
-
2664
2644
if self . config . target . contains ( "msvc" ) && self . config . cc != "" {
2665
2645
// We need to pass a path to `lib.exe`, so assume that `cc` is `cl.exe`
2666
2646
// and that `lib.exe` lives next to it.
@@ -2683,13 +2663,8 @@ impl<'test> TestCx<'test> {
2683
2663
. env ( "CC" , format ! ( "'{}' {}" , self . config. cc, cflags) )
2684
2664
. env ( "CXX" , format ! ( "'{}'" , & self . config. cxx) ) ;
2685
2665
} 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) )
2693
2668
. env ( "AR" , & self . config . ar ) ;
2694
2669
2695
2670
if self . config . target . contains ( "windows" ) {
0 commit comments