diff --git a/devel/libffi/Makefile b/devel/libffi/Makefile index 565da4c7ab5..7569cc44281 100644 --- a/devel/libffi/Makefile +++ b/devel/libffi/Makefile @@ -1,9 +1,9 @@ -# $OpenBSD: Makefile,v 1.22 2013/07/14 15:29:32 miod Exp $ +# $OpenBSD: Makefile,v 1.23 2013/07/15 19:01:56 miod Exp $ COMMENT= Foreign Function Interface DISTNAME= libffi-3.0.9 -REVISION= 4 +REVISION= 5 SHARED_LIBS += ffi 0.0 # .5.9 CATEGORIES= devel diff --git a/devel/libffi/patches/patch-src_m68k_ffi_c b/devel/libffi/patches/patch-src_m68k_ffi_c index 5b5127b0246..14e70bf34a0 100644 --- a/devel/libffi/patches/patch-src_m68k_ffi_c +++ b/devel/libffi/patches/patch-src_m68k_ffi_c @@ -1,4 +1,4 @@ -$OpenBSD: patch-src_m68k_ffi_c,v 1.1 2013/05/01 10:11:54 miod Exp $ +$OpenBSD: patch-src_m68k_ffi_c,v 1.2 2013/07/15 19:01:56 miod Exp $ Match the calling convention used by NetBSD and OpenBSD on m68k/ELF, which differs from Linux/ELF: structs are always passed on the stack, functions @@ -8,7 +8,7 @@ Add an OpenBSD-specific function to flush the instruction cache after building closure trampolines. --- src/m68k/ffi.c.orig Tue Dec 29 15:22:26 2009 -+++ src/m68k/ffi.c Wed Apr 24 15:23:09 2013 ++++ src/m68k/ffi.c Mon Jul 15 18:53:57 2013 @@ -9,8 +9,12 @@ #include @@ -80,9 +80,27 @@ building closure trampolines. ecif.rvalue = alloca (cif->rtype->size); else ecif.rvalue = rvalue; -@@ -266,8 +291,12 @@ ffi_prep_closure_loc (ffi_closure* closure, +@@ -257,17 +282,26 @@ ffi_prep_closure_loc (ffi_closure* closure, + { + FFI_ASSERT (cif->abi == FFI_SYSV); + +- *(unsigned short *)closure->tramp = 0x207c; + *(void **)(closure->tramp + 2) = codeloc; +- *(unsigned short *)(closure->tramp + 6) = 0x4ef9; ++ *(unsigned short *)(closure->tramp + 6) = 0x4ef9; /* jmp ffi_closure_... */ + if (cif->rtype->type == FFI_TYPE_STRUCT + && !cif->flags) +- *(void **)(closure->tramp + 8) = ffi_closure_struct_SYSV; ++ { ++ *(unsigned short *)closure->tramp = 0x227c; /* moval #codeloc, %a1 */ ++ *(void **)(closure->tramp + 8) = ffi_closure_struct_SYSV; ++ } else - *(void **)(closure->tramp + 8) = ffi_closure_SYSV; +- *(void **)(closure->tramp + 8) = ffi_closure_SYSV; ++ { ++ *(unsigned short *)closure->tramp = 0x207c; /* moval #codeloc, %a0 */ ++ *(void **)(closure->tramp + 8) = ffi_closure_SYSV; ++ } +#ifdef __OpenBSD__ + ffi_sync_icache(codeloc, FFI_TRAMPOLINE_SIZE); diff --git a/devel/libffi/patches/patch-src_m68k_sysv_S b/devel/libffi/patches/patch-src_m68k_sysv_S index 7c838b166c0..0a660047b58 100644 --- a/devel/libffi/patches/patch-src_m68k_sysv_S +++ b/devel/libffi/patches/patch-src_m68k_sysv_S @@ -1,4 +1,4 @@ -$OpenBSD: patch-src_m68k_sysv_S,v 1.1 2013/05/01 10:11:54 miod Exp $ +$OpenBSD: patch-src_m68k_sysv_S,v 1.2 2013/07/15 19:01:56 miod Exp $ Match the calling convention used by NetBSD and OpenBSD on m68k/ELF, which differs from Linux/ELF: structs are always passed on the stack, functions @@ -8,7 +8,7 @@ Add an OpenBSD-specific function to flush the instruction cache after building closure trampolines. --- src/m68k/sysv.S.orig Tue Dec 29 15:22:26 2009 -+++ src/m68k/sysv.S Wed Apr 24 15:23:09 2013 ++++ src/m68k/sysv.S Mon Jul 15 18:54:57 2013 @@ -68,12 +68,21 @@ ffi_call_SYSV: #endif addq.l #8,%sp @@ -87,7 +87,23 @@ building closure trampolines. CFI_ENDPROC() .size ffi_closure_SYSV,.-ffi_closure_SYSV -@@ -228,6 +262,20 @@ ffi_closure_struct_SYSV: +@@ -217,8 +251,13 @@ ffi_closure_struct_SYSV: + CFI_DEF_CFA(14,8) + move.l %sp,-12(%fp) + pea 8(%fp) +- move.l %a1,-(%sp) +- move.l %a0,-(%sp) ++#if defined(__NetBSD__) || defined(__OpenBSD__) ++ move.l %a0,-(%sp) /* struct return address */ ++ move.l %a1,-(%sp) /* closure */ ++#else ++ move.l %a1,-(%sp) /* struct return address */ ++ move.l %a0,-(%sp) /* closure */ ++#endif + #if !defined __PIC__ + jsr ffi_closure_SYSV_inner + #else +@@ -228,6 +267,20 @@ ffi_closure_struct_SYSV: rts CFI_ENDPROC() .size ffi_closure_struct_SYSV,.-ffi_closure_struct_SYSV