Commit Graph
408 Commits
Author SHA1 Message Date
Anthony Green b302bc3dfe Merge pull request #322 from compnerd/aarch64-base
aarch64: fix index base register for AArch64
2017-11-03 07:03:55 -04:00
Yen Chi Hsuan 9fc9dc535e Fix linux detection (closes #303) 2017-10-27 16:12:56 +08:00
Saleem Abdulrasool 1fb788ac89 aarch64: fix index base register for AArch64
The base is passed in `x3`, not in `x2`.  This fixes the indexing base
so that the right value is used.
2017-10-26 19:13:10 -07:00
Anthony Green dc2ff5baab Merge pull request #323 from compnerd/x86-alloca-alignment
x86: align alloca to 16-byte boundary
2017-10-25 13:11:40 -04:00
Anthony Green 927da71662 Merge pull request #379 from jlj/master
Xcode build improvements
2017-10-25 13:05:53 -04:00
Anthony Green a0455c0318 Merge pull request #383 from hjl-tools/hjl/master
Hjl/master
2017-10-25 13:04:23 -04:00
H.J. Lu 9d9d92b47f Skip WIN64/EFI64 support for x32
Since x32 doesn't support WIN64/EFI64, skip it if __ILP32__ is defined.
2017-10-25 05:37:30 -07:00
Saleem Abdulrasool 3c372c384a arm: fix a level of indirection issue
Rather than relying on the stack being 0'ed out always, do it manually.
The stack generally happened to be zero, and because the compiler
realizes that the tests are dealing with chars truncates the read value.
However, the top 3 nibbles of the value are undefined and may be
non-zero.  The indirection level caused a null-pointer dereference.

Explicitly scribbling on the stack during the allocation causes test
failures without the original zexting behaviour.
2017-10-24 16:44:54 -07: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
Saleem Abdulrasool 79d1509cb0 x86: align alloca to 16-byte boundary
Align the stack allocation to a 16-byte boundary.  This ensures that the
stack parameters are 16-byte aligned which is needed for some
instructions.
2017-10-22 14:09:51 -07:00
Sergei Trofimovich ed7488c003 src/ia64/unix.S: unbreak small struct handling
commit 6e8a446083
added FFI_TYPE_COMPLEX value type (comes after FFI_TYPE_POINTER)

ia64 ffi_closure_unix reiles on the ordering of
FFI_ enums as ia64 has ia64-specific FFI types:
small struct and FPU extesions.

As a result all tests handling small structs broke.

The change fixes dispatch table by adding (no-op)
FFI_TYPE_COMPLEX entry
This has positive effect of unbreaking most tests
on ia64:

                 === libffi Summary ===

-# of expected passes            1595
-# of unexpected failures        295
+# of expected passes            1930
+# of unexpected failures        10
 # of unsupported tests          30

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
2017-10-17 13:00:51 +01:00
Saleem Abdulrasool 7ad0ae7f42 arm: zext return value parameters
The closure function (invoked as closure->fun in ffi_closure_XXX_inner)
will only populate the actual number of bytes for the true return type,
which may be a character.  This leaves garbage on the stack when the
assembly closure function (i.e. ffi_closure_XXX) reads the return value
off of the stack into r0 as a 4-byte value.  ffi_closure_XXX always
leaves room for at least 4 bytes here, so we can safely set them to 0.
Otherwise, if there is garbage in any of these bytes, these end up in r0
and in the returned value as well.
2017-10-10 11:46:20 -07:00
Anthony Green 93d8e7dd17 Fix #265 2017-09-27 21:51:34 -04:00
Anthony Green 02a5145abb Merge pull request #263 from ksjogo/master
fix ios builds
2017-09-27 21:43:03 -04:00
Anthony Green 10099d6cad Merge pull request #271 from frida/fix/qnx-cache-flushing
arm: Fix cache flushing on QNX
2017-09-27 20:54:09 -04:00
Anthony Green db4dad97e2 Merge pull request #312 from fjricci/fix_ub
Fix misaligned memory access in ffi_call_int
2017-09-27 20:47:08 -04: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
Francis Ricci 9c12209d2e Fix misaligned memory access in ffi_call_int 2017-08-03 10:46:28 -07:00
Tony Reix 0ff9419f2e This patch enables FFI Go Closure on AIX. 2017-05-17 14:57:53 +02:00
Gregory Pakosz bd72848c7a Prefix ALIGN macros with FFI_ 2017-04-27 13:22:28 +02:00
Ole André Vadla Ravnås 57d8ff044c Simplify iOS trampoline table allocation
By using VM_FLAGS_OVERWRITE there is no need for speculatively
allocating on a page we just deallocated. This approach eliminates the
race-condition and gets rid of the retry logic.
2017-03-30 13:30:50 +02:00
Johannes Goslar 0040694505 Update Xcodeproj
Include all currently relevent files.
Call autogen is build script.
Fix compiler settings.
Fix mach include.
2017-03-30 13:26:15 +02:00
Anthony Green a94c999ba0 Handle fastcall declaration differently for some Microsoft compilers 2017-03-19 07:36:07 -04:00
Anthony Green a0b14eea2b Merge pull request #291 from ramon-garcia/visual-studio-build
Build with Visual C++ (64 bits)
2017-03-17 09:20:40 -04:00
Ole André Vadla Ravnås d42ce7b95c Fix error path so mutex is unlocked before returning
In the unusual case where ffi_trampoline_table_alloc() fails.
2017-03-15 01:27:43 +01:00
Ramón García Fernández 1e0d107b4b Modify configure.host to detect compilation with Microsoft Visual C++ and use assembly with Intel syntax in that case 2017-01-08 20:34:44 +01:00
Richard Henderson 256ce51c40 Merge pull request #273 from wbx-github/master
m68k: support ISA-A Coldfire CPUs
2016-09-01 13:54:51 -07:00
Richard Henderson 2ded2a4f49 Merge pull request #272 from yousong/mips64-soft-float
Mips64 soft float
2016-09-01 13:30:45 -07:00
Yuriy Kolerov b545ff81f5 ARC: Remove unused variable
Signed-off-by: Yuriy Kolerov <yuriy.kolerov@synopsys.com>
2016-08-23 20:23:37 +03:00
Waldemar Brodkorb 52a11f6d91 m68k: support ISA-A Coldfire CPUs
Fix compilation for m68k/coldfire CPUs like mcf5208.

Signed-off-by: Thorsten Glaser <tg@mirbsd.de>
Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
2016-08-20 01:05:32 +02:00
Yousong Zhou 7a0d2c83bf mips: fix MIPS softfloat build issue
The patch for o32.S is taken from OpenWrt packages repo 3a7a4bf "libffi:
fix MIPS softfloat build issue with current binutils"

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2016-08-15 15:14:54 +08: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
s1341 ed8488345e arm: Fix cache flushing on QNX
Use `msync()` directly as `__clear_cache()` is broken in the
qnx650_gcc4.8.3 toolchain.
2016-08-10 17:09:17 +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
Tom Tromey cf4b2a5041 Don't dereference "ecif" before NULL check
Fixes #260
2016-06-17 10:09:44 +01:00
Richard Henderson 794a54d4a6 Mark win64.S with GNU-stack note 2016-06-05 14:57:00 -07:00
Iain Sandoe 52fbd12dca [Darwin-ppc, build] Fixes for clang build.
clang is experimental on powerpc-darwin, but the changes are appropriate to cctools as as well.

Use the 'official' simplified cmpwi insn, rather than the implied one accepted by cctools.
Do not re-use a set value.
2016-05-26 09:06:35 +01:00
Iain Sandoe 92810b4bc1 [Darwin-x86, build] Fix up label prefixes, remove .purgem
Darwin uses a label prefix of _.
cctools assembler will not accept .purgem as a directive.
2016-05-26 09:06:35 +01:00
Berker Peksag 74b3f52014 Remove unused FFI_CLOSURE_TEST
It was here since the first commit c6dddbd (warning: huge diff) and
it wasn't defined by the configure script. It was probably used
manually during development.
2016-05-19 18:05:36 +03:00
Tom Tromey 0969a1c1b3 Merge pull request #232 from berkerpeksag/signcompare
Fix -Wsign-compare warnings in x86/ffi64.c
2016-05-18 10:09:28 -06:00
Berker Peksag 1e82e1cda4 Define _GNU_SOURCE on Linux for mremap()
This was committed to CPython's libffi copy in
https://bugs.python.org/issue10309

mremap() documentation says _GNU_SOURCE needs to
be defined in order to use mremap(): see the
synopsis section at http://linux.die.net/man/2/mremap

Original commit: https://hg.python.org/cpython/rev/9986fff720a2

Original patch was written by Hallvard B Furuseth.
2016-05-18 10:42:38 +03:00
Berker Peksag 4a677a425c Fix -Wsign-compare warnings in x86/ffi64.c
This was originally reported on the Python tracker:

  httpa://bugs.python.org/issue23958

The original patch was written by Steve R. Hastings.

I've updated it to current master of libffi.
2016-05-18 10:35:20 +03:00
Tom Tromey 9443eaeda8 Merge pull request #242 from somasis/master
Fix usage on musl libc
2016-05-17 17:04:50 -06:00
Richard Henderson 48bfae1f37 Merge pull request #236 from andreas-schwab/master
Define FFI_SIZEOF_JAVA_RAW for aarch64 ILP32
2016-05-02 20:58:57 -10:00
Kylie McClain e169ba2b83 Fix usage on musl libc
A gcc compiled on musl does not define __gnu_linux__, it defines __linux__.
Only on glibc does __gnu_linux__ get defined, but both define __linux__, so
we should check for that instead.

With this patch, libffi works perfectly, and passes its testsuite entirely
on musl libc systems.
2016-04-29 21:31:59 -04:00
Richard Henderson e5843a3a09 x86: Fix calling convention for ffi_closure_win64_inner
Also enable testing for the cross-abi calls.
2016-04-29 14:17:36 -07:00