tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

arm64-darwin-variadic.patch (958B)


      1 https://github.com/libffi/libffi/pull/577.
      2 
      3 diff --git a/src/aarch64/ffi.c b/src/aarch64/ffi.c
      4 index 1ebf43c192afe..a0a8c69dacf8b 100644
      5 --- a/src/aarch64/ffi.c
      6 +++ b/src/aarch64/ffi.c
      7 @@ -638,22 +638,23 @@ ffi_call_int (ffi_cif *cif, void (*fn)(void), void *orig_rvalue,
      8 	    if (state.ngrn < N_X_ARG_REG)
      9 	      context->x[state.ngrn++] = ext;
     10 	    else
     11 	      {
     12 		void *d = allocate_to_stack (&state, stack, ty->alignment, s);
     13 		state.ngrn = N_X_ARG_REG;
     14 		/* Note that the default abi extends each argument
     15 		   to a full 64-bit slot, while the iOS abi allocates
     16 -		   only enough space. */
     17 +		   only enough space, except for variadic arguments. */
     18 #ifdef __APPLE__
     19 -		memcpy(d, a, s);
     20 -#else
     21 -		*(ffi_arg *)d = ext;
     22 +		if (!state.allocating_variadic)
     23 +		  memcpy(d, a, s);
     24 +		else
     25 #endif
     26 +		  *(ffi_arg *)d = ext;
     27 	      }
     28 	  }
     29 	  break;
     30 
     31 	case FFI_TYPE_FLOAT:
     32 	case FFI_TYPE_DOUBLE:
     33 	case FFI_TYPE_LONGDOUBLE:
     34 	case FFI_TYPE_STRUCT: