@@ -1725,6 +1725,17 @@ impl<'test> TestCx<'test> {
1725
1725
}
1726
1726
}
1727
1727
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
+
1728
1739
fn compose_and_run_compiler ( & self , mut rustc : Command , input : Option < String > ) -> ProcRes {
1729
1740
let aux_dir = self . aux_output_dir_name ( ) ;
1730
1741
@@ -1768,6 +1779,7 @@ impl<'test> TestCx<'test> {
1768
1779
&& !self . config . host . contains ( "musl" ) )
1769
1780
|| self . config . target . contains ( "wasm32" )
1770
1781
|| self . config . target . contains ( "nvptx" )
1782
+ || !self . use_dynamic_linking ( )
1771
1783
{
1772
1784
// We primarily compile all auxiliary libraries as dynamic libraries
1773
1785
// to avoid code size bloat and large binaries as much as possible
@@ -1999,10 +2011,14 @@ impl<'test> TestCx<'test> {
1999
2011
}
2000
2012
2001
2013
if !is_rustdoc {
2002
- if self . config . target == "wasm32-unknown-unknown" {
2014
+ if self . config . target == "wasm32-unknown-unknown"
2015
+ || !self . use_dynamic_linking ( ) {
2003
2016
// rustc.arg("-g"); // get any backtrace at all on errors
2004
2017
} else if !self . props . no_prefer_dynamic {
2005
2018
rustc. args ( & [ "-C" , "prefer-dynamic" ] ) ;
2019
+ if self . config . target . contains ( "vxworks" ) {
2020
+ rustc. args ( & [ "-C" , "target-feature=-crt-static" ] ) ;
2021
+ }
2006
2022
}
2007
2023
}
2008
2024
0 commit comments