Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new Tier-3 target: loongarch64-unknown-linux-ohos #130750

Merged
merged 1 commit into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions compiler/rustc_target/src/spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1886,6 +1886,7 @@ supported_targets! {

("aarch64-unknown-linux-ohos", aarch64_unknown_linux_ohos),
("armv7-unknown-linux-ohos", armv7_unknown_linux_ohos),
("loongarch64-unknown-linux-ohos", loongarch64_unknown_linux_ohos),
("x86_64-unknown-linux-ohos", x86_64_unknown_linux_ohos),

("x86_64-unknown-linux-none", x86_64_unknown_linux_none),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
use crate::spec::{Target, TargetOptions, base};

pub(crate) fn target() -> Target {
Target {
// LLVM 15 doesn't support OpenHarmony yet, use a linux target instead.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: why does here currently still support for LLVM 15 when the minimum supported version is LLVM 18?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is copied from the aarch64-unknown-linux-ohos target. The ohos triple has been supported since LLVM 17, so it's time to update it. #130809

llvm_target: "loongarch64-unknown-linux-musl".into(),
metadata: crate::spec::TargetMetadata {
description: Some("LoongArch64 OpenHarmony".into()),
tier: Some(3),
host_tools: Some(false),
std: Some(true),
},
pointer_width: 64,
data_layout: "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128".into(),
arch: "loongarch64".into(),
options: TargetOptions {
cpu: "generic".into(),
features: "+f,+d".into(),
llvm_abiname: "lp64d".into(),
max_atomic_width: Some(64),
..base::linux_ohos::opts()
},
}
}
1 change: 1 addition & 0 deletions src/doc/rustc/src/platform-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ target | std | host | notes
`i686-uwp-windows-msvc` | ✓ | | [^x86_32-floats-return-ABI]
[`i686-win7-windows-msvc`](platform-support/win7-windows-msvc.md) | ✓ | | 32-bit Windows 7 support [^x86_32-floats-return-ABI]
[`i686-wrs-vxworks`](platform-support/vxworks.md) | ✓ | | [^x86_32-floats-return-ABI]
[`loongarch64-unknown-linux-ohos`](platform-support/openharmony.md) | ✓ | | LoongArch64 OpenHarmony
[`m68k-unknown-linux-gnu`](platform-support/m68k-unknown-linux-gnu.md) | ? | | Motorola 680x0 Linux
`mips-unknown-linux-gnu` | ✓ | ✓ | MIPS Linux (kernel 4.4, glibc 2.23)
`mips-unknown-linux-musl` | ✓ | | MIPS Linux with musl 1.2.3
Expand Down
8 changes: 8 additions & 0 deletions src/doc/rustc/src/platform-support/openharmony.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

**Tier: 2**

* aarch64-unknown-linux-ohos
* armv7-unknown-linux-ohos
* x86_64-unknown-linux-ohos

**Tier: 3**

* loongarch64-unknown-linux-ohos

Targets for the [OpenHarmony](https://gitee.com/openharmony/docs/) operating
system.

Expand Down
3 changes: 3 additions & 0 deletions tests/assembly/targets/targets-elf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,9 @@
//@ revisions: loongarch64_unknown_linux_musl
//@ [loongarch64_unknown_linux_musl] compile-flags: --target loongarch64-unknown-linux-musl
//@ [loongarch64_unknown_linux_musl] needs-llvm-components: loongarch
//@ revisions: loongarch64_unknown_linux_ohos
//@ [loongarch64_unknown_linux_ohos] compile-flags: --target loongarch64-unknown-linux-ohos
//@ [loongarch64_unknown_linux_ohos] needs-llvm-components: loongarch
//@ revisions: loongarch64_unknown_none
//@ [loongarch64_unknown_none] compile-flags: --target loongarch64-unknown-none
//@ [loongarch64_unknown_none] needs-llvm-components: loongarch
Expand Down
Loading