Skip to content

Commit

Permalink
Add support for the loongarch64 architecture
Browse files Browse the repository at this point in the history
  • Loading branch information
heiher authored and yorickpeterse committed Apr 20, 2023
1 parent 7777303 commit b625102
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
20 changes: 20 additions & 0 deletions libffi-sys-rs/src/arch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,3 +343,23 @@ mod s390x {

#[cfg(target_arch = "s390x")]
pub use s390x::*;

/// From libffi:src/loongarch64/ffitarget.h.
/// See: <https://github.com/libffi/libffi/blob/f24180be1367f942824365b131ae894b9c769c7d/src/loongarch64/ffitarget.h#L47>
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::*;
4 changes: 4 additions & 0 deletions libffi-sys-rs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit b625102

Please sign in to comment.