This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [libffi] closures for sparc
- From: Andreas Jaeger <aj at suse dot de>
- To: Jeff Sturm <jsturm at one-point dot com>
- Cc: gcc-patches at gcc dot gnu dot org, <java-patches at gcc dot gnu dot org>
- Date: Tue, 14 Jan 2003 10:50:50 +0100
- Subject: Re: [libffi] closures for sparc
- References: <Pine.LNX.4.44.0212281205090.9818-100000@ops2.one-point.com>
Jeff Sturm <jsturm@one-point.com> writes:
> This is a repost from July, cleaned up and retested on mainline. It
> enables closures for sparc and sparc64, to prepare for enabling the
> libjava bytecode interpreter.
>
> Special thanks to Ulrich Weigand for sorting through the difficult
> size/endianness/alignment issues for s390x:
>
> http://gcc.gnu.org/ml/java-patches/2002-q4/msg00000.html
>
> Tested on sparcv9-sun-solaris2.8 by running ffitest on sparcv7 and sparcv9
> multilibs. Bootstrap successful with GNU binutils and Sun as/ld.
>
> OK for mainline?
>
> 2002-12-28 Jeff Sturm <jsturm@one-point.com>
>
> * include/ffi.h.in: Add closure defines for SPARC, SPARC64.
> * src/ffitest.c (main): Use static storage for closure.
> * src/sparc/ffi.c (ffi_prep_closure, ffi_closure_sparc_inner): New.
> * src/sparc/v8.S (ffi_closure_v8): New.
> * src/sparc/v9.S (ffi_closure_v9): New.
>
> Index: include/ffi.h.in
> ===================================================================
> RCS file: /cvs/gcc/gcc/libffi/include/ffi.h.in,v
> retrieving revision 1.21
> diff -u -p -r1.21 ffi.h.in
> --- include/ffi.h.in 6 Dec 2002 01:16:44 -0000 1.21
> +++ include/ffi.h.in 28 Dec 2002 16:44:23 -0000
> @@ -443,6 +443,18 @@ struct ffi_ia64_trampoline_struct {
> #define FFI_TRAMPOLINE_SIZE 24 /* see struct below */
> #define FFI_NATIVE_RAW_API 0
>
> +#elif defined(SPARC64)
> +
> +#define FFI_CLOSURES 1
> +#define FFI_TRAMPOLINE_SIZE 24
> +#define FFI_NATIVE_RAW_API 0
> +
> +#elif defined(SPARC)
> +
> +#define FFI_CLOSURES 1
> +#define FFI_TRAMPOLINE_SIZE 16
> +#define FFI_NATIVE_RAW_API 0
> +
> #elif defined(S390)
>
> #define FFI_CLOSURES 1
> Index: src/ffitest.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/libffi/src/ffitest.c,v
> retrieving revision 1.9
> diff -u -p -r1.9 ffitest.c
> --- src/ffitest.c 6 Dec 2002 01:16:45 -0000 1.9
> +++ src/ffitest.c 28 Dec 2002 16:44:23 -0000
> @@ -1044,7 +1044,9 @@ int main(/*@unused@*/ int argc, /*@unuse
> # if FFI_CLOSURES
> /* A simple closure test */
> {
> - ffi_closure cl;
> + /* The closure must not be an automatic variable on
> + platforms (Solaris) that forbid stack execution by default. */
> + static ffi_closure cl;
> ffi_type * cl_arg_types[3];
>
> cl_arg_types[0] = &ffi_type_sint;
This breaks on x86-64 with:
/usr/src/aj/cvs/gcc/libffi/src/ffitest.c: In function `main':
/usr/src/aj/cvs/gcc/libffi/src/ffitest.c:431: error: syntax error before "cl"
make[4]: *** [ffitest.lo] Error 1
I'm committing the appended patch as obvious,
Andreas
2003-01-14 Andreas Jaeger <aj@suse.de>
* src/ffitest.c (main): Only use ffi_closures if those are
supported.
============================================================
Index: libffi/src/ffitest.c
--- src/ffitest.c 14 Jan 2003 05:15:21 -0000 1.11
+++ src/ffitest.c 14 Jan 2003 09:48:56 -0000
@@ -426,10 +426,12 @@ int main(/*@unused@*/ int argc, /*@unuse
ffi_arg rint;
long long rlonglong;
+# if FFI_CLOSURES
/* The closure must not be an automatic variable on
platforms (Solaris) that forbid stack execution by default. */
static ffi_closure cl;
-
+#endif
+
ffi_type * cl_arg_types[17];
ffi_type ts1_type;
--
Andreas Jaeger
SuSE Labs aj@suse.de
private aj@arthur.inka.de
http://www.suse.de/~aj