Commit Graph

80 Commits

Author SHA1 Message Date
Jakub Jelinek 041f741770 libffi: Fix up x86_64 classify_argument
As the following testcase shows, libffi didn't handle properly
classify_arguments of structures at byte offsets not divisible by
UNITS_PER_WORD.  The following patch adjusts it to match what
config/i386/ classify_argument does for that and also ports the
PR38781 fix there (the second chunk).

This has been committed to upstream libffi already:
5651bea284

2021-06-16  Jakub Jelinek  <jakub@redhat.com>

	* src/x86/ffi64.c (classify_argument): For FFI_TYPE_STRUCT set words
	to number of words needed for type->size + byte_offset bytes rather
	than just type->size bytes.  Compute pos before the loop and check
	total size of the structure.
	* testsuite/libffi.call/nested_struct12.c: New test.
2021-06-16 10:45:27 +02:00
Richard Henderson 36035d7967 Merge with upstream libffi 3ac1610aa33c887ea9b14935208943925714a33e
Includes build fixes for Solaris and Cygwin.

From-SVN: r219860
2015-01-19 13:14:59 -08:00
Richard Henderson be723d1e73 re PR libffi/64572 (r219477 breaks bootstrap on x86_64 darwin)
PR libffi/64572

 * src/x86/ffitarget.h (FFI_GO_CLOSURES): Do not define for darwin.
 (FFI_TARGET_HAS_COMPLEX_TYPE): Likewise.

From-SVN: r219538
2015-01-13 07:29:47 -08:00
Richard Henderson ca46eab70b Fix libjava failures on i686-linux
* src/x86/ffi.c (ffi_raw_call): Fill in frame.

From-SVN: r219505
2015-01-12 16:26:31 -08:00
Richard Henderson b1760f7f91 Merge libffi to upstream commit c82cc159426d8d4402375fa1ae3f045b9cf82e16
From-SVN: r219477
2015-01-12 08:19:59 -08:00
Bernd Edlinger 54fde020cc Enable Java on Cygwin-64
Currently it is not possible to build GCC's libjava support on Cygwin-64.

This patch fixes the current build-problems on Cygwin-64 and the most
fundamental bugs on that platform.

Note you must still add --enable-threads=posix to successfully build the
java language support.


boehm-gc/ChangeLog:

2014-05-13  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        Fix current cygwin-64 build problems.
        * include/gc_config_macros.h (GC_PTHREADS): Use __CYGWIN__ instead
        of __CYGWIN32__ here.
        * win32_threads.c (GC_push_all_stacks): Push all X86_64 registers.
        (GC_get_thread_stack_base): Get the stack base for X86_64.

libffi/ChangeLog:

2014-05-13  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        Fix current cygwin-64 build problems.
        * src/java_raw_api.c: Remove if !defined(FFI_NO_RAW_API).
        * src/x86/ffi.c: Add if defined(__CYGWIN__).
        * src/x86/win64.S (ffi_closure_win64, ffi_call_win64): Added
        handling for FFI_TYPE_UINT64, FFI_TYPE_POINTER and FFI_TYPE_INT.
        Added SEH information.  Fixed formatting.

libgcc/ChangeLog:

2014-05-13  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        * unwind-seh.c (_Unwind_Backtrace): Uncommented, finished
        implementation.

libjava/ChangeLog:

2014-05-13  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        Fix current cygwin-64 build problems.
        * configure.host: Added handling for x86_64-*-cygwin/mingw.
        * boehm.cc (_Jv_GCAttachThread, _Jv_GCDetachThread): Don't compile if
        GC_WIN32_THREADS is defined.
        * java/lang/natClass.cc (_Jv_InterfaceAssignableFrom): Rename interface
        to source_interface.

libjava/classpath/ChangeLog:

2014-05-13  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        Fix current cygwin-64 build problems.
        * native/fdlibm/mprec.c (_REENT_CHECK_MP, _REENT_MP_FREELIST,
        _REENT_MP_P5S, __ULong, __Long): Undefine previous definitions.

From-SVN: r210386
2014-05-13 16:23:11 +00:00
Kai Tietz 8280eba03b win64.S: Make use of ffi_closure_win64_inner symbol pc-relative.
* src/x86/win64.S: Make use of ffi_closure_win64_inner
	symbol pc-relative.

From-SVN: r196900
2013-03-22 10:38:55 +01:00
Anthony Green b4b575ce78 libffi merge
From-SVN: r194722
2012-12-26 16:28:02 +00:00
H.J. Lu d6a89122a6 Define FFI_SIZEOF_JAVA_RAW to 4 for x32
PR libffi/53982
	PR libffi/53973
	* src/x86/ffitarget.h: Check __ILP32__ instead of __LP64__ for
	x32.
	(FFI_SIZEOF_JAVA_RAW): Defined to 4 for x32.

From-SVN: r189626
2012-07-18 12:19:34 -07:00
Anthony Green 6adb730866 Restore trampled commits
From-SVN: r185955
2012-03-29 12:41:52 +00:00
Anthony Green 34fa7690ac Merge upstream libffi
From-SVN: r184897
2012-03-04 21:11:09 +00:00
Kai Tietz ffc81ae2c8 re PR libffi/52221 ([libffi] r183675,r184021 needs to be fixed.)
PR libffi/52221
        * src/x86/ffi.c (ffi_closure_raw_THISCALL): New
        prototype.
        (ffi_prep_raw_closure_loc): Use ffi_closure_raw_THISCALL for
        thiscall-convention.
        (ffi_raw_call): Use ffi_prep_args_raw.
        * src/x86/win32.S (ffi_closure_raw_THISCALL): Add
        implementation for stub.

From-SVN: r184526
2012-02-23 22:02:27 +01:00
Kai Tietz d86c2d9495 re PR libffi/52221 ([libffi] r183675,r184021 needs to be fixed.)
PR libffi/52221
        * src/x86/ffi.c (ffi_prep_raw_closure_loc): Add thiscall
        support for X86_WIN32.
        (FFI_INIT_TRAMPOLINE_THISCALL): Fix displacement.

From-SVN: r184155
2012-02-13 16:18:14 +01:00
Kai Tietz 893f430128 prep_cif.c (ffi_prep_cif): Allow for X86_WIN32 also FFI_THISCALL.
* src/prep_cif.c (ffi_prep_cif): Allow for X86_WIN32
        also FFI_THISCALL.
        * src/x86/ffi.c (ffi_closure_THISCALL): Add prototype.
        (FFI_INIT_TRAMPOLINE_THISCALL): New trampoline code.
        (ffi_prep_closure_loc): Add FFI_THISCALL support.
        * src/x86/ffitarget.h (FFI_TRAMPOLINE_SIZE): Adjust size.
        * src/x86/win32.S (ffi_closure_THISCALL): New closure code
        for thiscall-calling convention.
        * testsuite/libffi.call/closure_thiscall.c: New test.

From-SVN: r184021
2012-02-08 22:35:19 +01:00
Kai Tietz 9b850dd969 ffi.c (ffi_call_win32): Add new argument to prototype for specify calling-convention.
* src/libffi/src/x86/ffi.c (ffi_call_win32): Add new
        argument to prototype for specify calling-convention.
        (ffi_call): Add support for stdcall/thiscall convention.
        (ffi_prep_args): Likewise.
        (ffi_raw_call): Likewise.
        * src/x86/ffitarget.h (ffi_abi): Add FFI_THISCALL and
        FFI_FASTCALL.
        * src/x86/win32.S (_ffi_call_win32): Add support for
        fastcall/thiscall calling-convention calls.
        * testsuite/libffi.call/fastthis1_win32.c: New test.
        * testsuite/libffi.call/fastthis2_win32.c: New test.
        * testsuite/libffi.call/fastthis3_win32.c: New test.
        * testsuite/libffi.call/strlen2_win32.c: New test.
        * testsuite/libffi.call/many2_win32.c: New test.
        * testsuite/libffi.call/struct1_win32.c: New test.
        * testsuite/libffi.call/struct2_win32.c: New test.

From-SVN: r183676
2012-01-29 14:29:53 +01:00
Jakub Jelinek d652f226fc Update Copyright years for files modified in 2010.
From-SVN: r168438
2011-01-03 21:52:22 +01:00
Richard Henderson e12bcbf492 sysv.S (FDE_ENCODING, FDE_ENCODE): Define.
2010-11-29  Richard Henderson  <rth@redhat.com>
	    Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* src/x86/sysv.S (FDE_ENCODING, FDE_ENCODE): Define.
	(.eh_frame): Use FDE_ENCODING.
	(.LASFDE1, .LASFDE2, LASFDE3): Simplify with FDE_ENCODE.

Co-Authored-By: Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>

From-SVN: r167251
2010-11-29 16:43:24 +00:00
Jakub Jelinek 731fc5f040 re PR libffi/45677 (Bad stack allocation for ffi function calls on x86-64)
PR libffi/45677
	* src/x86/ffi64.c (ffi_prep_cif_machdep): Ensure cif->bytes is
	a multiple of 8.
	* testsuite/libffi.call/many2.c: New test.

From-SVN: r164829
2010-10-01 09:31:49 +02:00
Dan Witte 7862d49629 Remove warnings
From-SVN: r162959
2010-08-06 20:05:33 +00:00
Dan Witte 49f6cd1f25 Add OS/2 Support
Co-Authored-By: Walter Meinl <wuno@lsvw.de>

From-SVN: r162946
2010-08-06 12:36:26 +00:00
Matthias Klose 4736718a4e Improve libffi comments
From-SVN: r162936
2010-08-06 05:28:37 +00:00
Anthony Green 3ac097a580 Enable build with microsoft compiler
From-SVN: r162935
2010-08-06 05:24:11 +00:00
Oliver Kiddle fc28e435cf Enable build with sun compiler
From-SVN: r162933
2010-08-06 04:55:25 +00:00
Neil Roberts 4138b429ca sysv.S (ffi_call_SYSV): Align the stack pointer to 16-bytes.
2010-07-07   Neil Roberts <neil@linux.intel.com>

	* src/x86/sysv.S (ffi_call_SYSV): Align the stack pointer to
	16-bytes.

From-SVN: r161922
2010-07-07 15:59:30 +00:00
Rainer Orth d416abb494 configure.ac (libffi_cv_as_x86_pcrel): Check for illegal in as output, too.
* configure.ac (libffi_cv_as_x86_pcrel): Check for illegal in as
	output, too.
	(libffi_cv_as_ascii_pseudo_op): Check for .ascii.
	(libffi_cv_as_string_pseudo_op): Check for .string.
	* configure: Regenerate.
	* fficonfig.h.in: Regenerate.
	* src/x86/sysv.S (.eh_frame): Use .ascii, .string or error.

From-SVN: r159570
2010-05-19 15:31:36 +00:00
Rainer Orth f4b130bb74 configure.ac (libffi_cv_as_x86_64_unwind_section_type): New test.
* configure.ac (libffi_cv_as_x86_64_unwind_section_type): New test.
	* configure: Regenerate.
	* fficonfig.h.in: Regenerate.
	* libffi/src/x86/unix64.S (.eh_frame)
	[HAVE_AS_X86_64_UNWIND_SECTION_TYPE]: Use @unwind section type.

From-SVN: r157466
2010-03-15 19:36:26 +00:00
Uros Bizjak 6078f50a12 re PR libffi/41908 (closures fail for some structure arguments containing floats)
PR libffi/41908
	* src/x86/ffi64.c (classify_argument): Update from
	gcc/config/i386/i386.c.
	(ffi_closure_unix64_inner): Do not use the address of two consecutive
	SSE registers directly.
	* testsuite/libffi.call/cls_dbls_struct.c (main): Remove xfail
	for x86_64 linux targets.

From-SVN: r154988
2009-12-04 19:41:59 +01:00
Kai Tietz ef6ed66d16 win64.S (_ffi_call_win64 stack): Remove for gnu assembly version use of ___chkstk.
2009-09-28  Kai Tietz  <kai.tietz@onevision.com>

        * src/x86/win64.S (_ffi_call_win64 stack): Remove for gnu
        assembly version use of ___chkstk.

From-SVN: r152256
2009-09-29 00:26:25 +02:00
Loren J. Rittle 987ce5575c PR testsuite/32843 (strikes again)
2009-09-17  Loren J. Rittle  <ljrittle@acm.org>

	PR testsuite/32843 (strikes again)
	* src/x86/ffi.c (ffi_prep_cif_machdep): Add X86_FREEBSD to
	enable proper extension on char and short.

From-SVN: r151819
2009-09-17 20:54:56 +00:00
Dave Korn 723512bab1 re PR libffi/40807 (libffi.call/return_sc.c)
PR libffi/40807
	* src/x86/ffi.c (ffi_prep_cif_machdep): Also use sign/zero-extending
	return types for X86_WIN32.
	* src/x86/win32.S (_ffi_call_SYSV): Handle omitted return types.
	(_ffi_call_STDCALL, _ffi_closure_SYSV, _ffi_closure_raw_SYSV,
	_ffi_closure_STDCALL): Likewise.

	* src/closures.c (is_selinux_enabled): Define to const 0 for Cygwin.
	(dlmmap, dlmunmap): Also use these functions on Cygwin.

From-SVN: r150042
2009-07-24 10:12:16 +00:00
Andrew Haley 062b827975 [multiple changes]
2009-06-12  Andrew Haley  <aph@redhat.com>

	* ChangeLog.libffi: testsuite/libffi.call/cls_align_sint64.c,
	testsuite/libffi.call/cls_align_uint64.c,
	testsuite/libffi.call/cls_ulonglong.c,
	testsuite/libffi.call/return_ll1.c,
	testsuite/libffi.call/stret_medium2.c: Fix printf format
	specifiers.
	testsuite/libffi.special/unwindtest.cc: include stdint.h.

2009-06-11  Timothy Wall  <twall@users.sf.net>

	* Makefile.am,
        configure.ac,
        include/ffi.h.in,
        include/ffi_common.h,
        src/closures.c,
        src/dlmalloc.c,
        src/x86/ffi.c,
        src/x86/ffitarget.h,
        src/x86/win64.S (new),
	README: Added win64 support (mingw or MSVC)
        * Makefile.in,
        include/Makefile.in,
        man/Makefile.in,
        testsuite/Makefile.in,
        configure,
        aclocal.m4: Regenerated
        * ltcf-c.sh: properly escape cygwin/w32 path
        * man/ffi_call.3: Clarify size requirements for return value.
        * src/x86/ffi64.c: Fix filename in comment.
        * src/x86/win32.S: Remove unused extern.

        * testsuite/libffi.call/closure_fn0.c,
        testsuite/libffi.call/closure_fn1.c,
        testsuite/libffi.call/closure_fn2.c,
        testsuite/libffi.call/closure_fn3.c,
        testsuite/libffi.call/closure_fn4.c,
        testsuite/libffi.call/closure_fn5.c,
        testsuite/libffi.call/closure_fn6.c,
	testsuite/libffi.call/closure_stdcall.c,
	testsuite/libffi.call/cls_12byte.c,
	testsuite/libffi.call/cls_16byte.c,
	testsuite/libffi.call/cls_18byte.c,
	testsuite/libffi.call/cls_19byte.c,
	testsuite/libffi.call/cls_1_1byte.c,
	testsuite/libffi.call/cls_20byte.c,
	testsuite/libffi.call/cls_20byte1.c,
	testsuite/libffi.call/cls_24byte.c,
	testsuite/libffi.call/cls_2byte.c,
	testsuite/libffi.call/cls_3_1byte.c,
	testsuite/libffi.call/cls_3byte1.c,
 	testsuite/libffi.call/cls_3byte2.c,
 	testsuite/libffi.call/cls_4_1byte.c,
 	testsuite/libffi.call/cls_4byte.c,
 	testsuite/libffi.call/cls_5_1_byte.c,
 	testsuite/libffi.call/cls_5byte.c,
 	testsuite/libffi.call/cls_64byte.c,
 	testsuite/libffi.call/cls_6_1_byte.c,
 	testsuite/libffi.call/cls_6byte.c,
 	testsuite/libffi.call/cls_7_1_byte.c,
 	testsuite/libffi.call/cls_7byte.c,
 	testsuite/libffi.call/cls_8byte.c,
 	testsuite/libffi.call/cls_9byte1.c,
 	testsuite/libffi.call/cls_9byte2.c,
 	testsuite/libffi.call/cls_align_double.c,
 	testsuite/libffi.call/cls_align_float.c,
 	testsuite/libffi.call/cls_align_longdouble.c,
 	testsuite/libffi.call/cls_align_longdouble_split.c,
 	testsuite/libffi.call/cls_align_longdouble_split2.c,
 	testsuite/libffi.call/cls_align_pointer.c,
 	testsuite/libffi.call/cls_align_sint16.c,
 	testsuite/libffi.call/cls_align_sint32.c,
 	testsuite/libffi.call/cls_align_sint64.c,
 	testsuite/libffi.call/cls_align_uint16.c,
 	testsuite/libffi.call/cls_align_uint32.c,
 	testsuite/libffi.call/cls_align_uint64.c,
 	testsuite/libffi.call/cls_dbls_struct.c,
 	testsuite/libffi.call/cls_double.c,
 	testsuite/libffi.call/cls_double_va.c,
 	testsuite/libffi.call/cls_float.c,
 	testsuite/libffi.call/cls_longdouble.c,
 	testsuite/libffi.call/cls_longdouble_va.c,
 	testsuite/libffi.call/cls_multi_schar.c,
 	testsuite/libffi.call/cls_multi_sshort.c,
 	testsuite/libffi.call/cls_multi_sshortchar.c,
 	testsuite/libffi.call/cls_multi_uchar.c,
 	testsuite/libffi.call/cls_multi_ushort.c,
 	testsuite/libffi.call/cls_multi_ushortchar.c,
 	testsuite/libffi.call/cls_pointer.c,
 	testsuite/libffi.call/cls_pointer_stack.c,
 	testsuite/libffi.call/cls_schar.c,
 	testsuite/libffi.call/cls_sint.c,
 	testsuite/libffi.call/cls_sshort.c,
 	testsuite/libffi.call/cls_uchar.c,
 	testsuite/libffi.call/cls_uint.c,
 	testsuite/libffi.call/cls_ulonglong.c,
 	testsuite/libffi.call/cls_ushort.c,
 	testsuite/libffi.call/err_bad_abi.c,
 	testsuite/libffi.call/err_bad_typedef.c,
 	testsuite/libffi.call/float2.c,
 	testsuite/libffi.call/huge_struct.c,
 	testsuite/libffi.call/nested_struct.c,
 	testsuite/libffi.call/nested_struct1.c,
 	testsuite/libffi.call/nested_struct10.c,
 	testsuite/libffi.call/nested_struct2.c,
 	testsuite/libffi.call/nested_struct3.c,
 	testsuite/libffi.call/nested_struct4.c,
 	testsuite/libffi.call/nested_struct5.c,
 	testsuite/libffi.call/nested_struct6.c,
 	testsuite/libffi.call/nested_struct7.c,
 	testsuite/libffi.call/nested_struct8.c,
 	testsuite/libffi.call/nested_struct9.c,
 	testsuite/libffi.call/problem1.c,
 	testsuite/libffi.call/return_ldl.c,
 	testsuite/libffi.call/return_ll1.c,
 	testsuite/libffi.call/stret_large.c,
 	testsuite/libffi.call/stret_large2.c,
 	testsuite/libffi.call/stret_medium.c,
 	testsuite/libffi.call/stret_medium2.c,
        testsuite/libffi.special/unwindtest.cc: use ffi_closure_alloc instead
        of checking for MMAP.  Use intptr_t instead of long casts.

2009-06-12  Andrew Haley  <aph@redhat.com>

	* Makefile.am: Remove info_TEXINFOS.

From-SVN: r148433
2009-06-12 15:57:58 +00:00
Andrew Haley 6aa0b21841 freebsd.S: Add missing file.
2009-06-09  Andrew Haley  <aph@redhat.com>

        * src/x86/freebsd.S: Add missing file.

From-SVN: r148313
2009-06-09 15:23:38 +00:00
Andrew Haley 56faec5e60 ffitarget.h, ffi.c: Merge stdcall changes from libffi.
2009-06-05  Andrew Haley  <aph@redhat.com>

        * src/x86/ffitarget.h, src/x86/ffi.c: Merge stdcall changes from
        libffi.

From-SVN: r148207
2009-06-05 12:55:06 +00:00
Andrew Haley 90409e4c8a ffitarget.h, [...]: Back out stdcall changes.
2009-06-04  Andrew Haley  <aph@redhat.com>

	* src/x86/ffitarget.h, src/x86/win32.S, src/x86/ffi.c: Back out
	stdcall changes.

From-SVN: r148178
2009-06-04 17:08:10 +00:00
Andrew Haley b139375003 [multiple changes]
2008-02-26  Anthony Green  <green@redhat.com>
            Thomas Heller  <theller@ctypes.org>

        * src/x86/ffi.c (ffi_closure_SYSV_inner): Change C++ comment to C
        comment.

2008-02-03  Timothy Wall  <twall@users.sf.net>

        * src/x86/ffi.c (FFI_INIT_TRAMPOLINE_STDCALL): Calculate jump return
          offset based on code pointer, not data pointer.

2008-01-31  Timothy Wall <twall@users.sf.net>

        * testsuite/libffi.call/closure_stdcall.c: Add test for stdcall
        closures.
        * src/x86/ffitarget.h: Increase size of trampoline for stdcall
        closures.
        * src/x86/win32.S: Add assembly for stdcall closure.
        * src/x86/ffi.c: Initialize stdcall closure trampoline.

From-SVN: r148174
2009-06-04 16:02:47 +00:00
Andrew Haley 96baa25172 ffi.h.in: Change void (*)() to void (*)(void).
2009-06-04  Andrew Haley  <aph@redhat.com>

	* include/ffi.h.in: Change void (*)() to void (*)(void).
	* src/x86/ffi.c: Likewise.

From-SVN: r148173
2009-06-04 15:50:24 +00:00
Andrew Haley 7446546ab0 [multiple changes]
2009-06-04  Andrew Haley  <aph@redhat.com>

	* src/powerpc/ppc_closure.S: Insert licence header.
	* src/powerpc/linux64_closure.S: Likewise.
	* src/m68k/sysv.S: Likewise.

	* src/sh64/ffi.c: Change void (*)() to void (*)(void).
	* src/powerpc/ffi.c: Likewise.
	* src/powerpc/ffi_darwin.c: Likewise.
	* src/m32r/ffi.c: Likewise.
	* src/sh64/ffi.c: Likewise.
	* src/x86/ffi64.c: Likewise.
	* src/alpha/ffi.c: Likewise.
	* src/alpha/osf.S: Likewise.
	* src/frv/ffi.c: Likewise.
	* src/s390/ffi.c: Likewise.
	* src/pa/ffi.c: Likewise.
	* src/pa/hpux32.S: Likewise.
	* src/ia64/unix.S: Likewise.
	* src/ia64/ffi.c: Likewise.
	* src/sparc/ffi.c: Likewise.
	* src/mips/ffi.c: Likewise.
	* src/sh/ffi.c: Likewise.

2008-02-15  David Daney  <ddaney@avtrex.com>

        * src/mips/ffi.c (USE__BUILTIN___CLEAR_CACHE):
        Define (conditionally), and use it to include cachectl.h.
        (ffi_prep_closure_loc): Fix cache flushing.
        * src/mips/ffitarget.h (_ABIN32, _ABI64, _ABIO32): Define.

From-SVN: r148172
2009-06-04 15:43:03 +00:00
Andrew Haley 5f933ef0d8 2009-06-04 Andrew Haley <aph@redhat.com>
include/ffi.h.in,
        src/arm/ffitarget.h,
        src/arm/ffi.c,
        src/arm/sysv.S,
        src/powerpc/ffitarget.h,
        src/closures.c,
        src/sh64/ffitarget.h,
        src/sh64/ffi.c,
        src/sh64/sysv.S,
        src/types.c,
        src/x86/ffi64.c,
        src/x86/ffitarget.h,
        src/x86/win32.S,
        src/x86/darwin.S,
        src/x86/ffi.c,
        src/x86/sysv.S,
        src/x86/unix64.S,
        src/alpha/ffitarget.h,
        src/alpha/ffi.c,
        src/alpha/osf.S,
        src/m68k/ffitarget.h,
        src/frv/ffitarget.h,
        src/frv/ffi.c,
        src/s390/ffitarget.h,
        src/s390/sysv.S,
        src/cris/ffitarget.h,
        src/pa/linux.S,
        src/pa/ffitarget.h,
        src/pa/ffi.c,
        src/raw_api.c,
        src/ia64/ffitarget.h,
        src/ia64/unix.S,
        src/ia64/ffi.c,
        src/ia64/ia64_flags.h,
        src/java_raw_api.c,
        src/debug.c,
        src/sparc/v9.S,
        src/sparc/ffitarget.h,
        src/sparc/ffi.c,
        src/sparc/v8.S,
        src/mips/ffitarget.h,
        src/mips/n32.S,
        src/mips/o32.S,
        src/mips/ffi.c,
        src/prep_cif.c,
        src/sh/ffitarget.h,
        src/sh/ffi.c,
        src/sh/sysv.S: Update license text.

From-SVN: r148171
2009-06-04 15:11:12 +00:00
Dave Korn 84c40c4a8f win32.S (_ffi_closure_STDCALL): New function.
* src/x86/win32.S (_ffi_closure_STDCALL):  New function.
	(.eh_frame):  Add FDE for it.

From-SVN: r147802
2009-05-22 17:58:45 +00:00
Dave Korn 8353cd27a4 configure.ac: Also check if assembler supports pc-relative relocs on X86_WIN32 targets.
* configure.ac:  Also check if assembler supports pc-relative
	relocs on X86_WIN32 targets.
	* configure:  Regenerate.
	* src/x86/win32.S (ffi_prep_args):  Declare extern, not global.
	(_ffi_call_SYSV):  Add missing function type symbol .def and
	add EH markup labels.
	(_ffi_call_STDCALL):  Likewise.
	(_ffi_closure_SYSV):  Likewise.
	(_ffi_closure_raw_SYSV):  Likewise.
	(.eh_frame):  Add hand-crafted EH data.

From-SVN: r147800
2009-05-22 16:22:53 +00:00
Rainer Orth 4d3d40782b re PR libffi/26048 (libffi doesn't build on Solaris 10/x86 with native assembler)
PR libffi/26048
	* configure.ac (HAVE_AS_X86_PCREL): New test.
	* configure: Regenerate.
	* fficonfig.h.in: Regenerate.
	* src/x86/sysv.S [!FFI_NO_RAW_API]: Precalculate
	RAW_CLOSURE_CIF_OFFSET, RAW_CLOSURE_FUN_OFFSET,
	RAW_CLOSURE_USER_DATA_OFFSET for the Solaris 10/x86 assembler.
	(.eh_frame): Only use SYMBOL-. iff HAVE_AS_X86_PCREL.
	* src/x86/unix64.S (.Lstore_table): Move to .text section.
	(.Lload_table): Likewise.
	(.eh_frame): Only use SYMBOL-. iff HAVE_AS_X86_PCREL.

From-SVN: r142835
2008-12-19 14:59:42 +00:00
Matthias Klose feb5153085 [multiple changes]
2008-03-26  Daniel Jacobowitz  <dan@debian.org>

        * src/arm/sysv.S: Fix ARM comment marker.

2008-03-26  Jakub Jelinek  <jakub@redhat.com>

        * src/alpha/osf.S: Add .note.GNU-stack on Linux.
        * src/s390/sysv.S: Likewise.
        * src/powerpc/ppc_closure.S: Likewise.
        * src/powerpc/sysv.S: Likewise.
        * src/x86/unix64.S: Likewise.
        * src/x86/sysv.S: Likewise.
        * src/sparc/v8.S: Likewise.
        * src/sparc/v9.S: Likewise.
        * src/m68k/sysv.S: Likewise.
        * src/arm/sysv.S: Likewise.

From-SVN: r133594
2008-03-26 08:24:42 +00:00
H.J. Lu 7f92e24236 re PR libffi/34612 ([4.1/4.2] libffi doesn't work with -fomit-frame-pointer on ia32)
2008-01-30  H.J. Lu  <hongjiu.lu@intel.com>

	PR libffi/34612
	* src/x86/sysv.S (ffi_closure_SYSV): Pop 4 byte from stack when
	returning struct.

	* testsuite/libffi.call/call.exp: Add "-O2 -fomit-frame-pointer"
	tests.

From-SVN: r131964
2008-01-30 06:36:58 -08:00
Andreas Tobler 79ca8fc00b ffi.c (ffi_prep_cif_machdep): Fix thinko.
2008-01-06  Andreas Tobler  <a.tobler@schweiz.org>

	* src/x86/ffi.c (ffi_prep_cif_machdep): Fix thinko.

From-SVN: r131351
2008-01-06 13:17:03 +01:00
Andreas Tobler d7b07cc730 re PR testsuite/32843 (libffi.call/return_sc.c)
2008-01-05  Andreas Tobler  <a.tobler@schweiz.org>

	PR testsuite/32843
	* src/x86/ffi.c (ffi_prep_cif_machdep): Add code for
	signed/unsigned int8/16 for X86_DARWIN.
	Updated copyright info.
	Handle one and two byte structs with special cif->flags.
	* src/x86/ffitarget.h: Add special types for one and two byte structs.
	Updated copyright info.
	* src/x86/darwin.S (ffi_call_SYSV): Rewrite to use a jump table like
	sysv.S
	Remove code to pop args from the stack after call.
	Special-case signed/unsigned for int8/16, one and two byte structs.
	(ffi_closure_raw_SYSV): Handle FFI_TYPE_UINT8,
	FFI_TYPE_SINT8, FFI_TYPE_UINT16, FFI_TYPE_SINT16, FFI_TYPE_UINT32,
	FFI_TYPE_SINT32.
	Updated copyright info.

From-SVN: r131343
2008-01-05 21:49:41 +01:00
Andrew Haley 536e0a8f31 sysv.S (ffi_closure_raw_SYSV): Fix typo in previous checkin.
* src/x86/sysv.S (ffi_closure_raw_SYSV): Fix typo in previous
        checkin.

From-SVN: r127271
2007-08-07 12:52:47 +00:00
Andrew Haley 7665c9bebc re PR testsuite/32843 (libffi.call/return_sc.c)
PR testsuite/32843
	* src/x86/sysv.S (ffi_closure_raw_SYSV): Handle FFI_TYPE_UINT8,
	FFI_TYPE_SINT8, FFI_TYPE_UINT16, FFI_TYPE_SINT16, FFI_TYPE_UINT32,
	FFI_TYPE_SINT32.

From-SVN: r127241
2007-08-06 12:48:07 +00:00
Andrew Haley 387cfbba39 re PR testsuite/32843 (libffi.call/return_sc.c)
2007-07-30  Andrew Haley  <aph@redhat.com>

        PR testsuite/32843
        * src/x86/ffi.c (ffi_prep_cif_machdep): in x86 case, add code for
        signed/unsigned int8/16.
        * src/x86/sysv.S (ffi_call_SYSV): Rewrite to:
        Use a jump table.
        Remove code to pop args from the stack after call.
        Special-case signed/unsigned int8/16.
        * testsuite/libffi.call/return_sc.c (main): Revert.

From-SVN: r127093
2007-07-31 15:05:52 +00:00
Alexandre Oliva 18fa3240db ffi.h.in (ffi_closure_alloc, [...]): New.
libffi/ChangeLog:
* include/ffi.h.in (ffi_closure_alloc, ffi_closure_free): New.
(ffi_prep_closure_loc): New.
(ffi_prep_raw_closure_loc): New.
(ffi_prep_java_raw_closure_loc): New.
* src/closures.c: New file.
* src/dlmalloc.c [FFI_MMAP_EXEC_WRIT] (struct malloc_segment):
Replace sflags with exec_offset.
[FFI_MMAP_EXEC_WRIT] (mmap_exec_offset, add_segment_exec_offset,
sub_segment_exec_offset): New macros.
(get_segment_flags, set_segment_flags, check_segment_merge): New
macros.
(is_mmapped_segment, is_extern_segment): Use get_segment_flags.
(add_segment, sys_alloc, create_mspace, create_mspace_with_base,
destroy_mspace): Use new macros.
(sys_alloc): Silence warning.
* Makefile.am (libffi_la_SOURCES): Add src/closures.c.
* Makefile.in: Rebuilt.
* src/prep_cif [FFI_CLOSURES] (ffi_prep_closure): Implement in
terms of ffi_prep_closure_loc.
* src/raw_api.c (ffi_prep_raw_closure_loc): Renamed and adjusted
from...
(ffi_prep_raw_closure): ... this.  Re-implement in terms of the
renamed version.
* src/java_raw_api (ffi_prep_java_raw_closure_loc): Renamed and
adjusted from...
(ffi_prep_java_raw_closure): ... this.  Re-implement in terms of
the renamed version.
* src/alpha/ffi.c (ffi_prep_closure_loc): Renamed from
(ffi_prep_closure): ... this.
* src/pa/ffi.c: Likewise.
* src/cris/ffi.c: Likewise.  Adjust.
* src/frv/ffi.c: Likewise.
* src/ia64/ffi.c: Likewise.
* src/mips/ffi.c: Likewise.
* src/powerpc/ffi_darwin.c: Likewise.
* src/s390/ffi.c: Likewise.
* src/sh/ffi.c: Likewise.
* src/sh64/ffi.c: Likewise.
* src/sparc/ffi.c: Likewise.
* src/x86/ffi64.c: Likewise.
* src/x86/ffi.c: Likewise.
(FFI_INIT_TRAMPOLINE): Adjust.
(ffi_prep_raw_closure_loc): Renamed and adjusted from...
(ffi_prep_raw_closure): ... this.
* src/powerpc/ffi.c (ffi_prep_closure_loc): Renamed from
(ffi_prep_closure): ... this.
(flush_icache): Adjust.
boehm-gc/ChangeLog:
* include/gc.h (GC_REGISTER_FINALIZER_UNREACHABLE): New.
(GC_register_finalizer_unreachable): Declare.
(GC_debug_register_finalizer_unreachable): Declare.
* finalize.c (GC_unreachable_finalize_mark_proc): New.
(GC_register_finalizer_unreachable): New.
(GC_finalize): Handle it.
* dbg_mlc.c (GC_debug_register_finalizer_unreachable): New.
(GC_debug_register_finalizer_no_order): Fix whitespace.
libjava/ChangeLog:
* include/jvm.h (_Jv_ClosureListFinalizer): New.
(_Jv_Linker::create_error_method): Adjust.
* boehm.cc (_Jv_ClosureListFinalizer): New.
* nogc.cc (_Jv_ClosureListFinalizer): New.
* java/lang/Class.h (class _Jv_ClosureList): New.
(class java::lang::Class): Declare it as friend.
* java/lang/natClass.cc (_Jv_ClosureList::releaseClosures): New.
(_Jv_ClosureList::registerClousure): New.
* include/execution.h (_Jv_ExecutionEngine): Add get_closure_list.
(_Jv_CompiledEngine::do_get_closure_list): New.
(_Jv_CompiledEngine::_Jv_CompiledEngine): Use it.
(_Jv_IndirectCompiledClass): Add closures.
(_Jv_IndirectCompiledEngine::get_aux_info): New.
(_Jv_IndirectCompiledEngine::do_allocate_field_initializers): Use
it.
(_Jv_IndirectCompiledEngine::do_get_closure_list): New.
(_Jv_IndirectCompiledEngine::_Jv_IndirectCompiledEngine): Use it.
(_Jv_InterpreterEngine::do_get_closure_list): Declare.
(_Jv_InterpreterEngine::_Jv_InterpreterEngine): Use it.
* interpret.cc (FFI_PREP_RAW_CLOSURE): Use _loc variants.
(node_closure): Add closure list.
(_Jv_InterpMethod::ncode): Add jclass argument.  Use
ffi_closure_alloc and the separate code pointer.  Register the
closure for finalization.
(_Jv_JNIMethod::ncode): Likewise.
(_Jv_InterpreterEngine::do_create_ncode): Pass klass to ncode.
(_Jv_InterpreterEngine::do_get_closure_list): New.
* include/java-interp.h (_Jv_InterpMethod::ncode): Adjust.
(_Jv_InterpClass): Add closures field.
(_Jv_JNIMethod::ncode): Adjust.
* defineclass.cc (_Jv_ClassReader::handleCodeAttribute): Adjust.
(_Jv_ClassReader::handleMethodsEnd): Likewise.
* link.cc (struct method_closure): Add closure list.
(_Jv_Linker::create_error_method): Add jclass argument.  Use
ffi_closure_alloc and the separate code pointer.  Register the
closure for finalization.
(_Jv_Linker::link_symbol_table): Remove outdated comment about
sharing of otable and atable.  Adjust.
* java/lang/reflect/natVMProxy.cc (ncode_closure): Add closure
list.
(ncode): Add jclass argument.  Use ffi_closure_alloc and the
separate code pointer.  Register the closure for finalization.
(java::lang::reflect::VMProxy::generateProxyClass): Adjust.
* testsuite/libjava.jar/TestClosureGC.java: New.
* testsuite/libjava.jar/TestClosureGC.out: New.
* testsuite/libjava.jar/TestClosureGC.xfail: New.
* testsuite/libjava.jar/TestClosureGC.jar: New.

From-SVN: r122652
2007-03-07 07:27:25 +00:00
Andreas Tobler f4f7486bcf configure.ac: Add TARGET for x86_64-*-darwin*.
2006-12-14  Andreas Tobler  <a.tobler@schweiz.org>

	* configure.ac: Add TARGET for x86_64-*-darwin*.
	* Makefile.am (nodist_libffi_la_SOURCES): Add rules for 64-bit sources
	for X86_DARWIN.
	* src/x86/ffitarget.h: Set trampoline size for x86_64-*-darwin*.
	* src/x86/darwin64.S: New file for x86_64-*-darwin* support.
	* configure: Regenerate.
	* Makefile.in: Regenerate.
	* include/Makefile.in: Regenerate.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/libffi.special/unwindtest_ffi_call.cc: New test case for
	ffi_call only.

From-SVN: r119856
2006-12-14 08:34:45 +01:00