]> git.lizzy.rs Git - rust.git/commitdiff
Patch compilation test helpers for sgx platform
authorRaoul Strackx <raoul.strackx@fortanix.com>
Tue, 31 Mar 2020 09:28:01 +0000 (11:28 +0200)
committerRaoul Strackx <raoul.strackx@fortanix.com>
Fri, 25 Sep 2020 13:15:37 +0000 (15:15 +0200)
src/bootstrap/native.rs

index 9e4d6d0023dc947e469c6bf442b99aabc4a005b0..1e233cb389187a1f58a8f1b755c42a3434fa82f7 100644 (file)
@@ -625,7 +625,14 @@ fn run(self, builder: &Builder<'_>) {
         if builder.config.dry_run {
             return;
         }
-        let target = self.target;
+        // The x86_64-fortanix-unknown-sgx target doesn't have a working C
+        // toolchain. However, some x86_64 ELF objects can be linked
+        // without issues. Use this hack to compile the test helpers.
+        let target = if self.target == "x86_64-fortanix-unknown-sgx" {
+            TargetSelection::from_user("x86_64-unknown-linux-gnu")
+        } else {
+            self.target
+        };
         let dst = builder.test_helpers_out(target);
         let src = builder.src.join("src/test/auxiliary/rust_test_helpers.c");
         if up_to_date(&src, &dst.join("librust_test_helpers.a")) {
@@ -649,7 +656,6 @@ fn run(self, builder: &Builder<'_>) {
             }
             cfg.compiler(builder.cc(target));
         }
-
         cfg.cargo_metadata(false)
             .out_dir(&dst)
             .target(&target.triple)