Fix for closures with sunpro compiler

This commit is contained in:
Anthony Green
2013-01-09 21:14:54 -05:00
parent 8308984e47
commit 2d9b393975
5 changed files with 25 additions and 5 deletions

View File

@@ -1,3 +1,13 @@
2013-01-10 Anthony Green <green@moxielogic.com>
* configure.ac: Put local.exp in the right place.
* configure: Rebuilt.
* src/x86/ffi.c: Update comment about regparm function attributes.
* src/x86/sysv.S (ffi_closure_SYSV): The SUNPRO compiler requires
that all function arguments be passed on the stack (no regparm
support).
2013-01-08 Anthony Green <green@moxielogic.com> 2013-01-08 Anthony Green <green@moxielogic.com>
* configure.ac: Generate local.exp. This sets CC_FOR_TARGET * configure.ac: Generate local.exp. This sets CC_FOR_TARGET

4
configure vendored
View File

@@ -13068,10 +13068,10 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
if test "x$GCC" = "xyes"; then if test "x$GCC" = "xyes"; then
CFLAGS="$CFLAGS -fexceptions" CFLAGS="$CFLAGS -fexceptions"
touch testsuite/local.exp touch local.exp
else else
cat > local.exp <<EOF cat > local.exp <<EOF
set CC_FOR_TARGET $CC set CC_FOR_TARGET "$CC"
EOF EOF
fi fi

View File

@@ -40,10 +40,10 @@ AX_CC_MAXOPT
AX_CFLAGS_WARN_ALL AX_CFLAGS_WARN_ALL
if test "x$GCC" = "xyes"; then if test "x$GCC" = "xyes"; then
CFLAGS="$CFLAGS -fexceptions" CFLAGS="$CFLAGS -fexceptions"
touch testsuite/local.exp touch local.exp
else else
cat > local.exp <<EOF cat > local.exp <<EOF
set CC_FOR_TARGET $CC set CC_FOR_TARGET "$CC"
EOF EOF
fi fi

View File

@@ -424,7 +424,7 @@ void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
/** private members **/ /** private members **/
/* The following __attribute__((regparm(1))) decorations will have no effect /* The following __attribute__((regparm(1))) decorations will have no effect
on MSVC - standard cdecl convention applies. */ on MSVC or SUNPRO_C -- standard conventions apply. */
static void ffi_prep_incoming_args_SYSV (char *stack, void **ret, static void ffi_prep_incoming_args_SYSV (char *stack, void **ret,
void** args, ffi_cif* cif); void** args, ffi_cif* cif);
void FFI_HIDDEN ffi_closure_SYSV (ffi_closure *) void FFI_HIDDEN ffi_closure_SYSV (ffi_closure *)

View File

@@ -182,9 +182,19 @@ ffi_closure_SYSV:
leal -24(%ebp), %edx leal -24(%ebp), %edx
movl %edx, -12(%ebp) /* resp */ movl %edx, -12(%ebp) /* resp */
leal 8(%ebp), %edx leal 8(%ebp), %edx
#ifdef __SUNPRO_C
/* The SUNPRO compiler doesn't support GCC's regparm function
attribute, so we have to pass all three arguments to
ffi_closure_SYSV_inner on the stack. */
movl %edx, 8(%esp) /* args = __builtin_dwarf_cfa () */
leal -12(%ebp), %edx
movl %edx, 4(%esp) /* &resp */
movl %eax, (%esp) /* closure */
#else
movl %edx, 4(%esp) /* args = __builtin_dwarf_cfa () */ movl %edx, 4(%esp) /* args = __builtin_dwarf_cfa () */
leal -12(%ebp), %edx leal -12(%ebp), %edx
movl %edx, (%esp) /* &resp */ movl %edx, (%esp) /* &resp */
#endif
#if defined HAVE_HIDDEN_VISIBILITY_ATTRIBUTE || !defined __PIC__ #if defined HAVE_HIDDEN_VISIBILITY_ATTRIBUTE || !defined __PIC__
call ffi_closure_SYSV_inner call ffi_closure_SYSV_inner
#else #else