@@ -1725,14 +1725,25 @@ impl<'test> TestCx<'test> {
1725
1725
}
1726
1726
}
1727
1727
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 {
1729
1740
if self . config . target . contains ( "vxworks" ) {
1730
1741
match env:: var ( "RUST_TEST_DYLINK" ) {
1731
1742
Ok ( s) => s == "1" ,
1732
1743
_ => false
1733
1744
}
1734
1745
} else {
1735
- true
1746
+ false
1736
1747
}
1737
1748
}
1738
1749
@@ -1779,7 +1790,7 @@ impl<'test> TestCx<'test> {
1779
1790
&& !self . config . host . contains ( "musl" ) )
1780
1791
|| self . config . target . contains ( "wasm32" )
1781
1792
|| self . config . target . contains ( "nvptx" )
1782
- || ! self . use_dynamic_linking ( )
1793
+ || self . is_vxworks_pure_static ( )
1783
1794
{
1784
1795
// We primarily compile all auxiliary libraries as dynamic libraries
1785
1796
// to avoid code size bloat and large binaries as much as possible
@@ -2012,13 +2023,10 @@ impl<'test> TestCx<'test> {
2012
2023
2013
2024
if !is_rustdoc {
2014
2025
if self . config . target == "wasm32-unknown-unknown"
2015
- || ! self . use_dynamic_linking ( ) {
2026
+ || self . is_vxworks_pure_static ( ) {
2016
2027
// rustc.arg("-g"); // get any backtrace at all on errors
2017
2028
} else if !self . props . no_prefer_dynamic {
2018
2029
rustc. args ( & [ "-C" , "prefer-dynamic" ] ) ;
2019
- if self . config . target . contains ( "vxworks" ) {
2020
- rustc. args ( & [ "-C" , "target-feature=-crt-static" ] ) ;
2021
- }
2022
2030
}
2023
2031
}
2024
2032
@@ -2060,7 +2068,8 @@ impl<'test> TestCx<'test> {
2060
2068
}
2061
2069
2062
2070
// 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 ( ) {
2064
2073
rustc. arg ( "-Ctarget-feature=-crt-static" ) ;
2065
2074
}
2066
2075
0 commit comments