Commit Graph

851 Commits

Author SHA1 Message Date
Iain Sandoe
ae842a515b x86: More Darwin unwind fixups
EHFrame{N} IIRC is a special cue to ld64 that it should treat the unwind
in the object as "special/legacy" .. [these days everything is .cfi_xxxx
(except, cctools-as, as you noted)] .. without that much confusion arises
with ld64's atom-isation of the eh_frame section.

xxxx.eh labels are not needed for darwin ld64 >= 85.2.1 (i.e. darwin9,
xcode 3.1.4) to all intents and purposes, that's all that matters now,
since I think that anyone trying to build on 10.4/darwin8/xcode2.5 would
have to use a later ld64 (from odcctools) for other reasons.
2015-01-05 10:01:38 -08:00
Richard Henderson
8fa3c9f24b x86: Reinstate hand-written unwind info for unix64.S
One more try to get default Darwin to work.
2015-01-05 10:01:37 -08:00
Richard Henderson
5f35e0ffcc x86: Avoid using gas local labels
Which are unsupported by Darwin cctools as.
Thankfully this doesn't uglify the source too much.
2015-01-05 10:01:37 -08:00
Richard Henderson
ed1ca2777c x86: Remove use of .cfi_escape
The unwind info isn't 100% correct at all points during the epilogue,
and not annotating is just as incorrect as the annotation.  This works
better on systems that do not support DW_OP_call_frame_cfa.
2015-01-05 10:01:37 -08:00
Richard Henderson
1b12593d7e x86: Honor alignment of arguments
Darwin aligns long-double to 16, and thus all of the long double
tests were failing due to not honoring that.  We ought to be able
to devise a test case for GCC using __attribute__((aligned)) that
would have failed too.
2015-01-05 10:01:37 -08:00
Richard Henderson
042b8dafee x86: Use .balign not .align
The Apple assembler defaults to power of two alignment, rather than
byte alignment like everyone else.  Force byte alignment by using
the proper directive.
2015-01-05 10:01:37 -08:00
Richard Henderson
0172bc029c x86: Disable .org for Darwin 2015-01-05 10:01:37 -08:00
Richard Henderson
9f112619c1 x86: Best guess at update for Darwin 2015-01-05 10:01:37 -08:00
Anthony Green
58bf7d65d8 Merge pull request #158 from rth7680/s390
S390
2014-12-20 10:20:40 -05:00
Richard Henderson
7ba30b1906 s390: Inline and tidy ffi_prep_args
As per discussion with Ulrich Weigand, document the restrictions
on the code within ffi_call_int as we simultaneously prepare
stack frames for ffi_call_SYSV and the target function.
2014-12-19 11:38:17 -05:00
Richard Henderson
f69ec6f35d s390: Use pc-relative insns in 31-bit mode
It's silly to stick to esa/390 features when the compiler won't.
Detect when brasl and larl are used by the compiler and then use
them in the assembly.
2014-12-18 16:21:07 -05:00
Richard Henderson
2f530de168 s390: Reorganize assembly
Avoid using ffi_prep_args as a callback; do all the work setting
up the frame within ffi_call_int directly.  Save fewer registers
in ffi_closure_SYSV.
2014-12-18 16:01:59 -05:00
Richard Henderson
97512ded05 s390: Avoid aliasing warnings 2014-12-18 16:01:15 -05:00
Richard Henderson
c860ca9ac0 s390: Kill trailing whitespace 2014-12-17 13:24:03 -05:00
Dominik Vogt
02b7c89967 s390: Go closure support 2014-12-17 13:20:51 -05:00
Anthony Green
75b2199f26 Merge pull request #157 from rth7680/x86
Two fixes for x86
2014-12-12 10:13:56 -05:00
Anthony Green
8a3a2723aa Merge pull request #156 from rth7680/sparc
sparc: Define FFI_TARGET_SPECIFIC_VARIADIC for v9
2014-12-12 10:13:27 -05:00
Richard Henderson
2f65246968 x86: Handle void arguments as if an empty structure
Since libffi currently doesn't allow empty structures, libgo
currently maps them to ffi_type_void.  Given that we'll abort
on this case, handle it gracefully.
2014-12-11 14:16:00 -08:00
Richard Henderson
097ccfd6a6 x86: Fix some unwind errors 2014-12-11 14:11:44 -08:00
James Greenhalgh
9ae3bc870e Fix for https://github.com/atgreen/libffi/issues/141 2014-12-06 23:58:41 -05:00
Anthony Green
a5a40960bb Merge pull request #151 from amodra/master
powerpc: go closures for linux
2014-11-19 21:13:50 -05:00
Richard Henderson
590663b30b powerpc: Fix ffi_go_closure_linux64
Unlike ffi_closure_LINUX64, this entry point is called normally,
so we already have the TOC in R2 and the closure in R11.

	* powerpc/linux64_closure.S (ffi_closure_LINUX64): Remove a
	register dependency chain.
	(ffi_go_closure_linux64): Don't load r11 or r2.
2014-11-20 11:35:12 +10:30
Alan Modra
fa1040c111 GO closures for powerpc linux
Plus .cfi async unwind info, rearrangement of ffi_call_linux64 and
ffi_call_SYSV function params to avoid register copies, tweaks to
trampolines.

	* src/powerpc/ffitarget.h (FFI_GO_CLOSURES): Define.
	* src/powerpc/ffi.c (ffi_call_int): New function with extra
	closure param, and args rearranged on ffi_call_linux64 and
	ffi_call_SYSV calls, extracted from ..
	(ffi_call): ..here.
	(ffi_call_go, ffi_prep_go_closure): New functions.
	* src/powerpc/ffi_linux64.c (ffi_prep_closure_loc_linux64): Make
	hidden.  Only flush insn part of ELFv2 trampoline.  Don't shuffle
	ELFv1 trampoline.
	(ffi_closure_helper_LINUX64): Replace closure param with cif, fun,
	user_data params.
	* src/powerpc/ffi_powerpc.h (ffi_go_closure_sysv): Declare.
	(ffi_go_closure_linux64): Declare.
	(ffi_call_SYSV, fi_call_LINUX64): Update.
	(ffi_prep_closure_loc_sysv, ffi_prep_closure_loc_linux64): Declare.
	(ffi_closure_helper_SYSV, ffi_closure_helper_LINUX64): Update.
	* src/powerpc/ffi_sysv.c (ASM_NEEDS_REGISTERS): Increase to 6.
	(ffi_prep_closure_loc_sysv): Use bcl in trampoline, put data words
	last, flush just the insn part.
	(ffi_closure_helper_SYSV): Replace closure param with cif, fun and
	user_data params.
	* src/powerpc/linux64.S (ffi_call_LINUX64): Replace hand-written
	.eh_frame with .cfi directives.  Adjust for changed param order.
	Pass extra "closure" param to user function in static chain.  Add
	.cfi directives to describe epilogue.  Don't provide traceback
	table for ELFv2 or _CALL_LINUX.
	* src/powerpc/linux64_closure.S (ffi_closure_LINUX64): Replace
	hand-written .eh_frame with .cfi directives.  Adjust for changed
	ffi_closure_helper_LINUX64 params.  Add .cfi directives to
	describe epilogue.  Don't provide traceback table for ELFv2 or
	_CALL_LINUX.
	(ffi_go_closure_linux64): New function.
	* src/powerpc/sysv.S: Remove redundant .globl ffi_prep_args_SYSV.
	(ffi_call_SYSV): Make hidden.  Replace hand-written .eh_frame with
	.cfi directives.  Adjust for changed params.  Pass extra "closure"
	param to user function in static chain.  Add .cfi directives to
	describe epilogue.
	* src/powerpc/ppc_closure.S (ffi_closure_SYSV): Make hidden.
	Replace hand-written .eh_frame with .cfi directives.  Adjust for
	changed ffi_closure_helper_SYSV params.  Add .cfi directives to
	describe epilogue.  Don't just use nops in the dead __NO_FPRS__
	epilogues.
	(ffi_go_closure_sysv): New function.
2014-11-20 11:35:12 +10:30
Alan Modra
d3d06f4c94 Fix powerpc breakage from 6e8a4460
* src/powerpc/ffitarget.h: #error on unexpected FFI_TYPE_LAST.
	(FFI_PPC_TYPE_LAST): Define.
	(FFI_TYPE_UINT128): Define in terms of FFI_PPC_TYPE_LAST.
	(FFI_SYSV_TYPE_SMALL_STRUCT, FFI_V2_TYPE_FLOAT_HOMOG): Likewise.
	(FFI_V2_TYPE_DOUBLE_HOMOG, FFI_V2_TYPE_SMALL_STRUCT): Likewise.
2014-11-20 11:35:12 +10:30
Anthony Green
9ca43706f9 Merge pull request #148 from gpakosz/dlmalloc-preprocessor-fix
dlmalloc: change defined(i386) to defined(__i386__)
2014-11-19 11:32:08 -05:00
Richard Henderson
542e004710 sparc: Define FFI_TARGET_SPECIFIC_VARIADIC for v9
This is a port of

  http://gcc.gnu.org/viewcvs?rev=207763&root=gcc&view=rev

aka GCC PR libffi/60073, to the rewritten Sparc codebase.
Supposedly, we should have seen failures with the existing
libffi.call/cls_double_va.c testcase, but I hadn't.
Perhaps a gcc newer than 4.6.3 is required to see that...
2014-11-18 05:07:00 -08:00
Gregory Pakosz
a9ed0c3a04 dlmalloc: change defined(i386) to defined(__i386__)
When compiling with --std==c99, GCC and clang don't define i386 but __i386__
2014-11-18 09:37:10 +01:00
Anthony Green
5211c7207e Merge pull request #147 from rth7680/go/alpha
testsuite: Fix alpha static chain register name
2014-11-17 09:07:07 -05:00
Richard Henderson
ccdd7bb856 testsuite: Fix alpha static chain register name 2014-11-16 12:12:23 +01:00
Anthony Green
3316b666e3 Merge pull request #145 from rth7680/master
Configure and testsuite cleanups, v2
2014-11-15 07:31:41 -05:00
Anthony Green
b698638d76 Merge pull request #144 from atrosinenko/testsuite-fp-comparison-fix
Floating point number comparison fix for testsuite
2014-11-15 07:29:58 -05:00
Anthony Green
a353d5b16c Merge pull request #143 from adamkaplan/patch-1
Update i386 & armv7 minimum iOS version to 7.0
2014-11-15 07:27:21 -05:00
Richard Henderson
dea49e2020 x86: Fix typo in ffi_prep_go_closure
Used the wrong register for THISCALL and FASTCALL.
2014-11-14 13:07:47 +01:00
Richard Henderson
c9f5b6648b testsuite: Add trivial tests for Go closures 2014-11-14 13:07:47 +01:00
Richard Henderson
c952a92e20 testsuite: Move complex tests to their own subdirectory
It seems a bit silly to isolate them by globbing vs "*complex*"
when we can just as easily put them in their own subdirectory.
2014-11-14 13:07:47 +01:00
Richard Henderson
f1301a54bb testsuite: Use feature test rather than enumeration for complex 2014-11-14 13:07:45 +01:00
Richard Henderson
b5ade2fb5d testsuite: Detect clang
Clang doesn't like the -Wno-psabi argument that we want to pass to GCC.
Since clang is detected as GCC via __GNUC__, use ax_cv_c_compiler_vendor.
2014-11-14 13:07:16 +01:00
Richard Henderson
5d69d57a05 configure: Move target source selection into configure.host
This eliminates the AM_CONDITIONAL ugliness, which eliminates
just a bit of extra boilerplate for a new target.

At the same time, properly categorize the EXTRA_DIST files
into SOURCES and HEADERS, for the generation of ctags.
2014-11-14 13:06:12 +01:00
Anatoly Trosinenko
771fabc6d5 Take a float absolute value using fabs() instead of abs().
Replace integer abs() by floating point fabs() in the approximate
equality check for float values.
2014-11-14 14:21:35 +03:00
Anatoly Trosinenko
9622ede2e2 Fix floating point number comparisons in testsuite/libffi.call/float[123].c.
Rewrite the checks for approximate equality of floating point return
values to be in the form "fabs(a - b) < EPS" instead of just
"a - b < EPS".
2014-11-14 13:18:04 +03:00
Adam
e029c70fa7 Update i386 & armv7 minimum iOS version to 7.0
iOS 5 (and any below 7.1) is deprecated. Apple doesn't distribute the supporting libraries for this platform anymore as of Xcode 6, so it causes a linker error.
2014-11-13 15:08:16 -05:00
Richard Henderson
57f5248457 configure: Split out configure.host
Split out the host case statement to a separate file, so that
we don't have to regenerate configure.in for changes therein.
2014-11-13 12:42:54 +01:00
Richard Henderson
f8632815a6 powerpc: Delete patch output
Clearly added by mistake.
2014-11-13 12:32:35 +01:00
Anthony Green
4aa702a0e0 Merge branch 'rth7680-go-closure' 2014-11-12 08:08:57 -05:00
Anthony Green
8d5debc790 Update in preparation for next release 2014-11-12 08:04:51 -05:00
Richard Henderson
56735e05fe Merge branch 'go-closure' of https://github.com/rth7680/libffi into rth7680-go-closure
Conflicts:
	src/aarch64/ffi.c
2014-11-12 07:51:12 -05:00
Anthony Green
20562ac042 Fix for AArch64. Release as 3.2.1. 2014-11-12 07:00:59 -05:00
Richard Henderson
0e303c0657 x86: Work around clang bugs
http://llvm.org/bugs/show_bug.cgi?21500
http://llvm.org/bugs/show_bug.cgi?21501
http://llvm.org/bugs/show_bug.cgi?21515
2014-11-12 03:58:58 -08:00
Richard Henderson
6eec410f15 sparc: Re-add abi compliant structure support
The original code, removed in the "rewrite" patch, was incorrect for
large structures, and required dynamic allocation of a trampoline on
every ffi_call.

Instead, allocate a 4k entry table of all possible structure returns.
The table is 80k, but is read-only and dynamically paged, which ought
to be better than allocating the trampoline.

This is difficult to test with gcc.  One can only use -O0 at present.
See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63668.
2014-11-12 09:36:11 +01:00
Richard Henderson
92022496ef sparc: Add support for Go closures 2014-11-12 09:36:11 +01:00