-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #113061 - Amanieu:x86_64-ohos, r=compiler-errors
Add x86_64-unknown-linux-ohos target This complements the existing `aarch64-unknown-linux-ohos` and `armv7-unknown-linux-ohos` targets. This should be covered by the existing MCP (rust-lang/compiler-team#568), but I can also create a new MCP if that is preferred.
- Loading branch information
Showing
8 changed files
with
79 additions
and
10 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
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::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 | ||
} |
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
26 changes: 26 additions & 0 deletions
26
compiler/rustc_target/src/spec/x86_64_unknown_linux_ohos.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,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, | ||
} | ||
} |
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