@@ -1725,6 +1725,17 @@ impl<'test> TestCx<'test> {
17251725 }
17261726 }
17271727
1728+ fn use_dynamic_linking ( & self ) -> bool {
1729+ if self . config . target . contains ( "vxworks" ) {
1730+ match env:: var ( "RUST_TEST_DYLINK" ) {
1731+ Ok ( s) => s == "1" ,
1732+ _ => false
1733+ }
1734+ } else {
1735+ true
1736+ }
1737+ }
1738+
17281739 fn compose_and_run_compiler ( & self , mut rustc : Command , input : Option < String > ) -> ProcRes {
17291740 let aux_dir = self . aux_output_dir_name ( ) ;
17301741
@@ -1768,6 +1779,7 @@ impl<'test> TestCx<'test> {
17681779 && !self . config . host . contains ( "musl" ) )
17691780 || self . config . target . contains ( "wasm32" )
17701781 || self . config . target . contains ( "nvptx" )
1782+ || !self . use_dynamic_linking ( )
17711783 {
17721784 // We primarily compile all auxiliary libraries as dynamic libraries
17731785 // to avoid code size bloat and large binaries as much as possible
@@ -1999,10 +2011,14 @@ impl<'test> TestCx<'test> {
19992011 }
20002012
20012013 if !is_rustdoc {
2002- if self . config . target == "wasm32-unknown-unknown" {
2014+ if self . config . target == "wasm32-unknown-unknown"
2015+ || !self . use_dynamic_linking ( ) {
20032016 // rustc.arg("-g"); // get any backtrace at all on errors
20042017 } else if !self . props . no_prefer_dynamic {
20052018 rustc. args ( & [ "-C" , "prefer-dynamic" ] ) ;
2019+ if self . config . target . contains ( "vxworks" ) {
2020+ rustc. args ( & [ "-C" , "target-feature=-crt-static" ] ) ;
2021+ }
20062022 }
20072023 }
20082024
0 commit comments