Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tier 3 no_std x86 support for QNX Neutrino RTOS, version 7.0 #109173

Merged
merged 1 commit into from
Apr 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ pub fn target() -> Target {
LinkerFlavor::Gnu(Cc::Yes, Lld::No),
&["-Vgcc_ntoaarch64le_cxx"],
),
env: "nto71".into(),
..nto_qnx_base::opts()
},
}
Expand Down
24 changes: 24 additions & 0 deletions compiler/rustc_target/src/spec/i586_pc_nto_qnx700.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
use super::nto_qnx_base;
use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions};

pub fn target() -> Target {
Target {
llvm_target: "i586-pc-unknown".into(),
pointer_width: 32,
data_layout: "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-\
f64:32:64-f80:32-n8:16:32-S128"
.into(),
arch: "x86".into(),
options: TargetOptions {
cpu: "pentium4".into(),
max_atomic_width: Some(64),
pre_link_args: TargetOptions::link_args(
LinkerFlavor::Gnu(Cc::Yes, Lld::No),
&["-Vgcc_ntox86_cxx"],
),
env: "nto70".into(),
stack_probes: StackProbeType::X86,
..nto_qnx_base::opts()
},
}
}
1 change: 1 addition & 0 deletions compiler/rustc_target/src/spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1261,6 +1261,7 @@ supported_targets! {

("aarch64-unknown-nto-qnx710", aarch64_unknown_nto_qnx_710),
("x86_64-pc-nto-qnx710", x86_64_pc_nto_qnx710),
("i586-pc-nto-qnx700", i586_pc_nto_qnx700),

("aarch64-unknown-linux-ohos", aarch64_unknown_linux_ohos),
("armv7-unknown-linux-ohos", armv7_unknown_linux_ohos),
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_target/src/spec/nto_qnx_base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ pub fn opts() -> TargetOptions {
TargetOptions {
crt_static_respected: true,
dynamic_linking: true,
env: "nto71".into(),
executables: true,
families: cvs!["unix"],
has_rpath: true,
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_target/src/spec/x86_64_pc_nto_qnx710.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ pub fn target() -> Target {
LinkerFlavor::Gnu(Cc::Yes, Lld::No),
&["-Vgcc_ntox86_64_cxx"],
),
env: "nto71".into(),
..nto_qnx_base::opts()
},
}
Expand Down
1 change: 1 addition & 0 deletions src/doc/rustc/src/platform-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ target | std | host | notes
`bpfel-unknown-none` | * | | BPF (little endian)
`hexagon-unknown-linux-musl` | ? | |
`i386-apple-ios` | ✓ | | 32-bit x86 iOS
[`i586-pc-nto-qnx700`](platform-support/nto-qnx.md) | * | | 32-bit x86 QNX Neutrino 7.0 RTOS |
`i686-apple-darwin` | ✓ | ✓ | 32-bit macOS (10.7+, Lion+)
`i686-pc-windows-msvc` | * | | 32-bit Windows XP support
`i686-unknown-haiku` | ✓ | ✓ | 32-bit Haiku
Expand Down
15 changes: 12 additions & 3 deletions src/doc/rustc/src/platform-support/nto-qnx.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,18 @@ and [Blackberry QNX][BlackBerry].

## Requirements

Currently, only cross-compilation for QNX Neutrino on AArch64 and x86_64 are supported (little endian).
Currently, the following QNX Neutrino versions and compilation targets are supported:

| QNX Neutrino Version | Target Architecture | Full support | `no_std` support |
|----------------------|---------------------|:------------:|:----------------:|
| 7.1 | AArch64 | ✓ | ✓ |
| 7.1 | x86_64 | ✓ | ✓ |
| 7.0 | x86 | | ✓ |

Adding other architectures that are supported by QNX Neutrino is possible.

The standard library, including `core` and `alloc` (with default allocator) are supported.
In the table above, 'full support' indicates support for building Rust applications with the full standard library.
'`no_std` support' indicates that only `core` and `alloc` are available.

For building or using the Rust toolchain for QNX Neutrino, the
[QNX Software Development Platform (SDP)](https://blackberry.qnx.com/en/products/foundation-software/qnx-software-development-platform)
Expand Down Expand Up @@ -70,7 +78,7 @@ fn panic(_panic: &PanicInfo<'_>) -> ! {
pub extern "C" fn rust_eh_personality() {}
```

The QNX Neutrino support of Rust has been tested with QNX Neutrino 7.1.
The QNX Neutrino support of Rust has been tested with QNX Neutrino 7.0 and 7.1.

There are no further known requirements.

Expand All @@ -80,6 +88,7 @@ For conditional compilation, following QNX Neutrino specific attributes are defi

- `target_os` = `"nto"`
- `target_env` = `"nto71"` (for QNX Neutrino 7.1)
- `target_env` = `"nto70"` (for QNX Neutrino 7.0)

## Building the target

Expand Down