update ffi to 3.4.2

This commit is contained in:
alexey.lysiuk 2021-07-03 15:54:19 +03:00
parent 9fba5f414c
commit cc4795b7e8
6 changed files with 82 additions and 36 deletions

View file

@ -1,6 +1,7 @@
/* -----------------------------------------------------------------*-C-*- /* -----------------------------------------------------------------*-C-*-
libffi 3.3 - Copyright (c) 2011, 2014, 2019 Anthony Green libffi 3.4.2
- Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc. - Copyright (c) 2011, 2014, 2019, 2021 Anthony Green
- Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc.
Permission is hereby granted, free of charge, to any person Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation obtaining a copy of this software and associated documentation
@ -217,7 +218,8 @@ FFI_EXTERN ffi_type ffi_type_complex_longdouble;
typedef enum { typedef enum {
FFI_OK = 0, FFI_OK = 0,
FFI_BAD_TYPEDEF, FFI_BAD_TYPEDEF,
FFI_BAD_ABI FFI_BAD_ABI,
FFI_BAD_ARGTYPE
} ffi_status; } ffi_status;
typedef struct { typedef struct {
@ -269,7 +271,7 @@ typedef ffi_raw ffi_java_raw;
#endif #endif
FFI_API FFI_API
void ffi_raw_call (ffi_cif *cif, void ffi_raw_call (ffi_cif *cif,
void (*fn)(void), void (*fn)(void),
void *rvalue, void *rvalue,
@ -310,7 +312,10 @@ typedef struct {
void *trampoline_table; void *trampoline_table;
void *trampoline_table_entry; void *trampoline_table_entry;
#else #else
char tramp[FFI_TRAMPOLINE_SIZE]; union {
char tramp[FFI_TRAMPOLINE_SIZE];
void *ftramp;
};
#endif #endif
ffi_cif *cif; ffi_cif *cif;
void (*fun)(ffi_cif*,void*,void**,void*); void (*fun)(ffi_cif*,void*,void**,void*);
@ -330,6 +335,14 @@ typedef struct {
FFI_API void *ffi_closure_alloc (size_t size, void **code); FFI_API void *ffi_closure_alloc (size_t size, void **code);
FFI_API void ffi_closure_free (void *); FFI_API void ffi_closure_free (void *);
#if defined(PA_LINUX) || defined(PA_HPUX)
#define FFI_CLOSURE_PTR(X) ((void *)((unsigned int)(X) | 2))
#define FFI_RESTORE_PTR(X) ((void *)((unsigned int)(X) & ~3))
#else
#define FFI_CLOSURE_PTR(X) (X)
#define FFI_RESTORE_PTR(X) (X)
#endif
FFI_API ffi_status FFI_API ffi_status
ffi_prep_closure (ffi_closure*, ffi_prep_closure (ffi_closure*,
ffi_cif *, ffi_cif *,
@ -363,8 +376,8 @@ typedef struct {
#if !FFI_NATIVE_RAW_API #if !FFI_NATIVE_RAW_API
/* If this is enabled, then a raw closure has the same layout /* If this is enabled, then a raw closure has the same layout
as a regular closure. We use this to install an intermediate as a regular closure. We use this to install an intermediate
handler to do the transaltion, void** -> ffi_raw*. */ handler to do the transaltion, void** -> ffi_raw*. */
void (*translate_args)(ffi_cif*,void*,void**,void*); void (*translate_args)(ffi_cif*,void*,void**,void*);
@ -389,8 +402,8 @@ typedef struct {
#if !FFI_NATIVE_RAW_API #if !FFI_NATIVE_RAW_API
/* If this is enabled, then a raw closure has the same layout /* If this is enabled, then a raw closure has the same layout
as a regular closure. We use this to install an intermediate as a regular closure. We use this to install an intermediate
handler to do the translation, void** -> ffi_raw*. */ handler to do the translation, void** -> ffi_raw*. */
void (*translate_args)(ffi_cif*,void*,void**,void*); void (*translate_args)(ffi_cif*,void*,void**,void*);
@ -451,7 +464,7 @@ FFI_API void ffi_call_go (ffi_cif *cif, void (*fn)(void), void *rvalue,
/* ---- Public interface definition -------------------------------------- */ /* ---- Public interface definition -------------------------------------- */
FFI_API FFI_API
ffi_status ffi_prep_cif(ffi_cif *cif, ffi_status ffi_prep_cif(ffi_cif *cif,
ffi_abi abi, ffi_abi abi,
unsigned int nargs, unsigned int nargs,
@ -484,18 +497,18 @@ ffi_status ffi_get_struct_offsets (ffi_abi abi, ffi_type *struct_type,
#endif #endif
/* If these change, update src/mips/ffitarget.h. */ /* If these change, update src/mips/ffitarget.h. */
#define FFI_TYPE_VOID 0 #define FFI_TYPE_VOID 0
#define FFI_TYPE_INT 1 #define FFI_TYPE_INT 1
#define FFI_TYPE_FLOAT 2 #define FFI_TYPE_FLOAT 2
#define FFI_TYPE_DOUBLE 3 #define FFI_TYPE_DOUBLE 3
#if 0 #if 0
#define FFI_TYPE_LONGDOUBLE 4 #define FFI_TYPE_LONGDOUBLE 4
#else #else
#define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE #define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE
#endif #endif
#define FFI_TYPE_UINT8 5 #define FFI_TYPE_UINT8 5
#define FFI_TYPE_SINT8 6 #define FFI_TYPE_SINT8 6
#define FFI_TYPE_UINT16 7 #define FFI_TYPE_UINT16 7
#define FFI_TYPE_SINT16 8 #define FFI_TYPE_SINT16 8
#define FFI_TYPE_UINT32 9 #define FFI_TYPE_UINT32 9
#define FFI_TYPE_SINT32 10 #define FFI_TYPE_SINT32 10

View file

@ -32,7 +32,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#define FFI_SIZEOF_JAVA_RAW 4 #define FFI_SIZEOF_JAVA_RAW 4
typedef unsigned long long ffi_arg; typedef unsigned long long ffi_arg;
typedef signed long long ffi_sarg; typedef signed long long ffi_sarg;
#elif defined(_M_ARM64) #elif defined(_WIN32)
#define FFI_SIZEOF_ARG 8 #define FFI_SIZEOF_ARG 8
typedef unsigned long long ffi_arg; typedef unsigned long long ffi_arg;
typedef signed long long ffi_sarg; typedef signed long long ffi_sarg;
@ -45,8 +45,13 @@ typedef enum ffi_abi
{ {
FFI_FIRST_ABI = 0, FFI_FIRST_ABI = 0,
FFI_SYSV, FFI_SYSV,
FFI_WIN64,
FFI_LAST_ABI, FFI_LAST_ABI,
#if defined(_WIN32)
FFI_DEFAULT_ABI = FFI_WIN64
#else
FFI_DEFAULT_ABI = FFI_SYSV FFI_DEFAULT_ABI = FFI_SYSV
#endif
} ffi_abi; } ffi_abi;
#endif #endif
@ -69,22 +74,22 @@ typedef enum ffi_abi
#define FFI_TRAMPOLINE_CLOSURE_OFFSET FFI_TRAMPOLINE_SIZE #define FFI_TRAMPOLINE_CLOSURE_OFFSET FFI_TRAMPOLINE_SIZE
#endif #endif
#ifdef _M_ARM64 #ifdef _WIN32
#define FFI_EXTRA_CIF_FIELDS unsigned is_variadic #define FFI_EXTRA_CIF_FIELDS unsigned is_variadic
#endif #endif
#define FFI_TARGET_SPECIFIC_VARIADIC
/* ---- Internal ---- */ /* ---- Internal ---- */
#if defined (__APPLE__) #if defined (__APPLE__)
#define FFI_TARGET_SPECIFIC_VARIADIC
#define FFI_EXTRA_CIF_FIELDS unsigned aarch64_nfixedargs #define FFI_EXTRA_CIF_FIELDS unsigned aarch64_nfixedargs
#elif !defined(_M_ARM64) #elif !defined(_WIN32)
/* iOS and Windows reserve x18 for the system. Disable Go closures until /* iOS and Windows reserve x18 for the system. Disable Go closures until
a new static chain is chosen. */ a new static chain is chosen. */
#define FFI_GO_CLOSURES 1 #define FFI_GO_CLOSURES 1
#endif #endif
#ifndef _M_ARM64 #ifndef _WIN32
/* No complex type on Windows */ /* No complex type on Windows */
#define FFI_TARGET_HAS_COMPLEX_TYPE #define FFI_TARGET_HAS_COMPLEX_TYPE
#endif #endif

View file

@ -1,6 +1,7 @@
/* -----------------------------------------------------------------*-C-*- /* -----------------------------------------------------------------*-C-*-
libffi 3.3 - Copyright (c) 2011, 2014, 2019 Anthony Green libffi 3.4.2
- Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc. - Copyright (c) 2011, 2014, 2019, 2021 Anthony Green
- Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc.
Permission is hereby granted, free of charge, to any person Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation obtaining a copy of this software and associated documentation
@ -217,7 +218,8 @@ FFI_EXTERN ffi_type ffi_type_complex_longdouble;
typedef enum { typedef enum {
FFI_OK = 0, FFI_OK = 0,
FFI_BAD_TYPEDEF, FFI_BAD_TYPEDEF,
FFI_BAD_ABI FFI_BAD_ABI,
FFI_BAD_ARGTYPE
} ffi_status; } ffi_status;
typedef struct { typedef struct {
@ -269,7 +271,7 @@ typedef ffi_raw ffi_java_raw;
#endif #endif
FFI_API FFI_API
void ffi_raw_call (ffi_cif *cif, void ffi_raw_call (ffi_cif *cif,
void (*fn)(void), void (*fn)(void),
void *rvalue, void *rvalue,
@ -310,7 +312,10 @@ typedef struct {
void *trampoline_table; void *trampoline_table;
void *trampoline_table_entry; void *trampoline_table_entry;
#else #else
char tramp[FFI_TRAMPOLINE_SIZE]; union {
char tramp[FFI_TRAMPOLINE_SIZE];
void *ftramp;
};
#endif #endif
ffi_cif *cif; ffi_cif *cif;
void (*fun)(ffi_cif*,void*,void**,void*); void (*fun)(ffi_cif*,void*,void**,void*);
@ -330,6 +335,14 @@ typedef struct {
FFI_API void *ffi_closure_alloc (size_t size, void **code); FFI_API void *ffi_closure_alloc (size_t size, void **code);
FFI_API void ffi_closure_free (void *); FFI_API void ffi_closure_free (void *);
#if defined(PA_LINUX) || defined(PA_HPUX)
#define FFI_CLOSURE_PTR(X) ((void *)((unsigned int)(X) | 2))
#define FFI_RESTORE_PTR(X) ((void *)((unsigned int)(X) & ~3))
#else
#define FFI_CLOSURE_PTR(X) (X)
#define FFI_RESTORE_PTR(X) (X)
#endif
FFI_API ffi_status FFI_API ffi_status
ffi_prep_closure (ffi_closure*, ffi_prep_closure (ffi_closure*,
ffi_cif *, ffi_cif *,
@ -363,8 +376,8 @@ typedef struct {
#if !FFI_NATIVE_RAW_API #if !FFI_NATIVE_RAW_API
/* If this is enabled, then a raw closure has the same layout /* If this is enabled, then a raw closure has the same layout
as a regular closure. We use this to install an intermediate as a regular closure. We use this to install an intermediate
handler to do the transaltion, void** -> ffi_raw*. */ handler to do the transaltion, void** -> ffi_raw*. */
void (*translate_args)(ffi_cif*,void*,void**,void*); void (*translate_args)(ffi_cif*,void*,void**,void*);
@ -389,8 +402,8 @@ typedef struct {
#if !FFI_NATIVE_RAW_API #if !FFI_NATIVE_RAW_API
/* If this is enabled, then a raw closure has the same layout /* If this is enabled, then a raw closure has the same layout
as a regular closure. We use this to install an intermediate as a regular closure. We use this to install an intermediate
handler to do the translation, void** -> ffi_raw*. */ handler to do the translation, void** -> ffi_raw*. */
void (*translate_args)(ffi_cif*,void*,void**,void*); void (*translate_args)(ffi_cif*,void*,void**,void*);
@ -451,7 +464,7 @@ FFI_API void ffi_call_go (ffi_cif *cif, void (*fn)(void), void *rvalue,
/* ---- Public interface definition -------------------------------------- */ /* ---- Public interface definition -------------------------------------- */
FFI_API FFI_API
ffi_status ffi_prep_cif(ffi_cif *cif, ffi_status ffi_prep_cif(ffi_cif *cif,
ffi_abi abi, ffi_abi abi,
unsigned int nargs, unsigned int nargs,
@ -484,18 +497,18 @@ ffi_status ffi_get_struct_offsets (ffi_abi abi, ffi_type *struct_type,
#endif #endif
/* If these change, update src/mips/ffitarget.h. */ /* If these change, update src/mips/ffitarget.h. */
#define FFI_TYPE_VOID 0 #define FFI_TYPE_VOID 0
#define FFI_TYPE_INT 1 #define FFI_TYPE_INT 1
#define FFI_TYPE_FLOAT 2 #define FFI_TYPE_FLOAT 2
#define FFI_TYPE_DOUBLE 3 #define FFI_TYPE_DOUBLE 3
#if 1 #if 1
#define FFI_TYPE_LONGDOUBLE 4 #define FFI_TYPE_LONGDOUBLE 4
#else #else
#define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE #define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE
#endif #endif
#define FFI_TYPE_UINT8 5 #define FFI_TYPE_UINT8 5
#define FFI_TYPE_SINT8 6 #define FFI_TYPE_SINT8 6
#define FFI_TYPE_UINT16 7 #define FFI_TYPE_UINT16 7
#define FFI_TYPE_SINT16 8 #define FFI_TYPE_SINT16 8
#define FFI_TYPE_UINT32 9 #define FFI_TYPE_UINT32 9
#define FFI_TYPE_SINT32 10 #define FFI_TYPE_SINT32 10

View file

@ -136,12 +136,27 @@ typedef enum ffi_abi {
#if defined (X86_64) || defined(X86_WIN64) \ #if defined (X86_64) || defined(X86_WIN64) \
|| (defined (__x86_64__) && defined (X86_DARWIN)) || (defined (__x86_64__) && defined (X86_DARWIN))
# define FFI_TRAMPOLINE_SIZE 24 /* 4 bytes of ENDBR64 + 7 bytes of LEA + 6 bytes of JMP + 7 bytes of NOP
+ 8 bytes of pointer. */
# define FFI_TRAMPOLINE_SIZE 32
# define FFI_NATIVE_RAW_API 0 # define FFI_NATIVE_RAW_API 0
#else #else
# define FFI_TRAMPOLINE_SIZE 12 /* 4 bytes of ENDBR32 + 5 bytes of MOV + 5 bytes of JMP + 2 unused
bytes. */
# define FFI_TRAMPOLINE_SIZE 16
# define FFI_NATIVE_RAW_API 1 /* x86 has native raw api support */ # define FFI_NATIVE_RAW_API 1 /* x86 has native raw api support */
#endif #endif
#if !defined(GENERATE_LIBFFI_MAP) && defined(__CET__)
# include <cet.h>
# if (__CET__ & 1) != 0
# define ENDBR_PRESENT
# endif
# define _CET_NOTRACK notrack
#else
# define _CET_ENDBR
# define _CET_NOTRACK
#endif
#endif #endif

BIN
deps/ffi/lib/libffi.a vendored

Binary file not shown.

View file

@ -6,6 +6,6 @@ includedir=${prefix}/include
Name: libffi Name: libffi
Description: Library supporting Foreign Function Interfaces Description: Library supporting Foreign Function Interfaces
Version: 3.3 Version: 3.4.2
Libs: -L${toolexeclibdir} -lffi Libs: -L${toolexeclibdir} -lffi
Cflags: -I${includedir} Cflags: -I${includedir}