From 000e37e998161fd1062eaee27e74387eec4341aa Mon Sep 17 00:00:00 2001 From: Jonathan Pallant Date: Thu, 25 Jun 2026 10:18:08 +0000 Subject: [PATCH 1/5] QNX target renaming - aarch64-unknown-nto-qnx800 becomes simply aarch64-unknown-qnx - x86_64-pc-nto-qnx800 becomes simply x86_64-pc-qnx - references to QNX OS and QNX Neutrino RTOS are replaced with QNX SDP for uniformity - various nto_qnx modules are named to qnx_sdp to match the above The new target names are more consistent with those used by the QNX SDP 8.0 toolchain, and reflect a level on ongoing API stability similar to that for macOS and Linux (which simply have minimum supported versions record for their targets). Once the compiler knows about the new target names, libc and backtrace can be updated to match, and then building libstd for the new targets can be fixed. With these changes I can run: ```console $ ./x build library/std --stage 2 --target x86_64-pc-nto-qnx710,aarch64-unknown-nto-qnx710,x86_64-pc-nto-qnx710_iosock,aarch64-unknown-nto-qnx710_iosock,aarch64-unknown-nto-qnx700 $ ./x build library/core --stage 1 --target x86_64-pc-qnx,aarch64-unknown-qnx ``` --- compiler/rustc_target/src/spec/base/mod.rs | 2 +- .../src/spec/base/{nto_qnx.rs => qnx_sdp.rs} | 0 compiler/rustc_target/src/spec/mod.rs | 6 +- .../targets/aarch64_unknown_nto_qnx700.rs | 9 +- .../targets/aarch64_unknown_nto_qnx710.rs | 10 +- .../aarch64_unknown_nto_qnx710_iosock.rs | 10 +- .../targets/aarch64_unknown_nto_qnx800.rs | 11 -- .../src/spec/targets/aarch64_unknown_qnx.rs | 12 +++ .../src/spec/targets/i686_pc_nto_qnx700.rs | 15 +-- .../src/spec/targets/x86_64_pc_nto_qnx710.rs | 10 +- .../targets/x86_64_pc_nto_qnx710_iosock.rs | 10 +- .../src/spec/targets/x86_64_pc_nto_qnx800.rs | 11 -- .../src/spec/targets/x86_64_pc_qnx.rs | 12 +++ library/std/build.rs | 1 + library/std/src/env.rs | 1 + library/std/src/net/tcp/tests.rs | 8 +- library/std/src/net/udp/tests.rs | 8 +- library/std/src/os/mod.rs | 2 +- library/std/src/os/unix/mod.rs | 2 +- library/std/src/os/unix/net/datagram.rs | 2 + library/std/src/os/unix/net/mod.rs | 2 + library/std/src/os/unix/net/stream.rs | 3 +- library/std/src/os/unix/net/tests.rs | 2 +- library/std/src/os/unix/net/ucred.rs | 4 +- library/std/src/os/unix/process.rs | 2 +- library/std/src/sys/args/unix.rs | 1 + library/std/src/sys/env_consts.rs | 11 ++ library/std/src/sys/fd/unix.rs | 4 + library/std/src/sys/fs/unix.rs | 30 +++++- library/std/src/sys/io/error/unix.rs | 1 + .../std/src/sys/net/connection/socket/mod.rs | 5 +- .../std/src/sys/net/connection/socket/unix.rs | 2 + library/std/src/sys/pal/unix/sync/condvar.rs | 8 +- library/std/src/sys/pal/unix/time.rs | 2 +- library/std/src/sys/paths/unix.rs | 2 +- library/std/src/sys/process/unix/unix.rs | 29 +++-- library/std/src/sys/random/mod.rs | 1 + library/std/src/sys/thread/unix.rs | 7 +- library/unwind/src/lib.rs | 2 +- src/bootstrap/src/core/sanity.rs | 2 + src/doc/rustc/src/platform-support.md | 4 +- src/doc/rustc/src/platform-support/nto-qnx.md | 101 +++++------------- src/librustdoc/clean/cfg.rs | 10 +- src/tools/miri/tests/pass-dep/shims/gettid.rs | 2 +- tests/assembly-llvm/targets/targets-elf.rs | 12 +-- tests/rustdoc-html/doc-cfg/all-targets.rs | 2 +- tests/rustdoc-html/doc-cfg/sort.rs | 2 + .../auxiliary/used_pre_main_constructor.rs | 1 + tests/ui/check-cfg/cfg-crate-features.stderr | 2 +- tests/ui/check-cfg/well-known-values.stderr | 6 +- tests/ui/intrinsics/intrinsic-alignment.rs | 1 + tests/ui/process/process-sigpipe.rs | 4 +- tests/ui/structs/rec-align-u64.rs | 1 + 53 files changed, 229 insertions(+), 181 deletions(-) rename compiler/rustc_target/src/spec/base/{nto_qnx.rs => qnx_sdp.rs} (100%) delete mode 100644 compiler/rustc_target/src/spec/targets/aarch64_unknown_nto_qnx800.rs create mode 100644 compiler/rustc_target/src/spec/targets/aarch64_unknown_qnx.rs delete mode 100644 compiler/rustc_target/src/spec/targets/x86_64_pc_nto_qnx800.rs create mode 100644 compiler/rustc_target/src/spec/targets/x86_64_pc_qnx.rs diff --git a/compiler/rustc_target/src/spec/base/mod.rs b/compiler/rustc_target/src/spec/base/mod.rs index 9e7ff620fea43..13f364f3d8258 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 ef5c98642e9f8..e1427f490e969 100644 --- a/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs @@ -1790,10 +1790,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), @@ -1994,6 +1994,7 @@ crate::target_spec_enum! { OpenBsd = "openbsd", Psp = "psp", Psx = "psx", + Qnx = "qnx", Qurt = "qurt", Redox = "redox", Rtems = "rtems", @@ -2034,7 +2035,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 e1f29f832f0b5..db8905dba6cc3 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 1baa56630d3a9..3a76a0e34d699 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 80ae93247a3f0..e612105201ff0 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 5d265087c4a21..0000000000000 --- 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 0000000000000..cbd2f4224185d --- /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 7184a54961e20..c8def7e5bc423 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 9160015485097..6d814725d16ed 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 1e97ae6b7a08e..33789b61a18b1 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 bd98df621db16..0000000000000 --- 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 0000000000000..59eff3dbeb5d4 --- /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 5f2e441bf7d83..98856b58d890f 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 1cbabf572367e..fa5dfd8b76ec1 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 88f6af0e33df7..cada78a0d55ad 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 9e9d3bf77e50b..eeb6afdb072eb 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 44ddb55c920f4..a7ffd87d84d93 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 e3f15a00a0944..25aa3bf7893f4 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 6876446c25c5d..e7bcd70140d67 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 a44b23a77d2d4..137088dd832f7 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 a4218bd4da62c..4dfa06d74ce7e 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 d88c97113efeb..f703fc6d54c02 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 1395d2ef4be3c..36b67cb1163d8 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 8a7b94d914ab0..3b3a5794ac4f1 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 7a592c2b079dd..197931d8cc8d2 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 573f540483b1a..b14160cf4ad32 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 edb2ffc49995e..392e33a77dc50 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 3152a22534f6c..8fee56348c071 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 56295578bf7d9..85e3c09782ae2 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 55c928dc6c5fc..da25cff1d5444 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 3336dc4cf9233..41850574c96fa 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 73768860723d0..51162296ea3fc 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 26fb6d3d7cf2d..26296b5d169a1 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 e0b1aafda6eb0..36879b7b9bce3 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 b6ccc6b698fda..55906ed2854f2 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 12346ef5a2edd..e5a66dc463c6b 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 dd7b7940de510..e52ffff165beb 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 4e380d8894781..cb4a3593c51d6 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 3c2348c9bf71c..35de185ff7d68 100644 --- a/src/bootstrap/src/core/sanity.rs +++ b/src/bootstrap/src/core/sanity.rs @@ -38,6 +38,8 @@ pub struct Finder { const STAGE0_MISSING_TARGETS: &[&str] = &[ // just a dummy comment so the list doesn't get onelined "powerpc64-unknown-linux-gnuelfv2", + "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 0bc90e2a14008..e219f5bfb1a13 100644 --- a/src/doc/rustc/src/platform-support.md +++ b/src/doc/rustc/src/platform-support.md @@ -276,7 +276,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 @@ -445,7 +445,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 9f8960899c169..5c421af97bbf3 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 | | ✓ | - -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. +| `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 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 2950e3b563c1c..74a04b4451040 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 9b186699ce275..05885ac277f76 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 7cc7cb037d4ce..2332243a667ec 100644 --- a/tests/assembly-llvm/targets/targets-elf.rs +++ b/tests/assembly-llvm/targets/targets-elf.rs @@ -82,9 +82,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 @@ -667,9 +667,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 605a27a7d8927..7adf1d90de283 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 3aa79b7836271..245a9b7b39d05 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 f93a2aae5a1e9..6ea36dee947c1 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 242883995488e..9bf3cef403159 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 47ed9891a1a6c..2125e69da7ec5 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 242eea1f8407d..d14bdf35e81f3 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 574d79ee1ddaf..b8eb2a9688b4d 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 e49726c7d438f..a3d835799ad62 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 { From f43142bb0987c550f08df1c7d7a6008e7e3cbb0c Mon Sep 17 00:00:00 2001 From: Jonathan Pallant Date: Fri, 26 Jun 2026 17:33:41 +0000 Subject: [PATCH 2/5] Fix rustdoc tests The name of the OS had changed, so the tests needed updating --- tests/rustdoc-html/doc-cfg/all-targets.rs | 8 ++++---- tests/rustdoc-html/doc-cfg/sort.rs | 8 ++------ 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/tests/rustdoc-html/doc-cfg/all-targets.rs b/tests/rustdoc-html/doc-cfg/all-targets.rs index 7adf1d90de283..d5a8be83bc1d3 100644 --- a/tests/rustdoc-html/doc-cfg/all-targets.rs +++ b/tests/rustdoc-html/doc-cfg/all-targets.rs @@ -3,9 +3,9 @@ //@ has all_targets/fn.foo.html \ // '//*[@id="main-content"]/*[@class="item-info"]/*[@class="stab portability"]' \ // 'Available on target_env=fake_env or Catalyst or GNU or Managarm C Library \ -// or MSVC or musl or Neutrino 7.0 or Neutrino 7.1 or Neutrino 7.1 with io-sock \ -// or Neutrino 8.0 or Newlib or OpenHarmony or relibc or SGX or Simulator or \ -// uClibc or V5 or WASIp1 or WASIp2 or WASIp3 only.' +// or MSVC or musl or Newlib or OpenHarmony or QNX SDP 7.0 or QNX SDP 7.1 or \ +// QNX SDP 7.1 with io-sock or relibc or SGX or Simulator or uClibc or V5 or WASIp1 \ +// or WASIp2 or WASIp3 only.' #[doc(cfg(any( target_env = "gnu", target_env = "macabi", @@ -80,7 +80,7 @@ pub fn bar() {} // and HelenOS and Hermit and Horizon and illumos and iOS and L4Re and Linux \ // and LynxOS-178 and macOS and Managarm and Motor OS and NetBSD and NuttX \ // and OpenBSD and Play Station 1 and Play Station Portable and Play Station Vita \ -// and QNX Neutrino and QuRT and Redox OS and RTEMS OS and Solaris and \ +// and QNX SDP 7.x and QNX SDP 8.0+ and QuRT and Redox OS and RTEMS OS and Solaris and \ // SOLID ASP3 and TEEOS and Trusty and tvOS and UEFI and VEXos and visionOS \ // and VxWorks and WASI and watchOS and Windows and Xous and zero knowledge \ // Virtual Machine only.' diff --git a/tests/rustdoc-html/doc-cfg/sort.rs b/tests/rustdoc-html/doc-cfg/sort.rs index 245a9b7b39d05..2c54e86be67c7 100644 --- a/tests/rustdoc-html/doc-cfg/sort.rs +++ b/tests/rustdoc-html/doc-cfg/sort.rs @@ -9,7 +9,7 @@ // Tests that OS targets are sorted alphabetically. //@ has 'foo/fn.foo.html' //@ has - '//*[@class="stab portability"]' 'Available on Android or Apple or Cygwin \ -// or DragonFly BSD or FreeBSD or Linux or NetBSD or OpenBSD or QNX Neutrino only.' +// or DragonFly BSD or FreeBSD or Linux or NetBSD or OpenBSD only.' #[doc(cfg(any( target_os = "android", target_os = "linux", @@ -17,8 +17,6 @@ target_os = "freebsd", target_os = "netbsd", target_os = "openbsd", - target_os = "nto", - target_os = "qnx", target_vendor = "apple", target_os = "cygwin" )))] @@ -28,7 +26,7 @@ pub fn foo() {} // Tests that targets are sorted alphabetically just like explicit `doc(cfg)`. //@ has 'foo/fn.bar.html' //@ has - '//*[@class="stab portability"]' 'Available on Android or Apple or Cygwin \ -// or DragonFly BSD or FreeBSD or Linux or NetBSD or OpenBSD or QNX Neutrino only.' +// or DragonFly BSD or FreeBSD or Linux or NetBSD or OpenBSD only.' #[cfg(any( target_os = "android", target_os = "linux", @@ -36,8 +34,6 @@ pub fn foo() {} target_os = "freebsd", target_os = "netbsd", target_os = "openbsd", - target_os = "nto", - target_os = "qnx", target_vendor = "apple", target_os = "cygwin" ))] From 807ed6ce96813579eae921eae24fa563d79200ba Mon Sep 17 00:00:00 2001 From: Jonathan Pallant Date: Mon, 29 Jun 2026 09:31:49 +0000 Subject: [PATCH 3/5] Clean up nto-qnx target page - Now explains what SDP is - Moves sections into a more useful order - Re-wrap long blocks of text --- src/doc/rustc/src/platform-support/nto-qnx.md | 138 +++++++++++------- 1 file changed, 83 insertions(+), 55 deletions(-) diff --git a/src/doc/rustc/src/platform-support/nto-qnx.md b/src/doc/rustc/src/platform-support/nto-qnx.md index 5c421af97bbf3..045655644fa7d 100644 --- a/src/doc/rustc/src/platform-support/nto-qnx.md +++ b/src/doc/rustc/src/platform-support/nto-qnx.md @@ -1,8 +1,22 @@ -# Q +# QNX **Tier: 3** -Support for the [QNX®][qnx.com] Software Development Platform (SDP), version 7.0, 7.1 and 8.0. +Support for the [QNX®][qnx.com] [QNX Software Development Platform (SDP)], version 7.0, 7.1 and 8.0. + +[QNX Software Development Platform (SDP)]: https://qnx.software/en/software/products-and-solutions/qnx-software-development-platform + +The [QNX Software Development Platform (SDP)] is a development environment that +you download and install on a host computer. It includes a C toolchain for your +host, an IDE, and various board support packages for different target platforms. +You can then use QNX SDP to build a custom run-time environment which you deploy +onto an embedded device. That run-time environment will include a microkernel, +whatever services you have selected, and perhaps one or more applications +written in Rust. + +In QNX SDP 7.x the run-time environment is based on QNX Neutrino RTOS 7.x, while +in QNX SDP 8.0 the run-time environment is based on QNX OS 8.0. The name change +reflects architectural changes in the RTOS, but both use a microkernel design. ## Target maintainers @@ -24,44 +38,31 @@ The following QNX SDP versions and compilation targets are supported: | `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 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. - -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/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. +| `i686-pc-nto-qnx700` | QNX SDP 7.0 | x86 | - | ✓ | -### Disabling RELocation Read-Only (RELRO) +* QNX SDP 7.0 only offers the `io-pkt` network stack +* QNX SDP 7.1 uses the `io-pkt` network stack by default, but also includes the optional `io-sock` network stack +* QNX SDP 8.0 only offers the `io-sock` network stack -While not recommended by default, some QNX kernel setups may require the `RELRO` to be disabled with `-C relro_level=off`, e.g. by adding it to the `.cargo/config.toml` file: +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. -```toml -[target.aarch64-unknown-nto-qnx700] -rustflags = ["-C", "relro_level=off"] -``` +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, so see the installation instruction provided with +the SDP). Afterwards [`qcc`] (the QNX C/C++ compiler) should be available in +your system PATH because it will be called during Rust compilation (e.g. for +linking executables). -If your QNX kernel does not allow it, and `relro` is not disabled, running compiled binary would fail with `syntax error: ... unexpected` or similar. This is due to kernel trying to interpret compiled binary with `/bin/sh`, and obviously failing. To verify that this is really the case, run your binary with the `DL_DEBUG=all` env var, and look for this output. If you see it, you should disable `relro` as described above. +[`qcc`]: https://www.qnx.com/developers/docs/8.0/com.qnx.doc.neutrino.utilities/topic/q/qcc.html -```text -Resolution scope for Executable->/bin/sh: - Executable->/bin/sh - libc.so.4->/usr/lib/ldqnx-64.so.2 -``` +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. ## Conditional compilation @@ -127,18 +128,37 @@ For conditional compilation, the following QNX specific attributes are defined: rustc library/core library/alloc library/std ``` +## Building Rust programs + +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. + +Compiled executables can run directly on QNX, either by including them in the +disk image, or copying them over the network to a running system. + +Compiling C code requires the same environment variables to be set as compiling +the Rust toolchain (see above), to ensure `qcc` is used with proper arguments. +To ensure compatibility, do not specify any further arguments that for example +change calling conventions or memory layout. + ## Running the Rust test suite -The test suites of the Rust compiler and standard library can be executed much like other Rust targets. -The environment for testing should match the one used during compiler compilation (refer to `build_env` and `qcc`/`PATH` above) with the -addition of the TEST_DEVICE_ADDR environment variable. -The TEST_DEVICE_ADDR variable controls the remote runner and should point to the target, despite localhost being shown in the following example. -Note that some tests are failing which is why they are currently excluded by the target maintainers which can be seen in the following example. +The test suites of the Rust compiler and standard library can be executed much +like other Rust targets. The environment for testing should match the one used +during compiler compilation (refer to `build_env` and `qcc`/`PATH` above) with +the addition of the `TEST_DEVICE_ADDR` environment variable. The +`TEST_DEVICE_ADDR` variable controls the remote runner and should point to a +target running the `remote-test-server` executable. + +Note that some tests are failing which is why they are currently excluded by the +target maintainers which can be seen in the following example. To run all tests on a x86_64 QNX Neutrino 7.1 target: ```bash -export TEST_DEVICE_ADDR="localhost:12345" # must address the test target, can be a SSH tunnel +export TEST_DEVICE_ADDR="1.2.3.4:12345" # must address the test target, can be a SSH tunnel export build_env= # Disable tests that only work on the host or don't make sense for this target. @@ -161,16 +181,6 @@ env $build_env \ --target x86_64-pc-nto-qnx710 ``` -## Building Rust programs - -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. - -## Testing - -Compiled executables can run directly on QNX. - ### Rust std library test suite The target needs sufficient resources to execute all tests. The commands below assume that a QEMU image @@ -230,8 +240,26 @@ is used. 64 bytes from 127.0.0.1: icmp_seq=0 ttl=255 time=1 ms ``` -## Cross-compilation toolchains and C code +## Disabling RELocation Read-Only (RELRO) -Compiling C code requires the same environment variables to be set as compiling the Rust toolchain (see above), -to ensure `qcc` is used with proper arguments. -To ensure compatibility, do not specify any further arguments that for example change calling conventions or memory layout. +While not recommended by default, some QNX kernel setups may require the `RELRO` +to be disabled with `-C relro_level=off`, e.g. by adding it to the +`.cargo/config.toml` file: + +```toml +[target.aarch64-unknown-nto-qnx700] +rustflags = ["-C", "relro_level=off"] +``` + +If your QNX kernel does not allow it, and `relro` is not disabled, running +compiled binary would fail with `syntax error: ... unexpected` or similar. This +is due to kernel trying to interpret compiled binary with `/bin/sh`, and +obviously failing. To verify that this is really the case, run your binary with +the `DL_DEBUG=all` env var, and look for this output. If you see it, you should +disable `relro` as described above. + +```text +Resolution scope for Executable->/bin/sh: + Executable->/bin/sh + libc.so.4->/usr/lib/ldqnx-64.so.2 +``` From 096fb0bc4f0e1b2738cb2d02d7c51ddcd079bd02 Mon Sep 17 00:00:00 2001 From: Jonathan Pallant Date: Mon, 29 Jun 2026 10:18:47 +0000 Subject: [PATCH 4/5] Use /latest not /8.0 for URL on nto-qnx.md --- src/doc/rustc/src/platform-support/nto-qnx.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/rustc/src/platform-support/nto-qnx.md b/src/doc/rustc/src/platform-support/nto-qnx.md index 045655644fa7d..d187bda376188 100644 --- a/src/doc/rustc/src/platform-support/nto-qnx.md +++ b/src/doc/rustc/src/platform-support/nto-qnx.md @@ -57,7 +57,7 @@ the SDP). Afterwards [`qcc`] (the QNX C/C++ compiler) should be available in your system PATH because it will be called during Rust compilation (e.g. for linking executables). -[`qcc`]: https://www.qnx.com/developers/docs/8.0/com.qnx.doc.neutrino.utilities/topic/q/qcc.html +[`qcc`]: https://www.qnx.com/developers/docs/latest/com.qnx.doc.neutrino.utilities/topic/q/qcc.html When linking `no_std` applications, they must link against `libc.so` (see example). This is required because applications always link against the `crt` From d67cec1fab9a6d2bf40793419b17e5c9ba940bbd Mon Sep 17 00:00:00 2001 From: Jonathan Pallant Date: Mon, 29 Jun 2026 11:16:51 +0000 Subject: [PATCH 5/5] Fixup cfg ordering Just in case we were deliberately pairing up these OSes --- library/std/src/sys/net/connection/socket/mod.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/library/std/src/sys/net/connection/socket/mod.rs b/library/std/src/sys/net/connection/socket/mod.rs index da25cff1d5444..66aa2a804db22 100644 --- a/library/std/src/sys/net/connection/socket/mod.rs +++ b/library/std/src/sys/net/connection/socket/mod.rs @@ -66,8 +66,9 @@ cfg_select! { target_os = "dragonfly", target_os = "freebsd", target_os = "openbsd", target_os = "netbsd", target_os = "solaris", target_os = "illumos", - target_os = "haiku", target_os = "nto", - target_os = "qnx", target_os = "cygwin", + target_os = "haiku", + target_os = "nto", target_os = "qnx", + target_os = "cygwin", ) => { use libc::MSG_NOSIGNAL; }