From 443b45fa9fd87cf0939e80a64bead413530e375c Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Wed, 11 Nov 2020 20:10:15 +0300 Subject: [PATCH] rustc_target: Change os from "unknown" to "none" for bare metal targets x86_64-fortanix-unknown-sgx and wasm32-unknown-unknown still have os == "unknown" because both have libstd --- compiler/rustc_target/src/spec/avr_gnu_base.rs | 1 - compiler/rustc_target/src/spec/mod.rs | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_target/src/spec/avr_gnu_base.rs b/compiler/rustc_target/src/spec/avr_gnu_base.rs index 9cc10032c71d..67a7684da2c7 100644 --- a/compiler/rustc_target/src/spec/avr_gnu_base.rs +++ b/compiler/rustc_target/src/spec/avr_gnu_base.rs @@ -11,7 +11,6 @@ pub fn target(target_cpu: String) -> Target { pointer_width: 16, options: TargetOptions { c_int_width: "16".to_string(), - os: "unknown".to_string(), cpu: target_cpu.clone(), exe_suffix: ".elf".to_string(), diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs index 2a4ae786fb75..dc8c41ecedc2 100644 --- a/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs @@ -713,6 +713,9 @@ pub struct TargetOptions { /// Width of c_int type. Defaults to "32". pub c_int_width: String, /// OS name to use for conditional compilation. Defaults to "none". + /// "none" implies a bare metal target without `std` library. + /// A couple of targets having `std` also use "unknown" as an `os` value, + /// but they are exceptions. pub os: String, /// Environment name to use for conditional compilation. Defaults to "". pub env: String,