1
Fork 0

Add no_std AArch64 support for the QNX Neutrino (nto) 7.1 RTOS

This change allows to compile no_std applications for the QNX Neutrino
realtime operating system for ARM 64 bit CPUs.
Tested with QNX Neutrino 7.1.
This commit is contained in:
Florian Bartels 2022-09-05 10:56:06 +02:00
parent b7b7f2716e
commit 84e1fbcadf
7 changed files with 192 additions and 0 deletions

View file

@ -0,0 +1,28 @@
use super::nto_qnx_base;
use crate::spec::{Cc, LinkerFlavor, Lld, Target, TargetOptions};
pub fn target() -> Target {
Target {
llvm_target: "aarch64-unknown-unknown".into(),
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-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
arch: "aarch64".into(),
options: TargetOptions {
max_atomic_width: Some(128),
pre_link_args: TargetOptions::link_args(
LinkerFlavor::Gnu(Cc::Yes, Lld::No),
&["-Vgcc_ntoaarch64le_cxx"],
),
..nto_qnx_base::opts()
},
}
}

View file

@ -74,6 +74,7 @@ mod linux_musl_base;
mod linux_uclibc_base;
mod msvc_base;
mod netbsd_base;
mod nto_qnx_base;
mod openbsd_base;
mod redox_base;
mod solaris_base;
@ -1242,6 +1243,9 @@ supported_targets! {
("x86_64-unknown-none", x86_64_unknown_none),
("mips64-openwrt-linux-musl", mips64_openwrt_linux_musl),
("aarch64-unknown-nto-qnx7.1.0", aarch64_unknown_nto_qnx_710),
("x86_64-pc-nto-qnx7.1.0", x86_64_pc_nto_qnx710),
}
/// Cow-Vec-Str: Cow<'static, [Cow<'static, str>]>

View file

@ -0,0 +1,19 @@
use crate::spec::{cvs, RelroLevel, TargetOptions};
pub fn opts() -> TargetOptions {
TargetOptions {
crt_static_respected: true,
dynamic_linking: true,
env: "nto71".into(),
executables: true,
families: cvs!["unix"],
has_rpath: true,
has_thread_local: false,
linker: Some("qcc".into()),
os: "nto".into(),
position_independent_executables: true,
static_position_independent_executables: true,
relro_level: RelroLevel::Full,
..Default::default()
}
}

View file

@ -0,0 +1,21 @@
use super::nto_qnx_base;
use crate::spec::{Cc, LinkerFlavor, Lld, Target, TargetOptions};
pub fn target() -> Target {
Target {
llvm_target: "x86_64-pc-unknown".into(),
pointer_width: 64,
data_layout: "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
.into(),
arch: "x86_64".into(),
options: TargetOptions {
cpu: "x86-64".into(),
max_atomic_width: Some(64),
pre_link_args: TargetOptions::link_args(
LinkerFlavor::Gnu(Cc::Yes, Lld::No),
&["-Vgcc_ntox86_64_cxx"],
),
..nto_qnx_base::opts()
},
}
}