@@ -1725,14 +1725,25 @@ impl<'test> TestCx<'test> {
17251725 }
17261726 }
17271727
1728- fn use_dynamic_linking ( & self ) -> bool {
1728+ fn is_vxworks_pure_static ( & self ) -> bool {
1729+ if self . config . target . contains ( "vxworks" ) {
1730+ match env:: var ( "RUST_TEST_DYLINK" ) {
1731+ Ok ( s) => s != "1" ,
1732+ _ => true
1733+ }
1734+ } else {
1735+ false
1736+ }
1737+ }
1738+
1739+ fn is_vxworks_pure_dynamic ( & self ) -> bool {
17291740 if self . config . target . contains ( "vxworks" ) {
17301741 match env:: var ( "RUST_TEST_DYLINK" ) {
17311742 Ok ( s) => s == "1" ,
17321743 _ => false
17331744 }
17341745 } else {
1735- true
1746+ false
17361747 }
17371748 }
17381749
@@ -1779,7 +1790,7 @@ impl<'test> TestCx<'test> {
17791790 && !self . config . host . contains ( "musl" ) )
17801791 || self . config . target . contains ( "wasm32" )
17811792 || self . config . target . contains ( "nvptx" )
1782- || ! self . use_dynamic_linking ( )
1793+ || self . is_vxworks_pure_static ( )
17831794 {
17841795 // We primarily compile all auxiliary libraries as dynamic libraries
17851796 // to avoid code size bloat and large binaries as much as possible
@@ -2012,13 +2023,10 @@ impl<'test> TestCx<'test> {
20122023
20132024 if !is_rustdoc {
20142025 if self . config . target == "wasm32-unknown-unknown"
2015- || ! self . use_dynamic_linking ( ) {
2026+ || self . is_vxworks_pure_static ( ) {
20162027 // rustc.arg("-g"); // get any backtrace at all on errors
20172028 } else if !self . props . no_prefer_dynamic {
20182029 rustc. args ( & [ "-C" , "prefer-dynamic" ] ) ;
2019- if self . config . target . contains ( "vxworks" ) {
2020- rustc. args ( & [ "-C" , "target-feature=-crt-static" ] ) ;
2021- }
20222030 }
20232031 }
20242032
@@ -2060,7 +2068,8 @@ impl<'test> TestCx<'test> {
20602068 }
20612069
20622070 // Use dynamic musl for tests because static doesn't allow creating dylibs
2063- if self . config . host . contains ( "musl" ) {
2071+ if self . config . host . contains ( "musl" )
2072+ || self . is_vxworks_pure_dynamic ( ) {
20642073 rustc. arg ( "-Ctarget-feature=-crt-static" ) ;
20652074 }
20662075
0 commit comments