diff options
author | wiz <wiz@pkgsrc.org> | 2014-11-19 13:49:35 +0000 |
---|---|---|
committer | wiz <wiz@pkgsrc.org> | 2014-11-19 13:49:35 +0000 |
commit | 32319dc41a5cb0fd7f372f2f4b74288b86b56616 (patch) | |
tree | e86afba1eff6f9fabeb736d5b84bbfc232ed7fc9 /devel/libffi | |
parent | b183ea475e6acabd8a4e7299dcb211d535d85253 (diff) | |
download | pkgsrc-32319dc41a5cb0fd7f372f2f4b74288b86b56616.tar.gz |
Update to 3.2.1:
Fix for AArch64. Release as 3.2.1.
Fix typo
Final 3.2 changes
Final 3.2 changes
Mention OpenRISC
Merge pull request #134 from s-macke/openrisc
Add OpenRISC support
Only run the complex type tests on supported platforms.
Add OpenRISC support
This patch adds support for the OpenRISC architecture.
(http://opencores.org/or1k/Main_Page)
This patch has been tested under Linux with QEMU-user emulation support.
- 32 Bit
- big endian
- delayed instructions
This is the only available configuration under Linux.
The description of the ABI can be found on the official website.
Is passes the testsuite except of the unwindtest_ffi_call.cc
testcase, which seems to be a problem of gcc and not libffi.
Some testcases of the gcc testsuite still fail.
Signed-off-by: Sebastian Macke <sebastian@macke.de>
Add complex type support. Mostly broken right now
Compile tests with -Wno-psabi when using GCC
Update version to 3.2
More README updates for 3.2
Update release notes.
2014-05-11 Bernd Edlinger <bernd.edlinger@hotmail.de>
Fix current cygwin-64 build problems.
* src/java_raw_api.c: Remove if !defined(FFI_NO_RAW_API).
* src/x86/ffi.c: Add if defined(__CYGWIN__).
* src/x86/win64.S (ffi_closure_win64, ffi_call_win64): Added
handling for FFI_TYPE_UINT64, FFI_TYPE_POINTER and FFI_TYPE_INT.
Added SEH information. Fixed formatting.
2014-09-10 Jakub Jelinek <jakub@redhat.com>
* src/powerpc/linux64.S: Emit .note.GNU-stack even when
POWERPC64 is not defined.
* src/powerpc/linux64_closure.S: Likewise. Also test _CALL_ELF == 2.
Fix -Werror=declaration-after-statement problem
2014-07-22 Dominik Vogt <vogt@linux.vnet.ibm.com>
* src/types.c (FFI_TYPEDEF, FFI_NONCONST_TYPEDEF): Merge the macros by
adding another argument that controls whether the result is const or not
(FFI_LDBL_CONST): Temporary macro to reduce ifdef confusion
* src/prep_cif.c (ffi_prep_cif_core): Replace list of systems with new
macro FFI_TARGET_SPECIFIC_STACK_SPACE_ALLOCATION
* src/pa/ffitarget.h (FFI_TARGET_SPECIFIC_STACK_SPACE_ALLOCATION):
Define.
* src/s390/ffitarget.h (FFI_TARGET_SPECIFIC_STACK_SPACE_ALLOCATION):
Define.
* src/x86/ffitarget.h (FFI_TARGET_SPECIFIC_STACK_SPACE_ALLOCATION):
Define.
2014-07-22 Dominik Vogt <vogt@linux.vnet.ibm.com>
* doc/libffi.texi (Primitive Types): Document ffi_type_complex_float,
ffi_type_complex_double and ffi_type_complex_longdouble
(Complex Types): New subsection.
(Complex Type Example): Ditto.
* testsuite/libffi.call/cls_align_complex_double.c: New
FFI_TYPE_COMPLEX test.
* testsuite/libffi.call/cls_align_complex_float.c: Ditto.
* testsuite/libffi.call/cls_align_complex_longdouble.c: Ditto.
* testsuite/libffi.call/cls_complex_double.c: Ditto.
* testsuite/libffi.call/cls_complex_float.c: Ditto.
* testsuite/libffi.call/cls_complex_longdouble.c: Ditto.
* testsuite/libffi.call/cls_complex_struct_double.c: Ditto.
* testsuite/libffi.call/cls_complex_struct_float.c: Ditto.
* testsuite/libffi.call/cls_complex_struct_longdouble.c: Ditto.
* testsuite/libffi.call/cls_complex_va_double.c: Ditto.
* testsuite/libffi.call/cls_complex_va_float.c: Ditto.
* testsuite/libffi.call/cls_complex_va_longdouble.c: Ditto.
* testsuite/libffi.call/complex_double.c: Ditto.
* testsuite/libffi.call/complex_defs_double.c: Ditto.
* testsuite/libffi.call/complex_float.c: Ditto.
* testsuite/libffi.call/complex_defs_float.c: Ditto.
* testsuite/libffi.call/complex_longdouble.c: Ditto.
* testsuite/libffi.call/complex_defs_longdouble.c: Ditto.
* testsuite/libffi.call/complex_int.c: Ditto.
* testsuite/libffi.call/many_complex_double.c: Ditto.
* testsuite/libffi.call/many_complex_float.c: Ditto.
* testsuite/libffi.call/many_complex_longdouble.c: Ditto.
* testsuite/libffi.call/return_complex1_double.c: Ditto.
* testsuite/libffi.call/return_complex1_float.c: Ditto.
* testsuite/libffi.call/return_complex1_longdouble.c: Ditto.
* testsuite/libffi.call/return_complex2_double.c: Ditto.
* testsuite/libffi.call/return_complex2_float.c: Ditto.
* testsuite/libffi.call/return_complex2_longdouble.c: Ditto.
* testsuite/libffi.call/return_complex_double.c: Ditto.
* testsuite/libffi.call/return_complex_float.c: Ditto.
* testsuite/libffi.call/return_complex_longdouble.c: Ditto.
* src/raw_api.c (ffi_raw_to_ptrarray): Handle FFI_TYPE_COMPLEX
(ffi_ptrarray_to_raw): Ditto.
* src/prep_cif.c (ffi_prep_cif_core): Abort if FFI_TYPE_COMPLEX is not
implemented in libffi for the target.
* src/java_raw_api.c (ffi_java_raw_size): FFI_TYPE_COMPLEX not supported
yet (abort).
(ffi_java_raw_to_ptrarray): Ditto.
(ffi_java_rvalue_to_raw): Ditto.
(ffi_java_raw_to_rvalue): Ditto.
* src/debug.c (ffi_type_test): Add debug tests for complex types.
* include/ffi.h.in (FFI_TYPE_COMPLEX): Add new FFI_TYPE_COMPLEX.
(FFI_TYPE_LAST): Bump.
(ffi_type_complex_float): Add new ffi_type_....
(ffi_type_complex_double): Ditto.
(ffi_type_complex_longdouble): Ditto.
2014-07-22 Dominik Vogt <vogt@linux.vnet.ibm.com>
* src/s390/ffitarget.h (FFI_TARGET_HAS_COMPLEX_TYPE): Define to provide
FFI_TYPE_COMPLEX support.
* src/s390/ffi.c (ffi_check_struct_type): Implement FFI_TYPE_COMPLEX
(ffi_prep_args): Ditto.
(ffi_prep_cif_machdep): Ditto.
(ffi_closure_helper_SYSV): Ditto.
Merge pull request #132 from nielsAD/master
Pascal and Register calling convention support on x86
Merge pull request #130 from frida/fix/darwin-aarch64-float-alignment
Fix alignment of FFI_TYPE_FLOAT for Apple's ARM64 ABI
Merge pull request #129 from frida/fix/darwin-aarch64-cif-prep
Fix non-variadic CIF initialization for Apple/ARM64
Merge pull request #124 from knuesel/master
Fix issue with builddir when calling configure with absolute path
Merge pull request #123 from ehsan/clang-cl
Add support for building with clang-cl
Determine whether register arguments (THISCALL/FASTCALL/REGISTER) are really passed via register to closures. Use stack if not.
Fixed THISCALL/FASTCALL closures and added basic support for PASCAL/REGISTER closures.
Support for calling functions with PASCAL and REGISTER calling conventions on x86 Windows/Linux.
Also changed indentation to be more consistent throughout the (adjusted) files.
Enable forcing the usage of the static CRT in libffi's msvc wrapper
This is required for AddressSanitizer builds with clang-cl.
Fix alignment of FFI_TYPE_FLOAT for Apple's ARM64 ABI
Fix non-variadic CIF initialization for Apple/ARM64
Turns out `aarch64_nfixedargs` wasn't initialized in the non-variadic
case, resulting in undefined behavior when allocating arguments.
Fix issue with builddir when calling configure with absolute path
Add support for building with clang-cl
Remove compiler warning
Fix paths in libffi.pc.in
Merge pull request #122 from rvandermeulen/1014976
Don't make --enable-debug imply using the debug CRT in libffi
Bug 1014976 - Don't make --enable-debug imply using the debug CRT in libffi.
Prepare for libffi 3.1.1
Add missing GNU stack markings in win32.S
Fix typo
Update current version.
Increment libtool version number
Merge pull request #120 from l0kod/tmpfile
Create temporary file with O_TMPFILE and O_CLOEXEC when available
closures: Check for mkostemp(3)
closures: Create temporary file with O_TMPFILE and O_CLOEXEC when available
The open_temp_exec_file_dir function can create a temporary file without
file system accessible link. If the O_TMPFILE flag is not defined (old
Linux kernel or libc) the behavior is unchanged.
The open_temp_exec_file_name function now need a new argument "flags"
(like O_CLOEXEC) used for temporary file creation.
The O_TMPFILE flag allow temporary file creation without race condition.
This feature/fix prevent another process to access the (future)
executable file from the file system.
The O_CLOEXEC flag automatically close the temporary file for any
execve. This avoid transmitting (executable) file descriptor to a child
process.
Diffstat (limited to 'devel/libffi')
-rw-r--r-- | devel/libffi/Makefile | 5 | ||||
-rw-r--r-- | devel/libffi/distinfo | 20 | ||||
-rw-r--r-- | devel/libffi/patches/patch-aa | 41 | ||||
-rw-r--r-- | devel/libffi/patches/patch-ah | 26 | ||||
-rw-r--r-- | devel/libffi/patches/patch-ai | 20 | ||||
-rw-r--r-- | devel/libffi/patches/patch-fficonfig.h.in | 14 | ||||
-rw-r--r-- | devel/libffi/patches/patch-src_m88k_ffi.c | 405 | ||||
-rw-r--r-- | devel/libffi/patches/patch-src_m88k_ffitarget.h | 54 | ||||
-rw-r--r-- | devel/libffi/patches/patch-src_vax_elfbsd.S | 200 | ||||
-rw-r--r-- | devel/libffi/patches/patch-src_vax_ffi.c | 281 | ||||
-rw-r--r-- | devel/libffi/patches/patch-src_vax_ffitarget.h | 54 |
11 files changed, 22 insertions, 1098 deletions
diff --git a/devel/libffi/Makefile b/devel/libffi/Makefile index 692fae64b3f..91ed993f4bf 100644 --- a/devel/libffi/Makefile +++ b/devel/libffi/Makefile @@ -1,7 +1,6 @@ -# $NetBSD: Makefile,v 1.25 2014/11/04 21:40:05 joerg Exp $ +# $NetBSD: Makefile,v 1.26 2014/11/19 13:49:35 wiz Exp $ -DISTNAME= libffi-3.1 -PKGREVISION= 1 +DISTNAME= libffi-3.2.1 CATEGORIES= devel MASTER_SITES= ftp://sourceware.org/pub/libffi/ diff --git a/devel/libffi/distinfo b/devel/libffi/distinfo index a45d132368e..21c6ad64de2 100644 --- a/devel/libffi/distinfo +++ b/devel/libffi/distinfo @@ -1,24 +1,14 @@ -$NetBSD: distinfo,v 1.37 2014/11/10 21:29:40 joerg Exp $ +$NetBSD: distinfo,v 1.38 2014/11/19 13:49:35 wiz Exp $ -SHA1 (libffi-3.1.tar.gz) = cb373ef2115ec7c57913b84ca72eee14b10ccdc3 -RMD160 (libffi-3.1.tar.gz) = 2445ad6cf9cf42adbd29b9ced4cd29f252864ec5 -Size (libffi-3.1.tar.gz) = 937214 bytes -SHA1 (patch-aa) = 5aa03c9d2988bf4bbf15d0eb7348a504f2c375ff +SHA1 (libffi-3.2.1.tar.gz) = 280c265b789e041c02e5c97815793dfc283fb1e6 +RMD160 (libffi-3.2.1.tar.gz) = 9b546a3d002380bec3f00d86fc47d730abf51dfd +Size (libffi-3.2.1.tar.gz) = 940837 bytes +SHA1 (patch-aa) = 7748465dc903b53568999fc8e0caf4ea3fbc5778 SHA1 (patch-ac) = f3c6324f4334d23e684b4eca25173a13be5d37eb SHA1 (patch-ad) = 8bb3ec9ea69a8c06b0b1963b3f24018c6384c249 SHA1 (patch-ae) = 3d8cd3bcd834876f6e60ae519dca8c0b0ba0d4d1 SHA1 (patch-af) = 2c7ca79ef980a2561333bf79a18df1ecb0bbb9f7 SHA1 (patch-ag) = 6333317170f6e92f89db966315276dcd8e3484f2 -SHA1 (patch-ah) = e9580069ede90cd616da7bc230b28acbf5d204a6 -SHA1 (patch-ai) = f85a6cb64d4a9d7c3e56b47b7092fce10a744b5b SHA1 (patch-aj) = d130b2b20b94ca26c70dcc46614e36c6d0ac9153 -SHA1 (patch-fficonfig.h.in) = fd85fa767bc057c843ff71cc61bedfcff84def43 SHA1 (patch-src_arm_sysv.S) = ea294af156566c6e6f63810358de89cba6213c4f SHA1 (patch-src_m88k_elfbsd.S) = fae3e425dcff3e924ef195eab165f9bbc6ec4077 -SHA1 (patch-src_m88k_ffi.c) = e4b7382c3d6e253b8c1c6054150c530c21d018de -SHA1 (patch-src_m88k_ffitarget.h) = e8479bc3aa876f5e6d52a4d578c5da88291c6646 -SHA1 (patch-src_vax_elfbsd.S) = abf284bd1db086a12608b7243344af30e4a314ca -SHA1 (patch-src_vax_ffi.c) = f47ced03388e9744afa44d6bb5e14d5f4285cfbf -SHA1 (patch-src_vax_ffitarget.h) = 388f3a58e37dd8af5c194b5be77a6ea6f9beef4b -SHA1 (patch-src_x86_ffi.c) = b9ac64a53a92de663a339212e22c1286fa41c1d5 -SHA1 (patch-src_x86_win64.S) = 5b6836bae6c73743b925de4d11bc241c783bffd6 diff --git a/devel/libffi/patches/patch-aa b/devel/libffi/patches/patch-aa index c17bfb07575..ee06052ac2e 100644 --- a/devel/libffi/patches/patch-aa +++ b/devel/libffi/patches/patch-aa @@ -1,6 +1,6 @@ -$NetBSD: patch-aa,v 1.22 2014/11/04 21:40:05 joerg Exp $ +$NetBSD: patch-aa,v 1.23 2014/11/19 13:49:35 wiz Exp $ ---- configure.orig 2014-05-19 13:44:03.000000000 +0000 +--- configure.orig 2014-11-12 11:59:57.000000000 +0000 +++ configure @@ -654,6 +654,8 @@ VAX_FALSE VAX_TRUE @@ -11,7 +11,7 @@ $NetBSD: patch-aa,v 1.22 2014/11/04 21:40:05 joerg Exp $ PA64_HPUX_FALSE PA64_HPUX_TRUE PA_HPUX_FALSE -@@ -17199,7 +17201,7 @@ case "$host" in +@@ -17120,7 +17122,7 @@ case "$host" in TARGET=FRV; TARGETDIR=frv ;; @@ -20,7 +20,7 @@ $NetBSD: patch-aa,v 1.22 2014/11/04 21:40:05 joerg Exp $ TARGET=PA_LINUX; TARGETDIR=pa ;; hppa*64-*-hpux*) -@@ -17297,10 +17299,10 @@ case "$host" in +@@ -17218,10 +17220,10 @@ case "$host" in TARGET=METAG; TARGETDIR=metag ;; @@ -33,7 +33,7 @@ $NetBSD: patch-aa,v 1.22 2014/11/04 21:40:05 joerg Exp $ # Support 128-bit long double for NewABI. HAVE_LONG_DOUBLE='defined(__mips64)' TARGET=MIPS; TARGETDIR=mips -@@ -17326,7 +17328,7 @@ case "$host" in +@@ -17251,7 +17253,7 @@ case "$host" in powerpc-*-aix* | rs6000-*-aix*) TARGET=POWERPC_AIX; TARGETDIR=powerpc ;; @@ -42,7 +42,7 @@ $NetBSD: patch-aa,v 1.22 2014/11/04 21:40:05 joerg Exp $ TARGET=POWERPC_FREEBSD; TARGETDIR=powerpc HAVE_LONG_DOUBLE_VARIANT=1 ;; -@@ -17341,7 +17343,7 @@ case "$host" in +@@ -17266,7 +17268,7 @@ case "$host" in TARGET=S390; TARGETDIR=s390 ;; @@ -51,7 +51,7 @@ $NetBSD: patch-aa,v 1.22 2014/11/04 21:40:05 joerg Exp $ TARGET=SH; TARGETDIR=sh ;; sh64-*-* | sh5*-*-*) -@@ -17360,6 +17362,10 @@ case "$host" in +@@ -17285,6 +17287,10 @@ case "$host" in TARGET=VAX; TARGETDIR=vax ;; @@ -62,7 +62,7 @@ $NetBSD: patch-aa,v 1.22 2014/11/04 21:40:05 joerg Exp $ xtensa*-*) TARGET=XTENSA; TARGETDIR=xtensa ;; -@@ -17677,6 +17683,14 @@ else +@@ -17610,6 +17616,14 @@ else VAX_FALSE= fi @@ -77,7 +77,7 @@ $NetBSD: patch-aa,v 1.22 2014/11/04 21:40:05 joerg Exp $ if test x$TARGET = xXTENSA; then XTENSA_TRUE= XTENSA_FALSE='#' -@@ -18597,7 +18611,7 @@ case "$target" in +@@ -18530,7 +18544,7 @@ case "$target" in $as_echo "#define FFI_EXEC_TRAMPOLINE_TABLE 1" >>confdefs.h ;; @@ -86,16 +86,9 @@ $NetBSD: patch-aa,v 1.22 2014/11/04 21:40:05 joerg Exp $ $as_echo "#define FFI_MMAP_EXEC_WRIT 1" >>confdefs.h -@@ -18787,19 +18801,14 @@ if test "x$GCC" = "xyes"; then - if test -n "$with_cross_host" && - test x"$with_cross_host" != x"no"; then - toolexecdir='$(exec_prefix)/$(target_alias)' -- toolexeclibdir='$(toolexecdir)/lib' -+ toolexeclibdir='${toolexecdir}/lib' - else - toolexecdir='$(libdir)/gcc-lib/$(target_alias)' -- toolexeclibdir='$(libdir)' -+ toolexeclibdir='${libdir}' +@@ -18725,11 +18739,6 @@ if test "x$GCC" = "xyes"; then + toolexecdir="${libdir}"/gcc-lib/'$(target_alias)' + toolexeclibdir="${libdir}" fi - multi_os_directory=`$CC $CFLAGS -print-multi-os-directory` - case $multi_os_directory in @@ -104,12 +97,8 @@ $NetBSD: patch-aa,v 1.22 2014/11/04 21:40:05 joerg Exp $ - esac else -- toolexeclibdir='$(libdir)' -+ toolexeclibdir='${libdir}' - fi - - -@@ -19115,6 +19124,10 @@ if test -z "${VAX_TRUE}" && test -z "${V + toolexeclibdir="${libdir}" +@@ -19052,6 +19061,10 @@ if test -z "${VAX_TRUE}" && test -z "${V as_fn_error $? "conditional \"VAX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi @@ -120,7 +109,7 @@ $NetBSD: patch-aa,v 1.22 2014/11/04 21:40:05 joerg Exp $ if test -z "${XTENSA_TRUE}" && test -z "${XTENSA_FALSE}"; then as_fn_error $? "conditional \"XTENSA\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 -@@ -20813,13 +20826,13 @@ s/ [a-zA-Z0-9-]*-all [a-zA-Z0-9-]*-all-a +@@ -20749,13 +20762,13 @@ s/ [a-zA-Z0-9-]*-all [a-zA-Z0-9-]*-all-a /-all-all/d a\\ @ HOST="\$(HOST)\" \\\\\\ diff --git a/devel/libffi/patches/patch-ah b/devel/libffi/patches/patch-ah deleted file mode 100644 index fd636e3ab5c..00000000000 --- a/devel/libffi/patches/patch-ah +++ /dev/null @@ -1,26 +0,0 @@ -$NetBSD: patch-ah,v 1.1 2009/09/20 13:10:30 tnn Exp $ - ---- src/alpha/ffi.c.orig 2008-02-26 18:34:36.000000000 +0100 -+++ src/alpha/ffi.c -@@ -27,6 +27,9 @@ - #include <ffi.h> - #include <ffi_common.h> - #include <stdlib.h> -+#ifndef __GNUC__ -+#include <c_asm.h> -+#endif - - /* Force FFI_TYPE_LONGDOUBLE to be different than FFI_TYPE_DOUBLE; - all further uses in this file will refer to the 128-bit type. */ -@@ -195,7 +198,11 @@ ffi_prep_closure_loc (ffi_closure* closu - instead, since both Compaq as and gas can handle it. - - 0x86 is PAL_imb in Tru64 UNIX <alpha/pal.h>. */ -+#ifdef __GNUC__ - asm volatile ("call_pal 0x86" : : : "memory"); -+#else /* Compaq C compiler */ -+ asm ("call_pal 0x86"); -+#endif - - return FFI_OK; - } diff --git a/devel/libffi/patches/patch-ai b/devel/libffi/patches/patch-ai deleted file mode 100644 index a0ec8299a92..00000000000 --- a/devel/libffi/patches/patch-ai +++ /dev/null @@ -1,20 +0,0 @@ -$NetBSD: patch-ai,v 1.2 2010/01/16 16:28:58 asau Exp $ - ---- include/ffi_common.h.orig 2009-12-29 18:22:26.000000000 +0300 -+++ include/ffi_common.h 2010-01-12 12:47:54.000000000 +0300 -@@ -99,6 +99,15 @@ - typedef uint64_t UINT64; - typedef int64_t SINT64; - # endif -+#elif defined(__digital__) && !defined(__GNUC__) /* XXX tnn: check sunpro */ -+typedef unsigned int UINT8; -+typedef signed int SINT8; -+typedef unsigned int UINT16; -+typedef signed int SINT16; -+typedef unsigned int UINT32; -+typedef signed int SINT32; -+typedef unsigned int UINT64; -+typedef signed int SINT64; - #else - typedef unsigned int UINT8 __attribute__((__mode__(__QI__))); - typedef signed int SINT8 __attribute__((__mode__(__QI__))); diff --git a/devel/libffi/patches/patch-fficonfig.h.in b/devel/libffi/patches/patch-fficonfig.h.in deleted file mode 100644 index 2285977d795..00000000000 --- a/devel/libffi/patches/patch-fficonfig.h.in +++ /dev/null @@ -1,14 +0,0 @@ -$NetBSD: patch-fficonfig.h.in,v 1.1 2012/05/30 09:13:16 jperkin Exp $ - ---- fficonfig.h.in.orig Wed May 30 08:53:33 2012 -+++ fficonfig.h.in Wed May 30 08:54:03 2012 -@@ -46,6 +46,9 @@ - /* Define if your assembler supports PC relative relocs. */ - #undef HAVE_AS_X86_PCREL - -+/* Define if your assembler supports unwind section type. */ -+#undef HAVE_AS_X86_64_UNWIND_SECTION_TYPE -+ - /* Define to 1 if you have the <dlfcn.h> header file. */ - #undef HAVE_DLFCN_H - diff --git a/devel/libffi/patches/patch-src_m88k_ffi.c b/devel/libffi/patches/patch-src_m88k_ffi.c deleted file mode 100644 index 3eb5cdce8b7..00000000000 --- a/devel/libffi/patches/patch-src_m88k_ffi.c +++ /dev/null @@ -1,405 +0,0 @@ -$NetBSD: patch-src_m88k_ffi.c,v 1.1 2013/11/03 23:51:51 jklos Exp $ - ---- src/m88k/ffi.c.orig 2013-11-03 22:59:04.000000000 +0000 -+++ src/m88k/ffi.c -@@ -0,0 +1,400 @@ -+/* -+ * Copyright (c) 2013 Miodrag Vallat. <miod@openbsd.org> -+ * -+ * Permission is hereby granted, free of charge, to any person obtaining -+ * a copy of this software and associated documentation files (the -+ * ``Software''), to deal in the Software without restriction, including -+ * without limitation the rights to use, copy, modify, merge, publish, -+ * distribute, sublicense, and/or sell copies of the Software, and to -+ * permit persons to whom the Software is furnished to do so, subject to -+ * the following conditions: -+ * -+ * The above copyright notice and this permission notice shall be included -+ * in all copies or substantial portions of the Software. -+ * -+ * THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, -+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -+ */ -+ -+/* -+ * m88k Foreign Function Interface -+ * -+ * This file attempts to provide all the FFI entry points which can reliably -+ * be implemented in C. -+ * -+ * Only OpenBSD/m88k is currently supported; other platforms (such as -+ * Motorola's SysV/m88k) could be supported with the following tweaks: -+ * -+ * - non-OpenBSD systems use an `outgoing parameter area' as part of the -+ * 88BCS calling convention, which is not supported under OpenBSD from -+ * release 3.6 onwards. Supporting it should be as easy as taking it -+ * into account when adjusting the stack, in the assembly code. -+ * -+ * - the logic deciding whether a function argument gets passed through -+ * registers, or on the stack, has changed several times in OpenBSD in -+ * edge cases (especially for structs larger than 32 bytes being passed -+ * by value). The code below attemps to match the logic used by the -+ * system compiler of OpenBSD 5.3, i.e. gcc 3.3.6 with many m88k backend -+ * fixes. -+ */ -+ -+#include <ffi.h> -+#include <ffi_common.h> -+ -+#include <stdlib.h> -+#include <unistd.h> -+ -+void ffi_call_OBSD (unsigned int, extended_cif *, unsigned int, void *, -+ void (*fn) ()); -+void *ffi_prep_args (void *, extended_cif *); -+void ffi_closure_OBSD (ffi_closure *); -+void ffi_closure_struct_OBSD (ffi_closure *); -+unsigned int ffi_closure_OBSD_inner (ffi_closure *, void *, unsigned int *, -+ char *); -+void ffi_cacheflush_OBSD (unsigned int, unsigned int); -+ -+#define CIF_FLAGS_INT (1 << 0) -+#define CIF_FLAGS_DINT (1 << 1) -+ -+/* -+ * Foreign Function Interface API -+ */ -+ -+/* ffi_prep_args is called by the assembly routine once stack space has -+ been allocated for the function's arguments. */ -+ -+void * -+ffi_prep_args (void *stack, extended_cif *ecif) -+{ -+ unsigned int i; -+ void **p_argv; -+ char *argp, *stackp; -+ unsigned int *regp; -+ unsigned int regused; -+ ffi_type **p_arg; -+ void *struct_value_ptr; -+ -+ regp = (unsigned int *)stack; -+ stackp = (char *)(regp + 8); -+ regused = 0; -+ -+ if (ecif->cif->rtype->type == FFI_TYPE_STRUCT -+ && !ecif->cif->flags) -+ struct_value_ptr = ecif->rvalue; -+ else -+ struct_value_ptr = NULL; -+ -+ p_argv = ecif->avalue; -+ -+ for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; i != 0; i--, p_arg++) -+ { -+ size_t z; -+ unsigned short t, a; -+ -+ z = (*p_arg)->size; -+ t = (*p_arg)->type; -+ a = (*p_arg)->alignment; -+ -+ /* -+ * Figure out whether the argument can be passed through registers -+ * or on the stack. -+ * The rule is that registers can only receive simple types not larger -+ * than 64 bits, or structs the exact size of a register and aligned to -+ * the size of a register. -+ */ -+ if (t == FFI_TYPE_STRUCT) -+ { -+ if (z == sizeof (int) && a == sizeof (int) && regused < 8) -+ argp = (char *)regp; -+ else -+ argp = stackp; -+ } -+ else -+ { -+ if (z > sizeof (int) && regused < 8 - 1) -+ { -+ /* align to an even register pair */ -+ if (regused & 1) -+ { -+ regp++; -+ regused++; -+ } -+ } -+ if (regused < 8) -+ argp = (char *)regp; -+ else -+ argp = stackp; -+ } -+ -+ /* Enforce proper stack alignment of 64-bit types */ -+ if (argp == stackp && a > sizeof (int)) -+ { -+ stackp = (char *) ALIGN(stackp, a); -+ argp = stackp; -+ } -+ -+ switch (t) -+ { -+ case FFI_TYPE_SINT8: -+ *(signed int *) argp = (signed int) *(SINT8 *) *p_argv; -+ break; -+ -+ case FFI_TYPE_UINT8: -+ *(unsigned int *) argp = (unsigned int) *(UINT8 *) *p_argv; -+ break; -+ -+ case FFI_TYPE_SINT16: -+ *(signed int *) argp = (signed int) *(SINT16 *) *p_argv; -+ break; -+ -+ case FFI_TYPE_UINT16: -+ *(unsigned int *) argp = (unsigned int) *(UINT16 *) *p_argv; -+ break; -+ -+ case FFI_TYPE_INT: -+ case FFI_TYPE_FLOAT: -+ case FFI_TYPE_UINT32: -+ case FFI_TYPE_SINT32: -+ case FFI_TYPE_POINTER: -+ *(unsigned int *) argp = *(unsigned int *) *p_argv; -+ break; -+ -+ case FFI_TYPE_DOUBLE: -+ case FFI_TYPE_UINT64: -+ case FFI_TYPE_SINT64: -+ case FFI_TYPE_STRUCT: -+ memcpy (argp, *p_argv, z); -+ break; -+ -+ default: -+ FFI_ASSERT (0); -+ } -+ -+ /* Align if necessary. */ -+ if ((sizeof (int) - 1) & z) -+ z = ALIGN(z, sizeof (int)); -+ -+ p_argv++; -+ -+ /* Be careful, once all registers are filled, and about to continue -+ on stack, regp == stackp. Therefore the check for regused as well. */ -+ if (argp == (char *)regp && regused < 8) -+ { -+ regp += z / sizeof (int); -+ regused += z / sizeof (int); -+ } -+ else -+ stackp += z; -+ } -+ -+ return struct_value_ptr; -+} -+ -+/* Perform machine dependent cif processing */ -+ffi_status -+ffi_prep_cif_machdep (ffi_cif *cif) -+{ -+ /* Set the return type flag */ -+ switch (cif->rtype->type) -+ { -+ case FFI_TYPE_VOID: -+ cif->flags = 0; -+ break; -+ -+ case FFI_TYPE_STRUCT: -+ if (cif->rtype->size == sizeof (int) && -+ cif->rtype->alignment == sizeof (int)) -+ cif->flags = CIF_FLAGS_INT; -+ else -+ cif->flags = 0; -+ break; -+ -+ case FFI_TYPE_DOUBLE: -+ case FFI_TYPE_SINT64: -+ case FFI_TYPE_UINT64: -+ cif->flags = CIF_FLAGS_DINT; -+ break; -+ -+ default: -+ cif->flags = CIF_FLAGS_INT; -+ break; -+ } -+ -+ return FFI_OK; -+} -+ -+void -+ffi_call (ffi_cif *cif, void (*fn) (), void *rvalue, void **avalue) -+{ -+ extended_cif ecif; -+ -+ ecif.cif = cif; -+ ecif.avalue = avalue; -+ -+ /* If the return value is a struct and we don't have a return value -+ address then we need to make one. */ -+ -+ if (rvalue == NULL -+ && cif->rtype->type == FFI_TYPE_STRUCT -+ && (cif->rtype->size != sizeof (int) -+ || cif->rtype->alignment != sizeof (int))) -+ ecif.rvalue = alloca (cif->rtype->size); -+ else -+ ecif.rvalue = rvalue; -+ -+ switch (cif->abi) -+ { -+ case FFI_OBSD: -+ ffi_call_OBSD (cif->bytes, &ecif, cif->flags, ecif.rvalue, fn); -+ break; -+ -+ default: -+ FFI_ASSERT (0); -+ break; -+ } -+} -+ -+/* -+ * Closure API -+ */ -+ -+static void -+ffi_prep_closure_args_OBSD (ffi_cif *cif, void **avalue, unsigned int *regp, -+ char *stackp) -+{ -+ unsigned int i; -+ void **p_argv; -+ char *argp; -+ unsigned int regused; -+ ffi_type **p_arg; -+ -+ regused = 0; -+ -+ p_argv = avalue; -+ -+ for (i = cif->nargs, p_arg = cif->arg_types; i != 0; i--, p_arg++) -+ { -+ size_t z; -+ unsigned short t, a; -+ -+ z = (*p_arg)->size; -+ t = (*p_arg)->type; -+ a = (*p_arg)->alignment; -+ -+ /* -+ * Figure out whether the argument has been passed through registers -+ * or on the stack. -+ * The rule is that registers can only receive simple types not larger -+ * than 64 bits, or structs the exact size of a register and aligned to -+ * the size of a register. -+ */ -+ if (t == FFI_TYPE_STRUCT) -+ { -+ if (z == sizeof (int) && a == sizeof (int) && regused < 8) -+ argp = (char *)regp; -+ else -+ argp = stackp; -+ } -+ else -+ { -+ if (z > sizeof (int) && regused < 8 - 1) -+ { -+ /* align to an even register pair */ -+ if (regused & 1) -+ { -+ regp++; -+ regused++; -+ } -+ } -+ if (regused < 8) -+ argp = (char *)regp; -+ else -+ argp = stackp; -+ } -+ -+ /* Enforce proper stack alignment of 64-bit types */ -+ if (argp == stackp && a > sizeof (int)) -+ { -+ stackp = (char *) ALIGN(stackp, a); -+ argp = stackp; -+ } -+ -+ if (z < sizeof (int) && t != FFI_TYPE_STRUCT) -+ *p_argv = (void *) (argp + sizeof (int) - z); -+ else -+ *p_argv = (void *) argp; -+ -+ /* Align if necessary */ -+ if ((sizeof (int) - 1) & z) -+ z = ALIGN(z, sizeof (int)); -+ -+ p_argv++; -+ -+ /* Be careful, once all registers are exhausted, and about to fetch from -+ stack, regp == stackp. Therefore the check for regused as well. */ -+ if (argp == (char *)regp && regused < 8) -+ { -+ regp += z / sizeof (int); -+ regused += z / sizeof (int); -+ } -+ else -+ stackp += z; -+ } -+} -+ -+unsigned int -+ffi_closure_OBSD_inner (ffi_closure *closure, void *resp, unsigned int *regp, -+ char *stackp) -+{ -+ ffi_cif *cif; -+ void **arg_area; -+ -+ cif = closure->cif; -+ arg_area = (void**) alloca (cif->nargs * sizeof (void *)); -+ -+ ffi_prep_closure_args_OBSD(cif, arg_area, regp, stackp); -+ -+ (closure->fun) (cif, resp, arg_area, closure->user_data); -+ -+ return cif->flags; -+} -+ -+ffi_status -+ffi_prep_closure_loc (ffi_closure* closure, ffi_cif* cif, -+ void (*fun)(ffi_cif*,void*,void**,void*), -+ void *user_data, void *codeloc) -+{ -+ unsigned int *tramp = (unsigned int *) codeloc; -+ void *fn; -+ -+ FFI_ASSERT (cif->abi == FFI_OBSD); -+ -+ if (cif->rtype->type == FFI_TYPE_STRUCT && !cif->flags) -+ fn = &ffi_closure_struct_OBSD; -+ else -+ fn = &ffi_closure_OBSD; -+ -+ /* or.u %r10, %r0, %hi16(fn) */ -+ tramp[0] = 0x5d400000 | (((unsigned int)fn) >> 16); -+ /* or.u %r13, %r0, %hi16(closure) */ -+ tramp[1] = 0x5da00000 | ((unsigned int)closure >> 16); -+ /* or %r10, %r10, %lo16(fn) */ -+ tramp[2] = 0x594a0000 | (((unsigned int)fn) & 0xffff); -+ /* jmp.n %r10 */ -+ tramp[3] = 0xf400c40a; -+ /* or %r13, %r13, %lo16(closure) */ -+ tramp[4] = 0x59ad0000 | ((unsigned int)closure & 0xffff); -+ -+ ffi_cacheflush_OBSD((unsigned int)codeloc, FFI_TRAMPOLINE_SIZE); -+ -+ closure->cif = cif; -+ closure->user_data = user_data; -+ closure->fun = fun; -+ -+ return FFI_OK; -+} diff --git a/devel/libffi/patches/patch-src_m88k_ffitarget.h b/devel/libffi/patches/patch-src_m88k_ffitarget.h deleted file mode 100644 index b9e789adb77..00000000000 --- a/devel/libffi/patches/patch-src_m88k_ffitarget.h +++ /dev/null @@ -1,54 +0,0 @@ -$NetBSD: patch-src_m88k_ffitarget.h,v 1.1 2013/11/03 23:51:51 jklos Exp $ - ---- src/m88k/ffitarget.h.orig 2013-11-03 23:00:28.000000000 +0000 -+++ src/m88k/ffitarget.h -@@ -0,0 +1,49 @@ -+/* -+ * Copyright (c) 2013 Miodrag Vallat. <miod@openbsd.org> -+ * -+ * Permission is hereby granted, free of charge, to any person obtaining -+ * a copy of this software and associated documentation files (the -+ * ``Software''), to deal in the Software without restriction, including -+ * without limitation the rights to use, copy, modify, merge, publish, -+ * distribute, sublicense, and/or sell copies of the Software, and to -+ * permit persons to whom the Software is furnished to do so, subject to -+ * the following conditions: -+ * -+ * The above copyright notice and this permission notice shall be included -+ * in all copies or substantial portions of the Software. -+ * -+ * THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, -+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -+ */ -+ -+/* -+ * m88k Foreign Function Interface -+ */ -+ -+#ifndef LIBFFI_TARGET_H -+#define LIBFFI_TARGET_H -+ -+#ifndef LIBFFI_ASM -+typedef unsigned long ffi_arg; -+typedef signed long ffi_sarg; -+ -+typedef enum ffi_abi { -+ FFI_FIRST_ABI = 0, -+ FFI_OBSD, -+ FFI_DEFAULT_ABI = FFI_OBSD, -+ FFI_LAST_ABI = FFI_DEFAULT_ABI + 1 -+} ffi_abi; -+#endif -+ -+/* ---- Definitions for closures ----------------------------------------- */ -+ -+#define FFI_CLOSURES 1 -+#define FFI_TRAMPOLINE_SIZE 0x14 -+#define FFI_NATIVE_RAW_API 0 -+ -+#endif diff --git a/devel/libffi/patches/patch-src_vax_elfbsd.S b/devel/libffi/patches/patch-src_vax_elfbsd.S deleted file mode 100644 index de67548ae50..00000000000 --- a/devel/libffi/patches/patch-src_vax_elfbsd.S +++ /dev/null @@ -1,200 +0,0 @@ -$NetBSD: patch-src_vax_elfbsd.S,v 1.1 2013/11/03 23:51:51 jklos Exp $ - ---- src/vax/elfbsd.S.orig 2013-11-03 23:01:39.000000000 +0000 -+++ src/vax/elfbsd.S -@@ -0,0 +1,195 @@ -+/* -+ * Copyright (c) 2013 Miodrag Vallat. <miod@openbsd.org> -+ * -+ * Permission is hereby granted, free of charge, to any person obtaining -+ * a copy of this software and associated documentation files (the -+ * ``Software''), to deal in the Software without restriction, including -+ * without limitation the rights to use, copy, modify, merge, publish, -+ * distribute, sublicense, and/or sell copies of the Software, and to -+ * permit persons to whom the Software is furnished to do so, subject to -+ * the following conditions: -+ * -+ * The above copyright notice and this permission notice shall be included -+ * in all copies or substantial portions of the Software. -+ * -+ * THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, -+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -+ */ -+ -+/* -+ * vax Foreign Function Interface -+ */ -+ -+#define LIBFFI_ASM -+#include <fficonfig.h> -+#include <ffi.h> -+ -+ .text -+ -+/* -+ * void * %r0 -+ * ffi_call_elfbsd(extended_cif *ecif, 4(%ap) -+ * unsigned bytes, 8(%ap) -+ * unsigned flags, 12(%ap) -+ * void *rvalue, 16(%ap) -+ * void (*fn)()); 20(%ap) -+ */ -+ .globl ffi_call_elfbsd -+ .type ffi_call_elfbsd,@function -+ .align 2 -+ffi_call_elfbsd: -+ .word 0x00c # save R2 and R3 -+ -+ # Allocate stack space for the args -+ subl2 8(%ap), %sp -+ -+ # Call ffi_prep_args -+ pushl %sp -+ pushl 4(%ap) -+ calls $2, ffi_prep_args -+ -+ # Get function pointer -+ movl 20(%ap), %r1 -+ -+ # Build a CALLS frame -+ ashl $-2, 8(%ap), %r0 -+ pushl %r0 # argument stack usage -+ movl %sp, %r0 # future %ap -+ # saved registers -+ bbc $11, 0(%r1), 1f -+ pushl %r11 -+1: bbc $10, 0(%r1), 1f -+ pushl %r10 -+1: bbc $9, 0(%r1), 1f -+ pushl %r9 -+1: bbc $8, 0(%r1), 1f -+ pushl %r8 -+1: bbc $7, 0(%r1), 1f -+ pushl %r7 -+1: bbc $6, 0(%r1), 1f -+ pushl %r6 -+1: bbc $5, 0(%r1), 1f -+ pushl %r5 -+1: bbc $4, 0(%r1), 1f -+ pushl %r4 -+1: bbc $3, 0(%r1), 1f -+ pushl %r3 -+1: bbc $2, 0(%r1), 1f -+ pushl %r2 -+1: -+ pushal 9f -+ pushl %fp -+ pushl %ap -+ movl 16(%ap), %r3 # struct return address, if needed -+ movl %r0, %ap -+ movzwl 4(%fp), %r0 # previous PSW, without the saved registers mask -+ bisl2 $0x20000000, %r0 # calls frame -+ movzwl 0(%r1), %r2 -+ bicw2 $0xf003, %r2 # only keep R11-R2 -+ ashl $16, %r2, %r2 -+ bisl2 %r2, %r0 # saved register mask of the called function -+ pushl %r0 -+ pushl $0 -+ movl %sp, %fp -+ -+ # Invoke the function -+ pushal 2(%r1) # skip procedure entry mask -+ movl %r3, %r1 -+ bicpsw $0x000f -+ rsb -+ -+9: -+ # Copy return value if necessary -+ tstl 16(%ap) -+ jeql 9f -+ movl 16(%ap), %r2 -+ -+ bbc $0, 12(%ap), 1f # CIF_FLAGS_CHAR -+ movb %r0, 0(%r2) -+ brb 9f -+1: -+ bbc $1, 12(%ap), 1f # CIF_FLAGS_SHORT -+ movw %r0, 0(%r2) -+ brb 9f -+1: -+ bbc $2, 12(%ap), 1f # CIF_FLAGS_INT -+ movl %r0, 0(%r2) -+ brb 9f -+1: -+ bbc $3, 12(%ap), 1f # CIF_FLAGS_DINT -+ movq %r0, 0(%r2) -+ brb 9f -+1: -+ movl %r1, %r0 # might have been a struct -+ #brb 9f -+ -+9: -+ ret -+ -+/* -+ * ffi_closure_elfbsd(void); -+ * invoked with %r0: ffi_closure *closure -+ */ -+ .globl ffi_closure_elfbsd -+ .type ffi_closure_elfbsd, @function -+ .align 2 -+ffi_closure_elfbsd: -+ .word 0 -+ -+ # Allocate room on stack for return value -+ subl2 $8, %sp -+ -+ # Invoke the closure function -+ pushal 4(%ap) # calling stack -+ pushal 4(%sp) # return value -+ pushl %r0 # closure -+ calls $3, ffi_closure_elfbsd_inner -+ -+ # Copy return value if necessary -+ bitb $1, %r0 # CIF_FLAGS_CHAR -+ beql 1f -+ movb 0(%sp), %r0 -+ brb 9f -+1: -+ bitb $2, %r0 # CIF_FLAGS_SHORT -+ beql 1f -+ movw 0(%sp), %r0 -+ brb 9f -+1: -+ bitb $4, %r0 # CIF_FLAGS_INT -+ beql 1f -+ movl 0(%sp), %r0 -+ brb 9f -+1: -+ bitb $8, %r0 # CIF_FLAGS_DINT -+ beql 1f -+ movq 0(%sp), %r0 -+ #brb 9f -+1: -+ -+9: -+ ret -+ -+/* -+ * ffi_closure_struct_elfbsd(void); -+ * invoked with %r0: ffi_closure *closure -+ * %r1: struct return address -+ */ -+ .globl ffi_closure_struct_elfbsd -+ .type ffi_closure_struct_elfbsd, @function -+ .align 2 -+ffi_closure_struct_elfbsd: -+ .word 0 -+ -+ # Invoke the closure function -+ pushal 4(%ap) # calling stack -+ pushl %r1 # return value -+ pushl %r0 # closure -+ calls $3, ffi_closure_elfbsd_inner -+ -+ ret diff --git a/devel/libffi/patches/patch-src_vax_ffi.c b/devel/libffi/patches/patch-src_vax_ffi.c deleted file mode 100644 index dedcd2bb130..00000000000 --- a/devel/libffi/patches/patch-src_vax_ffi.c +++ /dev/null @@ -1,281 +0,0 @@ -$NetBSD: patch-src_vax_ffi.c,v 1.1 2013/11/03 23:51:51 jklos Exp $ - ---- src/vax/ffi.c.orig 2013-11-03 23:02:29.000000000 +0000 -+++ src/vax/ffi.c -@@ -0,0 +1,276 @@ -+/* -+ * Copyright (c) 2013 Miodrag Vallat. <miod@openbsd.org> -+ * -+ * Permission is hereby granted, free of charge, to any person obtaining -+ * a copy of this software and associated documentation files (the -+ * ``Software''), to deal in the Software without restriction, including -+ * without limitation the rights to use, copy, modify, merge, publish, -+ * distribute, sublicense, and/or sell copies of the Software, and to -+ * permit persons to whom the Software is furnished to do so, subject to -+ * the following conditions: -+ * -+ * The above copyright notice and this permission notice shall be included -+ * in all copies or substantial portions of the Software. -+ * -+ * THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, -+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -+ */ -+ -+/* -+ * vax Foreign Function Interface -+ * -+ * This file attempts to provide all the FFI entry points which can reliably -+ * be implemented in C. -+ */ -+ -+#include <ffi.h> -+#include <ffi_common.h> -+ -+#include <stdlib.h> -+#include <unistd.h> -+ -+#define CIF_FLAGS_CHAR 1 /* for struct only */ -+#define CIF_FLAGS_SHORT 2 /* for struct only */ -+#define CIF_FLAGS_INT 4 -+#define CIF_FLAGS_DINT 8 -+ -+/* -+ * Foreign Function Interface API -+ */ -+ -+void ffi_call_elfbsd (extended_cif *, unsigned, unsigned, void *, -+ void (*) ()); -+void *ffi_prep_args (extended_cif *ecif, void *stack); -+ -+void * -+ffi_prep_args (extended_cif *ecif, void *stack) -+{ -+ unsigned int i; -+ void **p_argv; -+ char *argp; -+ ffi_type **p_arg; -+ void *struct_value_ptr; -+ -+ argp = stack; -+ -+ if (ecif->cif->rtype->type == FFI_TYPE_STRUCT -+ && !ecif->cif->flags) -+ struct_value_ptr = ecif->rvalue; -+ else -+ struct_value_ptr = NULL; -+ -+ p_argv = ecif->avalue; -+ -+ for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; -+ i != 0; -+ i--, p_arg++) -+ { -+ size_t z; -+ -+ z = (*p_arg)->size; -+ if (z < sizeof (int)) -+ { -+ switch ((*p_arg)->type) -+ { -+ case FFI_TYPE_SINT8: -+ *(signed int *) argp = (signed int) *(SINT8 *) *p_argv; -+ break; -+ -+ case FFI_TYPE_UINT8: -+ *(unsigned int *) argp = (unsigned int) *(UINT8 *) *p_argv; -+ break; -+ -+ case FFI_TYPE_SINT16: -+ *(signed int *) argp = (signed int) *(SINT16 *) *p_argv; -+ break; -+ -+ case FFI_TYPE_UINT16: -+ *(unsigned int *) argp = (unsigned int) *(UINT16 *) *p_argv; -+ break; -+ -+ case FFI_TYPE_STRUCT: -+ memcpy (argp, *p_argv, z); -+ break; -+ -+ default: -+ FFI_ASSERT (0); -+ } -+ z = sizeof (int); -+ } -+ else -+ { -+ memcpy (argp, *p_argv, z); -+ -+ /* Align if necessary. */ -+ if ((sizeof(int) - 1) & z) -+ z = ALIGN(z, sizeof(int)); -+ } -+ -+ p_argv++; -+ argp += z; -+ } -+ -+ return struct_value_ptr; -+} -+ -+ffi_status -+ffi_prep_cif_machdep (ffi_cif *cif) -+{ -+ /* Set the return type flag */ -+ switch (cif->rtype->type) -+ { -+ case FFI_TYPE_VOID: -+ cif->flags = 0; -+ break; -+ -+ case FFI_TYPE_STRUCT: -+ if (cif->rtype->elements[0]->type == FFI_TYPE_STRUCT && -+ cif->rtype->elements[1]) -+ { -+ cif->flags = 0; -+ break; -+ } -+ -+ if (cif->rtype->size == sizeof (char)) -+ cif->flags = CIF_FLAGS_CHAR; -+ else if (cif->rtype->size == sizeof (short)) -+ cif->flags = CIF_FLAGS_SHORT; -+ else if (cif->rtype->size == sizeof (int)) -+ cif->flags = CIF_FLAGS_INT; -+ else if (cif->rtype->size == 2 * sizeof (int)) -+ cif->flags = CIF_FLAGS_DINT; -+ else -+ cif->flags = 0; -+ break; -+ -+ default: -+ if (cif->rtype->size <= sizeof (int)) -+ cif->flags = CIF_FLAGS_INT; -+ else -+ cif->flags = CIF_FLAGS_DINT; -+ break; -+ } -+ -+ return FFI_OK; -+} -+ -+void -+ffi_call (ffi_cif *cif, void (*fn) (), void *rvalue, void **avalue) -+{ -+ extended_cif ecif; -+ -+ ecif.cif = cif; -+ ecif.avalue = avalue; -+ -+ /* If the return value is a struct and we don't have a return value -+ address then we need to make one. */ -+ -+ if (rvalue == NULL -+ && cif->rtype->type == FFI_TYPE_STRUCT -+ && cif->flags == 0) -+ ecif.rvalue = alloca (cif->rtype->size); -+ else -+ ecif.rvalue = rvalue; -+ -+ switch (cif->abi) -+ { -+ case FFI_ELFBSD: -+ ffi_call_elfbsd (&ecif, cif->bytes, cif->flags, ecif.rvalue, fn); -+ break; -+ -+ default: -+ FFI_ASSERT (0); -+ break; -+ } -+} -+ -+/* -+ * Closure API -+ */ -+ -+void ffi_closure_elfbsd (void); -+void ffi_closure_struct_elfbsd (void); -+unsigned int ffi_closure_elfbsd_inner (ffi_closure *, void *, char *); -+ -+static void -+ffi_prep_closure_elfbsd (ffi_cif *cif, void **avalue, char *stackp) -+{ -+ unsigned int i; -+ void **p_argv; -+ ffi_type **p_arg; -+ -+ p_argv = avalue; -+ -+ for (i = cif->nargs, p_arg = cif->arg_types; i != 0; i--, p_arg++) -+ { -+ size_t z; -+ -+ z = (*p_arg)->size; -+ *p_argv = stackp; -+ -+ /* Align if necessary */ -+ if ((sizeof (int) - 1) & z) -+ z = ALIGN(z, sizeof (int)); -+ -+ p_argv++; -+ stackp += z; -+ } -+} -+ -+unsigned int -+ffi_closure_elfbsd_inner (ffi_closure *closure, void *resp, char *stack) -+{ -+ ffi_cif *cif; -+ void **arg_area; -+ -+ cif = closure->cif; -+ arg_area = (void **) alloca (cif->nargs * sizeof (void *)); -+ -+ ffi_prep_closure_elfbsd (cif, arg_area, stack); -+ -+ (closure->fun) (cif, resp, arg_area, closure->user_data); -+ -+ return cif->flags; -+} -+ -+ffi_status -+ffi_prep_closure_loc (ffi_closure *closure, ffi_cif *cif, -+ void (*fun)(ffi_cif *, void *, void **, void *), -+ void *user_data, void *codeloc) -+{ -+ char *tramp = (char *) codeloc; -+ void *fn; -+ -+ FFI_ASSERT (cif->abi == FFI_ELFBSD); -+ -+ /* entry mask */ -+ *(unsigned short *)(tramp + 0) = 0x0000; -+ /* movl #closure, r0 */ -+ tramp[2] = 0xd0; -+ tramp[3] = 0x8f; -+ *(unsigned int *)(tramp + 4) = (unsigned int) closure; -+ tramp[8] = 0x50; -+ -+ if (cif->rtype->type == FFI_TYPE_STRUCT -+ && !cif->flags) -+ fn = &ffi_closure_struct_elfbsd; -+ else -+ fn = &ffi_closure_elfbsd; -+ -+ /* jmpl #fn */ -+ tramp[9] = 0x17; -+ tramp[10] = 0xef; -+ *(unsigned int *)(tramp + 11) = (unsigned int)fn + 2 - -+ (unsigned int)tramp - 9 - 6; -+ -+ closure->cif = cif; -+ closure->user_data = user_data; -+ closure->fun = fun; -+ -+ return FFI_OK; -+} diff --git a/devel/libffi/patches/patch-src_vax_ffitarget.h b/devel/libffi/patches/patch-src_vax_ffitarget.h deleted file mode 100644 index 55233d268a9..00000000000 --- a/devel/libffi/patches/patch-src_vax_ffitarget.h +++ /dev/null @@ -1,54 +0,0 @@ -$NetBSD: patch-src_vax_ffitarget.h,v 1.1 2013/11/03 23:51:51 jklos Exp $ - ---- src/vax/ffitarget.h.orig 2013-11-03 23:03:01.000000000 +0000 -+++ src/vax/ffitarget.h -@@ -0,0 +1,49 @@ -+/* -+ * Copyright (c) 2013 Miodrag Vallat. <miod@openbsd.org> -+ * -+ * Permission is hereby granted, free of charge, to any person obtaining -+ * a copy of this software and associated documentation files (the -+ * ``Software''), to deal in the Software without restriction, including -+ * without limitation the rights to use, copy, modify, merge, publish, -+ * distribute, sublicense, and/or sell copies of the Software, and to -+ * permit persons to whom the Software is furnished to do so, subject to -+ * the following conditions: -+ * -+ * The above copyright notice and this permission notice shall be included -+ * in all copies or substantial portions of the Software. -+ * -+ * THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, -+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -+ */ -+ -+/* -+ * vax Foreign Function Interface -+ */ -+ -+#ifndef LIBFFI_TARGET_H -+#define LIBFFI_TARGET_H -+ -+#ifndef LIBFFI_ASM -+typedef unsigned long ffi_arg; -+typedef signed long ffi_sarg; -+ -+typedef enum ffi_abi { -+ FFI_FIRST_ABI = 0, -+ FFI_ELFBSD, -+ FFI_DEFAULT_ABI = FFI_ELFBSD, -+ FFI_LAST_ABI = FFI_DEFAULT_ABI + 1 -+} ffi_abi; -+#endif -+ -+/* ---- Definitions for closures ----------------------------------------- */ -+ -+#define FFI_CLOSURES 1 -+#define FFI_TRAMPOLINE_SIZE 15 -+#define FFI_NATIVE_RAW_API 0 -+ -+#endif |