From c3457cf8bb2d4c1e5c9dc1a0974ae98e803bd487 Mon Sep 17 00:00:00 2001 From: Vladimir Michael Eatwell Date: Wed, 16 Jun 2021 15:03:51 +0100 Subject: [PATCH 01/10] [watchos] add target specs for watchos armv7k and arm64_32 [watchos] Add spec for x86_64-apple-watchos-sim --- compiler/rustc_codegen_llvm/src/back/write.rs | 3 +- compiler/rustc_target/src/spec/apple_base.rs | 9 +++++ .../rustc_target/src/spec/apple_sdk_base.rs | 6 +++- .../src/spec/arm64_32_apple_watchos.rs | 29 ++++++++++++++++ .../src/spec/armv7k_apple_watchos.rs | 18 ++++++++++ compiler/rustc_target/src/spec/mod.rs | 4 +++ .../src/spec/x86_64_apple_watchos_sim.rs | 34 +++++++++++++++++++ library/panic_unwind/src/dwarf/eh.rs | 3 +- library/panic_unwind/src/gcc.rs | 2 +- library/std/build.rs | 1 + library/unwind/src/libunwind.rs | 8 ++--- 11 files changed, 109 insertions(+), 8 deletions(-) create mode 100644 compiler/rustc_target/src/spec/arm64_32_apple_watchos.rs create mode 100644 compiler/rustc_target/src/spec/armv7k_apple_watchos.rs create mode 100644 compiler/rustc_target/src/spec/x86_64_apple_watchos_sim.rs diff --git a/compiler/rustc_codegen_llvm/src/back/write.rs b/compiler/rustc_codegen_llvm/src/back/write.rs index c18719d4ad739..e7d6bbb30273b 100644 --- a/compiler/rustc_codegen_llvm/src/back/write.rs +++ b/compiler/rustc_codegen_llvm/src/back/write.rs @@ -1035,7 +1035,8 @@ unsafe fn embed_bitcode( // reason (see issue #90326 for historical background). let is_apple = cgcx.opts.target_triple.triple().contains("-ios") || cgcx.opts.target_triple.triple().contains("-darwin") - || cgcx.opts.target_triple.triple().contains("-tvos"); + || cgcx.opts.target_triple.triple().contains("-tvos") + || cgcx.opts.target_triple.triple().contains("-watchos"); if is_apple || cgcx.opts.target_triple.triple().starts_with("wasm") || cgcx.opts.target_triple.triple().starts_with("asmjs") diff --git a/compiler/rustc_target/src/spec/apple_base.rs b/compiler/rustc_target/src/spec/apple_base.rs index a4488f695f210..8ca5284eb2a0e 100644 --- a/compiler/rustc_target/src/spec/apple_base.rs +++ b/compiler/rustc_target/src/spec/apple_base.rs @@ -114,3 +114,12 @@ pub fn ios_sim_llvm_target(arch: &str) -> String { let (major, minor) = ios_deployment_target(); format!("{}-apple-ios{}.{}.0-simulator", arch, major, minor) } + +fn watchos_deployment_target() -> (u32, u32) { + deployment_target("WATCHOS_DEPLOYMENT_TARGET").unwrap_or((5, 0)) +} + +pub fn watchos_sim_llvm_target(arch: &str) -> String { + let (major, minor) = watchos_deployment_target(); + format!("{}-apple-watchos{}.{}.0-simulator", arch, major, minor) +} diff --git a/compiler/rustc_target/src/spec/apple_sdk_base.rs b/compiler/rustc_target/src/spec/apple_sdk_base.rs index 874e9b56aaa1e..0bcccf1df2d93 100644 --- a/compiler/rustc_target/src/spec/apple_sdk_base.rs +++ b/compiler/rustc_target/src/spec/apple_sdk_base.rs @@ -5,8 +5,10 @@ use Arch::*; #[derive(Copy, Clone)] pub enum Arch { Armv7, + Armv7k, Armv7s, Arm64, + Arm64_32, I386, X86_64, X86_64_macabi, @@ -26,8 +28,10 @@ fn target_abi(arch: Arch) -> String { fn target_cpu(arch: Arch) -> String { match arch { Armv7 => "cortex-a8", // iOS7 is supported on iPhone 4 and higher + Armv7k => "cortex-a8", Armv7s => "cortex-a9", Arm64 => "apple-a7", + Arm64_32 => "apple-s4", I386 => "yonah", X86_64 => "core2", X86_64_macabi => "core2", @@ -39,7 +43,7 @@ fn target_cpu(arch: Arch) -> String { fn link_env_remove(arch: Arch) -> Vec { match arch { - Armv7 | Armv7s | Arm64 | I386 | X86_64 | Arm64_sim => { + Armv7 | Armv7k | Armv7s | Arm64 | Arm64_32 | I386 | X86_64 | Arm64_sim => { vec!["MACOSX_DEPLOYMENT_TARGET".to_string()] } X86_64_macabi | Arm64_macabi => vec!["IPHONEOS_DEPLOYMENT_TARGET".to_string()], diff --git a/compiler/rustc_target/src/spec/arm64_32_apple_watchos.rs b/compiler/rustc_target/src/spec/arm64_32_apple_watchos.rs new file mode 100644 index 0000000000000..504bcd63052c7 --- /dev/null +++ b/compiler/rustc_target/src/spec/arm64_32_apple_watchos.rs @@ -0,0 +1,29 @@ +use super::apple_sdk_base::{opts, Arch}; +use crate::spec::{Target, TargetOptions}; + +pub fn target() -> Target { + let base = opts("watchos", Arch::Arm64_32); + Target { + llvm_target: "arm64_32-apple-watchos".to_string(), + pointer_width: 32, + data_layout: "e-m:o-p:32:32-i64:64-i128:128-n32:64-S128".to_string(), + arch: "aarch64".to_string(), + options: TargetOptions { + features: "+neon,+fp-armv8,+apple-a7".to_string(), + max_atomic_width: Some(64), + unsupported_abis: super::arm_base::unsupported_abis(), + forces_embed_bitcode: true, + // These arguments are not actually invoked - they just have + // to look right to pass App Store validation. + bitcode_llvm_cmdline: "-triple\0\ + arm64_32-apple-watchos5.0.0\0\ + -emit-obj\0\ + -disable-llvm-passes\0\ + -target-abi\0\ + darwinpcs\0\ + -Os\0" + .to_string(), + ..base + }, + } +} diff --git a/compiler/rustc_target/src/spec/armv7k_apple_watchos.rs b/compiler/rustc_target/src/spec/armv7k_apple_watchos.rs new file mode 100644 index 0000000000000..14092b9949457 --- /dev/null +++ b/compiler/rustc_target/src/spec/armv7k_apple_watchos.rs @@ -0,0 +1,18 @@ +use super::apple_sdk_base::{opts, Arch}; +use crate::spec::{Target, TargetOptions}; + +pub fn target() -> Target { + let base = opts("watchos", Arch::Armv7k); + Target { + llvm_target: "armv7k-apple-watchos".to_string(), + pointer_width: 32, + data_layout: "e-m:o-p:32:32-Fi8-i64:64-a:0:32-n32-S128".to_string(), + arch: "arm".to_string(), + options: TargetOptions { + features: "+v7".to_string(), + max_atomic_width: Some(64), + unsupported_abis: super::arm_base::unsupported_abis(), + ..base + }, + } +} diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs index 4f0c3bec1eecc..a07d61686b6e9 100644 --- a/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs @@ -923,6 +923,10 @@ supported_targets! { ("aarch64-apple-tvos", aarch64_apple_tvos), ("x86_64-apple-tvos", x86_64_apple_tvos), + ("armv7k-apple-watchos", armv7k_apple_watchos), + ("arm64_32-apple-watchos", arm64_32_apple_watchos), + ("x86_64-apple-watchos-sim", x86_64_apple_watchos_sim), + ("armebv7r-none-eabi", armebv7r_none_eabi), ("armebv7r-none-eabihf", armebv7r_none_eabihf), ("armv7r-none-eabi", armv7r_none_eabi), diff --git a/compiler/rustc_target/src/spec/x86_64_apple_watchos_sim.rs b/compiler/rustc_target/src/spec/x86_64_apple_watchos_sim.rs new file mode 100644 index 0000000000000..638f36a8bcba1 --- /dev/null +++ b/compiler/rustc_target/src/spec/x86_64_apple_watchos_sim.rs @@ -0,0 +1,34 @@ +use super::apple_sdk_base::{opts, Arch}; +use crate::spec::{StackProbeType, Target, TargetOptions}; + +pub fn target() -> Target { + let base = opts("watchos", Arch::X86_64); + + let arch = "x86_64"; + let llvm_target = super::apple_base::watchos_sim_llvm_target(arch); + + Target { + llvm_target: llvm_target, + pointer_width: 64, + data_layout: "e-m:o-i64:64-f80:128-n8:16:32:64-S128".to_string(), + arch: "x86_64".to_string(), + options: TargetOptions { + max_atomic_width: Some(64), + // don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved + stack_probes: StackProbeType::Call, + forces_embed_bitcode: true, + // Taken from a clang build on Xcode 11.4.1. + // These arguments are not actually invoked - they just have + // to look right to pass App Store validation. + bitcode_llvm_cmdline: "-triple\0\ + x86_64-apple-watchos5.0-simulator\0\ + -emit-obj\0\ + -disable-llvm-passes\0\ + -target-abi\0\ + darwinpcs\0\ + -Os\0" + .to_string(), + ..base + }, + } +} diff --git a/library/panic_unwind/src/dwarf/eh.rs b/library/panic_unwind/src/dwarf/eh.rs index 7394feab82f22..44086cd141e59 100644 --- a/library/panic_unwind/src/dwarf/eh.rs +++ b/library/panic_unwind/src/dwarf/eh.rs @@ -49,7 +49,8 @@ pub enum EHAction { Terminate, } -pub const USING_SJLJ_EXCEPTIONS: bool = cfg!(all(target_os = "ios", target_arch = "arm")); +pub const USING_SJLJ_EXCEPTIONS: bool = + cfg!(all(any(target_os = "ios", target_os = "watchos"), target_arch = "arm")); pub unsafe fn find_eh_action(lsda: *const u8, context: &EHContext<'_>) -> Result { if lsda.is_null() { diff --git a/library/panic_unwind/src/gcc.rs b/library/panic_unwind/src/gcc.rs index a0297b4b2f524..057e47bfdd18a 100644 --- a/library/panic_unwind/src/gcc.rs +++ b/library/panic_unwind/src/gcc.rs @@ -131,7 +131,7 @@ const UNWIND_DATA_REG: (i32, i32) = (10, 11); // x10, x11 // https://github.com/gcc-mirror/gcc/blob/trunk/libgcc/unwind-c.c cfg_if::cfg_if! { - if #[cfg(all(target_arch = "arm", not(target_os = "ios"), not(target_os = "netbsd")))] { + if #[cfg(all(target_arch = "arm", not(target_os = "ios"), not(target_os = "watchos"), not(target_os = "netbsd")))] { // ARM EHABI personality routine. // https://infocenter.arm.com/help/topic/com.arm.doc.ihi0038b/IHI0038B_ehabi.pdf // diff --git a/library/std/build.rs b/library/std/build.rs index 43168e77296ab..a6fdf500b63ca 100644 --- a/library/std/build.rs +++ b/library/std/build.rs @@ -15,6 +15,7 @@ fn main() { || target.contains("illumos") || target.contains("apple-darwin") || target.contains("apple-ios") + || target.contains("apple-watchos") || target.contains("uwp") || target.contains("windows") || target.contains("fuchsia") diff --git a/library/unwind/src/libunwind.rs b/library/unwind/src/libunwind.rs index 432628613f586..380d8ec6838e0 100644 --- a/library/unwind/src/libunwind.rs +++ b/library/unwind/src/libunwind.rs @@ -30,10 +30,10 @@ pub const unwinder_private_data_size: usize = 5; #[cfg(target_arch = "x86_64")] pub const unwinder_private_data_size: usize = 6; -#[cfg(all(target_arch = "arm", not(target_os = "ios")))] +#[cfg(all(target_arch = "arm", not(any(target_os = "ios", target_os = "watchos"))))] pub const unwinder_private_data_size: usize = 20; -#[cfg(all(target_arch = "arm", target_os = "ios"))] +#[cfg(all(target_arch = "arm", any(target_os = "ios", target_os = "watchos")))] pub const unwinder_private_data_size: usize = 5; #[cfg(all(target_arch = "aarch64", target_pointer_width = "64"))] @@ -105,7 +105,7 @@ extern "C" { } cfg_if::cfg_if! { -if #[cfg(any(target_os = "ios", target_os = "netbsd", not(target_arch = "arm")))] { +if #[cfg(any(target_os = "ios", target_os = "watchos", target_os = "netbsd", not(target_arch = "arm")))] { // Not ARM EHABI #[repr(C)] #[derive(Copy, Clone, PartialEq)] @@ -240,7 +240,7 @@ if #[cfg(any(target_os = "ios", target_os = "netbsd", not(target_arch = "arm"))) } // cfg_if! cfg_if::cfg_if! { -if #[cfg(not(all(target_os = "ios", target_arch = "arm")))] { +if #[cfg(not(all(any(target_os = "ios", target_os = "watchos"), target_arch = "arm")))] { // Not 32-bit iOS #[cfg_attr( all(feature = "llvm-libunwind", any(target_os = "fuchsia", target_os = "linux")), From 08a7e59b3ddf1e96b28c4625ae48cb6988877554 Mon Sep 17 00:00:00 2001 From: Vladimir Michael Eatwell Date: Thu, 17 Jun 2021 09:31:50 +0100 Subject: [PATCH 02/10] [watch_os] add stdlib (match ios) [watch_os] misc fixes [watch_os] fix target builds --- Cargo.toml | 2 + compiler/rustc_codegen_ssa/src/back/link.rs | 13 +- .../src/spec/armv7k_apple_watchos.rs | 2 +- library/panic_abort/Cargo.toml | 4 +- library/std/src/os/mod.rs | 2 + library/std/src/os/unix/mod.rs | 3 + library/std/src/os/unix/net/stream.rs | 3 + library/std/src/os/unix/ucred.rs | 4 +- library/std/src/os/unix/ucred/tests.rs | 3 +- library/std/src/os/watchos/fs.rs | 142 ++++++++++++++++++ library/std/src/os/watchos/mod.rs | 6 + library/std/src/os/watchos/raw.rs | 83 ++++++++++ library/std/src/sys/unix/args.rs | 4 +- library/std/src/sys/unix/env.rs | 11 ++ library/std/src/sys/unix/fd.rs | 2 + library/std/src/sys/unix/fs.rs | 20 ++- .../std/src/sys/unix/locks/pthread_condvar.rs | 6 + library/std/src/sys/unix/mod.rs | 5 +- library/std/src/sys/unix/os.rs | 6 +- library/std/src/sys/unix/rand.rs | 3 +- library/std/src/sys/unix/thread.rs | 2 +- library/std/src/sys/unix/time.rs | 4 +- library/std/src/sys_common/net.rs | 2 +- src/bootstrap/native.rs | 5 +- src/tools/compiletest/src/raise_fd_limit.rs | 2 +- src/tools/compiletest/src/util.rs | 1 + 26 files changed, 312 insertions(+), 28 deletions(-) create mode 100644 library/std/src/os/watchos/fs.rs create mode 100644 library/std/src/os/watchos/mod.rs create mode 100644 library/std/src/os/watchos/raw.rs diff --git a/Cargo.toml b/Cargo.toml index 4e78399606445..0ec3f510ea81f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -125,6 +125,8 @@ rustfmt-nightly = { path = "src/tools/rustfmt" } # See comments in `src/tools/rustc-workspace-hack/README.md` for what's going on # here rustc-workspace-hack = { path = 'src/tools/rustc-workspace-hack' } +cc = { git = "https://github.com/vladimir-ea/cc-rs", branch = "watch_os" } +libc = { git = "https://github.com/vladimir-ea/libc", branch = "watch_os" } # See comments in `library/rustc-std-workspace-core/README.md` for what's going on # here diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs index 9cc06ac031969..5d188e304dc38 100644 --- a/compiler/rustc_codegen_ssa/src/back/link.rs +++ b/compiler/rustc_codegen_ssa/src/back/link.rs @@ -2457,7 +2457,7 @@ fn add_apple_sdk(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavor) { let os = &sess.target.os; let llvm_target = &sess.target.llvm_target; if sess.target.vendor != "apple" - || !matches!(os.as_str(), "ios" | "tvos") + || !matches!(os.as_str(), "ios" | "tvos" | "watchos") || flavor != LinkerFlavor::Gcc { return; @@ -2472,6 +2472,10 @@ fn add_apple_sdk(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavor) { ("x86", "ios") => "iphonesimulator", ("x86_64", "ios") if llvm_target.contains("macabi") => "macosx", ("x86_64", "ios") => "iphonesimulator", + ("x86_64", "watchos") => "watchsimulator", + ("arm64_32", "watchos") => "watchos", + ("aarch64", "watchos") => "watchos", + ("armv7k", "watchos") => "watchos", _ => { sess.err(&format!("unsupported arch `{}` for os `{}`", arch, os)); return; @@ -2518,13 +2522,18 @@ fn get_apple_sdk_root(sdk_name: &str) -> Result { "macosx10.15" if sdkroot.contains("iPhoneOS.platform") || sdkroot.contains("iPhoneSimulator.platform") => {} + "watchos" + if sdkroot.contains("WatchSimulator.platform") + || sdkroot.contains("MacOSX.platform") => {} + "watchsimulator" + if sdkroot.contains("WatchOS.platform") || sdkroot.contains("MacOSX.platform") => {} // Ignore `SDKROOT` if it's not a valid path. _ if !p.is_absolute() || p == Path::new("/") || !p.exists() => {} _ => return Ok(sdkroot), } } let res = - Command::new("xcrun").arg("--show-sdk-path").arg("-sdk").arg(sdk_name).output().and_then( + Command::new("xcrunp").arg("--show-sdk-path").arg("-sdk").arg(sdk_name).output().and_then( |output| { if output.status.success() { Ok(String::from_utf8(output.stdout).unwrap()) diff --git a/compiler/rustc_target/src/spec/armv7k_apple_watchos.rs b/compiler/rustc_target/src/spec/armv7k_apple_watchos.rs index 14092b9949457..5fe07264d095b 100644 --- a/compiler/rustc_target/src/spec/armv7k_apple_watchos.rs +++ b/compiler/rustc_target/src/spec/armv7k_apple_watchos.rs @@ -9,7 +9,7 @@ pub fn target() -> Target { data_layout: "e-m:o-p:32:32-Fi8-i64:64-a:0:32-n32-S128".to_string(), arch: "arm".to_string(), options: TargetOptions { - features: "+v7".to_string(), + features: "+v7,+vfp4,+neon".to_string(), max_atomic_width: Some(64), unsupported_abis: super::arm_base::unsupported_abis(), ..base diff --git a/library/panic_abort/Cargo.toml b/library/panic_abort/Cargo.toml index 46183d1ad0066..ea1c36d16be96 100644 --- a/library/panic_abort/Cargo.toml +++ b/library/panic_abort/Cargo.toml @@ -15,5 +15,5 @@ doc = false alloc = { path = "../alloc" } cfg-if = { version = "0.1.8", features = ['rustc-dep-of-std'] } core = { path = "../core" } -libc = { version = "0.2", default-features = false } -compiler_builtins = "0.1.0" +libc = { version = "*", default-features = false } +compiler_builtins = "*" diff --git a/library/std/src/os/mod.rs b/library/std/src/os/mod.rs index 029f131c40be0..6182c5ad1c87b 100644 --- a/library/std/src/os/mod.rs +++ b/library/std/src/os/mod.rs @@ -129,6 +129,8 @@ pub mod illumos; pub mod ios; #[cfg(target_os = "l4re")] pub mod l4re; +#[cfg(target_os = "watchos")] +pub mod watchos; #[cfg(target_os = "macos")] pub mod macos; #[cfg(target_os = "netbsd")] diff --git a/library/std/src/os/unix/mod.rs b/library/std/src/os/unix/mod.rs index 7b8ca79eeb846..6a3b9bc8d5f1c 100644 --- a/library/std/src/os/unix/mod.rs +++ b/library/std/src/os/unix/mod.rs @@ -71,6 +71,8 @@ mod platform { pub use crate::os::solaris::*; #[cfg(target_os = "vxworks")] pub use crate::os::vxworks::*; + #[cfg(target_os = "watchos")] + pub use crate::os::watchos::*; } pub mod ffi; @@ -88,6 +90,7 @@ pub mod thread; target_os = "dragonfly", target_os = "freebsd", target_os = "ios", + target_os = "watchos", target_os = "macos", target_os = "netbsd", target_os = "openbsd" diff --git a/library/std/src/os/unix/net/stream.rs b/library/std/src/os/unix/net/stream.rs index 3943b4fed0949..a97474055e574 100644 --- a/library/std/src/os/unix/net/stream.rs +++ b/library/std/src/os/unix/net/stream.rs @@ -20,6 +20,7 @@ use crate::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, Owned target_os = "dragonfly", target_os = "freebsd", target_os = "ios", + target_os = "watchos", target_os = "macos", target_os = "netbsd", target_os = "openbsd" @@ -38,6 +39,7 @@ use crate::time::Duration; target_os = "dragonfly", target_os = "freebsd", target_os = "ios", + target_os = "watchos", target_os = "macos", target_os = "netbsd", target_os = "openbsd" @@ -246,6 +248,7 @@ impl UnixStream { target_os = "dragonfly", target_os = "freebsd", target_os = "ios", + target_os = "watchos", target_os = "macos", target_os = "netbsd", target_os = "openbsd" diff --git a/library/std/src/os/unix/ucred.rs b/library/std/src/os/unix/ucred.rs index 32e6430d3f627..382d425c1a814 100644 --- a/library/std/src/os/unix/ucred.rs +++ b/library/std/src/os/unix/ucred.rs @@ -36,7 +36,7 @@ pub use self::impl_linux::peer_cred; ))] pub use self::impl_bsd::peer_cred; -#[cfg(any(target_os = "macos", target_os = "ios",))] +#[cfg(any(target_os = "macos", target_os = "ios", target_os = "watchos",))] pub use self::impl_mac::peer_cred; #[cfg(any(target_os = "linux", target_os = "android"))] @@ -97,7 +97,7 @@ pub mod impl_bsd { } } -#[cfg(any(target_os = "macos", target_os = "ios",))] +#[cfg(any(target_os = "macos", target_os = "ios", target_os = "watchos",))] pub mod impl_mac { use super::UCred; use crate::os::unix::io::AsRawFd; diff --git a/library/std/src/os/unix/ucred/tests.rs b/library/std/src/os/unix/ucred/tests.rs index 42d79418cf78f..3d9f4d8f3ad3f 100644 --- a/library/std/src/os/unix/ucred/tests.rs +++ b/library/std/src/os/unix/ucred/tests.rs @@ -8,6 +8,7 @@ use libc::{getegid, geteuid, getpid}; target_os = "dragonfly", target_os = "freebsd", target_os = "ios", + target_os = "watchos", target_os = "macos", target_os = "openbsd" ))] @@ -25,7 +26,7 @@ fn test_socket_pair() { } #[test] -#[cfg(any(target_os = "linux", target_os = "ios", target_os = "macos",))] +#[cfg(any(target_os = "linux", target_os = "ios", target_os = "macos", target_os = "watchos",))] fn test_socket_pair_pids(arg: Type) -> RetType { // Create two connected sockets and get their peer credentials. let (sock_a, sock_b) = UnixStream::pair().unwrap(); diff --git a/library/std/src/os/watchos/fs.rs b/library/std/src/os/watchos/fs.rs new file mode 100644 index 0000000000000..3cf3d4a4521d5 --- /dev/null +++ b/library/std/src/os/watchos/fs.rs @@ -0,0 +1,142 @@ +#![stable(feature = "metadata_ext", since = "1.1.0")] + +use crate::fs::Metadata; +use crate::sys_common::AsInner; + +#[allow(deprecated)] +use crate::os::watchos::raw; + +/// OS-specific extensions to [`fs::Metadata`]. +/// +/// [`fs::Metadata`]: crate::fs::Metadata +#[stable(feature = "metadata_ext", since = "1.1.0")] +pub trait MetadataExt { + /// Gain a reference to the underlying `stat` structure which contains + /// the raw information returned by the OS. + /// + /// The contents of the returned `stat` are **not** consistent across + /// Unix platforms. The `os::unix::fs::MetadataExt` trait contains the + /// cross-Unix abstractions contained within the raw stat. + #[stable(feature = "metadata_ext", since = "1.1.0")] + #[rustc_deprecated( + since = "1.8.0", + reason = "deprecated in favor of the accessor \ + methods of this trait" + )] + #[allow(deprecated)] + fn as_raw_stat(&self) -> &raw::stat; + + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_dev(&self) -> u64; + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_ino(&self) -> u64; + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_mode(&self) -> u32; + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_nlink(&self) -> u64; + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_uid(&self) -> u32; + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_gid(&self) -> u32; + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_rdev(&self) -> u64; + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_size(&self) -> u64; + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_atime(&self) -> i64; + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_atime_nsec(&self) -> i64; + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_mtime(&self) -> i64; + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_mtime_nsec(&self) -> i64; + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_ctime(&self) -> i64; + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_ctime_nsec(&self) -> i64; + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_birthtime(&self) -> i64; + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_birthtime_nsec(&self) -> i64; + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_blksize(&self) -> u64; + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_blocks(&self) -> u64; + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_flags(&self) -> u32; + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_gen(&self) -> u32; + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_lspare(&self) -> u32; +} + +#[stable(feature = "metadata_ext", since = "1.1.0")] +impl MetadataExt for Metadata { + #[allow(deprecated)] + fn as_raw_stat(&self) -> &raw::stat { + unsafe { &*(self.as_inner().as_inner() as *const libc::stat as *const raw::stat) } + } + fn st_dev(&self) -> u64 { + self.as_inner().as_inner().st_dev as u64 + } + fn st_ino(&self) -> u64 { + self.as_inner().as_inner().st_ino as u64 + } + fn st_mode(&self) -> u32 { + self.as_inner().as_inner().st_mode as u32 + } + fn st_nlink(&self) -> u64 { + self.as_inner().as_inner().st_nlink as u64 + } + fn st_uid(&self) -> u32 { + self.as_inner().as_inner().st_uid as u32 + } + fn st_gid(&self) -> u32 { + self.as_inner().as_inner().st_gid as u32 + } + fn st_rdev(&self) -> u64 { + self.as_inner().as_inner().st_rdev as u64 + } + fn st_size(&self) -> u64 { + self.as_inner().as_inner().st_size as u64 + } + fn st_atime(&self) -> i64 { + self.as_inner().as_inner().st_atime as i64 + } + fn st_atime_nsec(&self) -> i64 { + self.as_inner().as_inner().st_atime_nsec as i64 + } + fn st_mtime(&self) -> i64 { + self.as_inner().as_inner().st_mtime as i64 + } + fn st_mtime_nsec(&self) -> i64 { + self.as_inner().as_inner().st_mtime_nsec as i64 + } + fn st_ctime(&self) -> i64 { + self.as_inner().as_inner().st_ctime as i64 + } + fn st_ctime_nsec(&self) -> i64 { + self.as_inner().as_inner().st_ctime_nsec as i64 + } + fn st_birthtime(&self) -> i64 { + self.as_inner().as_inner().st_birthtime as i64 + } + fn st_birthtime_nsec(&self) -> i64 { + self.as_inner().as_inner().st_birthtime_nsec as i64 + } + fn st_blksize(&self) -> u64 { + self.as_inner().as_inner().st_blksize as u64 + } + fn st_blocks(&self) -> u64 { + self.as_inner().as_inner().st_blocks as u64 + } + fn st_gen(&self) -> u32 { + self.as_inner().as_inner().st_gen as u32 + } + fn st_flags(&self) -> u32 { + self.as_inner().as_inner().st_flags as u32 + } + fn st_lspare(&self) -> u32 { + self.as_inner().as_inner().st_lspare as u32 + } +} diff --git a/library/std/src/os/watchos/mod.rs b/library/std/src/os/watchos/mod.rs new file mode 100644 index 0000000000000..cd6454ebbf99b --- /dev/null +++ b/library/std/src/os/watchos/mod.rs @@ -0,0 +1,6 @@ +//! watchOS-specific definitions + +#![stable(feature = "raw_ext", since = "1.1.0")] + +pub mod fs; +pub mod raw; diff --git a/library/std/src/os/watchos/raw.rs b/library/std/src/os/watchos/raw.rs new file mode 100644 index 0000000000000..d9d9995a5ac7f --- /dev/null +++ b/library/std/src/os/watchos/raw.rs @@ -0,0 +1,83 @@ +//! watchOS-specific raw type definitions + +#![stable(feature = "raw_ext", since = "1.1.0")] +#![rustc_deprecated( + since = "1.8.0", + reason = "these type aliases are no longer supported by \ + the standard library, the `libc` crate on \ + crates.io should be used instead for the correct \ + definitions" +)] +#![allow(deprecated)] + +use crate::os::raw::c_long; + +#[stable(feature = "raw_ext", since = "1.1.0")] +pub type blkcnt_t = u64; +#[stable(feature = "raw_ext", since = "1.1.0")] +pub type blksize_t = u64; +#[stable(feature = "raw_ext", since = "1.1.0")] +pub type dev_t = u64; +#[stable(feature = "raw_ext", since = "1.1.0")] +pub type ino_t = u64; +#[stable(feature = "raw_ext", since = "1.1.0")] +pub type mode_t = u32; +#[stable(feature = "raw_ext", since = "1.1.0")] +pub type nlink_t = u64; +#[stable(feature = "raw_ext", since = "1.1.0")] +pub type off_t = u64; +#[stable(feature = "raw_ext", since = "1.1.0")] +pub type time_t = i64; + +#[stable(feature = "pthread_t", since = "1.8.0")] +pub type pthread_t = usize; + +#[repr(C)] +#[derive(Clone)] +#[stable(feature = "raw_ext", since = "1.1.0")] +pub struct stat { + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_dev: i32, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_mode: u16, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_nlink: u16, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_ino: u64, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_uid: u32, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_gid: u32, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_rdev: i32, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_atime: c_long, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_atime_nsec: c_long, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_mtime: c_long, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_mtime_nsec: c_long, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_ctime: c_long, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_ctime_nsec: c_long, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_birthtime: c_long, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_birthtime_nsec: c_long, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_size: i64, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_blocks: i64, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_blksize: i32, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_flags: u32, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_gen: u32, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_lspare: i32, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_qspare: [i64; 2], +} diff --git a/library/std/src/sys/unix/args.rs b/library/std/src/sys/unix/args.rs index ee5e3983ac26a..662b7d144006c 100644 --- a/library/std/src/sys/unix/args.rs +++ b/library/std/src/sys/unix/args.rs @@ -150,7 +150,7 @@ mod imp { } } -#[cfg(any(target_os = "macos", target_os = "ios"))] +#[cfg(any(target_os = "macos", target_os = "ios", target_os = "watchos"))] mod imp { use super::Args; use crate::ffi::CStr; @@ -191,7 +191,7 @@ mod imp { // for i in (0..[args count]) // res.push([args objectAtIndex:i]) // res - #[cfg(target_os = "ios")] + #[cfg(any(target_os = "ios", target_os = "watchos"))] pub fn args() -> Args { use crate::ffi::OsString; use crate::mem; diff --git a/library/std/src/sys/unix/env.rs b/library/std/src/sys/unix/env.rs index 60551aeb3e73e..63c5f99974fdb 100644 --- a/library/std/src/sys/unix/env.rs +++ b/library/std/src/sys/unix/env.rs @@ -31,6 +31,17 @@ pub mod os { pub const EXE_EXTENSION: &str = ""; } +#[cfg(target_os = "watchos")] +pub mod os { + pub const FAMILY: &str = "unix"; + pub const OS: &str = "watchos"; + pub const DLL_PREFIX: &str = "lib"; + pub const DLL_SUFFIX: &str = ".dylib"; + pub const DLL_EXTENSION: &str = "dylib"; + pub const EXE_SUFFIX: &str = ""; + pub const EXE_EXTENSION: &str = ""; +} + #[cfg(target_os = "freebsd")] pub mod os { pub const FAMILY: &str = "unix"; diff --git a/library/std/src/sys/unix/fd.rs b/library/std/src/sys/unix/fd.rs index 3de7c68a6866d..c957b69934d93 100644 --- a/library/std/src/sys/unix/fd.rs +++ b/library/std/src/sys/unix/fd.rs @@ -31,6 +31,7 @@ const READ_LIMIT: usize = libc::ssize_t::MAX as usize; target_os = "dragonfly", target_os = "freebsd", target_os = "ios", + target_os = "watchos", target_os = "macos", target_os = "netbsd", target_os = "openbsd", @@ -50,6 +51,7 @@ const fn max_iov() -> usize { target_os = "emscripten", target_os = "freebsd", target_os = "ios", + target_os = "watchos", target_os = "linux", target_os = "macos", target_os = "netbsd", diff --git a/library/std/src/sys/unix/fs.rs b/library/std/src/sys/unix/fs.rs index b93a3d677711f..8230fb9b76e78 100644 --- a/library/std/src/sys/unix/fs.rs +++ b/library/std/src/sys/unix/fs.rs @@ -394,7 +394,8 @@ impl FileAttr { target_os = "freebsd", target_os = "openbsd", target_os = "macos", - target_os = "ios" + target_os = "ios", + target_os = "watchos" ))] pub fn created(&self) -> io::Result { Ok(SystemTime::from(libc::timespec { @@ -407,7 +408,8 @@ impl FileAttr { target_os = "freebsd", target_os = "openbsd", target_os = "macos", - target_os = "ios" + target_os = "ios", + target_os = "watchos" )))] pub fn created(&self) -> io::Result { cfg_has_statx! { @@ -664,6 +666,7 @@ impl DirEntry { #[cfg(any( target_os = "macos", target_os = "ios", + target_os = "watchos", target_os = "linux", target_os = "emscripten", target_os = "android", @@ -693,6 +696,7 @@ impl DirEntry { #[cfg(any( target_os = "macos", target_os = "ios", + target_os = "watchos", target_os = "netbsd", target_os = "openbsd", target_os = "freebsd", @@ -867,11 +871,11 @@ impl File { cvt_r(|| unsafe { os_fsync(self.as_raw_fd()) })?; return Ok(()); - #[cfg(any(target_os = "macos", target_os = "ios"))] + #[cfg(any(target_os = "macos", target_os = "ios", target_os = "watchos"))] unsafe fn os_fsync(fd: c_int) -> c_int { libc::fcntl(fd, libc::F_FULLFSYNC) } - #[cfg(not(any(target_os = "macos", target_os = "ios")))] + #[cfg(not(any(target_os = "macos", target_os = "ios", target_os = "watchos")))] unsafe fn os_fsync(fd: c_int) -> c_int { libc::fsync(fd) } @@ -881,7 +885,7 @@ impl File { cvt_r(|| unsafe { os_datasync(self.as_raw_fd()) })?; return Ok(()); - #[cfg(any(target_os = "macos", target_os = "ios"))] + #[cfg(any(target_os = "macos", target_os = "ios", target_os = "watchos"))] unsafe fn os_datasync(fd: c_int) -> c_int { libc::fcntl(fd, libc::F_FULLFSYNC) } @@ -899,6 +903,7 @@ impl File { target_os = "android", target_os = "freebsd", target_os = "ios", + target_os = "watchos", target_os = "linux", target_os = "macos", target_os = "netbsd", @@ -1353,7 +1358,8 @@ fn open_to_and_set_permissions( target_os = "linux", target_os = "android", target_os = "macos", - target_os = "ios" + target_os = "ios", + target_os = "watchos" )))] pub fn copy(from: &Path, to: &Path) -> io::Result { let (mut reader, reader_metadata) = open_from(from)?; @@ -1380,7 +1386,7 @@ pub fn copy(from: &Path, to: &Path) -> io::Result { } } -#[cfg(any(target_os = "macos", target_os = "ios"))] +#[cfg(any(target_os = "macos", target_os = "ios", target_os = "watchos"))] pub fn copy(from: &Path, to: &Path) -> io::Result { use crate::sync::atomic::{AtomicBool, Ordering}; diff --git a/library/std/src/sys/unix/locks/pthread_condvar.rs b/library/std/src/sys/unix/locks/pthread_condvar.rs index 099aa68706fa3..210b41fb45e97 100644 --- a/library/std/src/sys/unix/locks/pthread_condvar.rs +++ b/library/std/src/sys/unix/locks/pthread_condvar.rs @@ -28,6 +28,7 @@ impl Condvar { #[cfg(any( target_os = "macos", target_os = "ios", + target_os = "watchos", target_os = "l4re", target_os = "android", target_os = "redox" @@ -47,6 +48,7 @@ impl Condvar { #[cfg(not(any( target_os = "macos", target_os = "ios", + target_os = "watchos", target_os = "l4re", target_os = "android", target_os = "redox", @@ -90,8 +92,10 @@ impl Condvar { #[cfg(not(any( target_os = "macos", target_os = "ios", + target_os = "watchos", target_os = "android", target_os = "espidf" + target_os = "android", )))] pub unsafe fn wait_timeout(&self, mutex: &Mutex, dur: Duration) -> bool { use crate::mem; @@ -122,8 +126,10 @@ impl Condvar { #[cfg(any( target_os = "macos", target_os = "ios", + target_os = "watchos", target_os = "android", target_os = "espidf" + target_os = "android", ))] pub unsafe fn wait_timeout(&self, mutex: &Mutex, mut dur: Duration) -> bool { use crate::ptr; diff --git a/library/std/src/sys/unix/mod.rs b/library/std/src/sys/unix/mod.rs index e65c11b6d09fa..fb1313f2b7237 100644 --- a/library/std/src/sys/unix/mod.rs +++ b/library/std/src/sys/unix/mod.rs @@ -77,6 +77,7 @@ pub unsafe fn init(argc: isize, argv: *const *const u8) { // The poll on Darwin doesn't set POLLNVAL for closed fds. target_os = "macos", target_os = "ios", + target_os = "watchos", target_os = "redox", target_os = "l4re", )))] { @@ -104,7 +105,7 @@ pub unsafe fn init(argc: isize, argv: *const *const u8) { libc::abort(); } } - } else if #[cfg(any(target_os = "macos", target_os = "ios", target_os = "redox"))] { + } else if #[cfg(any(target_os = "macos", target_os = "ios", target_os = "watchos", target_os = "redox"))] { use crate::sys::os::errno; for fd in 0..3 { if libc::fcntl(fd, libc::F_GETFD) == -1 && errno() == libc::EBADF { @@ -295,7 +296,7 @@ cfg_if::cfg_if! { // See #41582 and https://blog.achernya.com/2013/03/os-x-has-silly-libsystem.html #[link(name = "resolv")] extern "C" {} - } else if #[cfg(target_os = "ios")] { + } else if #[cfg(any(target_os = "ios", target_os = "watchos"))] { #[link(name = "System")] #[link(name = "objc")] #[link(name = "Security", kind = "framework")] diff --git a/library/std/src/sys/unix/os.rs b/library/std/src/sys/unix/os.rs index 0b6cdb923bd6a..44797b420ecae 100644 --- a/library/std/src/sys/unix/os.rs +++ b/library/std/src/sys/unix/os.rs @@ -61,7 +61,7 @@ extern "C" { )] #[cfg_attr(any(target_os = "solaris", target_os = "illumos"), link_name = "___errno")] #[cfg_attr( - any(target_os = "macos", target_os = "ios", target_os = "freebsd"), + any(target_os = "macos", target_os = "ios", target_os = "watchos", target_os = "freebsd"), link_name = "__error" )] #[cfg_attr(target_os = "haiku", link_name = "_errnop")] @@ -361,7 +361,7 @@ pub fn current_exe() -> io::Result { } } -#[cfg(any(target_os = "macos", target_os = "ios"))] +#[cfg(any(target_os = "macos", target_os = "ios", target_os = "watchos"))] pub fn current_exe() -> io::Result { unsafe { let mut sz: u32 = 0; @@ -578,6 +578,7 @@ pub fn home_dir() -> Option { #[cfg(any( target_os = "android", target_os = "ios", + target_os = "watchos", target_os = "emscripten", target_os = "redox", target_os = "vxworks", @@ -589,6 +590,7 @@ pub fn home_dir() -> Option { #[cfg(not(any( target_os = "android", target_os = "ios", + target_os = "watchos", target_os = "emscripten", target_os = "redox", target_os = "vxworks", diff --git a/library/std/src/sys/unix/rand.rs b/library/std/src/sys/unix/rand.rs index 17e8efbe097ce..6ecb8546d48f8 100644 --- a/library/std/src/sys/unix/rand.rs +++ b/library/std/src/sys/unix/rand.rs @@ -14,6 +14,7 @@ pub fn hashmap_random_keys() -> (u64, u64) { unix, not(target_os = "macos"), not(target_os = "ios"), + not(target_os = "watchos"), not(target_os = "openbsd"), not(target_os = "freebsd"), not(target_os = "netbsd"), @@ -170,7 +171,7 @@ mod imp { // once per thread in `hashmap_random_keys`. Therefore `SecRandomCopyBytes` is // only used on iOS where direct access to `/dev/urandom` is blocked by the // sandbox. -#[cfg(target_os = "ios")] +#[cfg(any(target_os = "ios", target_os = "watchos"))] mod imp { use crate::io; use crate::ptr; diff --git a/library/std/src/sys/unix/thread.rs b/library/std/src/sys/unix/thread.rs index 2d5d306ed62bb..f121f5045e41c 100644 --- a/library/std/src/sys/unix/thread.rs +++ b/library/std/src/sys/unix/thread.rs @@ -133,7 +133,7 @@ impl Thread { } } - #[cfg(any(target_os = "macos", target_os = "ios"))] + #[cfg(any(target_os = "macos", target_os = "ios", target_os = "watchos"))] pub fn set_name(name: &CStr) { unsafe { libc::pthread_setname_np(name.as_ptr()); diff --git a/library/std/src/sys/unix/time.rs b/library/std/src/sys/unix/time.rs index 59ddd1aa92f81..c594ec9e7192b 100644 --- a/library/std/src/sys/unix/time.rs +++ b/library/std/src/sys/unix/time.rs @@ -114,7 +114,7 @@ impl Hash for Timespec { } } -#[cfg(any(target_os = "macos", target_os = "ios"))] +#[cfg(any(target_os = "macos", target_os = "ios", target_os = "watchos"))] mod inner { use crate::fmt; use crate::sync::atomic::{AtomicU64, Ordering}; @@ -263,7 +263,7 @@ mod inner { } } -#[cfg(not(any(target_os = "macos", target_os = "ios")))] +#[cfg(not(any(target_os = "macos", target_os = "ios", target_os = "watchos")))] mod inner { use crate::fmt; use crate::sys::cvt; diff --git a/library/std/src/sys_common/net.rs b/library/std/src/sys_common/net.rs index 3b7cdd55a081c..c3b6ba9a6e4e6 100644 --- a/library/std/src/sys_common/net.rs +++ b/library/std/src/sys_common/net.rs @@ -19,7 +19,7 @@ use libc::{c_int, c_void}; cfg_if::cfg_if! { if #[cfg(any( target_os = "dragonfly", target_os = "freebsd", - target_os = "ios", target_os = "macos", + target_os = "ios", target_os = "macos", target_os = "watchos", target_os = "openbsd", target_os = "netbsd", target_os = "illumos", target_os = "solaris", target_os = "haiku", target_os = "l4re"))] { use crate::sys::net::netc::IPV6_JOIN_GROUP as IPV6_ADD_MEMBERSHIP; diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs index a810a57feb7bb..256059b43760b 100644 --- a/src/bootstrap/native.rs +++ b/src/bootstrap/native.rs @@ -231,7 +231,10 @@ impl Step for Llvm { } // Are we compiling for iOS/tvOS? - if target.contains("apple-ios") || target.contains("apple-tvos") { + if target.contains("apple-ios") + || target.contains("apple-tvos") + || target.contains("apple-watchos") + { // These two defines prevent CMake from automatically trying to add a MacOSX sysroot, which leads to a compiler error. cfg.define("CMAKE_OSX_SYSROOT", "/"); cfg.define("CMAKE_OSX_DEPLOYMENT_TARGET", ""); diff --git a/src/tools/compiletest/src/raise_fd_limit.rs b/src/tools/compiletest/src/raise_fd_limit.rs index faded7c802483..a76df2bd7368b 100644 --- a/src/tools/compiletest/src/raise_fd_limit.rs +++ b/src/tools/compiletest/src/raise_fd_limit.rs @@ -50,5 +50,5 @@ pub unsafe fn raise_fd_limit() { } } -#[cfg(not(any(target_os = "macos", target_os = "ios")))] +#[cfg(not(any(target_os = "macos", target_os = "ios", target_os = "watchos")))] pub unsafe fn raise_fd_limit() {} diff --git a/src/tools/compiletest/src/util.rs b/src/tools/compiletest/src/util.rs index bed509d77be77..bbcd81a74e438 100644 --- a/src/tools/compiletest/src/util.rs +++ b/src/tools/compiletest/src/util.rs @@ -22,6 +22,7 @@ const OS_TABLE: &[(&str, &str)] = &[ ("hermit", "hermit"), ("illumos", "illumos"), ("ios", "ios"), + ("watchos", "watchos"), ("l4re", "l4re"), ("linux", "linux"), ("mingw32", "windows"), From 5aee29bb997bba377c4c265dd22a7b66a43857e6 Mon Sep 17 00:00:00 2001 From: Vladimir Michael Eatwell Date: Sun, 20 Jun 2021 08:43:53 +0100 Subject: [PATCH 03/10] [watchos] Add bitcode for armv7k, fix unwind for armv7k --- .../rustc_target/src/spec/armv7k_apple_watchos.rs | 11 +++++++++++ library/panic_unwind/src/dwarf/eh.rs | 2 +- library/unwind/src/libunwind.rs | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_target/src/spec/armv7k_apple_watchos.rs b/compiler/rustc_target/src/spec/armv7k_apple_watchos.rs index 5fe07264d095b..2f672ae06533d 100644 --- a/compiler/rustc_target/src/spec/armv7k_apple_watchos.rs +++ b/compiler/rustc_target/src/spec/armv7k_apple_watchos.rs @@ -12,6 +12,17 @@ pub fn target() -> Target { features: "+v7,+vfp4,+neon".to_string(), max_atomic_width: Some(64), unsupported_abis: super::arm_base::unsupported_abis(), + forces_embed_bitcode: true, + // These arguments are not actually invoked - they just have + // to look right to pass App Store validation. + bitcode_llvm_cmdline: "-triple\0\ + armv7k-apple-watchos3.0.0\0\ + -emit-obj\0\ + -disable-llvm-passes\0\ + -target-abi\0\ + darwinpcs\0\ + -Os\0" + .to_string(), ..base }, } diff --git a/library/panic_unwind/src/dwarf/eh.rs b/library/panic_unwind/src/dwarf/eh.rs index 44086cd141e59..8d59fa43ad996 100644 --- a/library/panic_unwind/src/dwarf/eh.rs +++ b/library/panic_unwind/src/dwarf/eh.rs @@ -50,7 +50,7 @@ pub enum EHAction { } pub const USING_SJLJ_EXCEPTIONS: bool = - cfg!(all(any(target_os = "ios", target_os = "watchos"), target_arch = "arm")); + cfg!(all(target_os = "ios", target_arch = "arm")); pub unsafe fn find_eh_action(lsda: *const u8, context: &EHContext<'_>) -> Result { if lsda.is_null() { diff --git a/library/unwind/src/libunwind.rs b/library/unwind/src/libunwind.rs index 380d8ec6838e0..cfe4290ca9953 100644 --- a/library/unwind/src/libunwind.rs +++ b/library/unwind/src/libunwind.rs @@ -240,7 +240,7 @@ if #[cfg(any(target_os = "ios", target_os = "watchos", target_os = "netbsd", not } // cfg_if! cfg_if::cfg_if! { -if #[cfg(not(all(any(target_os = "ios", target_os = "watchos"), target_arch = "arm")))] { +if #[cfg(not(all(target_os = "ios", target_arch = "arm")))] { // Not 32-bit iOS #[cfg_attr( all(feature = "llvm-libunwind", any(target_os = "fuchsia", target_os = "linux")), From de13bd335bfd537faf4c7bcad85f611e361c981e Mon Sep 17 00:00:00 2001 From: Vladimir Michael Eatwell Date: Tue, 8 Mar 2022 14:18:53 +0000 Subject: [PATCH 04/10] [watchos] Update WatchOs support - add to supported platforms --- Cargo.lock | 13 +++++-------- Cargo.toml | 7 +++++-- compiler/rustc_codegen_ssa/src/back/link.rs | 4 ++-- compiler/rustc_target/src/spec/apple_sdk_base.rs | 2 +- .../rustc_target/src/spec/arm64_32_apple_watchos.rs | 1 - .../rustc_target/src/spec/armv7k_apple_watchos.rs | 1 - .../src/spec/x86_64_apple_watchos_sim.rs | 6 +++--- library/std/src/sys/unix/fs.rs | 3 +++ library/std/src/sys/unix/locks/pthread_condvar.rs | 2 -- library/unwind/src/libunwind.rs | 2 +- src/doc/rustc/src/platform-support.md | 3 +++ 11 files changed, 23 insertions(+), 21 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 48518008b7d45..62c35678d54e9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -490,9 +490,8 @@ version = "0.1.0" [[package]] name = "cc" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e70cc2f62c6ce1868963827bd677764c62d07c3d9a3e1fb1177ee1a9ab199eb2" +version = "1.0.73" +source = "git+https://github.com/alexcrichton/cc-rs?rev=refs/pull/662/head#73f8fe4b5c0024d855398e4fa4ae68b5b82221f2" dependencies = [ "jobserver", ] @@ -734,8 +733,7 @@ dependencies = [ [[package]] name = "compiler_builtins" version = "0.1.70" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80873f979f0a344a4ade87c2f70d9ccf5720b83b10c97ec7cd745895d021e85a" +source = "git+https://github.com/rust-lang/compiler-builtins?rev=refs/pull/456/head#eb68e3a2f2a0bd4ea625e4287c2eb2069d1c4fa2" dependencies = [ "cc", "rustc-std-workspace-core", @@ -1965,9 +1963,8 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.116" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "565dbd88872dbe4cc8a46e527f26483c1d1f7afa6b884a3bd6cd893d4f98da74" +version = "0.2.119" +source = "git+https://github.com/rust-lang/libc?rev=refs/pull/2717/head#f073685f728891f104bf2125f1bcb9f123cf5d3b" dependencies = [ "rustc-std-workspace-core", ] diff --git a/Cargo.toml b/Cargo.toml index 0ec3f510ea81f..938510f0eef6c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -125,8 +125,11 @@ rustfmt-nightly = { path = "src/tools/rustfmt" } # See comments in `src/tools/rustc-workspace-hack/README.md` for what's going on # here rustc-workspace-hack = { path = 'src/tools/rustc-workspace-hack' } -cc = { git = "https://github.com/vladimir-ea/cc-rs", branch = "watch_os" } -libc = { git = "https://github.com/vladimir-ea/libc", branch = "watch_os" } + +# TODO prerequisite changes +compiler_builtins = { git = "https://github.com/rust-lang/compiler-builtins", rev = "refs/pull/456/head" } +cc = { git = "https://github.com/alexcrichton/cc-rs", rev = "refs/pull/662/head" } +libc = { git = "https://github.com/rust-lang/libc", rev = "refs/pull/2717/head" } # See comments in `library/rustc-std-workspace-core/README.md` for what's going on # here diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs index 5d188e304dc38..845091eae0d7e 100644 --- a/compiler/rustc_codegen_ssa/src/back/link.rs +++ b/compiler/rustc_codegen_ssa/src/back/link.rs @@ -2475,7 +2475,7 @@ fn add_apple_sdk(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavor) { ("x86_64", "watchos") => "watchsimulator", ("arm64_32", "watchos") => "watchos", ("aarch64", "watchos") => "watchos", - ("armv7k", "watchos") => "watchos", + ("arm", "watchos") => "watchos", _ => { sess.err(&format!("unsupported arch `{}` for os `{}`", arch, os)); return; @@ -2533,7 +2533,7 @@ fn get_apple_sdk_root(sdk_name: &str) -> Result { } } let res = - Command::new("xcrunp").arg("--show-sdk-path").arg("-sdk").arg(sdk_name).output().and_then( + Command::new("xcrun").arg("--show-sdk-path").arg("-sdk").arg(sdk_name).output().and_then( |output| { if output.status.success() { Ok(String::from_utf8(output.stdout).unwrap()) diff --git a/compiler/rustc_target/src/spec/apple_sdk_base.rs b/compiler/rustc_target/src/spec/apple_sdk_base.rs index 0bcccf1df2d93..dae782169168f 100644 --- a/compiler/rustc_target/src/spec/apple_sdk_base.rs +++ b/compiler/rustc_target/src/spec/apple_sdk_base.rs @@ -18,7 +18,7 @@ pub enum Arch { fn target_abi(arch: Arch) -> String { match arch { - Armv7 | Armv7s | Arm64 | I386 | X86_64 => "", + Armv7 | Armv7k | Armv7s | Arm64 | Arm64_32 | I386 | X86_64 => "", X86_64_macabi | Arm64_macabi => "macabi", Arm64_sim => "sim", } diff --git a/compiler/rustc_target/src/spec/arm64_32_apple_watchos.rs b/compiler/rustc_target/src/spec/arm64_32_apple_watchos.rs index 504bcd63052c7..54bb8c93ab9df 100644 --- a/compiler/rustc_target/src/spec/arm64_32_apple_watchos.rs +++ b/compiler/rustc_target/src/spec/arm64_32_apple_watchos.rs @@ -11,7 +11,6 @@ pub fn target() -> Target { options: TargetOptions { features: "+neon,+fp-armv8,+apple-a7".to_string(), max_atomic_width: Some(64), - unsupported_abis: super::arm_base::unsupported_abis(), forces_embed_bitcode: true, // These arguments are not actually invoked - they just have // to look right to pass App Store validation. diff --git a/compiler/rustc_target/src/spec/armv7k_apple_watchos.rs b/compiler/rustc_target/src/spec/armv7k_apple_watchos.rs index 2f672ae06533d..fef027e999f69 100644 --- a/compiler/rustc_target/src/spec/armv7k_apple_watchos.rs +++ b/compiler/rustc_target/src/spec/armv7k_apple_watchos.rs @@ -11,7 +11,6 @@ pub fn target() -> Target { options: TargetOptions { features: "+v7,+vfp4,+neon".to_string(), max_atomic_width: Some(64), - unsupported_abis: super::arm_base::unsupported_abis(), forces_embed_bitcode: true, // These arguments are not actually invoked - they just have // to look right to pass App Store validation. diff --git a/compiler/rustc_target/src/spec/x86_64_apple_watchos_sim.rs b/compiler/rustc_target/src/spec/x86_64_apple_watchos_sim.rs index 638f36a8bcba1..e52156876d948 100644 --- a/compiler/rustc_target/src/spec/x86_64_apple_watchos_sim.rs +++ b/compiler/rustc_target/src/spec/x86_64_apple_watchos_sim.rs @@ -1,5 +1,5 @@ use super::apple_sdk_base::{opts, Arch}; -use crate::spec::{StackProbeType, Target, TargetOptions}; +use crate::spec::{StackProbeType, Target, TargetOptions, LinkerFlavor, LldFlavor}; pub fn target() -> Target { let base = opts("watchos", Arch::X86_64); @@ -8,9 +8,9 @@ pub fn target() -> Target { let llvm_target = super::apple_base::watchos_sim_llvm_target(arch); Target { - llvm_target: llvm_target, + llvm_target, pointer_width: 64, - data_layout: "e-m:o-i64:64-f80:128-n8:16:32:64-S128".to_string(), + data_layout: "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128".to_string(), arch: "x86_64".to_string(), options: TargetOptions { max_atomic_width: Some(64), diff --git a/library/std/src/sys/unix/fs.rs b/library/std/src/sys/unix/fs.rs index 8230fb9b76e78..e9b039c467828 100644 --- a/library/std/src/sys/unix/fs.rs +++ b/library/std/src/sys/unix/fs.rs @@ -17,6 +17,7 @@ use crate::sys_common::{AsInner, AsInnerMut, FromInner, IntoInner}; all(target_os = "linux", target_env = "gnu"), target_os = "macos", target_os = "ios", + target_os = "watchos", ))] use crate::sys::weak::syscall; #[cfg(target_os = "macos")] @@ -27,6 +28,7 @@ use libc::{c_int, mode_t}; #[cfg(any( target_os = "macos", target_os = "ios", + target_os = "watchos", all(target_os = "linux", target_env = "gnu") ))] use libc::c_char; @@ -714,6 +716,7 @@ impl DirEntry { #[cfg(not(any( target_os = "macos", target_os = "ios", + target_os = "watchos", target_os = "netbsd", target_os = "openbsd", target_os = "freebsd", diff --git a/library/std/src/sys/unix/locks/pthread_condvar.rs b/library/std/src/sys/unix/locks/pthread_condvar.rs index 210b41fb45e97..6b14d55e8433e 100644 --- a/library/std/src/sys/unix/locks/pthread_condvar.rs +++ b/library/std/src/sys/unix/locks/pthread_condvar.rs @@ -95,7 +95,6 @@ impl Condvar { target_os = "watchos", target_os = "android", target_os = "espidf" - target_os = "android", )))] pub unsafe fn wait_timeout(&self, mutex: &Mutex, dur: Duration) -> bool { use crate::mem; @@ -129,7 +128,6 @@ impl Condvar { target_os = "watchos", target_os = "android", target_os = "espidf" - target_os = "android", ))] pub unsafe fn wait_timeout(&self, mutex: &Mutex, mut dur: Duration) -> bool { use crate::ptr; diff --git a/library/unwind/src/libunwind.rs b/library/unwind/src/libunwind.rs index cfe4290ca9953..25e96d2ad398e 100644 --- a/library/unwind/src/libunwind.rs +++ b/library/unwind/src/libunwind.rs @@ -33,7 +33,7 @@ pub const unwinder_private_data_size: usize = 6; #[cfg(all(target_arch = "arm", not(any(target_os = "ios", target_os = "watchos"))))] pub const unwinder_private_data_size: usize = 20; -#[cfg(all(target_arch = "arm", any(target_os = "ios", target_os = "watchos")))] +#[cfg(all(any(target_arch = "arm", target_arch="arm64_32"), any(target_os = "ios", target_os = "watchos")))] pub const unwinder_private_data_size: usize = 5; #[cfg(all(target_arch = "aarch64", target_pointer_width = "64"))] diff --git a/src/doc/rustc/src/platform-support.md b/src/doc/rustc/src/platform-support.md index cc92d273ed1c5..a1675828cd594 100644 --- a/src/doc/rustc/src/platform-support.md +++ b/src/doc/rustc/src/platform-support.md @@ -217,6 +217,7 @@ target | std | host | notes `aarch64-wrs-vxworks` | ? | | `aarch64_be-unknown-linux-gnu_ilp32` | ✓ | ✓ | ARM64 Linux (big-endian, ILP32 ABI) `aarch64_be-unknown-linux-gnu` | ✓ | ✓ | ARM64 Linux (big-endian) +`arm64_32-apple-watchos` | ✓ | | ARM Apple WatchOS 64-bit with 32-bit pointers `armv4t-unknown-linux-gnueabi` | ? | | `armv5te-unknown-linux-uclibceabi` | ? | | ARMv5TE Linux with uClibc `armv6-unknown-freebsd` | ✓ | ✓ | ARMv6 FreeBSD @@ -231,6 +232,7 @@ target | std | host | notes [`armv7a-kmc-solid_asp3-eabi`](platform-support/kmc-solid.md) | ✓ | | ARM SOLID with TOPPERS/ASP3 [`armv7a-kmc-solid_asp3-eabihf`](platform-support/kmc-solid.md) | ✓ | | ARM SOLID with TOPPERS/ASP3, hardfloat `armv7a-none-eabihf` | * | | ARM Cortex-A, hardfloat +`armv7k-apple-watchos` | ✓ | | ARM Apple WatchOS `armv7s-apple-ios` | ✓ | | `avr-unknown-gnu-atmega328` | * | | AVR. Requires `-Z build-std=core` `bpfeb-unknown-none` | * | | BPF (big endian) @@ -286,6 +288,7 @@ target | std | host | notes [`wasm64-unknown-unknown`](platform-support/wasm64-unknown-unknown.md) | ? | | WebAssembly `x86_64-apple-ios-macabi` | ✓ | | Apple Catalyst on x86_64 `x86_64-apple-tvos` | * | | x86 64-bit tvOS +`x86_64-apple-watchos-sim` | ✓ | | x86 64-bit Apple WatchOS simulator `x86_64-pc-windows-msvc` | * | | 64-bit Windows XP support `x86_64-sun-solaris` | ? | | Deprecated target for 64-bit Solaris 10/11, illumos `x86_64-unknown-dragonfly` | ✓ | ✓ | 64-bit DragonFlyBSD From 5fbf86938065c0e9ec51c69bd731a049f7fa8e5a Mon Sep 17 00:00:00 2001 From: Vladimir Michael Eatwell Date: Tue, 8 Mar 2022 14:39:35 +0000 Subject: [PATCH 05/10] [watchos] Remove unused imports in spec --- compiler/rustc_target/src/spec/x86_64_apple_watchos_sim.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_target/src/spec/x86_64_apple_watchos_sim.rs b/compiler/rustc_target/src/spec/x86_64_apple_watchos_sim.rs index e52156876d948..878ece8bcd628 100644 --- a/compiler/rustc_target/src/spec/x86_64_apple_watchos_sim.rs +++ b/compiler/rustc_target/src/spec/x86_64_apple_watchos_sim.rs @@ -1,5 +1,5 @@ use super::apple_sdk_base::{opts, Arch}; -use crate::spec::{StackProbeType, Target, TargetOptions, LinkerFlavor, LldFlavor}; +use crate::spec::{StackProbeType, Target, TargetOptions}; pub fn target() -> Target { let base = opts("watchos", Arch::X86_64); From 29c4c8bb3b481bdad76854ee55caca4464d592ff Mon Sep 17 00:00:00 2001 From: Vladimir Michael Eatwell Date: Tue, 8 Mar 2022 15:04:52 +0000 Subject: [PATCH 06/10] [watchos] remove crate patches --- Cargo.lock | 9 ++++++--- Cargo.toml | 5 ----- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 62c35678d54e9..6ea32af3dea62 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -491,7 +491,8 @@ version = "0.1.0" [[package]] name = "cc" version = "1.0.73" -source = "git+https://github.com/alexcrichton/cc-rs?rev=refs/pull/662/head#73f8fe4b5c0024d855398e4fa4ae68b5b82221f2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" dependencies = [ "jobserver", ] @@ -733,7 +734,8 @@ dependencies = [ [[package]] name = "compiler_builtins" version = "0.1.70" -source = "git+https://github.com/rust-lang/compiler-builtins?rev=refs/pull/456/head#eb68e3a2f2a0bd4ea625e4287c2eb2069d1c4fa2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80873f979f0a344a4ade87c2f70d9ccf5720b83b10c97ec7cd745895d021e85a" dependencies = [ "cc", "rustc-std-workspace-core", @@ -1964,7 +1966,8 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" version = "0.2.119" -source = "git+https://github.com/rust-lang/libc?rev=refs/pull/2717/head#f073685f728891f104bf2125f1bcb9f123cf5d3b" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bf2e165bb3457c8e098ea76f3e3bc9db55f87aa90d52d0e6be741470916aaa4" dependencies = [ "rustc-std-workspace-core", ] diff --git a/Cargo.toml b/Cargo.toml index 938510f0eef6c..4e78399606445 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -126,11 +126,6 @@ rustfmt-nightly = { path = "src/tools/rustfmt" } # here rustc-workspace-hack = { path = 'src/tools/rustc-workspace-hack' } -# TODO prerequisite changes -compiler_builtins = { git = "https://github.com/rust-lang/compiler-builtins", rev = "refs/pull/456/head" } -cc = { git = "https://github.com/alexcrichton/cc-rs", rev = "refs/pull/662/head" } -libc = { git = "https://github.com/rust-lang/libc", rev = "refs/pull/2717/head" } - # See comments in `library/rustc-std-workspace-core/README.md` for what's going on # here rustc-std-workspace-core = { path = 'library/rustc-std-workspace-core' } From a92030ad19c0ed76e4fd3d23b372a5e85109e8e4 Mon Sep 17 00:00:00 2001 From: Vladimir Michael Eatwell Date: Tue, 8 Mar 2022 15:23:53 +0000 Subject: [PATCH 07/10] [watchos] fix format --- library/panic_unwind/src/dwarf/eh.rs | 3 +-- library/std/src/os/mod.rs | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/library/panic_unwind/src/dwarf/eh.rs b/library/panic_unwind/src/dwarf/eh.rs index 8d59fa43ad996..7394feab82f22 100644 --- a/library/panic_unwind/src/dwarf/eh.rs +++ b/library/panic_unwind/src/dwarf/eh.rs @@ -49,8 +49,7 @@ pub enum EHAction { Terminate, } -pub const USING_SJLJ_EXCEPTIONS: bool = - cfg!(all(target_os = "ios", target_arch = "arm")); +pub const USING_SJLJ_EXCEPTIONS: bool = cfg!(all(target_os = "ios", target_arch = "arm")); pub unsafe fn find_eh_action(lsda: *const u8, context: &EHContext<'_>) -> Result { if lsda.is_null() { diff --git a/library/std/src/os/mod.rs b/library/std/src/os/mod.rs index 6182c5ad1c87b..241ee4cfe5c1a 100644 --- a/library/std/src/os/mod.rs +++ b/library/std/src/os/mod.rs @@ -129,8 +129,6 @@ pub mod illumos; pub mod ios; #[cfg(target_os = "l4re")] pub mod l4re; -#[cfg(target_os = "watchos")] -pub mod watchos; #[cfg(target_os = "macos")] pub mod macos; #[cfg(target_os = "netbsd")] @@ -141,11 +139,12 @@ pub mod openbsd; pub mod redox; #[cfg(target_os = "solaris")] pub mod solaris; - #[cfg(target_os = "solid_asp3")] pub mod solid; #[cfg(target_os = "vxworks")] pub mod vxworks; +#[cfg(target_os = "watchos")] +pub mod watchos; #[cfg(any(unix, target_os = "wasi", doc))] mod fd; From e57296d6650d3e5685fabb00d59c37bfe22adf8c Mon Sep 17 00:00:00 2001 From: Vladimir Michael Eatwell Date: Tue, 8 Mar 2022 15:38:23 +0000 Subject: [PATCH 08/10] [watchos] more format fix --- library/unwind/src/libunwind.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/library/unwind/src/libunwind.rs b/library/unwind/src/libunwind.rs index 25e96d2ad398e..4b9df5d4fd768 100644 --- a/library/unwind/src/libunwind.rs +++ b/library/unwind/src/libunwind.rs @@ -33,7 +33,10 @@ pub const unwinder_private_data_size: usize = 6; #[cfg(all(target_arch = "arm", not(any(target_os = "ios", target_os = "watchos"))))] pub const unwinder_private_data_size: usize = 20; -#[cfg(all(any(target_arch = "arm", target_arch="arm64_32"), any(target_os = "ios", target_os = "watchos")))] +#[cfg(all( + any(target_arch = "arm", target_arch = "arm64_32"), + any(target_os = "ios", target_os = "watchos") +))] pub const unwinder_private_data_size: usize = 5; #[cfg(all(target_arch = "aarch64", target_pointer_width = "64"))] From 44cb1417833b19aecdb8ed2c5bd9941d1e65b20c Mon Sep 17 00:00:00 2001 From: Vladimir Michael Eatwell Date: Tue, 8 Mar 2022 16:06:15 +0000 Subject: [PATCH 09/10] [watchos] fix formatting --- compiler/rustc_target/src/spec/x86_64_apple_watchos_sim.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_target/src/spec/x86_64_apple_watchos_sim.rs b/compiler/rustc_target/src/spec/x86_64_apple_watchos_sim.rs index 878ece8bcd628..77dc7938e0873 100644 --- a/compiler/rustc_target/src/spec/x86_64_apple_watchos_sim.rs +++ b/compiler/rustc_target/src/spec/x86_64_apple_watchos_sim.rs @@ -10,7 +10,8 @@ pub fn target() -> Target { Target { llvm_target, pointer_width: 64, - data_layout: "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128".to_string(), + data_layout: "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" + .to_string(), arch: "x86_64".to_string(), options: TargetOptions { max_atomic_width: Some(64), From 71711b9961af8c9c0a1b62a5b5ba0441de0ccb5a Mon Sep 17 00:00:00 2001 From: Vladimir Michael Eatwell Date: Tue, 8 Mar 2022 16:41:26 +0000 Subject: [PATCH 10/10] [watchos] Update expected cfg-check output to include watchos --- src/test/ui/check-cfg/well-known-values.stderr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/ui/check-cfg/well-known-values.stderr b/src/test/ui/check-cfg/well-known-values.stderr index 8b04c770fb505..4364d630b586f 100644 --- a/src/test/ui/check-cfg/well-known-values.stderr +++ b/src/test/ui/check-cfg/well-known-values.stderr @@ -7,7 +7,7 @@ LL | #[cfg(target_os = "linuz")] | help: did you mean: `"linux"` | = note: `#[warn(unexpected_cfgs)]` on by default - = note: expected values for `target_os` are: android, cuda, dragonfly, emscripten, espidf, freebsd, fuchsia, haiku, hermit, horizon, illumos, ios, l4re, linux, macos, netbsd, none, openbsd, psp, redox, solaris, solid_asp3, tvos, uefi, unknown, vxworks, wasi, windows + = note: expected values for `target_os` are: android, cuda, dragonfly, emscripten, espidf, freebsd, fuchsia, haiku, hermit, horizon, illumos, ios, l4re, linux, macos, netbsd, none, openbsd, psp, redox, solaris, solid_asp3, tvos, uefi, unknown, vxworks, wasi, watchos, windows warning: unexpected `cfg` condition value --> $DIR/well-known-values.rs:14:7