Skip to content

Commit 4d0b44a

Browse files
Rollup merge of #130750 - heiher:loong-linux-ohos-tier3, r=jieyouxu
Add new Tier-3 target: `loongarch64-unknown-linux-ohos` MCP: rust-lang/compiler-team#784
2 parents ec1ccff + 9ab7046 commit 4d0b44a

File tree

5 files changed

+37
-0
lines changed

5 files changed

+37
-0
lines changed

Diff for: compiler/rustc_target/src/spec/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1882,6 +1882,7 @@ supported_targets! {
18821882

18831883
("aarch64-unknown-linux-ohos", aarch64_unknown_linux_ohos),
18841884
("armv7-unknown-linux-ohos", armv7_unknown_linux_ohos),
1885+
("loongarch64-unknown-linux-ohos", loongarch64_unknown_linux_ohos),
18851886
("x86_64-unknown-linux-ohos", x86_64_unknown_linux_ohos),
18861887

18871888
("x86_64-unknown-linux-none", x86_64_unknown_linux_none),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
use crate::spec::{Target, TargetOptions, base};
2+
3+
pub(crate) fn target() -> Target {
4+
Target {
5+
// LLVM 15 doesn't support OpenHarmony yet, use a linux target instead.
6+
llvm_target: "loongarch64-unknown-linux-musl".into(),
7+
metadata: crate::spec::TargetMetadata {
8+
description: Some("LoongArch64 OpenHarmony".into()),
9+
tier: Some(3),
10+
host_tools: Some(false),
11+
std: Some(true),
12+
},
13+
pointer_width: 64,
14+
data_layout: "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128".into(),
15+
arch: "loongarch64".into(),
16+
options: TargetOptions {
17+
cpu: "generic".into(),
18+
features: "+f,+d".into(),
19+
llvm_abiname: "lp64d".into(),
20+
max_atomic_width: Some(64),
21+
..base::linux_ohos::opts()
22+
},
23+
}
24+
}

Diff for: src/doc/rustc/src/platform-support.md

+1
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ target | std | host | notes
313313
`i686-uwp-windows-msvc` | ✓ | | [^x86_32-floats-return-ABI]
314314
[`i686-win7-windows-msvc`](platform-support/win7-windows-msvc.md) | ✓ | | 32-bit Windows 7 support [^x86_32-floats-return-ABI]
315315
[`i686-wrs-vxworks`](platform-support/vxworks.md) | ✓ | | [^x86_32-floats-return-ABI]
316+
[`loongarch64-unknown-linux-ohos`](platform-support/openharmony.md) | ✓ | | LoongArch64 OpenHarmony
316317
[`m68k-unknown-linux-gnu`](platform-support/m68k-unknown-linux-gnu.md) | ? | | Motorola 680x0 Linux
317318
`mips-unknown-linux-gnu` | ✓ | ✓ | MIPS Linux (kernel 4.4, glibc 2.23)
318319
`mips-unknown-linux-musl` | ✓ | | MIPS Linux with musl 1.2.3

Diff for: src/doc/rustc/src/platform-support/openharmony.md

+8
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
**Tier: 2**
44

5+
* aarch64-unknown-linux-ohos
6+
* armv7-unknown-linux-ohos
7+
* x86_64-unknown-linux-ohos
8+
9+
**Tier: 3**
10+
11+
* loongarch64-unknown-linux-ohos
12+
513
Targets for the [OpenHarmony](https://gitee.com/openharmony/docs/) operating
614
system.
715

Diff for: tests/assembly/targets/targets-elf.rs

+3
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,9 @@
249249
//@ revisions: loongarch64_unknown_linux_musl
250250
//@ [loongarch64_unknown_linux_musl] compile-flags: --target loongarch64-unknown-linux-musl
251251
//@ [loongarch64_unknown_linux_musl] needs-llvm-components: loongarch
252+
//@ revisions: loongarch64_unknown_linux_ohos
253+
//@ [loongarch64_unknown_linux_ohos] compile-flags: --target loongarch64-unknown-linux-ohos
254+
//@ [loongarch64_unknown_linux_ohos] needs-llvm-components: loongarch
252255
//@ revisions: loongarch64_unknown_none
253256
//@ [loongarch64_unknown_none] compile-flags: --target loongarch64-unknown-none
254257
//@ [loongarch64_unknown_none] needs-llvm-components: loongarch

0 commit comments

Comments
 (0)