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
This commit is contained in:
Vadim Petrochenkov 2020-11-11 20:10:15 +03:00
parent d4ea0b3e46
commit 443b45fa9f
2 changed files with 3 additions and 1 deletions

View File

@ -11,7 +11,6 @@ pub fn target(target_cpu: String) -> Target {
pointer_width: 16, pointer_width: 16,
options: TargetOptions { options: TargetOptions {
c_int_width: "16".to_string(), c_int_width: "16".to_string(),
os: "unknown".to_string(),
cpu: target_cpu.clone(), cpu: target_cpu.clone(),
exe_suffix: ".elf".to_string(), exe_suffix: ".elf".to_string(),

View File

@ -713,6 +713,9 @@ pub struct TargetOptions {
/// Width of c_int type. Defaults to "32". /// Width of c_int type. Defaults to "32".
pub c_int_width: String, pub c_int_width: String,
/// OS name to use for conditional compilation. Defaults to "none". /// 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, pub os: String,
/// Environment name to use for conditional compilation. Defaults to "". /// Environment name to use for conditional compilation. Defaults to "".
pub env: String, pub env: String,