]> git.lizzy.rs Git - rust.git/commitdiff
run test for vxWorks in 'pure' static linking mode by default;
authorBaoshan Pang <baoshan.pang@windriver.com>
Fri, 16 Aug 2019 20:56:03 +0000 (13:56 -0700)
committerBaoshan Pang <baoshan.pang@windriver.com>
Wed, 21 Aug 2019 04:36:55 +0000 (21:36 -0700)
if environment variables 'RUST_TEST_DYLINK' is set to 1, then run test in 'pure' dynamic linking mode

src/tools/compiletest/src/runtest.rs

index 3da6be74129f457d356f7279d16b24f8dc0cd8dd..a712a27015d2546a2166ac28f6315803c98e6ddf 100644 (file)
@@ -1725,6 +1725,17 @@ fn compute_aux_test_paths(&self, rel_ab: &str) -> TestPaths {
         }
     }
 
+    fn use_dynamic_linking(&self) -> bool {
+        if self.config.target.contains("vxworks") {
+            match env::var("RUST_TEST_DYLINK") {
+                Ok(s) => s == "1",
+                _ => false
+            }
+        } else {
+            true
+        }
+    }
+
     fn compose_and_run_compiler(&self, mut rustc: Command, input: Option<String>) -> ProcRes {
         let aux_dir = self.aux_output_dir_name();
 
@@ -1768,6 +1779,7 @@ fn compose_and_run_compiler(&self, mut rustc: Command, input: Option<String>) ->
                     && !self.config.host.contains("musl"))
                 || self.config.target.contains("wasm32")
                 || self.config.target.contains("nvptx")
+                || !self.use_dynamic_linking()
             {
                 // We primarily compile all auxiliary libraries as dynamic libraries
                 // to avoid code size bloat and large binaries as much as possible
@@ -1999,10 +2011,14 @@ fn make_compile_args(
         }
 
         if !is_rustdoc {
-            if self.config.target == "wasm32-unknown-unknown" {
+            if self.config.target == "wasm32-unknown-unknown"
+            || !self.use_dynamic_linking() {
                 // rustc.arg("-g"); // get any backtrace at all on errors
             } else if !self.props.no_prefer_dynamic {
                 rustc.args(&["-C", "prefer-dynamic"]);
+                if self.config.target.contains("vxworks") {
+                    rustc.args(&["-C", "target-feature=-crt-static"]);
+                }
             }
         }