summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-04-19 18:59:43 +0000
committerbors <bors@rust-lang.org>2023-04-19 18:59:43 +0000
commit4983ced7004f075672e0663ebbc4e8122302f1e1 (patch)
tree3a6921368aa1ebb160b2370cd4c27d3211553a86
parent9cc77816fae6b66172798df7bc975e5faae754f2 (diff)
parent157ac25cc09ac65fdcadf02ffd5e797841a68cb3 (diff)
downloadrust-libc-4983ced7004f075672e0663ebbc4e8122302f1e1.tar.gz
Auto merge of #3204 - ComputerDruid:riscv64, r=JohnTitor
fuchsia: add definitions for riscv64
-rw-r--r--src/fuchsia/aarch64.rs1
-rw-r--r--src/fuchsia/mod.rs3
-rw-r--r--src/fuchsia/riscv64.rs44
3 files changed, 48 insertions, 0 deletions
diff --git a/src/fuchsia/aarch64.rs b/src/fuchsia/aarch64.rs
index 259893c0fa..33e3934d66 100644
--- a/src/fuchsia/aarch64.rs
+++ b/src/fuchsia/aarch64.rs
@@ -62,5 +62,6 @@ s! {
}
}
+// From https://cs.opensource.google/fuchsia/fuchsia/+/main:zircon/third_party/ulib/musl/include/bits/signal.h;l=20-21;drc=0827b18ab9540c46f8037f407d17ea15a79e9ba7
pub const MINSIGSTKSZ: ::size_t = 6144;
pub const SIGSTKSZ: ::size_t = 12288;
diff --git a/src/fuchsia/mod.rs b/src/fuchsia/mod.rs
index ea1ae466b2..6b12185413 100644
--- a/src/fuchsia/mod.rs
+++ b/src/fuchsia/mod.rs
@@ -4260,6 +4260,9 @@ cfg_if! {
} else if #[cfg(any(target_arch = "x86_64"))] {
mod x86_64;
pub use self::x86_64::*;
+ } else if #[cfg(any(target_arch = "riscv64"))] {
+ mod riscv64;
+ pub use self::riscv64::*;
} else {
// Unknown target_arch
}
diff --git a/src/fuchsia/riscv64.rs b/src/fuchsia/riscv64.rs
new file mode 100644
index 0000000000..de2b7197d7
--- /dev/null
+++ b/src/fuchsia/riscv64.rs
@@ -0,0 +1,44 @@
+// From psABI Calling Convention for RV64
+pub type c_char = u8;
+pub type __u64 = ::c_ulonglong;
+pub type wchar_t = i32;
+
+pub type nlink_t = ::c_ulong;
+pub type blksize_t = ::c_long;
+
+pub type stat64 = stat;
+s! {
+ pub struct stat {
+ pub st_dev: ::dev_t,
+ pub st_ino: ::ino_t,
+ pub st_nlink: ::nlink_t,
+ pub st_mode: ::mode_t,
+ pub st_uid: ::uid_t,
+ pub st_gid: ::gid_t,
+ __pad0: ::c_int,
+ pub st_rdev: ::dev_t,
+ pub st_size: ::off_t,
+ pub st_blksize: ::blksize_t,
+ pub st_blocks: ::blkcnt_t,
+ pub st_atime: ::time_t,
+ pub st_atime_nsec: ::c_long,
+ pub st_mtime: ::time_t,
+ pub st_mtime_nsec: ::c_long,
+ pub st_ctime: ::time_t,
+ pub st_ctime_nsec: ::c_long,
+ __unused: [::c_long; 3],
+ }
+
+ // Not actually used, IPC calls just return ENOSYS
+ pub struct ipc_perm {
+ pub __ipc_perm_key: ::key_t,
+ pub uid: ::uid_t,
+ pub gid: ::gid_t,
+ pub cuid: ::uid_t,
+ pub cgid: ::gid_t,
+ pub mode: ::mode_t,
+ pub __seq: ::c_ushort,
+ __unused1: ::c_ulong,
+ __unused2: ::c_ulong,
+ }
+}