update to libffi-3.3

tested on amd64 and arm64
This commit is contained in:
jasper 2020-02-10 18:06:34 +00:00
parent 0470b32451
commit 55c2bcafc0
9 changed files with 38 additions and 140 deletions

View File

@ -1,9 +1,8 @@
# $OpenBSD: Makefile,v 1.41 2019/12/11 21:05:44 jasper Exp $
# $OpenBSD: Makefile,v 1.42 2020/02/10 18:06:34 jasper Exp $
COMMENT= Foreign Function Interface
DISTNAME= libffi-3.2.1
REVISION= 6
DISTNAME= libffi-3.3
SHARED_LIBS += ffi 1.2 # .6.4
CATEGORIES= devel

View File

@ -1,2 +1,2 @@
SHA256 (libffi-3.2.1.tar.gz) = 0G67jh2aItGeONY/24OVQlPzm+3F1GIyoFZFaFciyjc=
SIZE (libffi-3.2.1.tar.gz) = 940837
SHA256 (libffi-3.3.tar.gz) = cvunkicD3fp6Ao1ROsFahcjVTI1n9V+lpIAohdxlIFY=
SIZE (libffi-3.3.tar.gz) = 1305466

View File

@ -1,30 +1,20 @@
$OpenBSD: patch-configure,v 1.10 2018/11/02 18:27:17 naddy Exp $
$OpenBSD: patch-configure,v 1.11 2020/02/10 18:06:34 jasper Exp $
- Check for HAVE_AS_X86_PCREL on i386 too
- Link with libc++abi on arm (to access unwind symbols)
Index: configure
--- configure.orig
+++ configure
@@ -18365,7 +18365,7 @@ $as_echo "#define HAVE_AS_REGISTER_PSEUDO_OP 1" >>conf
fi
fi
-if test x$TARGET = xX86 || test x$TARGET = xX86_WIN32 || test x$TARGET = xX86_64; then
+if test x$TARGET = xX86 || test x$TARGET = xX86_FREEBSD || test x$TARGET = xX86_WIN32 || test x$TARGET = xX86_64; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler supports pc related relocs" >&5
$as_echo_n "checking assembler supports pc related relocs... " >&6; }
if ${libffi_cv_as_x86_pcrel+:} false; then :
@@ -18521,6 +18521,12 @@ if test "x$sys_symbol_underscore" = xyes; then
$as_echo "#define SYMBOL_UNDERSCORE 1" >>confdefs.h
@@ -18475,6 +18475,12 @@ $as_echo "#define SYMBOL_UNDERSCORE 1" >>confdefs.h
fi
+
+case "$target" in
+ arm-*-openbsd*)
+ LDFLAGS="-lc++abi $LDFLAGS"
+ ;;
+esac
+
FFI_EXEC_TRAMPOLINE_TABLE=0
case "$target" in
*arm*-apple-* | aarch64-apple-*)

View File

@ -1,16 +0,0 @@
$OpenBSD: patch-libffi_pc_in,v 1.4 2018/01/31 17:58:38 jca Exp $
- Install headers into a standard directory.
Index: libffi.pc.in
--- libffi.pc.in.orig
+++ libffi.pc.in
@@ -2,7 +2,7 @@ prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
toolexeclibdir=@toolexeclibdir@
-includedir=${libdir}/@PACKAGE_NAME@-@PACKAGE_VERSION@/include
+includedir=@includedir@
Name: @PACKAGE_NAME@
Description: Library supporting Foreign Function Interfaces

View File

@ -1,16 +0,0 @@
$OpenBSD: patch-src_alpha_osf_S,v 1.1 2015/10/31 10:24:52 landry Exp $
Fix build on alpha, this part of code was removed upstream in master
--- src/alpha/osf.S.orig Sat Oct 31 04:17:37 2015
+++ src/alpha/osf.S Sat Oct 31 04:18:02 2015
@@ -294,7 +294,8 @@ $load_table:
|| FFI_TYPE_SINT64 != 12 \
|| FFI_TYPE_STRUCT != 13 \
|| FFI_TYPE_POINTER != 14 \
- || FFI_TYPE_LAST != 14
+ || FFI_TYPE_COMPLEX != 15 \
+ || FFI_TYPE_LAST != 15
#error "osf.S out of sync with ffi.h"
#endif

View File

@ -1,13 +1,13 @@
$OpenBSD: patch-src_arm_ffi_c,v 1.8 2018/01/22 06:28:00 bcallah Exp $
$OpenBSD: patch-src_arm_ffi_c,v 1.9 2020/02/10 18:06:34 jasper Exp $
https://svnweb.freebsd.org/ports/head/devel/libffi/files/patch-src__arm__ffi.c?revision=337118&view=markup
Index: src/arm/ffi.c
--- src/arm/ffi.c.orig
+++ src/arm/ffi.c
@@ -33,6 +33,11 @@
#include <stdlib.h>
@@ -55,6 +55,11 @@ extern unsigned int ffi_arm_trampoline[3] FFI_HIDDEN;
#endif
#endif
+#ifdef __arm__
+#include <machine/sysarch.h>
@ -15,11 +15,11 @@ Index: src/arm/ffi.c
+#endif
+
/* Forward declares. */
static int vfp_type_p (ffi_type *);
static int vfp_type_p (const ffi_type *);
static void layout_vfp_args (ffi_cif *);
@@ -750,6 +755,16 @@ ffi_closure_free (void *ptr)
}
@@ -591,6 +596,16 @@ ffi_prep_closure_loc (ffi_closure * closure,
config[0] = closure;
config[1] = closure_func;
#else
+
+#ifdef __arm__
@ -32,5 +32,5 @@ Index: src/arm/ffi.c
+ } while (0);
+#endif
#define FFI_INIT_TRAMPOLINE(TRAMP,FUN,CTX) \
({ unsigned char *__tramp = (unsigned char*)(TRAMP); \
#ifndef _M_ARM
memcpy(closure->tramp, ffi_arm_trampoline, 8);

View File

@ -1,61 +0,0 @@
$OpenBSD: patch-src_arm_sysv_S,v 1.8 2018/04/14 13:02:59 sthen Exp $
From FreeBSD, see also
https://github.com/libffi/libffi/issues/162
https://github.com/libffi/libffi/issues/191
This code is completely different in the 3.3 branch so can probably just
be removed straight off when a release has been from there.
Index: src/arm/sysv.S
--- src/arm/sysv.S.orig
+++ src/arm/sysv.S
@@ -360,7 +360,7 @@ ARM_FUNC_START(ffi_call_VFP)
cmp r0, #3
sub ip, fp, #64
flddle d0, [ip]
- fldmiadgt ip, {d0-d7}
+ vldmiagt ip, {d0-d7}
LSYM(Lbase_args):
@ move first 4 parameters in registers
@@ -396,7 +396,7 @@ LSYM(Lbase_args):
beq LSYM(Lepilogue_vfp)
cmp r3, #FFI_TYPE_SINT64
- stmeqia r2, {r0, r1}
+ stmiaeq r2, {r0, r1}
beq LSYM(Lepilogue_vfp)
cmp r3, #FFI_TYPE_FLOAT
@@ -409,7 +409,7 @@ LSYM(Lbase_args):
cmp r3, #FFI_TYPE_STRUCT_VFP_FLOAT
cmpne r3, #FFI_TYPE_STRUCT_VFP_DOUBLE
- fstmiadeq r2, {d0-d3}
+ vstmiaeq r2, {d0-d3}
LSYM(Lepilogue_vfp):
RETLDM "r0-r3,fp"
@@ -420,7 +420,7 @@ LSYM(Lepilogue_vfp):
ARM_FUNC_START(ffi_closure_VFP)
- fstmfdd sp!, {d0-d7}
+ vstmdb sp!, {d0-d7}
@ r0-r3, then d0-d7
UNWIND .pad #80
add ip, sp, #80
@@ -470,10 +470,10 @@ ARM_FUNC_START(ffi_closure_VFP)
ldmia sp, {r0, r1}
b .Lclosure_epilogue_vfp
.Lretfloat_struct_vfp:
- fldmiad sp, {d0-d1}
+ vldmia sp, {d0-d1}
b .Lclosure_epilogue_vfp
.Lretdouble_struct_vfp:
- fldmiad sp, {d0-d3}
+ vldmia sp, {d0-d3}
b .Lclosure_epilogue_vfp
.ffi_closure_VFP_end:

View File

@ -1,15 +1,16 @@
$OpenBSD: patch-src_closures_c,v 1.1 2016/05/26 20:48:50 jca Exp $
--- src/closures.c.orig Mon May 23 20:34:13 2016
+++ src/closures.c Mon May 23 20:35:56 2016
@@ -525,6 +525,7 @@ dlmmap (void *start, size_t length, int prot,
printf ("mapping in %zi\n", length);
#endif
$OpenBSD: patch-src_closures_c,v 1.2 2020/02/10 18:06:34 jasper Exp $
Index: src/closures.c
--- src/closures.c.orig
+++ src/closures.c
@@ -837,6 +837,7 @@ dlmmap (void *start, size_t length, int prot,
&& flags == (MAP_PRIVATE | MAP_ANONYMOUS)
&& fd == -1 && offset == 0);
+#if 0
if (execfd == -1 && is_emutramp_enabled ())
{
ptr = mmap (start, length, prot & ~PROT_EXEC, flags, fd, offset);
@@ -543,6 +544,7 @@ dlmmap (void *start, size_t length, int prot,
@@ -855,6 +856,7 @@ dlmmap (void *start, size_t length, int prot,
with ((prot & ~PROT_WRITE) | PROT_EXEC) and mremap with
MREMAP_DUP and prot at this point. */
}

View File

@ -1,15 +1,16 @@
$OpenBSD: patch-testsuite_lib_libffi_exp,v 1.1 2015/09/29 07:45:33 jasper Exp $
$OpenBSD: patch-testsuite_lib_libffi_exp,v 1.2 2020/02/10 18:06:34 jasper Exp $
cc1: error: unrecognized command line option "-Wno-psabi"
--- testsuite/lib/libffi.exp.orig Tue Sep 22 19:56:34 2015
+++ testsuite/lib/libffi.exp Tue Sep 22 19:56:44 2015
@@ -280,7 +280,7 @@ proc libffi-dg-runtest { testcases default-extra-flags
proc run-many-tests { testcases extra_flags } {
global using_gcc
if { [string match $using_gcc "yes"] } {
Index: testsuite/lib/libffi.exp
--- testsuite/lib/libffi.exp.orig
+++ testsuite/lib/libffi.exp
@@ -488,7 +488,7 @@ proc run-many-tests { testcases extra_flags } {
}
}
"gnu" {
- set common "-W -Wall -Wno-psabi"
+ set common "-W -Wall"
set optimizations { "-O0" "-O2" "-O3" "-Os" "-O2 -fomit-frame-pointer" }
} else {
# Assume we are using the vendor compiler.
if [info exists env(LIBFFI_TEST_OPTIMIZATION)] {
set optimizations [ list $env(LIBFFI_TEST_OPTIMIZATION) ]
} else {