Skip to content

Commit 3f045c9

Browse files
AkhilTThomasflba-eb
authored andcommitted
add nto80 x86-64 and aarch64 target
Signed-off-by: Florian Bartels <[email protected]>
1 parent 62661f2 commit 3f045c9

File tree

9 files changed

+39
-14
lines changed

9 files changed

+39
-14
lines changed

compiler/rustc_target/src/spec/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1964,8 +1964,10 @@ supported_targets! {
19641964
("aarch64-unknown-nto-qnx700", aarch64_unknown_nto_qnx700),
19651965
("aarch64-unknown-nto-qnx710", aarch64_unknown_nto_qnx710),
19661966
("aarch64-unknown-nto-qnx710_iosock", aarch64_unknown_nto_qnx710_iosock),
1967+
("aarch64-unknown-nto-qnx800", aarch64_unknown_nto_qnx800),
19671968
("x86_64-pc-nto-qnx710", x86_64_pc_nto_qnx710),
19681969
("x86_64-pc-nto-qnx710_iosock", x86_64_pc_nto_qnx710_iosock),
1970+
("x86_64-pc-nto-qnx800", x86_64_pc_nto_qnx800),
19691971
("i586-pc-nto-qnx700", i586_pc_nto_qnx700),
19701972

19711973
("aarch64-unknown-linux-ohos", aarch64_unknown_linux_ohos),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
use crate::spec::Target;
2+
use crate::spec::base::nto_qnx;
3+
4+
pub(crate) fn target() -> Target {
5+
let mut target = nto_qnx::aarch64();
6+
target.metadata.description = Some("ARM64 QNX Neutrino 8.0 RTOS".into());
7+
target.options.pre_link_args =
8+
nto_qnx::pre_link_args(nto_qnx::ApiVariant::Default, nto_qnx::Arch::Aarch64);
9+
target.options.env = "nto80".into();
10+
target
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
use crate::spec::Target;
2+
use crate::spec::base::nto_qnx;
3+
4+
pub(crate) fn target() -> Target {
5+
let mut target = nto_qnx::x86_64();
6+
target.metadata.description = Some("x86 64-bit QNX Neutrino 8.0 RTOS".into());
7+
target.options.pre_link_args =
8+
nto_qnx::pre_link_args(nto_qnx::ApiVariant::Default, nto_qnx::Arch::X86_64);
9+
target.options.env = "nto80".into();
10+
target
11+
}

library/std/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ test = true
139139
level = "warn"
140140
check-cfg = [
141141
'cfg(bootstrap)',
142-
'cfg(target_arch, values("xtensa", "aarch64-unknown-nto-qnx710_iosock", "x86_64-pc-nto-qnx710_iosock"))',
143-
'cfg(target_env, values("nto71_iosock"))',
142+
'cfg(target_arch, values("xtensa", "aarch64-unknown-nto-qnx710_iosock", "x86_64-pc-nto-qnx710_iosock", "x86_64-pc-nto-qnx800","aarch64-unknown-nto-qnx800"))',
143+
'cfg(target_env, values("nto71_iosock", "nto80"))',
144144
# std use #[path] imports to portable-simd `std_float` crate
145145
# and to the `backtrace` crate which messes-up with Cargo list
146146
# of declared features, we therefor expect any feature cfg

library/std/src/sys/pal/unix/process/process_unix.rs

+3-11
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ use crate::sys::process::process_common::*;
1919
use crate::{fmt, mem, sys};
2020

2121
cfg_if::cfg_if! {
22-
// This workaround is only needed for QNX 7.0 and 7.1. The bug should have been fixed in 8.0
23-
if #[cfg(any(target_env = "nto70", target_env = "nto71", target_env = "nto71_iosock"))] {
22+
if #[cfg(target_os = "nto")] {
2423
use crate::thread;
2524
use libc::{c_char, posix_spawn_file_actions_t, posix_spawnattr_t};
2625
use crate::time::Duration;
@@ -187,13 +186,7 @@ impl Command {
187186

188187
// Attempts to fork the process. If successful, returns Ok((0, -1))
189188
// in the child, and Ok((child_pid, -1)) in the parent.
190-
#[cfg(not(any(
191-
target_os = "watchos",
192-
target_os = "tvos",
193-
target_env = "nto70",
194-
target_env = "nto71",
195-
target_env = "nto71_iosock",
196-
)))]
189+
#[cfg(not(any(target_os = "watchos", target_os = "tvos", target_os = "nto")))]
197190
unsafe fn do_fork(&mut self) -> Result<pid_t, io::Error> {
198191
cvt(libc::fork())
199192
}
@@ -202,8 +195,7 @@ impl Command {
202195
// or closed a file descriptor while the fork() was occurring".
203196
// Documentation says "... or try calling fork() again". This is what we do here.
204197
// See also https://www.qnx.com/developers/docs/7.1/#com.qnx.doc.neutrino.lib_ref/topic/f/fork.html
205-
// This workaround is only needed for QNX 7.0 and 7.1. The bug should have been fixed in 8.0
206-
#[cfg(any(target_env = "nto70", target_env = "nto71", target_env = "nto71_iosock"))]
198+
#[cfg(target_os = "nto")]
207199
unsafe fn do_fork(&mut self) -> Result<pid_t, io::Error> {
208200
use crate::sys::os::errno;
209201

src/bootstrap/src/core/sanity.rs

+2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ const STAGE0_MISSING_TARGETS: &[&str] = &[
3636
// just a dummy comment so the list doesn't get onelined
3737
"aarch64-unknown-nto-qnx710_iosock",
3838
"x86_64-pc-nto-qnx710_iosock",
39+
"x86_64-pc-nto-qnx800",
40+
"aarch64-unknown-nto-qnx800",
3941
];
4042

4143
/// Minimum version threshold for libstdc++ required when using prebuilt LLVM

src/doc/rustc/src/platform-support/nto-qnx.md

+1
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ For conditional compilation, following QNX Neutrino specific attributes are defi
115115
- `target_env` = `"nto71"` (for QNX Neutrino 7.1 with "classic" network stack "io_pkt")
116116
- `target_env` = `"nto71_iosock"` (for QNX Neutrino 7.1 with network stack "io_sock")
117117
- `target_env` = `"nto70"` (for QNX Neutrino 7.0)
118+
- `target_env` = `"nto80"` (for QNX Neutrino 8.0)
118119

119120
## Building the target
120121

tests/assembly/targets/targets-elf.rs

+6
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@
6060
//@ revisions: aarch64_unknown_nto_qnx710_iosock
6161
//@ [aarch64_unknown_nto_qnx710_iosock] compile-flags: --target aarch64-unknown-nto-qnx710_iosock
6262
//@ [aarch64_unknown_nto_qnx710_iosock] needs-llvm-components: aarch64
63+
//@ revisions: aarch64_unknown_nto_qnx800
64+
//@ [aarch64_unknown_nto_qnx800] compile-flags: --target aarch64-unknown-nto-qnx800
65+
//@ [aarch64_unknown_nto_qnx800] needs-llvm-components: aarch64
6366
//@ revisions: aarch64_unknown_openbsd
6467
//@ [aarch64_unknown_openbsd] compile-flags: --target aarch64-unknown-openbsd
6568
//@ [aarch64_unknown_openbsd] needs-llvm-components: aarch64
@@ -570,6 +573,9 @@
570573
//@ revisions: x86_64_pc_nto_qnx710_iosock
571574
//@ [x86_64_pc_nto_qnx710_iosock] compile-flags: --target x86_64-pc-nto-qnx710_iosock
572575
//@ [x86_64_pc_nto_qnx710_iosock] needs-llvm-components: x86
576+
//@ revisions: x86_64_pc_nto_qnx800
577+
//@ [x86_64_pc_nto_qnx800] compile-flags: --target x86_64-pc-nto-qnx800
578+
//@ [x86_64_pc_nto_qnx800] needs-llvm-components: x86
573579
//@ revisions: x86_64_pc_solaris
574580
//@ [x86_64_pc_solaris] compile-flags: --target x86_64-pc-solaris
575581
//@ [x86_64_pc_solaris] needs-llvm-components: x86

tests/ui/check-cfg/well-known-values.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
156156
LL | target_env = "_UNEXPECTED_VALUE",
157157
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
158158
|
159-
= note: expected values for `target_env` are: ``, `gnu`, `msvc`, `musl`, `newlib`, `nto70`, `nto71`, `nto71_iosock`, `ohos`, `p1`, `p2`, `relibc`, `sgx`, and `uclibc`
159+
= note: expected values for `target_env` are: ``, `gnu`, `msvc`, `musl`, `newlib`, `nto70`, `nto71`, `nto71_iosock`, `nto80`, `ohos`, `p1`, `p2`, `relibc`, `sgx`, and `uclibc`
160160
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
161161

162162
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`

0 commit comments

Comments
 (0)