diff --git a/compiler/rustc_target/src/spec/base/mod.rs b/compiler/rustc_target/src/spec/base/mod.rs index 9e7ff620fea..13f364f3d82 100644 --- a/compiler/rustc_target/src/spec/base/mod.rs +++ b/compiler/rustc_target/src/spec/base/mod.rs @@ -26,8 +26,8 @@ pub(crate) mod managarm_mlibc; pub(crate) mod motor; pub(crate) mod msvc; pub(crate) mod netbsd; -pub(crate) mod nto_qnx; pub(crate) mod openbsd; +pub(crate) mod qnx_sdp; pub(crate) mod redox; pub(crate) mod solaris; pub(crate) mod solid; diff --git a/compiler/rustc_target/src/spec/base/nto_qnx.rs b/compiler/rustc_target/src/spec/base/qnx_sdp.rs similarity index 100% rename from compiler/rustc_target/src/spec/base/nto_qnx.rs rename to compiler/rustc_target/src/spec/base/qnx_sdp.rs diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs index f00b6e079c7..7d2115f81a1 100644 --- a/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs @@ -1791,10 +1791,10 @@ supported_targets! { ("aarch64-unknown-nto-qnx700", aarch64_unknown_nto_qnx700), ("aarch64-unknown-nto-qnx710", aarch64_unknown_nto_qnx710), ("aarch64-unknown-nto-qnx710_iosock", aarch64_unknown_nto_qnx710_iosock), - ("aarch64-unknown-nto-qnx800", aarch64_unknown_nto_qnx800), + ("aarch64-unknown-qnx", aarch64_unknown_qnx), ("x86_64-pc-nto-qnx710", x86_64_pc_nto_qnx710), ("x86_64-pc-nto-qnx710_iosock", x86_64_pc_nto_qnx710_iosock), - ("x86_64-pc-nto-qnx800", x86_64_pc_nto_qnx800), + ("x86_64-pc-qnx", x86_64_pc_qnx), ("i686-pc-nto-qnx700", i686_pc_nto_qnx700), ("aarch64-unknown-linux-ohos", aarch64_unknown_linux_ohos), @@ -1995,6 +1995,7 @@ crate::target_spec_enum! { OpenBsd = "openbsd", Psp = "psp", Psx = "psx", + Qnx = "qnx", Qurt = "qurt", Redox = "redox", Rtems = "rtems", @@ -2035,7 +2036,6 @@ crate::target_spec_enum! { Nto70 = "nto70", Nto71 = "nto71", Nto71IoSock = "nto71_iosock", - Nto80 = "nto80", Ohos = "ohos", Relibc = "relibc", Sgx = "sgx", diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_nto_qnx700.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_nto_qnx700.rs index e1f29f832f0..db8905dba6c 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_nto_qnx700.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_nto_qnx700.rs @@ -1,11 +1,12 @@ -use crate::spec::base::nto_qnx; +use crate::spec::base::qnx_sdp; use crate::spec::{Env, Target}; pub(crate) fn target() -> Target { - let mut target = nto_qnx::aarch64(); - target.metadata.description = Some("ARM64 QNX Neutrino 7.0 RTOS".into()); + let mut target = qnx_sdp::aarch64(); + target.metadata.description = Some("ARM64 QNX SDP 7.0".into()); target.options.pre_link_args = - nto_qnx::pre_link_args(nto_qnx::ApiVariant::Default, nto_qnx::Arch::Aarch64); + qnx_sdp::pre_link_args(qnx_sdp::ApiVariant::Default, qnx_sdp::Arch::Aarch64); + // for QNX SDP 7.x, we keep target_os = "nto" for backwards compatibility, and use target_env to specify which version target.options.env = Env::Nto70; target } diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_nto_qnx710.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_nto_qnx710.rs index 1baa56630d3..3a76a0e34d6 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_nto_qnx710.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_nto_qnx710.rs @@ -1,12 +1,12 @@ -use crate::spec::base::nto_qnx; +use crate::spec::base::qnx_sdp; use crate::spec::{Env, Target}; pub(crate) fn target() -> Target { - let mut target = nto_qnx::aarch64(); - target.metadata.description = - Some("ARM64 QNX Neutrino 7.1 RTOS with io-pkt network stack".into()); + let mut target = qnx_sdp::aarch64(); + target.metadata.description = Some("ARM64 QNX SDP 7.1 with io-pkt network stack".into()); target.options.pre_link_args = - nto_qnx::pre_link_args(nto_qnx::ApiVariant::Default, nto_qnx::Arch::Aarch64); + qnx_sdp::pre_link_args(qnx_sdp::ApiVariant::Default, qnx_sdp::Arch::Aarch64); + // for QNX SDP 7.x, we keep target_os = "nto" for backwards compatibility, and use target_env to specify which version target.options.env = Env::Nto71; target } diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_nto_qnx710_iosock.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_nto_qnx710_iosock.rs index 80ae93247a3..e612105201f 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_nto_qnx710_iosock.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_nto_qnx710_iosock.rs @@ -1,12 +1,12 @@ -use crate::spec::base::nto_qnx; +use crate::spec::base::qnx_sdp; use crate::spec::{Env, Target}; pub(crate) fn target() -> Target { - let mut target = nto_qnx::aarch64(); - target.metadata.description = - Some("ARM64 QNX Neutrino 7.1 RTOS with io-sock network stack".into()); + let mut target = qnx_sdp::aarch64(); + target.metadata.description = Some("ARM64 QNX SDP 7.1 with io-sock network stack".into()); target.options.pre_link_args = - nto_qnx::pre_link_args(nto_qnx::ApiVariant::IoSock, nto_qnx::Arch::Aarch64); + qnx_sdp::pre_link_args(qnx_sdp::ApiVariant::IoSock, qnx_sdp::Arch::Aarch64); + // for QNX SDP 7.x, we keep target_os = "nto" for backwards compatibility, and use target_env to specify which version target.options.env = Env::Nto71IoSock; target } diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_nto_qnx800.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_nto_qnx800.rs deleted file mode 100644 index 5d265087c4a..00000000000 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_nto_qnx800.rs +++ /dev/null @@ -1,11 +0,0 @@ -use crate::spec::base::nto_qnx; -use crate::spec::{Env, Target}; - -pub(crate) fn target() -> Target { - let mut target = nto_qnx::aarch64(); - target.metadata.description = Some("ARM64 QNX Neutrino 8.0 RTOS".into()); - target.options.pre_link_args = - nto_qnx::pre_link_args(nto_qnx::ApiVariant::Default, nto_qnx::Arch::Aarch64); - target.options.env = Env::Nto80; - target -} diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_qnx.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_qnx.rs new file mode 100644 index 00000000000..cbd2f422418 --- /dev/null +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_qnx.rs @@ -0,0 +1,12 @@ +use crate::spec::base::qnx_sdp; +use crate::spec::{Os, Target}; + +pub(crate) fn target() -> Target { + let mut target = qnx_sdp::aarch64(); + target.metadata.description = Some("ARM64 QNX SDP 8.0+".into()); + target.options.pre_link_args = + qnx_sdp::pre_link_args(qnx_sdp::ApiVariant::Default, qnx_sdp::Arch::Aarch64); + // for QNX SDP 8.0, we have target_os = "qnx" and no target_env + target.options.os = Os::Qnx; + target +} diff --git a/compiler/rustc_target/src/spec/targets/i686_pc_nto_qnx700.rs b/compiler/rustc_target/src/spec/targets/i686_pc_nto_qnx700.rs index 7184a54961e..c8def7e5bc4 100644 --- a/compiler/rustc_target/src/spec/targets/i686_pc_nto_qnx700.rs +++ b/compiler/rustc_target/src/spec/targets/i686_pc_nto_qnx700.rs @@ -1,9 +1,9 @@ -use crate::spec::base::nto_qnx; +use crate::spec::base::qnx_sdp; use crate::spec::{Arch, Env, RustcAbi, StackProbeType, Target, TargetOptions, base}; pub(crate) fn target() -> Target { - let mut meta = nto_qnx::meta(); - meta.description = Some("32-bit x86 QNX Neutrino 7.0 RTOS".into()); + let mut meta = qnx_sdp::meta(); + meta.description = Some("32-bit x86 QNX SDP 7.0".into()); meta.std = Some(false); Target { llvm_target: "i586-pc-unknown".into(), @@ -17,14 +17,15 @@ pub(crate) fn target() -> Target { rustc_abi: Some(RustcAbi::X86Sse2), cpu: "pentium4".into(), max_atomic_width: Some(64), - pre_link_args: nto_qnx::pre_link_args( - nto_qnx::ApiVariant::Default, - nto_qnx::Arch::I586, + pre_link_args: qnx_sdp::pre_link_args( + qnx_sdp::ApiVariant::Default, + qnx_sdp::Arch::I586, ), + // for QNX SDP 7.x, we keep target_os = "nto" for backwards compatibility, and use target_env to specify which version env: Env::Nto70, vendor: "pc".into(), stack_probes: StackProbeType::Inline, - ..base::nto_qnx::opts() + ..base::qnx_sdp::opts() }, } } diff --git a/compiler/rustc_target/src/spec/targets/x86_64_pc_nto_qnx710.rs b/compiler/rustc_target/src/spec/targets/x86_64_pc_nto_qnx710.rs index 91600154850..6d814725d16 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_pc_nto_qnx710.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_pc_nto_qnx710.rs @@ -1,12 +1,12 @@ -use crate::spec::base::nto_qnx; +use crate::spec::base::qnx_sdp; use crate::spec::{Env, Target}; pub(crate) fn target() -> Target { - let mut target = nto_qnx::x86_64(); - target.metadata.description = - Some("x86 64-bit QNX Neutrino 7.1 RTOS with io-pkt network stack".into()); + let mut target = qnx_sdp::x86_64(); + target.metadata.description = Some("x86 64-bit QNX SDP 7.1 with io-pkt network stack".into()); target.options.pre_link_args = - nto_qnx::pre_link_args(nto_qnx::ApiVariant::Default, nto_qnx::Arch::X86_64); + qnx_sdp::pre_link_args(qnx_sdp::ApiVariant::Default, qnx_sdp::Arch::X86_64); + // for QNX SDP 7.x, we keep target_os = "nto" for backwards compatibility, and use target_env to specify which version target.options.env = Env::Nto71; target } diff --git a/compiler/rustc_target/src/spec/targets/x86_64_pc_nto_qnx710_iosock.rs b/compiler/rustc_target/src/spec/targets/x86_64_pc_nto_qnx710_iosock.rs index 1e97ae6b7a0..33789b61a18 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_pc_nto_qnx710_iosock.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_pc_nto_qnx710_iosock.rs @@ -1,12 +1,12 @@ -use crate::spec::base::nto_qnx; +use crate::spec::base::qnx_sdp; use crate::spec::{Env, Target}; pub(crate) fn target() -> Target { - let mut target = nto_qnx::x86_64(); - target.metadata.description = - Some("x86 64-bit QNX Neutrino 7.1 RTOS with io-sock network stack".into()); + let mut target = qnx_sdp::x86_64(); + target.metadata.description = Some("x86 64-bit QNX SDP 7.1 with io-sock network stack".into()); target.options.pre_link_args = - nto_qnx::pre_link_args(nto_qnx::ApiVariant::IoSock, nto_qnx::Arch::X86_64); + qnx_sdp::pre_link_args(qnx_sdp::ApiVariant::IoSock, qnx_sdp::Arch::X86_64); + // for QNX SDP 7.x, we keep target_os = "nto" for backwards compatibility, and use target_env to specify which version target.options.env = Env::Nto71IoSock; target } diff --git a/compiler/rustc_target/src/spec/targets/x86_64_pc_nto_qnx800.rs b/compiler/rustc_target/src/spec/targets/x86_64_pc_nto_qnx800.rs deleted file mode 100644 index bd98df621db..00000000000 --- a/compiler/rustc_target/src/spec/targets/x86_64_pc_nto_qnx800.rs +++ /dev/null @@ -1,11 +0,0 @@ -use crate::spec::base::nto_qnx; -use crate::spec::{Env, Target}; - -pub(crate) fn target() -> Target { - let mut target = nto_qnx::x86_64(); - target.metadata.description = Some("x86 64-bit QNX Neutrino 8.0 RTOS".into()); - target.options.pre_link_args = - nto_qnx::pre_link_args(nto_qnx::ApiVariant::Default, nto_qnx::Arch::X86_64); - target.options.env = Env::Nto80; - target -} diff --git a/compiler/rustc_target/src/spec/targets/x86_64_pc_qnx.rs b/compiler/rustc_target/src/spec/targets/x86_64_pc_qnx.rs new file mode 100644 index 00000000000..59eff3dbeb5 --- /dev/null +++ b/compiler/rustc_target/src/spec/targets/x86_64_pc_qnx.rs @@ -0,0 +1,12 @@ +use crate::spec::base::qnx_sdp; +use crate::spec::{Os, Target}; + +pub(crate) fn target() -> Target { + let mut target = qnx_sdp::x86_64(); + target.metadata.description = Some("x86 64-bit QNX SDP 8.0+".into()); + target.options.pre_link_args = + qnx_sdp::pre_link_args(qnx_sdp::ApiVariant::Default, qnx_sdp::Arch::X86_64); + // for QNX SDP 8.0, we have target_os = "qnx" and no target_env + target.options.os = Os::Qnx; + target +} diff --git a/library/std/build.rs b/library/std/build.rs index 5f2e441bf7d..98856b58d89 100644 --- a/library/std/build.rs +++ b/library/std/build.rs @@ -48,6 +48,7 @@ fn main() { || target_os == "vita" || target_os == "aix" || target_os == "nto" + || target_os == "qnx" || target_os == "xous" || target_os == "hurd" || target_os == "uefi" diff --git a/library/std/src/env.rs b/library/std/src/env.rs index 1cbabf57236..fa5dfd8b76e 100644 --- a/library/std/src/env.rs +++ b/library/std/src/env.rs @@ -1096,6 +1096,7 @@ pub mod consts { /// * `"netbsd"` /// * `"nto"` /// * `"openbsd"` + /// * `"qnx"` /// * `"redox"` /// * `"solaris"` /// * `"solid_asp3"` diff --git a/library/std/src/net/tcp/tests.rs b/library/std/src/net/tcp/tests.rs index 88f6af0e33d..cada78a0d55 100644 --- a/library/std/src/net/tcp/tests.rs +++ b/library/std/src/net/tcp/tests.rs @@ -733,7 +733,13 @@ fn debug() { // no longer has rounding errors. // VxWorks ignores SO_SNDTIMEO. #[cfg_attr( - any(target_os = "netbsd", target_os = "openbsd", target_os = "vxworks", target_os = "nto"), + any( + target_os = "netbsd", + target_os = "openbsd", + target_os = "vxworks", + target_os = "nto", + target_os = "qnx" + ), ignore )] #[cfg_attr(target_env = "sgx", ignore)] // FIXME: https://github.com/fortanix/rust-sgx/issues/31 diff --git a/library/std/src/net/udp/tests.rs b/library/std/src/net/udp/tests.rs index 9e9d3bf77e5..eeb6afdb072 100644 --- a/library/std/src/net/udp/tests.rs +++ b/library/std/src/net/udp/tests.rs @@ -188,7 +188,13 @@ fn debug() { // no longer has rounding errors. // VxWorks ignores SO_SNDTIMEO. #[cfg_attr( - any(target_os = "netbsd", target_os = "openbsd", target_os = "vxworks", target_os = "nto"), + any( + target_os = "netbsd", + target_os = "openbsd", + target_os = "vxworks", + target_os = "nto", + target_os = "qnx" + ), ignore )] #[cfg_attr(target_os = "wasi", ignore)] // timeout not supported diff --git a/library/std/src/os/mod.rs b/library/std/src/os/mod.rs index 44ddb55c920..a7ffd87d84d 100644 --- a/library/std/src/os/mod.rs +++ b/library/std/src/os/mod.rs @@ -121,7 +121,7 @@ pub mod macos; pub mod motor; #[cfg(target_os = "netbsd")] pub mod netbsd; -#[cfg(target_os = "nto")] +#[cfg(any(target_os = "nto", target_os = "qnx"))] pub mod nto; #[cfg(target_os = "nuttx")] pub mod nuttx; diff --git a/library/std/src/os/unix/mod.rs b/library/std/src/os/unix/mod.rs index e3f15a00a09..25aa3bf7893 100644 --- a/library/std/src/os/unix/mod.rs +++ b/library/std/src/os/unix/mod.rs @@ -69,7 +69,7 @@ mod platform { pub use crate::os::linux::*; #[cfg(target_os = "netbsd")] pub use crate::os::netbsd::*; - #[cfg(target_os = "nto")] + #[cfg(any(target_os = "nto", target_os = "qnx"))] pub use crate::os::nto::*; #[cfg(target_os = "nuttx")] pub use crate::os::nuttx::*; diff --git a/library/std/src/os/unix/net/datagram.rs b/library/std/src/os/unix/net/datagram.rs index 6876446c25c..e7bcd70140d 100644 --- a/library/std/src/os/unix/net/datagram.rs +++ b/library/std/src/os/unix/net/datagram.rs @@ -9,6 +9,7 @@ target_os = "illumos", target_os = "haiku", target_os = "nto", + target_os = "qnx", target_os = "cygwin" ))] use libc::MSG_NOSIGNAL; @@ -36,6 +37,7 @@ use crate::{fmt, io}; target_os = "illumos", target_os = "haiku", target_os = "nto", + target_os = "qnx", target_os = "cygwin" )))] const MSG_NOSIGNAL: core::ffi::c_int = 0x0; diff --git a/library/std/src/os/unix/net/mod.rs b/library/std/src/os/unix/net/mod.rs index a44b23a77d2..137088dd832 100644 --- a/library/std/src/os/unix/net/mod.rs +++ b/library/std/src/os/unix/net/mod.rs @@ -20,6 +20,7 @@ mod tests; target_os = "netbsd", target_os = "openbsd", target_os = "nto", + target_os = "qnx", target_vendor = "apple", target_os = "cygwin" ))] @@ -44,6 +45,7 @@ pub use self::stream::*; target_os = "netbsd", target_os = "openbsd", target_os = "nto", + target_os = "qnx", target_vendor = "apple", target_os = "cygwin", ))] diff --git a/library/std/src/os/unix/net/stream.rs b/library/std/src/os/unix/net/stream.rs index a4218bd4da6..4dfa06d74ce 100644 --- a/library/std/src/os/unix/net/stream.rs +++ b/library/std/src/os/unix/net/stream.rs @@ -6,7 +6,7 @@ cfg_select! { target_os = "openbsd", target_os = "netbsd", target_os = "solaris", target_os = "illumos", target_os = "haiku", target_os = "nto", - target_os = "cygwin", + target_os = "qnx", target_os = "cygwin", ) => { use libc::MSG_NOSIGNAL; } @@ -26,6 +26,7 @@ use super::{SocketAncillary, recv_vectored_with_ancillary_from, send_vectored_wi target_os = "netbsd", target_os = "openbsd", target_os = "nto", + target_os = "qnx", target_vendor = "apple", target_os = "cygwin" ))] diff --git a/library/std/src/os/unix/net/tests.rs b/library/std/src/os/unix/net/tests.rs index d88c97113ef..f703fc6d54c 100644 --- a/library/std/src/os/unix/net/tests.rs +++ b/library/std/src/os/unix/net/tests.rs @@ -176,7 +176,7 @@ fn long_path() { } #[test] -#[cfg(not(target_os = "nto"))] +#[cfg(not(any(target_os = "nto", target_os = "qnx")))] #[cfg_attr(target_os = "android", ignore)] // Android SELinux rules prevent creating Unix sockets #[cfg_attr(target_os = "cygwin", ignore)] // Cygwin connect needs handshake #[cfg_attr(target_os = "vxworks", ignore = "Unix sockets are not implemented in VxWorks")] diff --git a/library/std/src/os/unix/net/ucred.rs b/library/std/src/os/unix/net/ucred.rs index 1395d2ef4be..36b67cb1163 100644 --- a/library/std/src/os/unix/net/ucred.rs +++ b/library/std/src/os/unix/net/ucred.rs @@ -30,7 +30,8 @@ pub(super) use self::impl_apple::peer_cred; target_os = "freebsd", target_os = "openbsd", target_os = "netbsd", - target_os = "nto" + target_os = "nto", + target_os = "qnx" ))] pub(super) use self::impl_bsd::peer_cred; #[cfg(any(target_os = "android", target_os = "linux", target_os = "cygwin"))] @@ -79,6 +80,7 @@ mod impl_linux { target_os = "openbsd", target_os = "netbsd", target_os = "nto", + target_os = "qnx", ))] mod impl_bsd { use super::UCred; diff --git a/library/std/src/os/unix/process.rs b/library/std/src/os/unix/process.rs index 8a7b94d914a..3b3a5794ac4 100644 --- a/library/std/src/os/unix/process.rs +++ b/library/std/src/os/unix/process.rs @@ -16,7 +16,7 @@ cfg_select! { type UserId = u16; type GroupId = u16; } - target_os = "nto" => { + any(target_os = "nto", target_os = "qnx") => { // Both IDs are signed, see `sys/target_nto.h` of the QNX Neutrino SDP. // Only positive values should be used, see e.g. // https://www.qnx.com/developers/docs/7.1/#com.qnx.doc.neutrino.lib_ref/topic/s/setuid.html diff --git a/library/std/src/sys/args/unix.rs b/library/std/src/sys/args/unix.rs index 7a592c2b079..197931d8cc8 100644 --- a/library/std/src/sys/args/unix.rs +++ b/library/std/src/sys/args/unix.rs @@ -81,6 +81,7 @@ pub fn args() -> Args { target_os = "horizon", target_os = "aix", target_os = "nto", + target_os = "qnx", target_os = "hurd", target_os = "rtems", target_os = "nuttx", diff --git a/library/std/src/sys/env_consts.rs b/library/std/src/sys/env_consts.rs index 573f540483b..b14160cf4ad 100644 --- a/library/std/src/sys/env_consts.rs +++ b/library/std/src/sys/env_consts.rs @@ -224,6 +224,17 @@ pub mod os { pub const EXE_EXTENSION: &str = ""; } +#[cfg(target_os = "qnx")] +pub mod os { + pub const FAMILY: &str = "unix"; + pub const OS: &str = "qnx"; + pub const DLL_PREFIX: &str = "lib"; + pub const DLL_SUFFIX: &str = ".so"; + pub const DLL_EXTENSION: &str = "so"; + pub const EXE_SUFFIX: &str = ""; + pub const EXE_EXTENSION: &str = ""; +} + #[cfg(target_os = "nuttx")] pub mod os { pub const FAMILY: &str = "unix"; diff --git a/library/std/src/sys/fd/unix.rs b/library/std/src/sys/fd/unix.rs index edb2ffc4999..392e33a77dc 100644 --- a/library/std/src/sys/fd/unix.rs +++ b/library/std/src/sys/fd/unix.rs @@ -76,6 +76,7 @@ const fn max_iov() -> usize { target_os = "emscripten", target_os = "linux", target_os = "nto", + target_os = "qnx", ))] const fn max_iov() -> usize { libc::UIO_MAXIOV as usize @@ -91,6 +92,7 @@ const fn max_iov() -> usize { target_os = "netbsd", target_os = "nuttx", target_os = "nto", + target_os = "qnx", target_os = "openbsd", target_os = "horizon", target_os = "vita", @@ -561,6 +563,7 @@ impl FileDesc { target_os = "redox", target_os = "vxworks", target_os = "nto", + target_os = "qnx", target_os = "wasi", )))] pub fn set_cloexec(&self) -> io::Result<()> { @@ -585,6 +588,7 @@ impl FileDesc { target_os = "redox", target_os = "vxworks", target_os = "nto", + target_os = "qnx", target_os = "wasi", ))] pub fn set_cloexec(&self) -> io::Result<()> { diff --git a/library/std/src/sys/fs/unix.rs b/library/std/src/sys/fs/unix.rs index 3152a22534f..8fee56348c0 100644 --- a/library/std/src/sys/fs/unix.rs +++ b/library/std/src/sys/fs/unix.rs @@ -28,6 +28,7 @@ use libc::fstatat64; target_os = "fuchsia", target_os = "illumos", target_os = "nto", + target_os = "qnx", target_os = "redox", target_os = "solaris", target_os = "vita", @@ -45,6 +46,7 @@ use libc::readdir as readdir64; target_os = "l4re", target_os = "linux", target_os = "nto", + target_os = "qnx", target_os = "redox", target_os = "solaris", target_os = "vita", @@ -282,6 +284,7 @@ cfg_select! { target_os = "horizon", target_os = "vita", target_os = "nto", + target_os = "qnx", target_os = "vxworks", ) => { pub use crate::sys::fs::common::Dir; @@ -410,6 +413,7 @@ fn get_path_from_fd(fd: c_int) -> Option { target_os = "illumos", target_os = "linux", target_os = "nto", + target_os = "qnx", target_os = "redox", target_os = "solaris", target_os = "vita", @@ -436,6 +440,7 @@ pub struct DirEntry { target_os = "illumos", target_os = "linux", target_os = "nto", + target_os = "qnx", target_os = "redox", target_os = "solaris", target_os = "vita", @@ -448,6 +453,7 @@ struct dirent64_min { target_os = "illumos", target_os = "aix", target_os = "nto", + target_os = "qnx", target_os = "vita", )))] d_type: u8, @@ -462,6 +468,7 @@ struct dirent64_min { target_os = "illumos", target_os = "linux", target_os = "nto", + target_os = "qnx", target_os = "redox", target_os = "solaris", target_os = "vita", @@ -611,7 +618,13 @@ impl FileAttr { } } -#[cfg(not(any(target_os = "netbsd", target_os = "nto", target_os = "aix", target_os = "wasi")))] +#[cfg(not(any( + target_os = "netbsd", + target_os = "nto", + target_os = "qnx", + target_os = "aix", + target_os = "wasi" +)))] impl FileAttr { #[cfg(not(any( target_os = "vxworks", @@ -736,7 +749,7 @@ impl FileAttr { } } -#[cfg(any(target_os = "nto", target_os = "wasi"))] +#[cfg(any(target_os = "nto", target_os = "qnx", target_os = "wasi"))] impl FileAttr { pub fn modified(&self) -> io::Result { SystemTime::new(self.stat.st_mtim.tv_sec, self.stat.st_mtim.tv_nsec.into()) @@ -854,6 +867,7 @@ impl Iterator for ReadDir { target_os = "illumos", target_os = "linux", target_os = "nto", + target_os = "qnx", target_os = "redox", target_os = "solaris", target_os = "vita", @@ -927,6 +941,7 @@ impl Iterator for ReadDir { target_os = "illumos", target_os = "aix", target_os = "nto", + target_os = "qnx", )))] d_type: (*entry_ptr).d_type as u8, }; @@ -952,6 +967,7 @@ impl Iterator for ReadDir { target_os = "illumos", target_os = "linux", target_os = "nto", + target_os = "qnx", target_os = "redox", target_os = "solaris", target_os = "vita", @@ -1015,6 +1031,7 @@ impl Drop for DirStream { miri, target_os = "redox", target_os = "nto", + target_os = "qnx", target_os = "vita", target_os = "hurd", target_os = "espidf", @@ -1103,6 +1120,7 @@ impl DirEntry { target_os = "vxworks", target_os = "aix", target_os = "nto", + target_os = "qnx", target_os = "vita", ))] pub fn file_type(&self) -> io::Result { @@ -1116,6 +1134,7 @@ impl DirEntry { target_os = "vxworks", target_os = "aix", target_os = "nto", + target_os = "qnx", target_os = "vita", )))] pub fn file_type(&self) -> io::Result { @@ -1146,6 +1165,7 @@ impl DirEntry { target_os = "l4re", target_os = "linux", target_os = "nto", + target_os = "qnx", target_os = "redox", target_os = "rtems", target_os = "solaris", @@ -1205,6 +1225,7 @@ impl DirEntry { target_os = "redox", target_os = "aix", target_os = "nto", + target_os = "qnx", target_os = "vita", target_os = "hurd", target_os = "wasi", @@ -1222,6 +1243,7 @@ impl DirEntry { target_os = "redox", target_os = "aix", target_os = "nto", + target_os = "qnx", target_os = "vita", target_os = "hurd", target_os = "wasi", @@ -1419,6 +1441,7 @@ impl File { target_os = "netbsd", target_os = "openbsd", target_os = "nto", + target_os = "qnx", target_os = "hurd", ))] unsafe fn os_datasync(fd: c_int) -> c_int { @@ -1433,6 +1456,7 @@ impl File { target_os = "netbsd", target_os = "openbsd", target_os = "nto", + target_os = "qnx", target_os = "hurd", target_vendor = "apple", )))] @@ -2405,6 +2429,7 @@ pub use remove_dir_impl::remove_dir_all; target_os = "horizon", target_os = "vita", target_os = "nto", + target_os = "qnx", target_os = "vxworks", miri ))] @@ -2419,6 +2444,7 @@ mod remove_dir_impl { target_os = "horizon", target_os = "vita", target_os = "nto", + target_os = "qnx", target_os = "vxworks", miri )))] diff --git a/library/std/src/sys/io/error/unix.rs b/library/std/src/sys/io/error/unix.rs index 56295578bf7..85e3c09782a 100644 --- a/library/std/src/sys/io/error/unix.rs +++ b/library/std/src/sys/io/error/unix.rs @@ -27,6 +27,7 @@ unsafe extern "C" { )] #[cfg_attr(any(target_os = "solaris", target_os = "illumos"), link_name = "___errno")] #[cfg_attr(target_os = "nto", link_name = "__get_errno_ptr")] + #[cfg_attr(target_os = "qnx", link_name = "__get_errno_ptr")] #[cfg_attr(any(target_os = "freebsd", target_vendor = "apple"), link_name = "__error")] #[cfg_attr(target_os = "haiku", link_name = "_errnop")] #[cfg_attr(target_os = "aix", link_name = "_Errno")] diff --git a/library/std/src/sys/net/connection/socket/mod.rs b/library/std/src/sys/net/connection/socket/mod.rs index 55c928dc6c5..da25cff1d54 100644 --- a/library/std/src/sys/net/connection/socket/mod.rs +++ b/library/std/src/sys/net/connection/socket/mod.rs @@ -46,6 +46,7 @@ cfg_select! { target_os = "haiku", target_os = "l4re", target_os = "nto", + target_os = "qnx", target_os = "nuttx", target_vendor = "apple", ) => { @@ -66,7 +67,7 @@ cfg_select! { target_os = "openbsd", target_os = "netbsd", target_os = "solaris", target_os = "illumos", target_os = "haiku", target_os = "nto", - target_os = "cygwin", + target_os = "qnx", target_os = "cygwin", ) => { use libc::MSG_NOSIGNAL; } @@ -80,7 +81,7 @@ cfg_select! { target_os = "dragonfly", target_os = "freebsd", target_os = "openbsd", target_os = "netbsd", target_os = "solaris", target_os = "illumos", - target_os = "nto", + target_os = "nto", target_os = "qnx", ) => { use crate::ffi::c_uchar; type IpV4MultiCastType = c_uchar; diff --git a/library/std/src/sys/net/connection/socket/unix.rs b/library/std/src/sys/net/connection/socket/unix.rs index 3336dc4cf92..41850574c96 100644 --- a/library/std/src/sys/net/connection/socket/unix.rs +++ b/library/std/src/sys/net/connection/socket/unix.rs @@ -76,6 +76,7 @@ impl Socket { target_os = "openbsd", target_os = "cygwin", target_os = "nto", + target_os = "qnx", target_os = "solaris", ) => { // On platforms that support it we pass the SOCK_CLOEXEC @@ -124,6 +125,7 @@ impl Socket { target_os = "openbsd", target_os = "cygwin", target_os = "nto", + target_os = "qnx", ) => { // Like above, set cloexec atomically cvt(libc::socketpair(fam, ty | libc::SOCK_CLOEXEC, 0, fds.as_mut_ptr()))?; diff --git a/library/std/src/sys/pal/unix/sync/condvar.rs b/library/std/src/sys/pal/unix/sync/condvar.rs index 73768860723..51162296ea3 100644 --- a/library/std/src/sys/pal/unix/sync/condvar.rs +++ b/library/std/src/sys/pal/unix/sync/condvar.rs @@ -1,9 +1,9 @@ use super::Mutex; use crate::cell::UnsafeCell; use crate::pin::Pin; -#[cfg(not(target_os = "nto"))] +#[cfg(not(any(target_os = "nto", target_os = "qnx")))] use crate::sys::pal::time::TIMESPEC_MAX; -#[cfg(target_os = "nto")] +#[cfg(any(target_os = "nto", target_os = "qnx"))] use crate::sys::pal::time::TIMESPEC_MAX_CAPPED; use crate::time::Duration; @@ -69,10 +69,10 @@ impl Condvar { let timeout = Timespec::now(Self::CLOCK).checked_add_duration(&dur); - #[cfg(not(target_os = "nto"))] + #[cfg(not(any(target_os = "nto", target_os = "qnx")))] let timeout = timeout.and_then(|t| t.to_timespec()).unwrap_or(TIMESPEC_MAX); - #[cfg(target_os = "nto")] + #[cfg(any(target_os = "nto", target_os = "qnx"))] let timeout = timeout.and_then(|t| t.to_timespec_capped()).unwrap_or(TIMESPEC_MAX_CAPPED); let r = unsafe { libc::pthread_cond_timedwait(self.raw(), mutex, &timeout) }; diff --git a/library/std/src/sys/pal/unix/time.rs b/library/std/src/sys/pal/unix/time.rs index 26fb6d3d7cf..26296b5d169 100644 --- a/library/std/src/sys/pal/unix/time.rs +++ b/library/std/src/sys/pal/unix/time.rs @@ -16,7 +16,7 @@ pub const TIMESPEC_MAX: libc::timespec = { // This additional constant is only used when calling // `libc::pthread_cond_timedwait`. -#[cfg(target_os = "nto")] +#[cfg(any(target_os = "nto", target_os = "qnx"))] pub(in crate::sys) const TIMESPEC_MAX_CAPPED: libc::timespec = libc::timespec { tv_sec: (u64::MAX / NSEC_PER_SEC) as i64, tv_nsec: (u64::MAX % NSEC_PER_SEC) as i64, diff --git a/library/std/src/sys/paths/unix.rs b/library/std/src/sys/paths/unix.rs index e0b1aafda6e..36879b7b9bc 100644 --- a/library/std/src/sys/paths/unix.rs +++ b/library/std/src/sys/paths/unix.rs @@ -269,7 +269,7 @@ pub fn current_exe() -> io::Result { } } -#[cfg(target_os = "nto")] +#[cfg(any(target_os = "nto", target_os = "qnx"))] pub fn current_exe() -> io::Result { let mut e = crate::fs::read("/proc/self/exefile")?; // Current versions of QNX Neutrino provide a null-terminated path. diff --git a/library/std/src/sys/process/unix/unix.rs b/library/std/src/sys/process/unix/unix.rs index b6ccc6b698f..55906ed2854 100644 --- a/library/std/src/sys/process/unix/unix.rs +++ b/library/std/src/sys/process/unix/unix.rs @@ -20,7 +20,7 @@ use crate::sys::process::PidFd; use crate::{fmt, mem, sys}; cfg_select! { - target_os = "nto" => { + any(target_os = "nto", target_os = "qnx") => { use crate::thread; use libc::{c_char, posix_spawn_file_actions_t, posix_spawnattr_t}; use crate::time::Duration; @@ -183,7 +183,12 @@ impl Command { // Attempts to fork the process. If successful, returns Ok((0, -1)) // in the child, and Ok((child_pid, -1)) in the parent. - #[cfg(not(any(target_os = "watchos", target_os = "tvos", target_os = "nto")))] + #[cfg(not(any( + target_os = "watchos", + target_os = "tvos", + target_os = "nto", + target_os = "qnx" + )))] unsafe fn do_fork(&mut self) -> Result { cvt(libc::fork()) } @@ -192,7 +197,7 @@ impl Command { // or closed a file descriptor while the fork() was occurring". // Documentation says "... or try calling fork() again". This is what we do here. // See also https://www.qnx.com/developers/docs/7.1/#com.qnx.doc.neutrino.lib_ref/topic/f/fork.html - #[cfg(target_os = "nto")] + #[cfg(any(target_os = "nto", target_os = "qnx"))] unsafe fn do_fork(&mut self) -> Result { use crate::sys::io::errno; @@ -424,6 +429,7 @@ impl Command { all(target_os = "linux", target_env = "gnu"), all(target_os = "linux", target_env = "musl"), target_os = "nto", + target_os = "qnx", target_vendor = "apple", target_os = "cygwin", )))] @@ -443,6 +449,7 @@ impl Command { all(target_os = "linux", target_env = "gnu"), all(target_os = "linux", target_env = "musl"), target_os = "nto", + target_os = "qnx", target_vendor = "apple", target_os = "cygwin", ))] @@ -550,7 +557,7 @@ impl Command { // or closed a file descriptor while the posix_spawn() was occurring". // Documentation says "... or try calling posix_spawn() again". This is what we do here. // See also http://www.qnx.com/developers/docs/7.1/#com.qnx.doc.neutrino.lib_ref/topic/p/posix_spawn.html - #[cfg(target_os = "nto")] + #[cfg(any(target_os = "nto", target_os = "qnx"))] unsafe fn retrying_libc_posix_spawnp( pid: *mut pid_t, file: *const c_char, @@ -763,9 +770,9 @@ impl Command { let _env_lock = sys::env::env_read_lock(); let envp = envp.map(|c| c.as_ptr()).unwrap_or_else(|| *sys::env::environ() as *const _); - #[cfg(not(target_os = "nto"))] + #[cfg(not(any(target_os = "nto", target_os = "qnx")))] let spawn_fn = libc::posix_spawnp; - #[cfg(target_os = "nto")] + #[cfg(any(target_os = "nto", target_os = "qnx"))] let spawn_fn = retrying_libc_posix_spawnp; #[cfg(target_os = "linux")] @@ -822,7 +829,7 @@ impl Command { envp as *const _, ); - #[cfg(target_os = "nto")] + #[cfg(any(target_os = "nto", target_os = "qnx"))] let spawn_res = spawn_res?; cvt_nz(spawn_res)?; @@ -1202,7 +1209,12 @@ fn signal_string(signal: i32) -> &'static str { ) ))] libc::SIGSTKFLT => " (SIGSTKFLT)", - #[cfg(any(target_os = "linux", target_os = "nto", target_os = "cygwin"))] + #[cfg(any( + target_os = "linux", + target_os = "nto", + target_os = "qnx", + target_os = "cygwin" + ))] libc::SIGPWR => " (SIGPWR)", #[cfg(any( target_os = "freebsd", @@ -1210,6 +1222,7 @@ fn signal_string(signal: i32) -> &'static str { target_os = "openbsd", target_os = "dragonfly", target_os = "nto", + target_os = "qnx", target_vendor = "apple", target_os = "cygwin", ))] diff --git a/library/std/src/sys/random/mod.rs b/library/std/src/sys/random/mod.rs index 12346ef5a2e..e5a66dc463c 100644 --- a/library/std/src/sys/random/mod.rs +++ b/library/std/src/sys/random/mod.rs @@ -54,6 +54,7 @@ cfg_select! { target_os = "hurd", target_os = "l4re", target_os = "nto", + target_os = "qnx", ) => { mod unix_legacy; pub use unix_legacy::fill_bytes; diff --git a/library/std/src/sys/thread/unix.rs b/library/std/src/sys/thread/unix.rs index dd7b7940de5..e52ffff165b 100644 --- a/library/std/src/sys/thread/unix.rs +++ b/library/std/src/sys/thread/unix.rs @@ -12,7 +12,12 @@ use crate::mem::{self, DropGuard, ManuallyDrop}; use crate::num::NonZero; #[cfg(all(target_os = "linux", target_env = "gnu"))] use crate::sys::weak::dlsym; -#[cfg(any(target_os = "solaris", target_os = "illumos", target_os = "nto",))] +#[cfg(any( + target_os = "solaris", + target_os = "illumos", + target_os = "nto", + target_os = "qnx", +))] use crate::sys::weak::weak; use crate::thread::ThreadInit; use crate::time::Duration; diff --git a/library/unwind/src/lib.rs b/library/unwind/src/lib.rs index 4e380d88947..cb4a3593c51 100644 --- a/library/unwind/src/lib.rs +++ b/library/unwind/src/lib.rs @@ -193,7 +193,7 @@ unsafe extern "C" {} #[link(name = "unwind")] unsafe extern "C" {} -#[cfg(target_os = "nto")] +#[cfg(any(target_os = "nto", target_os = "qnx"))] cfg_select! { target_env = "nto70" => { #[link(name = "gcc")] diff --git a/src/bootstrap/src/core/sanity.rs b/src/bootstrap/src/core/sanity.rs index 6ebfa4da490..99d9c8a04c5 100644 --- a/src/bootstrap/src/core/sanity.rs +++ b/src/bootstrap/src/core/sanity.rs @@ -39,6 +39,8 @@ const STAGE0_MISSING_TARGETS: &[&str] = &[ // just a dummy comment so the list doesn't get onelined "powerpc64-unknown-linux-gnuelfv2", "aarch64-unknown-linux-pauthtest", // Stage 0 compiler is not guaranteed to see the target yet. + "aarch64-unknown-qnx", + "x86_64-pc-qnx", ]; /// Minimum version threshold for libstdc++ required when using prebuilt LLVM diff --git a/src/doc/rustc/src/platform-support.md b/src/doc/rustc/src/platform-support.md index be64a6cfe3e..4ab9663ef50 100644 --- a/src/doc/rustc/src/platform-support.md +++ b/src/doc/rustc/src/platform-support.md @@ -277,7 +277,7 @@ target | std | host | notes [`aarch64-unknown-nto-qnx700`](platform-support/nto-qnx.md) | ? | | ARM64 QNX Neutrino 7.0 RTOS | [`aarch64-unknown-nto-qnx710`](platform-support/nto-qnx.md) | ✓ | | ARM64 QNX Neutrino 7.1 RTOS with default network stack (io-pkt) | [`aarch64-unknown-nto-qnx710_iosock`](platform-support/nto-qnx.md) | ✓ | | ARM64 QNX Neutrino 7.1 RTOS with new network stack (io-sock) | -[`aarch64-unknown-nto-qnx800`](platform-support/nto-qnx.md) | ✓ | | ARM64 QNX Neutrino 8.0 RTOS | +[`aarch64-unknown-qnx`](platform-support/nto-qnx.md) | ✓ | | ARM64 QNX SDP 8.0+ | [`aarch64-unknown-nuttx`](platform-support/nuttx.md) | ✓ | | ARM64 with NuttX [`aarch64-unknown-openbsd`](platform-support/openbsd.md) | ✓ | ✓ | ARM64 OpenBSD [`aarch64-unknown-redox`](platform-support/redox.md) | ✓ | | ARM64 Redox OS @@ -446,7 +446,7 @@ target | std | host | notes [`x86_64-pc-cygwin`](platform-support/x86_64-pc-cygwin.md) | ✓ | | 64-bit x86 Cygwin | [`x86_64-pc-nto-qnx710`](platform-support/nto-qnx.md) | ✓ | | x86 64-bit QNX Neutrino 7.1 RTOS with default network stack (io-pkt) | [`x86_64-pc-nto-qnx710_iosock`](platform-support/nto-qnx.md) | ✓ | | x86 64-bit QNX Neutrino 7.1 RTOS with new network stack (io-sock) | -[`x86_64-pc-nto-qnx800`](platform-support/nto-qnx.md) | ✓ | | x86 64-bit QNX Neutrino 8.0 RTOS | +[`x86_64-pc-qnx`](platform-support/nto-qnx.md) | ✓ | | x86 64-bit QNX SDP 8.0+ | [`x86_64-unikraft-linux-musl`](platform-support/unikraft-linux-musl.md) | ✓ | | 64-bit Unikraft with musl 1.2.5 `x86_64-unknown-dragonfly` | ✓ | ✓ | 64-bit DragonFlyBSD `x86_64-unknown-haiku` | ✓ | ✓ | 64-bit Haiku diff --git a/src/doc/rustc/src/platform-support/nto-qnx.md b/src/doc/rustc/src/platform-support/nto-qnx.md index 9f8960899c1..5c421af97bb 100644 --- a/src/doc/rustc/src/platform-support/nto-qnx.md +++ b/src/doc/rustc/src/platform-support/nto-qnx.md @@ -1,15 +1,8 @@ -# nto-qnx +# Q **Tier: 3** -The [QNX®][qnx.com] Neutrino (nto) Real-time operating system. Known as QNX OS -from version 8 onwards. - -This support has been implemented jointly by [Elektrobit Automotive GmbH][Elektrobit] -and [QNX][qnx.com]. - -[qnx.com]: https://blackberry.qnx.com -[Elektrobit]: https://www.elektrobit.com +Support for the [QNX®][qnx.com] Software Development Platform (SDP), version 7.0, 7.1 and 8.0. ## Target maintainers @@ -20,36 +13,35 @@ and [QNX][qnx.com]. ## Requirements -Currently, the following QNX versions and compilation targets are supported: +The following QNX SDP versions and compilation targets are supported: | Target Tuple | QNX Version | Target Architecture | Full support | `no_std` support | | ----------------------------------- | ----------------------------- | ------------------- | :----------: | :--------------: | -| `aarch64-unknown-nto-qnx800` | QNX OS 8.0 | AArch64 | ? | ✓ | -| `x86_64-pc-nto-qnx800` | QNX OS 8.0 | x86_64 | ? | ✓ | -| `aarch64-unknown-nto-qnx710` | QNX Neutrino 7.1 with io-pkt | AArch64 | ✓ | ✓ | -| `x86_64-pc-nto-qnx710` | QNX Neutrino 7.1 with io-pkt | x86_64 | ✓ | ✓ | -| `aarch64-unknown-nto-qnx710_iosock` | QNX Neutrino 7.1 with io-sock | AArch64 | ? | ✓ | -| `x86_64-pc-nto-qnx710_iosock` | QNX Neutrino 7.1 with io-sock | x86_64 | ? | ✓ | -| `aarch64-unknown-nto-qnx700` | QNX Neutrino 7.0 | AArch64 | ? | ✓ | -| `i686-pc-nto-qnx700` | QNX Neutrino 7.0 | x86 | | ✓ | +| `aarch64-unknown-qnx` | QNX SDP 8.0+ | AArch64 | ? | ✓ | +| `x86_64-pc-qnx` | QNX SDP 8.0+ | x86_64 | ? | ✓ | +| `aarch64-unknown-nto-qnx710_iosock` | QNX SDP 7.1 with io-sock | AArch64 | ? | ✓ | +| `x86_64-pc-nto-qnx710_iosock` | QNX SDP 7.1 with io-sock | x86_64 | ? | ✓ | +| `aarch64-unknown-nto-qnx710` | QNX SDP 7.1 with io-pkt | AArch64 | ✓ | ✓ | +| `x86_64-pc-nto-qnx710` | QNX SDP 7.1 with io-pkt | x86_64 | ✓ | ✓ | +| `aarch64-unknown-nto-qnx700` | QNX SDP 7.0 | AArch64 | ? | ✓ | +| `i686-pc-nto-qnx700` | QNX SDP 7.0 | x86 | | ✓ | -On QNX Neutrino 7.0 and 7.1, `io-pkt` is used as network stack by default. -QNX Neutrino 7.1 includes the optional network stack `io-sock`. -QNX OS 8.0 always uses `io-sock`. QNX OS 8.0 support is currently work in progress. +* On QNX SDP 7.0 and 7.1, `io-pkt` is used as network stack by default. +* QNX SDP 7.1 includes the optional network stack `io-sock`. +* QNX SDP 8.0 always uses `io-sock`. Adding other architectures that are supported by QNX is possible. -In the table above, 'full support' indicates support for building Rust applications with the full standard library. A '?' means that support is in-progress. -'`no_std` support' is for building `#![no_std]` applications where only `core` and `alloc` are available. +In the table above, 'full support' indicates support for building Rust applications with the full standard library. A '?' means that support is in-progress. `no_std` support' is for building `#![no_std]` applications where only `core` and `alloc` are available. -For building or using the Rust toolchain for QNX, the -[QNX Software Development Platform (SDP)](https://blackberry.qnx.com/en/products/foundation-software/qnx-software-development-platform) -must be installed and initialized. +For building or using the Rust toolchain for QNX, the relevant version of the [QNX Software Development Platform (SDP)] must be installed and initialized. Initialization is usually done by sourcing `qnxsdp-env.sh` (this will be installed as part of the SDP, see also installation instruction provided with the SDP). -Afterwards [`qcc`](https://www.qnx.com/developers/docs/7.1/#com.qnx.doc.neutrino.utilities/topic/q/qcc.html) (QNX C/C++ compiler) +Afterwards [`qcc`](https://www.qnx.com/developers/docs/8.0/com.qnx.doc.neutrino.utilities/topic/q/qcc.html) (the QNX C/C++ compiler) should be available (in the `$PATH` variable). `qcc` will be called e.g. for linking executables. +[QNX Software Development Platform (SDP)]: https://qnx.software/en/software/products-and-solutions/qnx-software-development-platform + When linking `no_std` applications, they must link against `libc.so` (see example). This is required because applications always link against the `crt` library and `crt` depends on `libc.so`. This is done automatically when using the standard library. @@ -71,56 +63,15 @@ Resolution scope for Executable->/bin/sh: libc.so.4->/usr/lib/ldqnx-64.so.2 ``` -### Small example application - -Small `no_std` example is shown below. Applications using the standard library work as well. - -```rust,ignore (platform-specific) -#![no_std] -#![no_main] -#![feature(lang_items)] - -// We must always link against libc, even if no external functions are used -// "extern C" - Block can be empty but must be present -#[link(name = "c")] -extern "C" { - pub fn printf(format: *const core::ffi::c_char, ...) -> core::ffi::c_int; -} - -#[no_mangle] -pub extern "C" fn main(_argc: core::ffi::c_int, _argv: *const *const u8) -> core::ffi::c_int { - const HELLO: &'static str = "Hello World, the answer is %d\n\0"; - unsafe { - printf(HELLO.as_ptr() as *const _, 42); - } - 0 -} - -use core::panic::PanicInfo; - -#[panic_handler] -fn panic(_panic: &PanicInfo<'_>) -> ! { - loop {} -} - -#[lang = "eh_personality"] -#[no_mangle] -pub extern "C" fn rust_eh_personality() {} -``` - -The QNX support in Rust has been tested with QNX Neutrino 7.0 and 7.1. Support for QNX OS 8.0 is a work in progress. - -There are no further known requirements. - ## Conditional compilation -For conditional compilation, following QNX specific attributes are defined: +For conditional compilation, the following QNX specific attributes are defined: - `target_os` = `"nto"` -- `target_env` = `"nto71"` (for QNX Neutrino 7.1 with "classic" network stack "io_pkt") -- `target_env` = `"nto71_iosock"` (for QNX Neutrino 7.1 with network stack "io_sock") -- `target_env` = `"nto70"` (for QNX Neutrino 7.0) -- `target_env` = `"nto80"` (for QNX OS 8.0) + - `target_env` = `"nto70"` (for QNX SDP 7.0) + - `target_env` = `"nto71"` (for QNX SDP 7.1 with "classic" network stack "io_pkt") + - `target_env` = `"nto71_iosock"` (for QNX SDP 7.1 with "new" network stack "io_sock") +- `target_os` = `"qnx"` (for QNX SDP 8.0 or higher) ## Building the target @@ -212,7 +163,7 @@ env $build_env \ ## Building Rust programs -Rust does not yet ship pre-compiled artifacts for this target. +Rust does not ship pre-compiled artifacts for this target. To compile for this target, you must either build Rust with the target enabled (see "Building the target" above), or build your own copy of `core` by using `build-std` or similar. diff --git a/src/librustdoc/clean/cfg.rs b/src/librustdoc/clean/cfg.rs index 2950e3b563c..74a04b44510 100644 --- a/src/librustdoc/clean/cfg.rs +++ b/src/librustdoc/clean/cfg.rs @@ -638,11 +638,12 @@ fn human_readable_target_os(os: Symbol) -> Option<&'static str> { Motor => "Motor OS", NetBsd => "NetBSD", None => "bare-metal", - Nto => "QNX Neutrino", + Nto => "QNX SDP 7.x", NuttX => "NuttX", OpenBsd => "OpenBSD", Psp => "Play Station Portable", Psx => "Play Station 1", + Qnx => "QNX SDP 8.0+", Qurt => "QuRT", Redox => "Redox OS", Rtems => "RTEMS OS", @@ -718,10 +719,9 @@ fn human_readable_target_env(env: Symbol) -> Option<&'static str> { Msvc => "MSVC", Musl => "musl", Newlib => "Newlib", - Nto70 => "Neutrino 7.0", - Nto71 => "Neutrino 7.1", - Nto71IoSock => "Neutrino 7.1 with io-sock", - Nto80 => "Neutrino 8.0", + Nto70 => "QNX SDP 7.0", + Nto71 => "QNX SDP 7.1", + Nto71IoSock => "QNX SDP 7.1 with io-sock", Ohos => "OpenHarmony", P1 => "WASIp1", P2 => "WASIp2", diff --git a/src/tools/miri/tests/pass-dep/shims/gettid.rs b/src/tools/miri/tests/pass-dep/shims/gettid.rs index 9b186699ce2..05885ac277f 100644 --- a/src/tools/miri/tests/pass-dep/shims/gettid.rs +++ b/src/tools/miri/tests/pass-dep/shims/gettid.rs @@ -9,7 +9,7 @@ fn gettid() -> u64 { any(target_os = "android", target_os = "linux") => { gettid_linux_like() } - target_os = "nto" => { + any(target_os = "nto", target_os = "qnx") => { unsafe { libc::gettid() as u64 } } target_os = "openbsd" => { diff --git a/tests/assembly-llvm/targets/targets-elf.rs b/tests/assembly-llvm/targets/targets-elf.rs index 3d7fd936baa..da4176040a5 100644 --- a/tests/assembly-llvm/targets/targets-elf.rs +++ b/tests/assembly-llvm/targets/targets-elf.rs @@ -85,9 +85,9 @@ //@ revisions: aarch64_unknown_nto_qnx710_iosock //@ [aarch64_unknown_nto_qnx710_iosock] compile-flags: --target aarch64-unknown-nto-qnx710_iosock //@ [aarch64_unknown_nto_qnx710_iosock] needs-llvm-components: aarch64 -//@ revisions: aarch64_unknown_nto_qnx800 -//@ [aarch64_unknown_nto_qnx800] compile-flags: --target aarch64-unknown-nto-qnx800 -//@ [aarch64_unknown_nto_qnx800] needs-llvm-components: aarch64 +//@ revisions: aarch64_unknown_qnx +//@ [aarch64_unknown_qnx] compile-flags: --target aarch64-unknown-qnx +//@ [aarch64_unknown_qnx] needs-llvm-components: aarch64 //@ revisions: aarch64_unknown_openbsd //@ [aarch64_unknown_openbsd] compile-flags: --target aarch64-unknown-openbsd //@ [aarch64_unknown_openbsd] needs-llvm-components: aarch64 @@ -670,9 +670,9 @@ //@ revisions: x86_64_pc_nto_qnx710_iosock //@ [x86_64_pc_nto_qnx710_iosock] compile-flags: --target x86_64-pc-nto-qnx710_iosock //@ [x86_64_pc_nto_qnx710_iosock] needs-llvm-components: x86 -//@ revisions: x86_64_pc_nto_qnx800 -//@ [x86_64_pc_nto_qnx800] compile-flags: --target x86_64-pc-nto-qnx800 -//@ [x86_64_pc_nto_qnx800] needs-llvm-components: x86 +//@ revisions: x86_64_pc_qnx +//@ [x86_64_pc_qnx] compile-flags: --target x86_64-pc-qnx +//@ [x86_64_pc_qnx] needs-llvm-components: x86 //@ revisions: x86_64_pc_solaris //@ [x86_64_pc_solaris] compile-flags: --target x86_64-pc-solaris //@ [x86_64_pc_solaris] needs-llvm-components: x86 diff --git a/tests/rustdoc-html/doc-cfg/all-targets.rs b/tests/rustdoc-html/doc-cfg/all-targets.rs index 605a27a7d89..7adf1d90de2 100644 --- a/tests/rustdoc-html/doc-cfg/all-targets.rs +++ b/tests/rustdoc-html/doc-cfg/all-targets.rs @@ -16,7 +16,6 @@ target_env = "nto70", target_env = "nto71", target_env = "nto71_iosock", - target_env = "nto80", target_env = "ohos", target_env = "relibc", target_env = "sgx", @@ -112,6 +111,7 @@ pub fn bar() {} target_os = "netbsd", target_os = "none", target_os = "nto", + target_os = "qnx", target_os = "nuttx", target_os = "openbsd", target_os = "psp", diff --git a/tests/rustdoc-html/doc-cfg/sort.rs b/tests/rustdoc-html/doc-cfg/sort.rs index 3aa79b78362..245a9b7b39d 100644 --- a/tests/rustdoc-html/doc-cfg/sort.rs +++ b/tests/rustdoc-html/doc-cfg/sort.rs @@ -18,6 +18,7 @@ target_os = "netbsd", target_os = "openbsd", target_os = "nto", + target_os = "qnx", target_vendor = "apple", target_os = "cygwin" )))] @@ -36,6 +37,7 @@ pub fn foo() {} target_os = "netbsd", target_os = "openbsd", target_os = "nto", + target_os = "qnx", target_vendor = "apple", target_os = "cygwin" ))] diff --git a/tests/ui/attributes/auxiliary/used_pre_main_constructor.rs b/tests/ui/attributes/auxiliary/used_pre_main_constructor.rs index f93a2aae5a1..6ea36dee947 100644 --- a/tests/ui/attributes/auxiliary/used_pre_main_constructor.rs +++ b/tests/ui/attributes/auxiliary/used_pre_main_constructor.rs @@ -18,6 +18,7 @@ target_os = "linux", target_os = "netbsd", target_os = "nto", + target_os = "qnx", target_os = "openbsd", target_os = "fuchsia", target_os = "managarm", diff --git a/tests/ui/check-cfg/cfg-crate-features.stderr b/tests/ui/check-cfg/cfg-crate-features.stderr index 24288399548..9bf3cef4031 100644 --- a/tests/ui/check-cfg/cfg-crate-features.stderr +++ b/tests/ui/check-cfg/cfg-crate-features.stderr @@ -24,7 +24,7 @@ warning: unexpected `cfg` condition value: `does_not_exist` LL | #![cfg(not(target(os = "does_not_exist")))] | ^^^^^^^^^^^^^^^^^^^^^ | - = note: expected values for `target_os` are: `aix`, `amdhsa`, `android`, `cuda`, `cygwin`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `helenos`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `lynxos178`, `macos`, `managarm`, `motor`, `netbsd`, `none`, `nto`, `nuttx`, `openbsd`, `psp`, `psx`, `qurt`, `redox`, `rtems`, `solaris`, and `solid_asp3` and 14 more + = note: expected values for `target_os` are: `aix`, `amdhsa`, `android`, `cuda`, `cygwin`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `helenos`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `lynxos178`, `macos`, `managarm`, `motor`, `netbsd`, `none`, `nto`, `nuttx`, `openbsd`, `psp`, `psx`, `qnx`, `qurt`, `redox`, `rtems`, and `solaris` and 15 more = note: see for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/well-known-values.stderr b/tests/ui/check-cfg/well-known-values.stderr index ebcb439b734..5c797783e48 100644 --- a/tests/ui/check-cfg/well-known-values.stderr +++ b/tests/ui/check-cfg/well-known-values.stderr @@ -156,7 +156,7 @@ warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` LL | target_env = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: expected values for `target_env` are: ``, `gnu`, `macabi`, `mlibc`, `msvc`, `musl`, `newlib`, `nto70`, `nto71`, `nto71_iosock`, `nto80`, `ohos`, `p1`, `p2`, `p3`, `relibc`, `sgx`, `sim`, `uclibc`, and `v5` + = note: expected values for `target_env` are: ``, `gnu`, `macabi`, `mlibc`, `msvc`, `musl`, `newlib`, `nto70`, `nto71`, `nto71_iosock`, `ohos`, `p1`, `p2`, `p3`, `relibc`, `sgx`, `sim`, `uclibc`, and `v5` = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` @@ -210,7 +210,7 @@ warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` LL | target_os = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: expected values for `target_os` are: `aix`, `amdhsa`, `android`, `cuda`, `cygwin`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `helenos`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `lynxos178`, `macos`, `managarm`, `motor`, `netbsd`, `none`, `nto`, `nuttx`, `openbsd`, `psp`, `psx`, `qurt`, `redox`, `rtems`, `solaris`, `solid_asp3`, `teeos`, `trusty`, `tvos`, `uefi`, `unknown`, `vexos`, `visionos`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`, and `zkvm` + = note: expected values for `target_os` are: `aix`, `amdhsa`, `android`, `cuda`, `cygwin`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `helenos`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `lynxos178`, `macos`, `managarm`, `motor`, `netbsd`, `none`, `nto`, `nuttx`, `openbsd`, `psp`, `psx`, `qnx`, `qurt`, `redox`, `rtems`, `solaris`, `solid_asp3`, `teeos`, `trusty`, `tvos`, `uefi`, `unknown`, `vexos`, `visionos`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`, and `zkvm` = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` @@ -283,7 +283,7 @@ LL | #[cfg(target_os = "linuz")] // testing that we suggest `linux` | | | help: there is a expected value with a similar name: `"linux"` | - = note: expected values for `target_os` are: `aix`, `amdhsa`, `android`, `cuda`, `cygwin`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `helenos`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `lynxos178`, `macos`, `managarm`, `motor`, `netbsd`, `none`, `nto`, `nuttx`, `openbsd`, `psp`, `psx`, `qurt`, `redox`, `rtems`, `solaris`, `solid_asp3`, `teeos`, `trusty`, `tvos`, `uefi`, `unknown`, `vexos`, `visionos`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`, and `zkvm` + = note: expected values for `target_os` are: `aix`, `amdhsa`, `android`, `cuda`, `cygwin`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `helenos`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `lynxos178`, `macos`, `managarm`, `motor`, `netbsd`, `none`, `nto`, `nuttx`, `openbsd`, `psp`, `psx`, `qnx`, `qurt`, `redox`, `rtems`, `solaris`, `solid_asp3`, `teeos`, `trusty`, `tvos`, `uefi`, `unknown`, `vexos`, `visionos`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`, and `zkvm` = note: see for more information about checking conditional configuration warning: 29 warnings emitted diff --git a/tests/ui/intrinsics/intrinsic-alignment.rs b/tests/ui/intrinsics/intrinsic-alignment.rs index 242eea1f840..d14bdf35e81 100644 --- a/tests/ui/intrinsics/intrinsic-alignment.rs +++ b/tests/ui/intrinsics/intrinsic-alignment.rs @@ -16,6 +16,7 @@ target_os = "solaris", target_os = "vxworks", target_os = "nto", + target_os = "qnx", target_vendor = "apple", ))] mod m { diff --git a/tests/ui/process/process-sigpipe.rs b/tests/ui/process/process-sigpipe.rs index 574d79ee1dd..b8eb2a9688b 100644 --- a/tests/ui/process/process-sigpipe.rs +++ b/tests/ui/process/process-sigpipe.rs @@ -31,9 +31,9 @@ fn main() { thread::sleep_ms(5000); process::exit(1); }); - // QNX Neutrino does not have `yes`. Therefore, use `while-echo` for `nto` + // QNX does not have `yes`. Therefore, use `while-echo` for `nto` // and `yes` for other platforms. - let command = if cfg!(target_os = "nto") { + let command = if cfg!(any(target_os = "nto", target_os = "qnx")) { "while echo y ; do : ; done | head" } else { "yes | head" diff --git a/tests/ui/structs/rec-align-u64.rs b/tests/ui/structs/rec-align-u64.rs index e49726c7d43..a3d835799ad 100644 --- a/tests/ui/structs/rec-align-u64.rs +++ b/tests/ui/structs/rec-align-u64.rs @@ -36,6 +36,7 @@ struct Outer { target_os = "solaris", target_os = "vxworks", target_os = "nto", + target_os = "qnx", target_vendor = "apple", ))] mod m {