about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorEric Huss <eric@huss.org>2020-07-06 20:31:12 -0700
committerEric Huss <eric@huss.org>2020-07-15 09:57:10 -0700
commit0eb293ddb72ce080b3d0a6bdf643bd645849fa9e (patch)
tree04f7024267632bc85abb802b6f4f27d7700df085 /src/libstd
parentcee9f05c2d369cda1d8487fe6e475a2ae990b9f8 (diff)
downloadrust-0eb293ddb72ce080b3d0a6bdf643bd645849fa9e.tar.gz
rust-0eb293ddb72ce080b3d0a6bdf643bd645849fa9e.zip
Use an allow-list of platforms that support std.
Use a fall-through for no_std targets.
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/build.rs26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/libstd/build.rs b/src/libstd/build.rs
index 8317eedd53f..eb2753d6245 100644
--- a/src/libstd/build.rs
+++ b/src/libstd/build.rs
@@ -62,9 +62,29 @@ fn main() {
         }
         println!("cargo:rustc-link-lib=c");
         println!("cargo:rustc-link-lib=compiler_rt");
-    }
-    println!("cargo:rustc-env=STD_ENV_ARCH={}", env::var("CARGO_CFG_TARGET_ARCH").unwrap());
-    if target.contains("-none") || target.contains("nvptx") {
+    } else if (target.contains("sgx") && target.contains("fortanix"))
+        || target.contains("hermit")
+        || target.contains("l4re")
+        || target.contains("redox")
+        || target.contains("haiku")
+        || target.contains("vxworks")
+        || target.contains("wasm32")
+        || target.contains("asmjs")
+    {
+        // These platforms don't have any special requirements.
+    } else {
+        // This is for Cargo's build-std support, to mark std as unstable for
+        // typically no_std platforms.
+        // This covers:
+        // - os=none ("bare metal" targets)
+        // - mipsel-sony-psp
+        // - nvptx64-nvidia-cuda
+        // - avr-unknown-unknown
+        // - tvos (aarch64-apple-tvos, x86_64-apple-tvos)
+        // - uefi (x86_64-unknown-uefi, i686-unknown-uefi)
+        // - JSON targets
+        // - Any new targets that have not been explicitly added above.
         println!("cargo:rustc-cfg=feature=\"restricted-std\"");
     }
+    println!("cargo:rustc-env=STD_ENV_ARCH={}", env::var("CARGO_CFG_TARGET_ARCH").unwrap());
 }