forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#133631 - flba-eb:add_nto_qnx71_iosock_suppo…
…rt, r=workingjubilee Support QNX 7.1 with `io-sock`+libstd and QNX 8.0 (`no_std` only) Changes of this pull request: 1. Refactor code for qnx nto targets to share more code in file `nto_qnx.rs` 1. Add support for an additional network stack on nto qnx 7.1. QNX 7.1 supports two network stacks: 1. `io-pkt`, which is default 2. `io-sock`, which is optional on 7.1 but default in QNX 8.0 As one can see in the [io-sock migration notes](https://www.qnx.com/developers/docs/7.1/index.html#com.qnx.doc.neutrino.io_sock/topic/migrate_app.html), this changes the libc API in a way similar to e.g. linux-gnu vs. linux-musl. This change adds a new target which has a different value for `target_env`, so that e.g. libc can distinguish between both APIs. 2. Add initial support for QNX 8.0, thanks to AkhilTThomas. As it turned out, the problem with forking many processes still exists in QNX 8.0. Because if this, we are now using it for any QNX version (i.e. not check for `target_env` anymore).
- Loading branch information
Showing
17 changed files
with
285 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 8 additions & 34 deletions
42
compiler/rustc_target/src/spec/targets/aarch64_unknown_nto_qnx700.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,11 @@ | ||
use crate::spec::{Cc, LinkerFlavor, Lld, Target, TargetOptions, base}; | ||
use crate::spec::Target; | ||
use crate::spec::base::nto_qnx; | ||
|
||
pub(crate) fn target() -> Target { | ||
// In QNX, libc does not provide a compatible ABI between versions. | ||
// To distinguish between QNX versions, we needed a stable conditional compilation switch, | ||
// which is why we needed to implement different targets in the compiler. | ||
Target { | ||
llvm_target: "aarch64-unknown-unknown".into(), | ||
metadata: crate::spec::TargetMetadata { | ||
description: Some("ARM64 QNX Neutrino 7.0 RTOS".into()), | ||
tier: Some(3), | ||
host_tools: Some(false), | ||
std: Some(true), | ||
}, | ||
pointer_width: 64, | ||
// from: https://llvm.org/docs/LangRef.html#data-layout | ||
// e = little endian | ||
// m:e = ELF mangling: Private symbols get a .L prefix | ||
// i8:8:32 = 8-bit-integer, minimum_alignment=8, preferred_alignment=32 | ||
// i16:16:32 = 16-bit-integer, minimum_alignment=16, preferred_alignment=32 | ||
// i64:64 = 64-bit-integer, minimum_alignment=64, preferred_alignment=64 | ||
// i128:128 = 128-bit-integer, minimum_alignment=128, preferred_alignment=128 | ||
// n32:64 = 32 and 64 are native integer widths; Elements of this set are considered to support most general arithmetic operations efficiently. | ||
// S128 = 128 bits are the natural alignment of the stack in bits. | ||
data_layout: "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32".into(), | ||
arch: "aarch64".into(), | ||
options: TargetOptions { | ||
features: "+v8a".into(), | ||
max_atomic_width: Some(128), | ||
pre_link_args: TargetOptions::link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &[ | ||
"-Vgcc_ntoaarch64le_cxx", | ||
]), | ||
env: "nto70".into(), | ||
..base::nto_qnx::opts() | ||
}, | ||
} | ||
let mut target = nto_qnx::aarch64(); | ||
target.metadata.description = Some("ARM64 QNX Neutrino 7.0 RTOS".into()); | ||
target.options.pre_link_args = | ||
nto_qnx::pre_link_args(nto_qnx::ApiVariant::Default, nto_qnx::Arch::Aarch64); | ||
target.options.env = "nto70".into(); | ||
target | ||
} |
12 changes: 8 additions & 4 deletions
12
compiler/rustc_target/src/spec/targets/aarch64_unknown_nto_qnx710.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
use crate::spec::Target; | ||
use crate::spec::base::nto_qnx; | ||
|
||
pub(crate) fn target() -> Target { | ||
let mut base = super::aarch64_unknown_nto_qnx700::target(); | ||
base.metadata.description = Some("ARM64 QNX Neutrino 7.1 RTOS".into()); | ||
base.options.env = "nto71".into(); | ||
base | ||
let mut target = nto_qnx::aarch64(); | ||
target.metadata.description = | ||
Some("ARM64 QNX Neutrino 7.1 RTOS with io-pkt network stack".into()); | ||
target.options.pre_link_args = | ||
nto_qnx::pre_link_args(nto_qnx::ApiVariant::Default, nto_qnx::Arch::Aarch64); | ||
target.options.env = "nto71".into(); | ||
target | ||
} |
12 changes: 12 additions & 0 deletions
12
compiler/rustc_target/src/spec/targets/aarch64_unknown_nto_qnx710_iosock.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
use crate::spec::Target; | ||
use crate::spec::base::nto_qnx; | ||
|
||
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()); | ||
target.options.pre_link_args = | ||
nto_qnx::pre_link_args(nto_qnx::ApiVariant::IoSock, nto_qnx::Arch::Aarch64); | ||
target.options.env = "nto71_iosock".into(); | ||
target | ||
} |
11 changes: 11 additions & 0 deletions
11
compiler/rustc_target/src/spec/targets/aarch64_unknown_nto_qnx800.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
use crate::spec::Target; | ||
use crate::spec::base::nto_qnx; | ||
|
||
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 = "nto80".into(); | ||
target | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 9 additions & 25 deletions
34
compiler/rustc_target/src/spec/targets/x86_64_pc_nto_qnx710.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,12 @@ | ||
use crate::spec::{Cc, LinkerFlavor, Lld, Target, TargetOptions, base}; | ||
use crate::spec::Target; | ||
use crate::spec::base::nto_qnx; | ||
|
||
pub(crate) fn target() -> Target { | ||
Target { | ||
llvm_target: "x86_64-pc-unknown".into(), | ||
metadata: crate::spec::TargetMetadata { | ||
description: Some("x86 64-bit QNX Neutrino 7.1 RTOS".into()), | ||
tier: Some(3), | ||
host_tools: Some(false), | ||
std: Some(true), | ||
}, | ||
pointer_width: 64, | ||
data_layout: | ||
"e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128".into(), | ||
arch: "x86_64".into(), | ||
options: TargetOptions { | ||
cpu: "x86-64".into(), | ||
plt_by_default: false, | ||
max_atomic_width: Some(64), | ||
pre_link_args: TargetOptions::link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &[ | ||
"-Vgcc_ntox86_64_cxx", | ||
]), | ||
env: "nto71".into(), | ||
vendor: "pc".into(), | ||
..base::nto_qnx::opts() | ||
}, | ||
} | ||
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()); | ||
target.options.pre_link_args = | ||
nto_qnx::pre_link_args(nto_qnx::ApiVariant::Default, nto_qnx::Arch::X86_64); | ||
target.options.env = "nto71".into(); | ||
target | ||
} |
12 changes: 12 additions & 0 deletions
12
compiler/rustc_target/src/spec/targets/x86_64_pc_nto_qnx710_iosock.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
use crate::spec::Target; | ||
use crate::spec::base::nto_qnx; | ||
|
||
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()); | ||
target.options.pre_link_args = | ||
nto_qnx::pre_link_args(nto_qnx::ApiVariant::IoSock, nto_qnx::Arch::X86_64); | ||
target.options.env = "nto71_iosock".into(); | ||
target | ||
} |
11 changes: 11 additions & 0 deletions
11
compiler/rustc_target/src/spec/targets/x86_64_pc_nto_qnx800.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
use crate::spec::Target; | ||
use crate::spec::base::nto_qnx; | ||
|
||
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 = "nto80".into(); | ||
target | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.