Skip to content

Commit 458f49c

Browse files
authored
Merge pull request #1894 from alistair23/alistair/rv32
2 parents 2ae4135 + bdfd015 commit 458f49c

File tree

6 files changed

+861
-14
lines changed

6 files changed

+861
-14
lines changed

ci/build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ powerpc64-unknown-freebsd \
225225
riscv64gc-unknown-linux-gnu \
226226
riscv32imac-unknown-none-elf \
227227
riscv32imc-unknown-none-elf \
228+
riscv32gc-unknown-linux-gnu \
228229
sparc64-unknown-netbsd \
229230
230231
thumbv6m-none-eabi \

src/unix/linux_like/linux/align.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ macro_rules! expand_align {
88
target_arch = "s390x",
99
target_arch = "sparc64",
1010
target_arch = "aarch64",
11-
target_arch = "riscv64"),
11+
target_arch = "riscv64",
12+
target_arch = "riscv32"),
1213
repr(align(4)))]
1314
#[cfg_attr(not(any(target_pointer_width = "32",
1415
target_arch = "x86_64",
@@ -17,7 +18,8 @@ macro_rules! expand_align {
1718
target_arch = "s390x",
1819
target_arch = "sparc64",
1920
target_arch = "aarch64",
20-
target_arch = "riscv64")),
21+
target_arch = "riscv64",
22+
target_arch = "riscv32")),
2123
repr(align(8)))]
2224
pub struct pthread_mutexattr_t {
2325
#[doc(hidden)]

src/unix/linux_like/linux/gnu/b32/mod.rs

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,39 @@ use pthread_mutex_t;
55
pub type c_long = i32;
66
pub type c_ulong = u32;
77
pub type clock_t = i32;
8-
pub type time_t = i32;
9-
pub type suseconds_t = i32;
10-
pub type ino_t = u32;
11-
pub type off_t = i32;
12-
pub type blkcnt_t = i32;
13-
14-
pub type fsblkcnt_t = ::c_ulong;
15-
pub type fsfilcnt_t = ::c_ulong;
16-
pub type rlim_t = c_ulong;
8+
179
pub type shmatt_t = ::c_ulong;
1810
pub type msgqnum_t = ::c_ulong;
1911
pub type msglen_t = ::c_ulong;
20-
pub type blksize_t = i32;
2112
pub type nlink_t = u32;
2213
pub type __u64 = ::c_ulonglong;
2314
pub type __fsword_t = i32;
15+
pub type fsblkcnt64_t = u64;
16+
pub type fsfilcnt64_t = u64;
17+
18+
cfg_if! {
19+
if #[cfg(target_arch = "riscv32")] {
20+
pub type time_t = i64;
21+
pub type suseconds_t = i64;
22+
pub type ino_t = u64;
23+
pub type off_t = i64;
24+
pub type blkcnt_t = i64;
25+
pub type fsblkcnt_t = u64;
26+
pub type fsfilcnt_t = u64;
27+
pub type rlim_t = u64;
28+
pub type blksize_t = i64;
29+
} else {
30+
pub type time_t = i32;
31+
pub type suseconds_t = i32;
32+
pub type ino_t = u32;
33+
pub type off_t = i32;
34+
pub type blkcnt_t = i32;
35+
pub type fsblkcnt_t = ::c_ulong;
36+
pub type fsfilcnt_t = ::c_ulong;
37+
pub type rlim_t = c_ulong;
38+
pub type blksize_t = i32;
39+
}
40+
}
2441

2542
s! {
2643
pub struct stat {
@@ -278,6 +295,9 @@ cfg_if! {
278295
} else if #[cfg(target_arch = "sparc")] {
279296
mod sparc;
280297
pub use self::sparc::*;
298+
} else if #[cfg(target_arch = "riscv32")] {
299+
mod riscv32;
300+
pub use self::riscv32::*;
281301
} else {
282302
// Unknown target_arch
283303
}

0 commit comments

Comments
 (0)