diff --git a/libffi-sys-rs/src/arch.rs b/libffi-sys-rs/src/arch.rs index 0a1e5e4e..4ffe486a 100644 --- a/libffi-sys-rs/src/arch.rs +++ b/libffi-sys-rs/src/arch.rs @@ -343,3 +343,23 @@ mod s390x { #[cfg(target_arch = "s390x")] pub use s390x::*; + +/// From libffi:src/loongarch64/ffitarget.h. +/// See: +mod loongarch64 { + use crate::ffi_abi; + + pub const ffi_abi_FFI_FIRST_ABI: ffi_abi = 0; + pub const ffi_abi_FFI_LP64S: ffi_abi = 1; + pub const ffi_abi_FFI_LP64F: ffi_abi = 2; + pub const ffi_abi_FFI_LP64D: ffi_abi = 3; + pub const ffi_abi_FFI_LAST_ABI: ffi_abi = 4; + pub const ffi_abi_FFI_DEFAULT_ABI: ffi_abi = ffi_abi_FFI_LP64D; + + pub const FFI_GO_CLOSURES: u32 = 1; + pub const FFI_TRAMPOLINE_SIZE: usize = 24; + pub const FFI_NATIVE_RAW_API: u32 = 0; +} + +#[cfg(target_arch = "loongarch64")] +pub use loongarch64::*; diff --git a/libffi-sys-rs/src/lib.rs b/libffi-sys-rs/src/lib.rs index e652ce69..89029ed5 100644 --- a/libffi-sys-rs/src/lib.rs +++ b/libffi-sys-rs/src/lib.rs @@ -133,6 +133,10 @@ pub struct ffi_cif { pub riscv_nfixedargs: c_uint, #[cfg(any(target_arch = "riscv", target_arch = "riscv64"))] pub riscv_unused: c_uint, + #[cfg(all(target_arch = "loongarch64"))] + pub loongarch_nfixedargs: c_uint, + #[cfg(all(target_arch = "loongarch64"))] + pub loongarch_unused: c_uint, } impl Default for ffi_cif {