From 8ef41557bac07c9c89d85e9845cbd2a8f2761b35 Mon Sep 17 00:00:00 2001 From: Shi Pujin Date: Tue, 1 Aug 2023 09:14:05 +0800 Subject: [PATCH 1/2] fix rust build Signed-off-by: Shi Pujin --- third_party/rust/authenticator/build.rs | 2 ++ .../rust/authenticator/src/transport/linux/hidwrapper.rs | 3 +++ .../authenticator/src/transport/linux/ioctl_loongarch64.rs | 5 +++++ third_party/rust/cty/src/lib.rs | 1 + third_party/rust/nix/src/sys/ioctl/linux.rs | 1 + 5 files changed, 12 insertions(+) create mode 100644 third_party/rust/authenticator/src/transport/linux/ioctl_loongarch64.rs diff --git a/third_party/rust/authenticator/build.rs b/third_party/rust/authenticator/build.rs index 58f6cfa393..acc4f09466 100644 --- a/third_party/rust/authenticator/build.rs +++ b/third_party/rust/authenticator/build.rs @@ -47,6 +47,8 @@ fn main() { "ioctl_s390xbe.rs" } else if cfg!(all(target_arch = "riscv64", target_endian = "little")) { "ioctl_riscv64.rs" + } else if cfg!(all(target_arch = "loongarch64", target_endian = "little")) { + "ioctl_loongarch64.rs" } else { panic!("architecture not supported"); }; diff --git a/third_party/rust/authenticator/src/transport/linux/hidwrapper.rs b/third_party/rust/authenticator/src/transport/linux/hidwrapper.rs index 82aabc6301..bc8582c5b1 100644 --- a/third_party/rust/authenticator/src/transport/linux/hidwrapper.rs +++ b/third_party/rust/authenticator/src/transport/linux/hidwrapper.rs @@ -49,3 +49,6 @@ include!("ioctl_s390xbe.rs"); #[cfg(all(target_arch = "riscv64", target_endian = "little"))] include!("ioctl_riscv64.rs"); + +#[cfg(all(target_arch = "loongarch64", target_endian = "little"))] +include!("ioctl_loongarch64.rs"); diff --git a/third_party/rust/authenticator/src/transport/linux/ioctl_loongarch64.rs b/third_party/rust/authenticator/src/transport/linux/ioctl_loongarch64.rs new file mode 100644 index 0000000000..a784e9bf46 --- /dev/null +++ b/third_party/rust/authenticator/src/transport/linux/ioctl_loongarch64.rs @@ -0,0 +1,5 @@ +/* automatically generated by rust-bindgen */ + +pub type __u32 = ::std::os::raw::c_uint; +pub const _HIDIOCGRDESCSIZE: __u32 = 2147764225; +pub const _HIDIOCGRDESC: __u32 = 2416199682; diff --git a/third_party/rust/cty/src/lib.rs b/third_party/rust/cty/src/lib.rs index 971c9cb3a9..80b8f3f291 100644 --- a/third_party/rust/cty/src/lib.rs +++ b/third_party/rust/cty/src/lib.rs @@ -24,6 +24,7 @@ pub use pwd::*; target_arch = "powerpc", target_arch = "powerpc64", target_arch = "s390x", + target_arch = "loongarch64", target_arch = "riscv32", target_arch = "riscv64"))] mod ad { diff --git a/third_party/rust/nix/src/sys/ioctl/linux.rs b/third_party/rust/nix/src/sys/ioctl/linux.rs index 0c0a209053..85d67004c6 100644 --- a/third_party/rust/nix/src/sys/ioctl/linux.rs +++ b/third_party/rust/nix/src/sys/ioctl/linux.rs @@ -40,6 +40,7 @@ mod consts { target_arch = "arm", target_arch = "s390x", target_arch = "x86_64", + target_arch = "loongarch64", target_arch = "aarch64", target_arch = "riscv32", target_arch = "riscv64" -- 2.41.0