Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit c4bc807

Browse files
committed
Merge pull request #50 from livecodeian/update-libffi_3.999_ios_only
[[ Bug 16357 ]] Include latest libffi version from git to support closures on iOS arm64
2 parents d30c3f5 + de3c68a commit c4bc807

157 files changed

Lines changed: 58441 additions & 32 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#ifdef __arm64__
2+
3+
#include <ffi_arm64.h>
4+
5+
6+
#endif
7+
#ifdef __i386__
8+
9+
#include <ffi_i386.h>
10+
11+
12+
#endif
13+
#ifdef __arm__
14+
15+
#include <ffi_armv7.h>
16+
17+
18+
#endif
19+
#ifdef __x86_64__
20+
21+
#include <ffi_x86_64.h>
22+
23+
24+
#endif
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/* -----------------------------------------------------------------------
2+
ffi_cfi.h - Copyright (c) 2014 Red Hat, Inc.
3+
4+
Conditionally assemble cfi directives. Only necessary for building libffi.
5+
----------------------------------------------------------------------- */
6+
7+
#ifndef FFI_CFI_H
8+
#define FFI_CFI_H
9+
10+
#ifdef HAVE_AS_CFI_PSEUDO_OP
11+
12+
# define cfi_startproc .cfi_startproc
13+
# define cfi_endproc .cfi_endproc
14+
# define cfi_def_cfa(reg, off) .cfi_def_cfa reg, off
15+
# define cfi_def_cfa_register(reg) .cfi_def_cfa_register reg
16+
# define cfi_def_cfa_offset(off) .cfi_def_cfa_offset off
17+
# define cfi_adjust_cfa_offset(off) .cfi_adjust_cfa_offset off
18+
# define cfi_offset(reg, off) .cfi_offset reg, off
19+
# define cfi_rel_offset(reg, off) .cfi_rel_offset reg, off
20+
# define cfi_register(r1, r2) .cfi_register r1, r2
21+
# define cfi_return_column(reg) .cfi_return_column reg
22+
# define cfi_restore(reg) .cfi_restore reg
23+
# define cfi_same_value(reg) .cfi_same_value reg
24+
# define cfi_undefined(reg) .cfi_undefined reg
25+
# define cfi_remember_state .cfi_remember_state
26+
# define cfi_restore_state .cfi_restore_state
27+
# define cfi_window_save .cfi_window_save
28+
# define cfi_personality(enc, exp) .cfi_personality enc, exp
29+
# define cfi_lsda(enc, exp) .cfi_lsda enc, exp
30+
# define cfi_escape(...) .cfi_escape __VA_ARGS__
31+
32+
#else
33+
34+
# define cfi_startproc
35+
# define cfi_endproc
36+
# define cfi_def_cfa(reg, off)
37+
# define cfi_def_cfa_register(reg)
38+
# define cfi_def_cfa_offset(off)
39+
# define cfi_adjust_cfa_offset(off)
40+
# define cfi_offset(reg, off)
41+
# define cfi_rel_offset(reg, off)
42+
# define cfi_register(r1, r2)
43+
# define cfi_return_column(reg)
44+
# define cfi_restore(reg)
45+
# define cfi_same_value(reg)
46+
# define cfi_undefined(reg)
47+
# define cfi_remember_state
48+
# define cfi_restore_state
49+
# define cfi_window_save
50+
# define cfi_personality(enc, exp)
51+
# define cfi_lsda(enc, exp)
52+
# define cfi_escape(...)
53+
54+
#endif /* HAVE_AS_CFI_PSEUDO_OP */
55+
#endif /* FFI_CFI_H */
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
/* -----------------------------------------------------------------------
2+
ffi_common.h - Copyright (C) 2011, 2012, 2013 Anthony Green
3+
Copyright (C) 2007 Free Software Foundation, Inc
4+
Copyright (c) 1996 Red Hat, Inc.
5+
6+
Common internal definitions and macros. Only necessary for building
7+
libffi.
8+
----------------------------------------------------------------------- */
9+
10+
#ifndef FFI_COMMON_H
11+
#define FFI_COMMON_H
12+
13+
#ifdef __cplusplus
14+
extern "C" {
15+
#endif
16+
17+
#include <fficonfig.h>
18+
19+
/* Do not move this. Some versions of AIX are very picky about where
20+
this is positioned. */
21+
#ifdef __GNUC__
22+
# if HAVE_ALLOCA_H
23+
# include <alloca.h>
24+
# else
25+
/* mingw64 defines this already in malloc.h. */
26+
# ifndef alloca
27+
# define alloca __builtin_alloca
28+
# endif
29+
# endif
30+
# define MAYBE_UNUSED __attribute__((__unused__))
31+
#else
32+
# define MAYBE_UNUSED
33+
# if HAVE_ALLOCA_H
34+
# include <alloca.h>
35+
# else
36+
# ifdef _AIX
37+
# pragma alloca
38+
# else
39+
# ifndef alloca /* predefined by HP cc +Olibcalls */
40+
# ifdef _MSC_VER
41+
# define alloca _alloca
42+
# else
43+
char *alloca ();
44+
# endif
45+
# endif
46+
# endif
47+
# endif
48+
#endif
49+
50+
/* Check for the existence of memcpy. */
51+
#if STDC_HEADERS
52+
# include <string.h>
53+
#else
54+
# ifndef HAVE_MEMCPY
55+
# define memcpy(d, s, n) bcopy ((s), (d), (n))
56+
# endif
57+
#endif
58+
59+
#if defined(FFI_DEBUG)
60+
#include <stdio.h>
61+
#endif
62+
63+
#ifdef FFI_DEBUG
64+
void ffi_assert(char *expr, char *file, int line);
65+
void ffi_stop_here(void);
66+
void ffi_type_test(ffi_type *a, char *file, int line);
67+
68+
#define FFI_ASSERT(x) ((x) ? (void)0 : ffi_assert(#x, __FILE__,__LINE__))
69+
#define FFI_ASSERT_AT(x, f, l) ((x) ? 0 : ffi_assert(#x, (f), (l)))
70+
#define FFI_ASSERT_VALID_TYPE(x) ffi_type_test (x, __FILE__, __LINE__)
71+
#else
72+
#define FFI_ASSERT(x)
73+
#define FFI_ASSERT_AT(x, f, l)
74+
#define FFI_ASSERT_VALID_TYPE(x)
75+
#endif
76+
77+
#define ALIGN(v, a) (((((size_t) (v))-1) | ((a)-1))+1)
78+
#define ALIGN_DOWN(v, a) (((size_t) (v)) & -a)
79+
80+
/* Perform machine dependent cif processing */
81+
ffi_status ffi_prep_cif_machdep(ffi_cif *cif);
82+
ffi_status ffi_prep_cif_machdep_var(ffi_cif *cif,
83+
unsigned int nfixedargs, unsigned int ntotalargs);
84+
85+
#if HAVE_LONG_DOUBLE_VARIANT
86+
/* Used to adjust size/alignment of ffi types. */
87+
void ffi_prep_types (ffi_abi abi);
88+
#endif
89+
90+
/* Extended cif, used in callback from assembly routine */
91+
typedef struct
92+
{
93+
ffi_cif *cif;
94+
void *rvalue;
95+
void **avalue;
96+
} extended_cif;
97+
98+
/* Terse sized type definitions. */
99+
#if defined(_MSC_VER) || defined(__sgi) || defined(__SUNPRO_C)
100+
typedef unsigned char UINT8;
101+
typedef signed char SINT8;
102+
typedef unsigned short UINT16;
103+
typedef signed short SINT16;
104+
typedef unsigned int UINT32;
105+
typedef signed int SINT32;
106+
# ifdef _MSC_VER
107+
typedef unsigned __int64 UINT64;
108+
typedef signed __int64 SINT64;
109+
# else
110+
# include <inttypes.h>
111+
typedef uint64_t UINT64;
112+
typedef int64_t SINT64;
113+
# endif
114+
#else
115+
typedef unsigned int UINT8 __attribute__((__mode__(__QI__)));
116+
typedef signed int SINT8 __attribute__((__mode__(__QI__)));
117+
typedef unsigned int UINT16 __attribute__((__mode__(__HI__)));
118+
typedef signed int SINT16 __attribute__((__mode__(__HI__)));
119+
typedef unsigned int UINT32 __attribute__((__mode__(__SI__)));
120+
typedef signed int SINT32 __attribute__((__mode__(__SI__)));
121+
typedef unsigned int UINT64 __attribute__((__mode__(__DI__)));
122+
typedef signed int SINT64 __attribute__((__mode__(__DI__)));
123+
#endif
124+
125+
typedef float FLOAT32;
126+
127+
#ifndef __GNUC__
128+
#define __builtin_expect(x, expected_value) (x)
129+
#endif
130+
#define LIKELY(x) __builtin_expect(!!(x),1)
131+
#define UNLIKELY(x) __builtin_expect((x)!=0,0)
132+
133+
#ifdef __cplusplus
134+
}
135+
#endif
136+
137+
#endif
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#ifdef __arm64__
2+
3+
#include <fficonfig_arm64.h>
4+
5+
6+
#endif
7+
#ifdef __i386__
8+
9+
#include <fficonfig_i386.h>
10+
11+
12+
#endif
13+
#ifdef __arm__
14+
15+
#include <fficonfig_armv7.h>
16+
17+
18+
#endif
19+
#ifdef __x86_64__
20+
21+
#include <fficonfig_x86_64.h>
22+
23+
24+
#endif
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#ifdef __arm64__
2+
3+
#include <ffitarget_arm64.h>
4+
5+
6+
#endif
7+
#ifdef __i386__
8+
9+
#include <ffitarget_i386.h>
10+
11+
12+
#endif
13+
#ifdef __arm__
14+
15+
#include <ffitarget_armv7.h>
16+
17+
18+
#endif
19+
#ifdef __x86_64__
20+
21+
#include <ffitarget_x86_64.h>
22+
23+
24+
#endif

0 commit comments

Comments
 (0)