Fix building with Clang for Darwin (OS X 10.6+ and iOS
4.0+)
This commit is contained in:
committed by
Anthony Green
parent
3afaa9a34a
commit
39dccddb60
115
patches/apple-fixes
Normal file
115
patches/apple-fixes
Normal file
@@ -0,0 +1,115 @@
|
||||
Index: libffi/ChangeLog
|
||||
===================================================================
|
||||
--- libffi.orig/ChangeLog
|
||||
+++ libffi/ChangeLog
|
||||
@@ -1,3 +1,10 @@
|
||||
+2012-04-05 Zachary Waldowski <zwaldowski@gmail.com>
|
||||
+
|
||||
+ * include/ffi.h.in: Add missing trampoline table fields.
|
||||
+ * src/arm/sysv.S: Fix ENTRY definition, and wrap symbol references
|
||||
+ in CNAME.
|
||||
+ * src/x86/ffi.c: Wrap Windows specific code in ifdefs.
|
||||
+
|
||||
2012-04-02 Peter Rosin <peda@lysator.liu.se>
|
||||
|
||||
* src/x86/win32.S (ffi_call_win32): Sign/zero extend the return
|
||||
Index: libffi/include/ffi.h.in
|
||||
===================================================================
|
||||
--- libffi.orig/include/ffi.h.in
|
||||
+++ libffi/include/ffi.h.in
|
||||
@@ -297,7 +297,12 @@ size_t ffi_java_raw_size (ffi_cif *cif);
|
||||
__declspec(align(8))
|
||||
#endif
|
||||
typedef struct {
|
||||
+#if @FFI_EXEC_TRAMPOLINE_TABLE@
|
||||
+ void *trampoline_table;
|
||||
+ void *trampoline_table_entry;
|
||||
+#else
|
||||
char tramp[FFI_TRAMPOLINE_SIZE];
|
||||
+#endif
|
||||
ffi_cif *cif;
|
||||
void (*fun)(ffi_cif*,void*,void**,void*);
|
||||
void *user_data;
|
||||
@@ -330,8 +335,12 @@ ffi_prep_closure_loc (ffi_closure*,
|
||||
# pragma pack 8
|
||||
#endif
|
||||
typedef struct {
|
||||
+#if @FFI_EXEC_TRAMPOLINE_TABLE@
|
||||
+ void *trampoline_table;
|
||||
+ void *trampoline_table_entry;
|
||||
+#else
|
||||
char tramp[FFI_TRAMPOLINE_SIZE];
|
||||
-
|
||||
+#endif
|
||||
ffi_cif *cif;
|
||||
|
||||
#if !FFI_NATIVE_RAW_API
|
||||
@@ -351,7 +360,12 @@ typedef struct {
|
||||
} ffi_raw_closure;
|
||||
|
||||
typedef struct {
|
||||
+#if @FFI_EXEC_TRAMPOLINE_TABLE@
|
||||
+ void *trampoline_table;
|
||||
+ void *trampoline_table_entry;
|
||||
+#else
|
||||
char tramp[FFI_TRAMPOLINE_SIZE];
|
||||
+#endif
|
||||
|
||||
ffi_cif *cif;
|
||||
|
||||
Index: libffi/src/arm/sysv.S
|
||||
===================================================================
|
||||
--- libffi.orig/src/arm/sysv.S
|
||||
+++ libffi/src/arm/sysv.S
|
||||
@@ -41,7 +41,7 @@
|
||||
#define CNAME(x) x
|
||||
#endif
|
||||
#ifdef __APPLE__
|
||||
-#define ENTRY(x) .globl CNAME(x); CNAME(x):
|
||||
+#define ENTRY(x) .globl _##x; _##x:
|
||||
#else
|
||||
#define ENTRY(x) .globl CNAME(x); .type CNAME(x),%function; CNAME(x):
|
||||
#endif /* __APPLE__ */
|
||||
@@ -187,7 +187,7 @@ ARM_FUNC_START ffi_call_SYSV
|
||||
@ r1 already set
|
||||
|
||||
@ Call ffi_prep_args(stack, &ecif)
|
||||
- bl ffi_prep_args
|
||||
+ bl CNAME(ffi_prep_args)
|
||||
|
||||
@ move first 4 parameters in registers
|
||||
ldmia sp, {r0-r3}
|
||||
@@ -364,7 +364,7 @@ ARM_FUNC_START ffi_call_VFP
|
||||
sub r2, fp, #64 @ VFP scratch space
|
||||
|
||||
@ Call ffi_prep_args(stack, &ecif, vfp_space)
|
||||
- bl ffi_prep_args
|
||||
+ bl CNAME(ffi_prep_args)
|
||||
|
||||
@ Load VFP register args if needed
|
||||
cmp r0, #0
|
||||
@@ -446,7 +446,7 @@ ARM_FUNC_START ffi_closure_VFP
|
||||
sub sp, sp, #72
|
||||
str sp, [sp, #64]
|
||||
add r1, sp, #64
|
||||
- bl ffi_closure_SYSV_inner
|
||||
+ bl CNAME(ffi_closure_SYSV_inner)
|
||||
|
||||
cmp r0, #FFI_TYPE_INT
|
||||
beq .Lretint_vfp
|
||||
Index: libffi/src/x86/ffi.c
|
||||
===================================================================
|
||||
--- libffi.orig/src/x86/ffi.c
|
||||
+++ libffi/src/x86/ffi.c
|
||||
@@ -280,9 +280,11 @@ ffi_status ffi_prep_cif_machdep(ffi_cif
|
||||
else
|
||||
#endif
|
||||
{
|
||||
+#ifdef X86_WIN32
|
||||
if (cif->abi == FFI_MS_CDECL)
|
||||
cif->flags = FFI_TYPE_MS_STRUCT;
|
||||
else
|
||||
+#endif
|
||||
cif->flags = FFI_TYPE_STRUCT;
|
||||
/* allocate space for return value pointer */
|
||||
cif->bytes += ALIGN(sizeof(void*), FFI_SIZEOF_ARG);
|
||||
@@ -8,3 +8,4 @@ vararg_float_test_fix
|
||||
vfp-eabi
|
||||
msvc-changes
|
||||
win32-return-sign
|
||||
apple-fixes
|
||||
|
||||
Reference in New Issue
Block a user