diff options
| author | Kresimir Jozic <kjozic@gmail.com> | 2023-10-02 20:28:14 +0000 |
|---|---|---|
| committer | Robert Clausecker <fuz@FreeBSD.org> | 2023-10-04 15:59:57 -0400 |
| commit | 5631aa7d069993d7be49c516eaec772630437436 (patch) | |
| tree | 31c5347401d774e8efc4f0cac75f8547a513c868 | |
| parent | net-p2p/transmission-components: fix typo in "WEB" option description (diff) | |
devel/wasmer: fix build on aarch64
Handle differences between ucontext_t and mcontext_t
pertaining to aarch64 FreeBSD.
PR: 274202
| -rw-r--r-- | devel/wasmer/Makefile | 7 | ||||
| -rw-r--r-- | devel/wasmer/files/patch-lib_vm_src_trap_traphandlers.rs | 35 |
2 files changed, 38 insertions, 4 deletions
diff --git a/devel/wasmer/Makefile b/devel/wasmer/Makefile index 59f7e49e47fa..893c1841bd6e 100644 --- a/devel/wasmer/Makefile +++ b/devel/wasmer/Makefile @@ -1,6 +1,7 @@ PORTNAME= wasmer DISTVERSIONPREFIX= v DISTVERSION= 4.2.1 +PORTREVISION= 1 CATEGORIES= devel MAINTAINER= kjozic@gmail.com @@ -10,10 +11,8 @@ WWW= https://wasmer.io/ LICENSE= MIT LICENSE_FILE= ${WRKSRC}/LICENSE -ONLY_FOR_ARCHS= aarch64 amd64 riscv64 -ONLY_FOR_ARCHS_REASON= only aarch64, amd64 and riscv64 are supported so far -BROKEN_aarch64= needs fix for mcontext_t in lib/vm/src/trap/traphandlers.rs -BROKEN_riscv64= build issues +ONLY_FOR_ARCHS= aarch64 amd64 +ONLY_FOR_ARCHS_REASON= only aarch64 and amd64 are supported so far BUILD_DEPENDS= bash>0:shells/bash diff --git a/devel/wasmer/files/patch-lib_vm_src_trap_traphandlers.rs b/devel/wasmer/files/patch-lib_vm_src_trap_traphandlers.rs new file mode 100644 index 000000000000..89fe09a58b68 --- /dev/null +++ b/devel/wasmer/files/patch-lib_vm_src_trap_traphandlers.rs @@ -0,0 +1,35 @@ +--- lib/vm/src/trap/traphandlers.rs.orig 2023-04-07 07:18:13 UTC ++++ lib/vm/src/trap/traphandlers.rs +@@ -52,7 +52,21 @@ struct ucontext_t { + uc_mcontext: libc::mcontext_t, + } + +-#[cfg(all(unix, not(all(target_arch = "aarch64", target_os = "macos"))))] ++// Current definition of `ucontext_t` in the `libc` crate is not present ++// on aarch64-unknown-freebsd so it's defined here. ++#[repr(C)] ++#[cfg(all(target_arch = "aarch64", target_os = "freebsd"))] ++#[allow(non_camel_case_types)] ++struct ucontext_t { ++ uc_sigmask: libc::sigset_t, ++ uc_mcontext: libc::mcontext_t, ++ uc_link: *mut ucontext_t, ++ uc_stack: libc::stack_t, ++ uc_flags: libc::c_int, ++ spare: [libc::c_int; 4], ++} ++ ++#[cfg(all(unix, not(all(target_arch = "aarch64", target_os = "macos")), not(all(target_arch="aarch64", target_os="freebsd"))))] + use libc::ucontext_t; + + /// Default stack size is 1MB. +@@ -434,7 +448,8 @@ cfg_if::cfg_if! { + (*context.uc_mcontext).__ss.__fp = x29; + (*context.uc_mcontext).__ss.__lr = lr; + } else if #[cfg(all(target_os = "freebsd", target_arch = "aarch64"))] { +- context.uc_mcontext.mc_gpregs.gp_pc = pc as libc::register_t; ++ let TrapHandlerRegs { pc, sp, x0, x1, x29, lr } = regs; ++ context.uc_mcontext.mc_gpregs.gp_elr = pc as libc::register_t; + context.uc_mcontext.mc_gpregs.gp_sp = sp as libc::register_t; + context.uc_mcontext.mc_gpregs.gp_x[0] = x0 as libc::register_t; + context.uc_mcontext.mc_gpregs.gp_x[1] = x1 as libc::register_t; |
