Skip to content

Commit f478ea5

Browse files
authored
Rollup merge of rust-lang#112858 - chriswailes:riscv64-android, r=Mark-Simulacrum
Update Android system definitions and add riscv-linux-android as tier 3 target This PR includes the following: * Corrected Android system definitions for some types * Support for the riscv64-linux-android target The authoritative types for the system definitions can be found here: https://cs.android.com/android/platform/superproject/+/master:bionic/libc/include/sys/stat.h Fixes rust-lang/compiler-team#640
2 parents b321edd + 0081d64 commit f478ea5

File tree

4 files changed

+22
-1
lines changed

4 files changed

+22
-1
lines changed

compiler/rustc_target/src/spec/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1300,6 +1300,7 @@ supported_targets! {
13001300
("armv7-linux-androideabi", armv7_linux_androideabi),
13011301
("thumbv7neon-linux-androideabi", thumbv7neon_linux_androideabi),
13021302
("aarch64-linux-android", aarch64_linux_android),
1303+
("riscv64-linux-android", riscv64_linux_android),
13031304

13041305
("aarch64-unknown-freebsd", aarch64_unknown_freebsd),
13051306
("armv6-unknown-freebsd", armv6_unknown_freebsd),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
use crate::spec::{CodeModel, SanitizerSet, Target, TargetOptions};
2+
3+
pub fn target() -> Target {
4+
Target {
5+
llvm_target: "riscv64-linux-android".into(),
6+
pointer_width: 64,
7+
data_layout: "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128".into(),
8+
arch: "riscv64".into(),
9+
options: TargetOptions {
10+
code_model: Some(CodeModel::Medium),
11+
cpu: "generic-rv64".into(),
12+
features: "+m,+a,+f,+d,+c".into(),
13+
llvm_abiname: "lp64d".into(),
14+
supported_sanitizers: SanitizerSet::ADDRESS,
15+
max_atomic_width: Some(64),
16+
..super::android_base::opts()
17+
},
18+
}
19+
}

library/std/src/os/android/raw.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ mod arch {
8989
}
9090
}
9191

92-
#[cfg(target_arch = "aarch64")]
92+
#[cfg(any(target_arch = "aarch64", target_arch = "riscv64"))]
9393
mod arch {
9494
use crate::os::raw::{c_int, c_long, c_uint, c_ulong};
9595
use crate::os::unix::raw::{gid_t, uid_t};

src/doc/rustc/src/platform-support.md

+1
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@ target | std | host | notes
309309
`riscv64gc-unknown-linux-musl` | | | RISC-V Linux (kernel 4.20, musl 1.2.0)
310310
[`riscv64gc-unknown-netbsd`](platform-support/netbsd.md) | ✓ | ✓ | RISC-V NetBSD
311311
[`riscv64gc-unknown-openbsd`](platform-support/openbsd.md) | ✓ | ✓ | OpenBSD/riscv64
312+
[`riscv64-linux-android`](platform-support/android.md) | | | RISC-V 64-bit Android
312313
`s390x-unknown-linux-musl` | | | S390x Linux (kernel 3.2, MUSL)
313314
`sparc-unknown-linux-gnu` | ✓ | | 32-bit SPARC Linux
314315
[`sparc64-unknown-netbsd`](platform-support/netbsd.md) | ✓ | ✓ | NetBSD/sparc64

0 commit comments

Comments
 (0)