Commit Graph
55 Commits
Author SHA1 Message Date
Paul Monson c2a6859012 fix mingw build and crashing bugs for Python Windows ARM64 (#496)
* fix mingw build and crashing bugs for Python Windows ARM64

* Fix issues found in PR review
2019-08-07 14:57:45 -04:00
ossdev07 d856743e6b libffi: added ARM64 support for Windows (#486)
*  libffi: added ARM64 support for Windows

    1. ported sysv.S to win64_armasm.S for armasm64 assembler
    2. added msvc_build folder for visual studio solution
    3. updated README.md for the same
    4. MSVC solution created with the changes, and below test suites are tested
       with test script written in python.

       libffi.bhaible
       libffi.call
    5. Basic functionality of above test suites are getting passed

Signed-off-by: ossdev07 <ossdev@puresoftware.com>

* Update README.md
2019-06-25 22:01:22 -04:00
Dan Horák a7d6396f06 fix check for Linux/aarch64
fixes #473
2019-03-29 14:19:20 +01:00
Jeremy Huddleston Sequoia 05a1796419 Cleanup symbol exports on darwin and add architecture preprocessor checks to assist in building fat binaries (eg: i386+x86_64 on macOS or arm+aarch64 on iOS) (#450)
* x86: Ensure _efi64 suffixed symbols are not exported

* x86: Ensure we do not export ffi_prep_cif_machdep

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>

* x86: Ensure we don't export ffi_call_win64, ffi_closure_win64, or ffi_go_closure_win64

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>

* closures: Silence a semantic warning

libffi/src/closures.c:175:23: This function declaration is not a prototype

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>

* aarch64: Ensure we don't export ffi_prep_cif_machdep

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>

* arm: Ensure we don't export ffi_prep_cif_machdep

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>

* aarch64, arm, x86: Add architecture preprocessor checks to support easier fat builds (eg: iOS)

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>

* x86: Silence some static analysis warnings

libffi/src/x86/ffi64.c:286:21: The left operand of '!=' is a garbage value due to array index out of bounds
libffi/src/x86/ffi64.c:297:22: The left operand of '!=' is a garbage value due to array index out of bounds

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>

* aarch: Use FFI_HIDDEN rather than .hidden

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>

* ffi.h: Don't advertise ffi_java_rvalue_to_raw, ffi_prep_java_raw_closure, and ffi_prep_java_raw_closure_loc when FFI_NATIVE_RAW_API is 0

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2019-02-19 07:11:28 -05:00
Florian Weimer 44a6c28545 aarch64: Flush code mapping in addition to data mapping (#471)
This needs a new function, ffi_data_to_code_pointer, to translate
from data pointers to code pointers.

Fixes issue #470.
2019-02-19 06:55:11 -05:00
Martin Bektchiev 4a84df4ae9 Fix Q registers parameter passing on ARM64
The second two quads are located at offset 32 not 16
2018-10-31 16:25:05 +02:00
Andreas Schwab e66fd67820 Revert "Fix passing struct by value on aarch64"
This reverts commit 482b37f004.

That was actually a bug in python, see <https://bugs.python.org/issue30353>.
2018-02-20 10:47:09 +01:00
Andreas Schwab 482b37f004 Fix passing struct by value on aarch64
This fixes the ctypes test in the python testsuite.
2018-02-07 12:50:14 +01:00
Jean-Luc Jumpertz 181fc4cc9c Merge branch 'master' based on ksjogo/libffi
Added a tvOS target in Xcode project. Misc Xcode project cleanup.
  Fix macOS build target in Xcode project.

# Conflicts:
#	src/aarch64/ffi.c
#	src/x86/ffi64.c
2017-10-23 15:02:29 +02:00
Jean-Luc Jumpertz a78da73956 Fix macOS build target in Xcode project.
- Add missing files for desktop platforms in generate-darwin-source-and-headers.py, and in the Xcode project.
- Add a static library target for macOS.
- Fix "implicit conversion loses integer precision" warnings for iOS mad macOS targets.
2017-09-04 15:55:34 +02:00
Gregory Pakosz bd72848c7a Prefix ALIGN macros with FFI_ 2017-04-27 13:22:28 +02:00
Tom Tromey 06d7c5190e Merge pull request #269 from frida/fix/aarch64-variadic-closures-on-ios
aarch64: Fix handling of variadic closures on iOS
2016-08-10 15:06:16 -06:00
Tom Tromey aa7ed78c0e Merge pull request #268 from frida/fix/aarch64-large-aggregates
aarch64: Fix handling of aggregates larger than 16 bytes
2016-08-10 15:03:37 -06:00
Ole André Vadla Ravnås 4da814b18a aarch64: Fix handling of aggregates larger than 16 bytes
Instead of allocating stack space for a pointer we would allocate stack
space for the actual aggregate size.
2016-08-10 22:48:09 +02:00
Ole André Vadla Ravnås 5e9ac7e252 aarch64: Fix warning about unused function on iOS 2016-08-10 17:07:17 +02:00
Ole André Vadla Ravnås 4d1f11f6a9 aarch64: Fix operand size warning reported by Clang 2016-08-10 17:07:11 +02:00
Ole André Vadla Ravnås 301166b11e aarch64: Fix handling of variadic closures on iOS 2016-08-10 17:05:00 +02:00
Russell Keith-Magee bc4fc07aa5 Fixed #181 -- Corrected problems with ARMv7 build under iOS.
Based on a patch from @fealebenpae, with input from @SolaWing and @rth7680,
and testing from @superdump.
2015-12-21 00:37:06 +08:00
Yavor Georgiev 536366349c aarch64: implement the trampoline table workaround for ffi closures on Apple systems
This is a direct copy/paste port of the ARM code, with changes because of Aarch64 pc-relative addressing restrictions.
2015-01-16 15:31:55 +02:00
Richard Henderson c6352b664c aarch64: Add support for Go closures 2014-11-12 09:29:32 +01:00
Richard Henderson 0e41c73b09 aarch64: Move x8 out of call_context
Reduces stack size.  It was only used by the closure, and there
are available argument registers.
2014-11-12 09:29:32 +01:00
Richard Henderson a992f8789b aarch64: Add support for complex types 2014-11-12 09:29:31 +01:00
Richard Henderson 658b2b5600 aarch64: Remove aarch64_flags
This field was useless from the start, since the normal flags
field is available for backend use.
2014-11-12 09:28:44 +01:00
Richard Henderson 4a3cbcaa4f aarch64: Unify scalar fp and hfa handling
Since an HFA of a single element is exactly the same as scalar,
this tidies things up a bit.
2014-11-12 09:28:44 +01:00
Richard Henderson 12cf89ee04 aarch64: Move return value handling into ffi_closure_SYSV
As with the change to ffi_call_SYSV, this avoids copying data
into a temporary buffer.
2014-11-12 09:28:44 +01:00
Richard Henderson 4fe1aea121 aarch64: Move return value handling into ffi_call_SYSV
This lets us pass return data directly to the caller of ffi_call
in most cases, rather than storing it into temporary storage first.
2014-11-12 09:28:44 +01:00
Richard Henderson 325471ea6a aarch64: Merge prep_args with ffi_call
Use the trick to allocate the stack frame for ffi_call_SYSV
within ffi_call itself.
2014-11-12 09:28:44 +01:00
Richard Henderson 8c8161cb62 aarch64: Tidy up abi manipulation
Avoid false abstraction, like get_x_addr.  Avoid recomputing data
about the type being manipulated.  Use NEON insns for HFA manipulation.

Note that some of the inline assembly will go away in a subsequent patch.
2014-11-12 09:28:44 +01:00
Richard Henderson b55e03665d aarch64: Treat void return as not passed in registers
This lets us do less post-processing when there's no return value.
2014-11-12 09:28:44 +01:00
Richard Henderson 95a04af134 aarch64: Reduce the size of register_context
We don't need to store 32 general and vector registers.
Only 8 of each are used for parameter passing.
2014-11-12 09:28:44 +01:00
Richard Henderson 77c4cddca6 aarch64: Simplify AARCH64_STACK_ALIGN
The iOS abi doesn't require padding between arguments, but
that's not what AARCH64_STACK_ALIGN meant.  The hardware will
in fact trap if the SP register is not 16 byte aligned.
2014-11-12 09:28:44 +01:00
Richard Henderson b5f147d847 aarch64: Always distinguish LONGDOUBLE
Avoid if-deffery by forcing FFI_TYPE_LONGDOUBLE different
from FFI_TYPE_DOUBLE.  This will simply be unused on hosts
that define them identically.
2014-11-12 09:28:44 +01:00
Richard Henderson 38b54b9c18 aarch64: Improve is_hfa
The set of functions get_homogeneous_type, element_count, and is_hfa
are all intertwined and recompute data.  Return a compound quantity
from is_hfa that contains all the data and avoids the recomputation.
2014-11-12 09:28:44 +01:00
Richard Henderson 18b74ce54a aarch64: Fix non-apple compilation 2014-11-12 09:28:44 +01:00
Anthony Green 862f53de04 Merge pull request #130 from frida/fix/darwin-aarch64-float-alignment
Fix alignment of FFI_TYPE_FLOAT for Apple's ARM64 ABI
2014-09-18 19:06:08 -04:00
Ole André Vadla Ravnås aebf2c3023 Fix alignment of FFI_TYPE_FLOAT for Apple's ARM64 ABI 2014-07-26 00:17:47 +02:00
Ole André Vadla Ravnås 0f4e09d27d Fix non-variadic CIF initialization for Apple/ARM64
Turns out `aarch64_nfixedargs` wasn't initialized in the non-variadic
case, resulting in undefined behavior when allocating arguments.
2014-07-26 00:17:07 +02:00
Ole André Vadla Ravnås 419503f409 Fix handling of variadic calls on Darwin/AArch64 2014-04-06 20:59:25 +02:00
Zachary Waldowski b4df9cf9cc AArch64: Fix void fall-through case when assertions are enabled 2014-02-05 14:29:08 -05:00
Zachary Waldowski f466aad0d9 AArch64: Fix missing semicolons when assertions are enabled 2014-02-05 14:28:59 -05:00
Zachary Waldowski 0a0f12ce1f AArch64: Remove duplicitous element_count call.
This inhibits an analyzer warning by Clang.
2014-02-05 14:28:59 -05:00
Zachary Waldowski 4330fdcd92 Darwin/aarch64: Respect iOS ABI re: stack argument alignment 2014-02-05 14:28:59 -05:00
Zachary Waldowski 0a333d6c39 Darwin/aarch64: Fix size_t assumptions 2014-02-05 14:28:59 -05:00
Zachary Waldowski 2c18e3c76a Darwin/aarch64: Fix "shadows declaration" warnings 2014-02-05 14:28:58 -05:00
Zachary Waldowski 1b8a8e20e3 Darwin/aarch64: Use Clang cache invalidation builtin 2014-02-05 14:28:58 -05:00
Zachary Waldowski 6030cdcae7 Darwin/aarch64: Account for long double being equal to double 2014-02-05 14:28:58 -05:00
Zachary Waldowski 5bfe62a00d Darwin/AArch64: Inhibit Clang previous prototype warnings 2014-01-09 13:41:27 -05:00
Anthony Green 3dc3f32c35 Undo iOS ARM64 changes. 2013-12-05 16:23:25 -05:00
Zachary Waldowski 0278284e47 Darwin/aarch64: size_t assumptions 2013-11-30 12:02:18 -05:00
Zachary Waldowski 9775446b64 Darwin/aarch64: Fix “shadows declaration” warnings 2013-11-30 04:17:00 -05:00