Merge pull request #116 from frida/fix/darwin-aarch64-variadic
authorAnthony Green <green@moxielogic.com>
Sat, 12 Apr 2014 23:32:08 +0000 (19:32 -0400)
committerAnthony Green <green@moxielogic.com>
Sat, 12 Apr 2014 23:32:08 +0000 (19:32 -0400)
Fix handling of variadic calls on Darwin/AArch64

src/aarch64/sysv.S
src/x86/ffi.c

index 7273b73..169eab8 100644 (file)
@@ -47,6 +47,9 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  */
 #ifdef __ELF__
         .type CNAME(ffi_call_SYSV), #function
 #endif
+#ifdef __APPLE__
+        .align 2
+#endif
 
 /* ffi_call_SYSV()
 
@@ -241,6 +244,9 @@ CNAME(ffi_call_SYSV):
 
         .text
         .globl CNAME(ffi_closure_SYSV)
+#ifdef __APPLE__
+        .align 2
+#endif
         .cfi_startproc
 CNAME(ffi_closure_SYSV):
         stp     x29, x30, [sp, #-16]!
index 72bed06..bcfc153 100644 (file)
@@ -746,7 +746,7 @@ ffi_prep_raw_closure_loc (ffi_raw_closure* closure,
     }
   else if (cif->abi == FFI_THISCALL)
     {
-      FFI_INIT_TRAMPOLINE_RAW_THISCALL (&closure->tramp[0], &ffi_closure_raw_THISCALL, codeloc);
+      FFI_INIT_TRAMPOLINE_RAW_THISCALL (&closure->tramp[0], &ffi_closure_raw_THISCALL, codeloc, cif->bytes);
     }
 #endif
   closure->cif  = cif;