Add x86_64-unknown-linux-ohos target
This complements the existing `aarch64-unknown-linux-ohos` and `armv7-unknown-linux-ohos` targets.
This commit is contained in:
parent
fe37f37e4b
commit
5d46bd995d
8 changed files with 79 additions and 10 deletions
|
@ -3,9 +3,7 @@ use crate::spec::{Target, TargetOptions};
|
|||
use super::SanitizerSet;
|
||||
|
||||
pub fn target() -> Target {
|
||||
let mut base = super::linux_musl_base::opts();
|
||||
base.env = "ohos".into();
|
||||
base.crt_static_default = false;
|
||||
let mut base = super::linux_ohos_base::opts();
|
||||
base.max_atomic_width = Some(128);
|
||||
|
||||
Target {
|
||||
|
@ -17,8 +15,6 @@ pub fn target() -> Target {
|
|||
options: TargetOptions {
|
||||
features: "+reserve-x18".into(),
|
||||
mcount: "\u{1}_mcount".into(),
|
||||
force_emulated_tls: true,
|
||||
has_thread_local: false,
|
||||
supported_sanitizers: SanitizerSet::ADDRESS
|
||||
| SanitizerSet::CFI
|
||||
| SanitizerSet::LEAK
|
||||
|
|
|
@ -17,12 +17,8 @@ pub fn target() -> Target {
|
|||
abi: "eabi".into(),
|
||||
features: "+v7,+thumb2,+soft-float,-neon".into(),
|
||||
max_atomic_width: Some(64),
|
||||
env: "ohos".into(),
|
||||
crt_static_default: false,
|
||||
mcount: "\u{1}mcount".into(),
|
||||
force_emulated_tls: true,
|
||||
has_thread_local: false,
|
||||
..super::linux_musl_base::opts()
|
||||
..super::linux_ohos_base::opts()
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
12
compiler/rustc_target/src/spec/linux_ohos_base.rs
Normal file
12
compiler/rustc_target/src/spec/linux_ohos_base.rs
Normal file
|
@ -0,0 +1,12 @@
|
|||
use crate::spec::TargetOptions;
|
||||
|
||||
pub fn opts() -> TargetOptions {
|
||||
let mut base = super::linux_base::opts();
|
||||
|
||||
base.env = "ohos".into();
|
||||
base.crt_static_default = false;
|
||||
base.force_emulated_tls = true;
|
||||
base.has_thread_local = false;
|
||||
|
||||
base
|
||||
}
|
|
@ -73,6 +73,7 @@ mod l4re_base;
|
|||
mod linux_base;
|
||||
mod linux_gnu_base;
|
||||
mod linux_musl_base;
|
||||
mod linux_ohos_base;
|
||||
mod linux_uclibc_base;
|
||||
mod msvc_base;
|
||||
mod netbsd_base;
|
||||
|
@ -1365,6 +1366,7 @@ supported_targets! {
|
|||
|
||||
("aarch64-unknown-linux-ohos", aarch64_unknown_linux_ohos),
|
||||
("armv7-unknown-linux-ohos", armv7_unknown_linux_ohos),
|
||||
("x86_64-unknown-linux-ohos", x86_64_unknown_linux_ohos),
|
||||
}
|
||||
|
||||
/// Cow-Vec-Str: Cow<'static, [Cow<'static, str>]>
|
||||
|
|
26
compiler/rustc_target/src/spec/x86_64_unknown_linux_ohos.rs
Normal file
26
compiler/rustc_target/src/spec/x86_64_unknown_linux_ohos.rs
Normal file
|
@ -0,0 +1,26 @@
|
|||
use crate::spec::{Cc, LinkerFlavor, Lld, SanitizerSet, StackProbeType, Target};
|
||||
|
||||
pub fn target() -> Target {
|
||||
let mut base = super::linux_ohos_base::opts();
|
||||
base.cpu = "x86-64".into();
|
||||
base.max_atomic_width = Some(64);
|
||||
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
|
||||
base.stack_probes = StackProbeType::X86;
|
||||
base.static_position_independent_executables = true;
|
||||
base.supported_sanitizers = SanitizerSet::ADDRESS
|
||||
| SanitizerSet::CFI
|
||||
| SanitizerSet::LEAK
|
||||
| SanitizerSet::MEMORY
|
||||
| SanitizerSet::THREAD;
|
||||
base.supports_xray = true;
|
||||
|
||||
Target {
|
||||
// LLVM 15 doesn't support OpenHarmony yet, use a linux target instead.
|
||||
llvm_target: "x86_64-unknown-linux-musl".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: base,
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue