Commit 53d7b165642c220aa5166ba350b490802f359b54

Anthony Green 2011-02-28T15:23:31

Merge branch 'master' of https://github.com/landonf/libffi-ios

diff --git a/include/ffi.h.in b/include/ffi.h.in
index 96b8fd3..747dd17 100644
--- a/include/ffi.h.in
+++ b/include/ffi.h.in
@@ -270,7 +270,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;
@@ -303,7 +308,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;
 
@@ -324,7 +334,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;
 
diff --git a/src/arm/sysv.S b/src/arm/sysv.S
index 14a7f03..2b7ea60 100644
--- a/src/arm/sysv.S
+++ b/src/arm/sysv.S
@@ -147,23 +147,6 @@ _L__\name:
 .endm
 #endif
 
-.macro	RETLDM	regs=, cond=, dirn=ia
-#if defined (__INTERWORKING__)
-	.ifc "\regs",""
-	ldr\cond	lr, [sp], #4
-	.else
-	ldm\cond\dirn	sp!, {\regs, lr}
-	.endif
-	bx\cond	lr
-#else
-	.ifc "\regs",""
-	ldr\cond	pc, [sp], #4
-	.else
-	ldm\cond\dirn	sp!, {\regs, pc}
-	.endif
-#endif
-.endm
-
 	@ r0:   ffi_prep_args
 	@ r1:   &ecif
 	@ r2:   cif->bytes
@@ -187,7 +170,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}
@@ -335,7 +318,12 @@ ARM_FUNC_START ffi_closure_SYSV
 
 /* Below are VFP hard-float ABI call and closure implementations.
    Add VFP FPU directive here. */
+#ifndef __APPLE__
+    /* XXX - .fpu pseudo-directive is not supported by Apple's assembler,
+       and VFP hard-float calling conventions are not supported by the
+       compiler. */
 	.fpu	vfp
+#endif
 
 	@ r0:   fn
 	@ r1:   &ecif
@@ -362,7 +350,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
@@ -424,11 +412,18 @@ LSYM(Lbase_args):
 	fstmiadeq	r2, {d0-d3}
 
 LSYM(Lepilogue_vfp):
-	RETLDM	"r0-r3,fp"
+#if defined (__INTERWORKING__)
+  ldmia   sp!, {r0-r3,fp, lr}
+  bx  lr
+#else
+  ldmia   sp!, {r0-r3,fp, pc}
+#endif
 
 .ffi_call_VFP_end:
 	UNWIND .fnend
+#ifdef __ELF__
         .size    CNAME(ffi_call_VFP),.ffi_call_VFP_end-CNAME(ffi_call_VFP)
+#endif
 
 
 ARM_FUNC_START ffi_closure_VFP
@@ -444,7 +439,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
@@ -490,7 +485,9 @@ ARM_FUNC_START ffi_closure_VFP
 
 .ffi_closure_VFP_end:
 	UNWIND .fnend
+#ifdef __ELF__
         .size    CNAME(ffi_closure_VFP),.ffi_closure_VFP_end-CNAME(ffi_closure_VFP)
+#endif
 
 #if defined __ELF__ && defined __linux__
 	.section	.note.GNU-stack,"",%progbits