Commit Graph

424 Commits

Author SHA1 Message Date
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
Richard Henderson
d06751979b x86: Copy fix for clang .org from unix64.S
Clang doesn't understand .org with symbolic operands.
2016-04-15 16:10:28 -07:00
Andreas Schwab
d76975dbd2 Define FFI_SIZEOF_JAVA_RAW for aarch64 ILP32
Like x32, aarch64 ILP32 needs to define FFI_SIZEOF_JAVA_RAW.  This fixes
the java interpreter.
2016-03-16 12:23:07 +01:00
Tom Tromey
38a4d72c95 add ffi_get_struct_offsets 2016-02-22 16:07:55 -07:00
Anthony Green
49b95edafd Merge pull request #194 from amodra/master
Correct powerpc sysv stack argument accounting
2016-02-20 06:49:40 -05:00
Anthony Green
415723b40b Merge pull request #104 from joshtriplett/efi64
Support the Windows/EFI calling convention on all x86-64 targets
2016-02-20 06:49:19 -05:00
Anthony Green
69143d06c6 Merge pull request #197 from foxsen/mips_go_closure
Mips go closure support
2016-02-20 06:44:28 -05: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
Zhang Fuxin
505346e18f fix type error in unwind code 2015-08-26 09:57:10 +08:00
foxsen
5953c66bd7 add unwind infor for *go_closure;
reorder the labels to make thing more clear
2015-08-20 20:28:13 +08:00
Zhang Fuxin
f0ecd5d403 fix O32 stack unwind code
add missing 1: label
2015-08-11 12:47:36 +08:00
foxsen
6f0201c803 various fixes for go closure support. Now all n64 tests passed. 2015-08-04 18:25:34 +08:00
foxsen
697dd4e8a0 add support for go closure support on mips 2015-08-04 12:53:33 +08:00
Alan Modra
43fc5bca48 Correct powerpc sysv stack argument accounting
ppc32 starts using the stack for integer arg passing when we run out
of integer arg passing registers.  Similarly, we start using the stack
for floating point args when we run out of floating point registers.
The decision on where an integer arg goes does not depend on number of
floating point args, nor does the decision on where a floating point
arg goes depend on number of integer args.  Alignment of stack args
also simply depends on number of stack args.

This patch untangles the horrible mess we had, with intarg_count being
wrongly used to count both integer args and stack words.

	* src/powerpc/ffi_sysv.c (ffi_prep_cif_sysv_core): Count fprs,
	gprs, and stack words separately.
	(ffi_prep_args_SYSV): Similarly.
2015-08-03 23:34:05 +09:30
Josh Triplett
1f6b5a91f4 Support the WIN64/EFI64 calling convention on all X86_64 platforms
Add a new calling convention FFI_EFI64, alias FFI_WIN64, on all X86_64
platforms.  This allows libffi compiled on a 64-bit x86 platform to call
EFI functions.

Compile in ffiw64.c and win64.S on all X86_64 platforms.  When compiled
for a platform other than X86_WIN64, ffiw64.c suffixes its functions
with _efi64, to avoid conflict with the platform's actual
implementations of those functions.
2015-07-26 17:18:16 -07:00
Josh Triplett
6de51f3e04 src/x86/ffiw64.c: Don't assign a "char *" to an "unsigned char *"
Declare a local variable to match the type of the struct field assigned
to it, rather than adding unsigned to the type.  Fixes a -Wpointer-sign
warning.
2015-07-26 17:18:16 -07:00
Josh Triplett
eaa59755fc src/x86/win64.S: Handle name mangling and PIC
Move the macros from unix64.S into a shared header asmnames.h and use
them in win64.S too.
2015-07-26 17:18:16 -07:00
Josh Triplett
c8e82d9fbf src/x86/win64.S: Support compiling on non-WIN64 platforms
Non-WIN64 versions of the GNU assembler don't support the .seh_*
directives for structured exception handling, so wrap them in a macro
that compiles to nothing.

Handle the registers used for the non-Windows x86-64 calling convention
when on a non-Windows platform.  Distinguish between cases that should
refer to the native argument registers (defined as arg0, arg1, arg2, and
arg3) and cases that should always refer to the Windows argument
registers.
2015-07-26 16:18:57 -07:00
Russell Keith-Magee
e3d2812ce4 Modified arm/sysv.S to remove directives not allowed by clang. 2015-04-25 19:03:03 +08:00
Andrew Pinski
95df379193 aarch64: Handle ILP32 ABI 2015-02-11 08:31:48 -08:00
Richard Henderson
2104b2a4fc sparc: Re-introduce hand-written unwind info
Fixes the build with the Solaris assembler.
2015-01-28 09:41:07 -08:00
Anthony Green
31a6185307 Merge pull request #170 from fealebenpae/aarch64-trampoline-table
Support closures on ARM64 iOS
2015-01-21 05:55:47 -05:00
Richard Henderson
3ac1610aa3 x86: Fix cygwin32 build
The section syntax is just that little bit different.
2015-01-19 20:48:40 +01:00
Richard Henderson
1ad0b17177 sparc: Also mark the return address in unwind info 2015-01-16 13:30:05 -08:00
Richard Henderson
d68c8aed19 sparc: Solaris fixes, part 2
/bin/as seems to only understand single-digit labels
/bin/as knows nothing about .rept/.endr
2015-01-16 11:40:33 -08:00
Rainer Orth
b740ab7cc9 sparc: Solaris fixes
* /bin/as requires .type fn,#function instead of @function.
* /bin/as doesn't support .macro/.endm.  I'm using preprocessor macros
  instead to implement E in src/sparc/v[89].S.
2015-01-16 11:32:23 -08:00
Rainer Orth
f1560b7bbe x86: Solaris fixes
* Solaris/x86 /bin/as doesn't support .org, so I've just disabled the
  uses in src/x86/{sysv, unix64}.S, as on Darwin.
* Solaris/x86 needs to use EH_FRAME_FLAGS so manually and compiler
  generated .eh_frame sections match, otherwise libffi.so fails to link:
* Solaris/x86 /bin/as has different COMDAT syntax; I've disabled it for
  the moment.
2015-01-16 11:32:11 -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
Yavor Georgiev
05e65b4e20 aarch64: rewrite range syntax into list to appease Clang
Clang's assembler in Xcode 6 appears to choke when the operand of st4 is a range, but is happy with a list.
2015-01-16 15:31:02 +02:00
Richard Henderson
f27c4e4673 x86: Fix thinko in ffi_raw_call
Missed structure initialization for raw path.
Apparently there are no tests for this outside gcc.
2015-01-13 07:22:07 -08:00
Anthony Green
1c61e73ad8 Merge pull request #165 from rth7680/pcc
Support PCC as producer and consumer
2015-01-10 09:23:30 -05:00
Anthony Green
dd0b59a5cf Merge pull request #164 from rth7680/darwin
Fix build on darwin
2015-01-10 09:22:55 -05:00
Anthony Green
9131039c93 Merge pull request #160 from nobu/msvc-no-complex
x86: MSVC does not support Complex type
2015-01-10 09:22:42 -05:00
Anthony Green
4ca2262ad6 Merge pull request #159 from nobu/fix-void-arith
x86: Fix void pointer arithmetic
2015-01-10 09:21:37 -05:00
Richard Henderson
3fa5d70cbb x86: Avoid fastcall when building with pcc
Apparently, PCC doesn't support the fastcall calling convention.
Nor does it issue a warning or error for the attribute that it
does not understand.
2015-01-05 13:03:06 -08:00