cargo-c,rust: Fix build on risv32

Apply fix in libc that are needed for rustix-0.38 to build.

(From OE-Core rev: c21fd6f1c0b6a9df9950c541025f24e342b7a118)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Khem Raj
2025-04-06 11:10:25 -07:00
committed by Richard Purdie
parent 92038bcbbd
commit 77e5b8db1e
5 changed files with 152 additions and 237 deletions

View File

@@ -0,0 +1,38 @@
From 3665e73b2f087370f8058c12911996b109d8e93a Mon Sep 17 00:00:00 2001
From: Dan Gohman <dev@sunfishcode.online>
Date: Sun, 6 Apr 2025 05:22:49 -0700
Subject: [PATCH] Define more ioctl codes on riscv32gc-unknown-linux-gnu
Define ioctl codes including `FICLONE` and `FS_IOC32_GETVERSION` on
riscv32gc-unknown-linux-gnu.
Upstream-Status: Submitted [https://github.com/rust-lang/libc/pull/4382]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
src/unix/linux_like/linux/arch/generic/mod.rs | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/unix/linux_like/linux/arch/generic/mod.rs b/src/unix/linux_like/linux/arch/generic/mod.rs
index 2f437e1..fdac4bb 100644
--- a/src/unix/linux_like/linux/arch/generic/mod.rs
+++ b/src/unix/linux_like/linux/arch/generic/mod.rs
@@ -114,6 +114,7 @@ cfg_if! {
target_arch = "x86_64",
target_arch = "arm",
target_arch = "aarch64",
+ target_arch = "riscv32",
target_arch = "riscv64",
target_arch = "s390x",
target_arch = "csky",
@@ -218,7 +219,10 @@ cfg_if! {
// where S stands for size (int, long, struct...)
// where T stands for type ('f','v','X'...)
// where N stands for NR (NumbeR)
- if #[cfg(any(target_arch = "x86", target_arch = "arm", target_arch = "csky"))] {
+ if #[cfg(any(target_arch = "x86",
+ target_arch = "arm",
+ target_arch = "csky",
+ target_arch = "riscv32"))] {
pub const FS_IOC_GETFLAGS: ::Ioctl = 0x80046601;
pub const FS_IOC_SETFLAGS: ::Ioctl = 0x40046602;
pub const FS_IOC_GETVERSION: ::Ioctl = 0x80047601;