diff mbox series

[meta-oe,v2,1/2] cbindgen: Fix build on riscv32

Message ID 20250406180938.2326040-1-raj.khem@gmail.com
State New
Headers show
Series [meta-oe,v2,1/2] cbindgen: Fix build on riscv32 | expand

Commit Message

Khem Raj April 6, 2025, 6:09 p.m. UTC
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
v2: Patch libc instead of rustix

 ...l-codes-on-riscv32gc-unknown-linux-g.patch | 38 +++++++++++++++++++
 .../cbindgen/cbindgen_0.28.0.bb               |  3 +-
 2 files changed, 40 insertions(+), 1 deletion(-)
 create mode 100644 meta-oe/recipes-devtools/cbindgen/cbindgen/0001-Define-more-ioctl-codes-on-riscv32gc-unknown-linux-g.patch
diff mbox series

Patch

diff --git a/meta-oe/recipes-devtools/cbindgen/cbindgen/0001-Define-more-ioctl-codes-on-riscv32gc-unknown-linux-g.patch b/meta-oe/recipes-devtools/cbindgen/cbindgen/0001-Define-more-ioctl-codes-on-riscv32gc-unknown-linux-g.patch
new file mode 100644
index 0000000000..75086aba75
--- /dev/null
+++ b/meta-oe/recipes-devtools/cbindgen/cbindgen/0001-Define-more-ioctl-codes-on-riscv32gc-unknown-linux-g.patch
@@ -0,0 +1,38 @@ 
+From 6ab6af57cbd3b3b0cd4ba04f7f65693e1ca69870 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..db1f1e7 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 = "riscv32",
++                 target_arch = "csky"))] {
+         pub const FS_IOC_GETFLAGS: ::Ioctl = 0x80046601;
+         pub const FS_IOC_SETFLAGS: ::Ioctl = 0x40046602;
+         pub const FS_IOC_GETVERSION: ::Ioctl = 0x80047601;
diff --git a/meta-oe/recipes-devtools/cbindgen/cbindgen_0.28.0.bb b/meta-oe/recipes-devtools/cbindgen/cbindgen_0.28.0.bb
index 40436ef035..eb8556ebc6 100644
--- a/meta-oe/recipes-devtools/cbindgen/cbindgen_0.28.0.bb
+++ b/meta-oe/recipes-devtools/cbindgen/cbindgen_0.28.0.bb
@@ -3,7 +3,8 @@  HOMEPAGE = "https://github.com/mozilla/cbindgen"
 LICENSE = "MPL-2.0"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=9741c346eef56131163e13b9db1241b3"
 
-SRC_URI += "git://github.com/mozilla/cbindgen.git;protocol=https;branch=master"
+SRC_URI += "git://github.com/mozilla/cbindgen.git;protocol=https;branch=master \
+            file://0001-Define-more-ioctl-codes-on-riscv32gc-unknown-linux-g.patch;patchdir=${CARGO_VENDORING_DIRECTORY}/libc-0.2.155"
 SRCREV = "bd78bbe59b10eda6ef1255e4acda95c56c6d0279"
 S = "${WORKDIR}/git"