Skip to content

Commit

Permalink
Rollup merge of #112858 - chriswailes:riscv64-android, r=Mark-Simulacrum
Browse files Browse the repository at this point in the history
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
  • Loading branch information
matthiaskrgr authored Jul 31, 2023
2 parents b3df56a + 0081d64 commit d0ae0b3
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
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 @@ -1300,6 +1300,7 @@ supported_targets! {
("armv7-linux-androideabi", armv7_linux_androideabi),
("thumbv7neon-linux-androideabi", thumbv7neon_linux_androideabi),
("aarch64-linux-android", aarch64_linux_android),
("riscv64-linux-android", riscv64_linux_android),

("aarch64-unknown-freebsd", aarch64_unknown_freebsd),
("armv6-unknown-freebsd", armv6_unknown_freebsd),
Expand Down
19 changes: 19 additions & 0 deletions compiler/rustc_target/src/spec/riscv64_linux_android.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
use crate::spec::{CodeModel, SanitizerSet, Target, TargetOptions};

pub fn target() -> Target {
Target {
llvm_target: "riscv64-linux-android".into(),
pointer_width: 64,
data_layout: "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128".into(),
arch: "riscv64".into(),
options: TargetOptions {
code_model: Some(CodeModel::Medium),
cpu: "generic-rv64".into(),
features: "+m,+a,+f,+d,+c".into(),
llvm_abiname: "lp64d".into(),
supported_sanitizers: SanitizerSet::ADDRESS,
max_atomic_width: Some(64),
..super::android_base::opts()
},
}
}
2 changes: 1 addition & 1 deletion library/std/src/os/android/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ mod arch {
}
}

#[cfg(target_arch = "aarch64")]
#[cfg(any(target_arch = "aarch64", target_arch = "riscv64"))]
mod arch {
use crate::os::raw::{c_int, c_long, c_uint, c_ulong};
use crate::os::unix::raw::{gid_t, uid_t};
Expand Down
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 @@ -309,6 +309,7 @@ target | std | host | notes
`riscv64gc-unknown-linux-musl` | | | RISC-V Linux (kernel 4.20, musl 1.2.0)
[`riscv64gc-unknown-netbsd`](platform-support/netbsd.md) | ✓ | ✓ | RISC-V NetBSD
[`riscv64gc-unknown-openbsd`](platform-support/openbsd.md) | ✓ | ✓ | OpenBSD/riscv64
[`riscv64-linux-android`](platform-support/android.md) | | | RISC-V 64-bit Android
`s390x-unknown-linux-musl` | | | S390x Linux (kernel 3.2, MUSL)
`sparc-unknown-linux-gnu` | ✓ | | 32-bit SPARC Linux
[`sparc64-unknown-netbsd`](platform-support/netbsd.md) | ✓ | ✓ | NetBSD/sparc64
Expand Down

0 comments on commit d0ae0b3

Please sign in to comment.