3.0.9rc12

This commit is contained in:
Anthony Green
2009-12-29 10:06:04 -05:00
parent 14e2e92e86
commit 0cfe60e9d1
51 changed files with 1400 additions and 919 deletions

View File

@@ -1,15 +1,15 @@
10
dir
155472
155499
svn+ssh://green@gcc.gnu.org/svn/gcc/trunk/libffi/src
svn+ssh://green@gcc.gnu.org/svn/gcc
2009-12-26T04:59:25.888276Z
155470
green
2009-12-28T18:19:18.861565Z
155492
dje
@@ -26,10 +26,10 @@ green
138bc75d-0d04-0410-961f-82ee72b054a4
powerpc
arm
dir
arm
powerpc
dir
closures.c
@@ -38,11 +38,11 @@ file
2009-12-20T06:01:56.058555Z
c36f20ce319c714943a9f8272a1ec6c7
2009-12-10T10:09:17.074519Z
155124
ro
2009-12-29T03:43:00.566983Z
51d610374f7ef5c8ca8e54c607e251d9
2009-12-26T18:49:55.630686Z
155475
andreast
@@ -64,7 +64,7 @@ ro
16543
16354
m32r
dir
@@ -72,15 +72,6 @@ dir
sh64
dir
m68k
dir
alpha
dir
x86
dir
types.c
file
@@ -115,19 +106,28 @@ aph
2904
frv
x86
dir
alpha
dir
m68k
dir
avr32
dir
frv
dir
s390
dir
pa
cris
dir
cris
pa
dir
ia64

View File

@@ -50,11 +50,6 @@
executable memory. */
# define FFI_MMAP_EXEC_WRIT 1
# endif
# if defined(X86_64) && defined(__sun__) && defined(__svr4__)
/* The data segment on 64-bit Solaris/x86 isn't executable, so use mmap
instead. */
# define FFI_MMAP_EXEC_WRIT 1
# endif
#endif
#if FFI_MMAP_EXEC_WRIT && !defined FFI_MMAP_EXEC_SELINUX

View File

@@ -1,7 +1,7 @@
10
dir
155472
155499
svn+ssh://green@gcc.gnu.org/svn/gcc/trunk/libffi/src/alpha
svn+ssh://green@gcc.gnu.org/svn/gcc

View File

@@ -1,7 +1,7 @@
10
dir
155472
155499
svn+ssh://green@gcc.gnu.org/svn/gcc/trunk/libffi/src/arm
svn+ssh://green@gcc.gnu.org/svn/gcc

View File

@@ -1,7 +1,7 @@
10
dir
155472
155499
svn+ssh://green@gcc.gnu.org/svn/gcc/trunk/libffi/src/avr32
svn+ssh://green@gcc.gnu.org/svn/gcc

View File

@@ -1,5 +1,5 @@
/* -----------------------------------------------------------------------
closures.c - Copyright (c) 2007 Red Hat, Inc.
closures.c - Copyright (c) 2007, 2009 Red Hat, Inc.
Copyright (C) 2007, 2009 Free Software Foundation, Inc
Code to allocate and deallocate memory for closures.

51
src/closures.c.rej Normal file
View File

@@ -0,0 +1,51 @@
--- src/closures.c
+++ src/closures.c
@@ -50,11 +50,6 @@
executable memory. */
# define FFI_MMAP_EXEC_WRIT 1
# endif
-# if defined(X86_64) && defined(__sun__) && defined(__svr4__)
-/* The data segment on 64-bit Solaris/x86 isn't executable, so use mmap
- instead. */
-# define FFI_MMAP_EXEC_WRIT 1
-# endif
#endif
#if FFI_MMAP_EXEC_WRIT && !defined FFI_MMAP_EXEC_SELINUX
@@ -214,6 +209,8 @@
#if !(defined(X86_WIN32) || defined(X86_WIN64)) || defined (__CYGWIN__)
+#if FFI_MMAP_EXEC_SELINUX
+
/* A mutex used to synchronize access to *exec* variables in this file. */
static pthread_mutex_t open_temp_exec_file_mutex = PTHREAD_MUTEX_INITIALIZER;
@@ -483,6 +480,27 @@
return dlmmap_locked (start, length, prot, flags, offset);
}
+#else
+
+static void *
+dlmmap (void *start, size_t length, int prot,
+ int flags, int fd, off_t offset)
+{
+
+ assert (start == NULL && length % malloc_getpagesize == 0
+ && prot == (PROT_READ | PROT_WRITE)
+ && flags == (MAP_PRIVATE | MAP_ANONYMOUS)
+ && fd == -1 && offset == 0);
+
+#if FFI_CLOSURE_TEST
+ printf ("mapping in %zi\n", length);
+#endif
+
+ return mmap (start, length, prot | PROT_EXEC, flags, fd, offset);
+}
+
+#endif
+
/* Release memory at the given address, as well as the corresponding
executable page if it's separate. */
static int

View File

@@ -1,7 +1,7 @@
10
dir
155472
155499
svn+ssh://green@gcc.gnu.org/svn/gcc/trunk/libffi/src/cris
svn+ssh://green@gcc.gnu.org/svn/gcc

View File

@@ -1,7 +1,7 @@
10
dir
155472
155499
svn+ssh://green@gcc.gnu.org/svn/gcc/trunk/libffi/src/frv
svn+ssh://green@gcc.gnu.org/svn/gcc

View File

@@ -1,7 +1,7 @@
10
dir
155472
155499
svn+ssh://green@gcc.gnu.org/svn/gcc/trunk/libffi/src/ia64
svn+ssh://green@gcc.gnu.org/svn/gcc

View File

@@ -1,7 +1,7 @@
10
dir
155472
155499
svn+ssh://green@gcc.gnu.org/svn/gcc/trunk/libffi/src/m32r
svn+ssh://green@gcc.gnu.org/svn/gcc

View File

@@ -1,7 +1,7 @@
10
dir
155472
155499
svn+ssh://green@gcc.gnu.org/svn/gcc/trunk/libffi/src/m68k
svn+ssh://green@gcc.gnu.org/svn/gcc

View File

@@ -1,7 +1,7 @@
10
dir
155472
155499
svn+ssh://green@gcc.gnu.org/svn/gcc/trunk/libffi/src/mips
svn+ssh://green@gcc.gnu.org/svn/gcc

View File

@@ -1,7 +1,7 @@
10
dir
155472
155499
svn+ssh://green@gcc.gnu.org/svn/gcc/trunk/libffi/src/pa
svn+ssh://green@gcc.gnu.org/svn/gcc

View File

@@ -1,14 +1,14 @@
10
dir
155472
155499
svn+ssh://green@gcc.gnu.org/svn/gcc/trunk/libffi/src/powerpc
svn+ssh://green@gcc.gnu.org/svn/gcc
2009-12-08T00:41:10.883117Z
155070
2009-12-28T18:19:18.861565Z
155492
dje
@@ -202,11 +202,11 @@ file
2009-12-20T06:01:53.730558Z
5e33e72fe5ecabf0a89cf4d5227cb1ca
2009-06-16T17:55:39.375944Z
148543
andreast
2009-12-29T03:43:00.498236Z
817f588a25206791e6c66eac1d0053ef
2009-12-26T12:40:27.505316Z
155473
schwab
@@ -228,7 +228,7 @@ andreast
39006
39056
sysv.S
file
@@ -338,10 +338,10 @@ file
2009-12-20T06:01:53.730558Z
060e5d94c60a73470ae84eefddd59be0
2009-12-04T15:36:50.057287Z
154983
2009-12-29T03:43:00.515985Z
16f90a13659a11e0db8871d655b430f8
2009-12-28T18:19:18.861565Z
155492
dje
@@ -364,7 +364,7 @@ dje
24973
26077
linux64.S
file

View File

@@ -185,6 +185,7 @@ ffi_prep_args_SYSV (extended_cif *ecif, unsigned *const stack)
{
*next_arg.f = (float) double_tmp;
next_arg.u += 1;
intarg_count++;
}
else
*fpr_base.d++ = double_tmp;
@@ -1149,6 +1150,7 @@ ffi_closure_helper_SYSV (ffi_closure *closure, void *rvalue,
pst++;
avalue[i] = pst;
pst += 2;
ng = 8;
}
break;
@@ -1222,6 +1224,7 @@ ffi_closure_helper_SYSV (ffi_closure *closure, void *rvalue,
{
avalue[i] = pst;
pst += 4;
ng = 8;
}
break;
}

View File

@@ -32,7 +32,7 @@
#include <stdlib.h>
extern void ffi_closure_ASM(void);
extern void ffi_closure_ASM (void);
enum {
/* The assembly depends on these exact flags. */
@@ -80,10 +80,13 @@ enum { ASM_NEEDS_REGISTERS = 4 };
*/
void ffi_prep_args(extended_cif *ecif, unsigned long *const stack)
void
ffi_prep_args (extended_cif *ecif, unsigned long *const stack)
{
const unsigned bytes = ecif->cif->bytes;
const unsigned flags = ecif->cif->flags;
const unsigned nargs = ecif->cif->nargs;
const ffi_abi abi = ecif->cif->abi;
/* 'stacktop' points at the previous backchain pointer. */
unsigned long *const stacktop = stack + (bytes / sizeof(unsigned long));
@@ -118,7 +121,7 @@ void ffi_prep_args(extended_cif *ecif, unsigned long *const stack)
*next_arg++ = (unsigned long) (char *) ecif->rvalue;
/* Now for the arguments. */
for (i = ecif->cif->nargs; i > 0; i--, ptr++, p_argv++)
for (i = nargs; i > 0; i--, ptr++, p_argv++)
{
switch ((*ptr)->type)
{
@@ -213,7 +216,7 @@ void ffi_prep_args(extended_cif *ecif, unsigned long *const stack)
size_al = (*ptr)->size;
if ((*ptr)->elements[0]->type == 3)
size_al = ALIGN((*ptr)->size, 8);
if (size_al < 3 && ecif->cif->abi == FFI_DARWIN)
if (size_al < 3 && abi == FFI_DARWIN)
dest_cpy += 4 - size_al;
memcpy ((char *) dest_cpy, (char *) *p_argv, size_al);
@@ -229,7 +232,7 @@ void ffi_prep_args(extended_cif *ecif, unsigned long *const stack)
the struct to double-word. */
if ((*ptr)->elements[0]->type == FFI_TYPE_DOUBLE)
size_al = ALIGN((*ptr)->size, 8);
if (size_al < 3 && ecif->cif->abi == FFI_DARWIN)
if (size_al < 3 && abi == FFI_DARWIN)
dest_cpy += 4 - size_al;
memcpy((char *) dest_cpy, (char *) *p_argv, size_al);
@@ -301,8 +304,44 @@ darwin_adjust_aggregate_sizes (ffi_type *s)
/* Do not add additional tail padding. */
}
/* Adjust the size of S to be correct for AIX.
Word-align double unless it is the first member of a structure. */
static void
aix_adjust_aggregate_sizes (ffi_type *s)
{
int i;
if (s->type != FFI_TYPE_STRUCT)
return;
s->size = 0;
for (i = 0; s->elements[i] != NULL; i++)
{
ffi_type *p;
int align;
p = s->elements[i];
aix_adjust_aggregate_sizes (p);
align = p->alignment;
if (i != 0 && p->type == FFI_TYPE_DOUBLE)
align = 4;
s->size = ALIGN(s->size, align) + p->size;
}
s->size = ALIGN(s->size, s->alignment);
if (s->elements[0]->type == FFI_TYPE_UINT64
|| s->elements[0]->type == FFI_TYPE_SINT64
|| s->elements[0]->type == FFI_TYPE_DOUBLE
|| s->elements[0]->alignment == 8)
s->alignment = s->alignment > 8 ? s->alignment : 8;
/* Do not add additional tail padding. */
}
/* Perform machine dependent cif processing. */
ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
ffi_status
ffi_prep_cif_machdep (ffi_cif *cif)
{
/* All this is for the DARWIN ABI. */
int i;
@@ -323,6 +362,13 @@ ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
darwin_adjust_aggregate_sizes (cif->arg_types[i]);
}
if (cif->abi == FFI_AIX)
{
aix_adjust_aggregate_sizes (cif->rtype);
for (i = 0; i < cif->nargs; i++)
aix_adjust_aggregate_sizes (cif->arg_types[i]);
}
/* Space for the frame pointer, callee's LR, CR, etc, and for
the asm's temp regs. */
@@ -473,7 +519,8 @@ extern void ffi_call_AIX(extended_cif *, long, unsigned, unsigned *,
extern void ffi_call_DARWIN(extended_cif *, long, unsigned, unsigned *,
void (*fn)(void), void (*fn2)(void));
void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
void
ffi_call (ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
{
extended_cif ecif;
@@ -486,7 +533,7 @@ void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
if ((rvalue == NULL) &&
(cif->rtype->type == FFI_TYPE_STRUCT))
{
ecif.rvalue = alloca(cif->rtype->size);
ecif.rvalue = alloca (cif->rtype->size);
}
else
ecif.rvalue = rvalue;
@@ -661,8 +708,9 @@ typedef union
double d;
} ffi_dblfl;
int ffi_closure_helper_DARWIN (ffi_closure*, void*,
unsigned long*, ffi_dblfl*);
int
ffi_closure_helper_DARWIN (ffi_closure *, void *,
unsigned long *, ffi_dblfl *);
/* Basically the trampoline invokes ffi_closure_ASM, and on
entry, r11 holds the address of the closure.
@@ -671,8 +719,9 @@ int ffi_closure_helper_DARWIN (ffi_closure*, void*,
up space for a return value, ffi_closure_ASM invokes the
following helper function to do most of the work. */
int ffi_closure_helper_DARWIN (ffi_closure* closure, void * rvalue,
unsigned long * pgr, ffi_dblfl * pfr)
int
ffi_closure_helper_DARWIN (ffi_closure *closure, void *rvalue,
unsigned long *pgr, ffi_dblfl *pfr)
{
/* rvalue is the pointer to space for return value in closure assembly
pgr is the pointer to where r3-r10 are stored in ffi_closure_ASM
@@ -694,7 +743,7 @@ int ffi_closure_helper_DARWIN (ffi_closure* closure, void * rvalue,
unsigned size_al;
cif = closure->cif;
avalue = alloca(cif->nargs * sizeof(void *));
avalue = alloca (cif->nargs * sizeof(void *));
/* Copy the caller's structure return value address so that the closure
returns the data directly to the caller. */

View File

@@ -1205,6 +1205,7 @@ ffi_closure_helper_SYSV (ffi_closure *closure, void *rvalue,
pst++;
avalue[i] = pst;
pst += 2;
ng = 8;
}
break;

18
src/powerpc/ffi.c.rej Normal file
View File

@@ -0,0 +1,18 @@
--- src/powerpc/ffi.c
+++ src/powerpc/ffi.c
@@ -186,6 +187,7 @@
{
*next_arg.f = (float) double_tmp;
next_arg.u += 1;
+ intarg_count++;
}
else
*fpr_base.d++ = double_tmp;
@@ -1224,6 +1227,7 @@
{
avalue[i] = pst;
pst += 4;
+ ng = 8;
}
break;
}

View File

@@ -32,7 +32,7 @@
#include <stdlib.h>
extern void ffi_closure_ASM(void);
extern void ffi_closure_ASM (void);
enum {
/* The assembly depends on these exact flags. */
@@ -80,10 +80,13 @@ enum { ASM_NEEDS_REGISTERS = 4 };
*/
void ffi_prep_args(extended_cif *ecif, unsigned long *const stack)
void
ffi_prep_args (extended_cif *ecif, unsigned long *const stack)
{
const unsigned bytes = ecif->cif->bytes;
const unsigned flags = ecif->cif->flags;
const unsigned nargs = ecif->cif->nargs;
const ffi_abi abi = ecif->cif->abi;
/* 'stacktop' points at the previous backchain pointer. */
unsigned long *const stacktop = stack + (bytes / sizeof(unsigned long));
@@ -118,7 +121,7 @@ void ffi_prep_args(extended_cif *ecif, unsigned long *const stack)
*next_arg++ = (unsigned long) (char *) ecif->rvalue;
/* Now for the arguments. */
for (i = ecif->cif->nargs; i > 0; i--, ptr++, p_argv++)
for (i = nargs; i > 0; i--, ptr++, p_argv++)
{
switch ((*ptr)->type)
{
@@ -213,7 +216,7 @@ void ffi_prep_args(extended_cif *ecif, unsigned long *const stack)
size_al = (*ptr)->size;
if ((*ptr)->elements[0]->type == 3)
size_al = ALIGN((*ptr)->size, 8);
if (size_al < 3 && ecif->cif->abi == FFI_DARWIN)
if (size_al < 3 && abi == FFI_DARWIN)
dest_cpy += 4 - size_al;
memcpy ((char *) dest_cpy, (char *) *p_argv, size_al);
@@ -229,7 +232,7 @@ void ffi_prep_args(extended_cif *ecif, unsigned long *const stack)
the struct to double-word. */
if ((*ptr)->elements[0]->type == FFI_TYPE_DOUBLE)
size_al = ALIGN((*ptr)->size, 8);
if (size_al < 3 && ecif->cif->abi == FFI_DARWIN)
if (size_al < 3 && abi == FFI_DARWIN)
dest_cpy += 4 - size_al;
memcpy((char *) dest_cpy, (char *) *p_argv, size_al);
@@ -301,8 +304,44 @@ darwin_adjust_aggregate_sizes (ffi_type *s)
/* Do not add additional tail padding. */
}
/* Adjust the size of S to be correct for AIX.
Word-align double unless it is the first member of a structure. */
static void
aix_adjust_aggregate_sizes (ffi_type *s)
{
int i;
if (s->type != FFI_TYPE_STRUCT)
return;
s->size = 0;
for (i = 0; s->elements[i] != NULL; i++)
{
ffi_type *p;
int align;
p = s->elements[i];
aix_adjust_aggregate_sizes (p);
align = p->alignment;
if (i != 0 && p->type == FFI_TYPE_DOUBLE)
align = 4;
s->size = ALIGN(s->size, align) + p->size;
}
s->size = ALIGN(s->size, s->alignment);
if (s->elements[0]->type == FFI_TYPE_UINT64
|| s->elements[0]->type == FFI_TYPE_SINT64
|| s->elements[0]->type == FFI_TYPE_DOUBLE
|| s->elements[0]->alignment == 8)
s->alignment = s->alignment > 8 ? s->alignment : 8;
/* Do not add additional tail padding. */
}
/* Perform machine dependent cif processing. */
ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
ffi_status
ffi_prep_cif_machdep (ffi_cif *cif)
{
/* All this is for the DARWIN ABI. */
int i;
@@ -323,6 +362,13 @@ ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
darwin_adjust_aggregate_sizes (cif->arg_types[i]);
}
if (cif->abi == FFI_AIX)
{
aix_adjust_aggregate_sizes (cif->rtype);
for (i = 0; i < cif->nargs; i++)
aix_adjust_aggregate_sizes (cif->arg_types[i]);
}
/* Space for the frame pointer, callee's LR, CR, etc, and for
the asm's temp regs. */
@@ -473,7 +519,8 @@ extern void ffi_call_AIX(extended_cif *, long, unsigned, unsigned *,
extern void ffi_call_DARWIN(extended_cif *, long, unsigned, unsigned *,
void (*fn)(void), void (*fn2)(void));
void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
void
ffi_call (ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
{
extended_cif ecif;
@@ -486,7 +533,7 @@ void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
if ((rvalue == NULL) &&
(cif->rtype->type == FFI_TYPE_STRUCT))
{
ecif.rvalue = alloca(cif->rtype->size);
ecif.rvalue = alloca (cif->rtype->size);
}
else
ecif.rvalue = rvalue;
@@ -661,8 +708,9 @@ typedef union
double d;
} ffi_dblfl;
int ffi_closure_helper_DARWIN (ffi_closure*, void*,
unsigned long*, ffi_dblfl*);
int
ffi_closure_helper_DARWIN (ffi_closure *, void *,
unsigned long *, ffi_dblfl *);
/* Basically the trampoline invokes ffi_closure_ASM, and on
entry, r11 holds the address of the closure.
@@ -671,8 +719,9 @@ int ffi_closure_helper_DARWIN (ffi_closure*, void*,
up space for a return value, ffi_closure_ASM invokes the
following helper function to do most of the work. */
int ffi_closure_helper_DARWIN (ffi_closure* closure, void * rvalue,
unsigned long * pgr, ffi_dblfl * pfr)
int
ffi_closure_helper_DARWIN (ffi_closure *closure, void *rvalue,
unsigned long *pgr, ffi_dblfl *pfr)
{
/* rvalue is the pointer to space for return value in closure assembly
pgr is the pointer to where r3-r10 are stored in ffi_closure_ASM
@@ -694,7 +743,7 @@ int ffi_closure_helper_DARWIN (ffi_closure* closure, void * rvalue,
unsigned size_al;
cif = closure->cif;
avalue = alloca(cif->nargs * sizeof(void *));
avalue = alloca (cif->nargs * sizeof(void *));
/* Copy the caller's structure return value address so that the closure
returns the data directly to the caller. */

View File

@@ -1,7 +1,7 @@
10
dir
155472
155499
svn+ssh://green@gcc.gnu.org/svn/gcc/trunk/libffi/src/s390
svn+ssh://green@gcc.gnu.org/svn/gcc

View File

@@ -1,7 +1,7 @@
10
dir
155472
155499
svn+ssh://green@gcc.gnu.org/svn/gcc/trunk/libffi/src/sh
svn+ssh://green@gcc.gnu.org/svn/gcc

View File

@@ -1,7 +1,7 @@
10
dir
155472
155499
svn+ssh://green@gcc.gnu.org/svn/gcc/trunk/libffi/src/sh64
svn+ssh://green@gcc.gnu.org/svn/gcc

View File

@@ -1,7 +1,7 @@
10
dir
155472
155499
svn+ssh://green@gcc.gnu.org/svn/gcc/trunk/libffi/src/sparc
svn+ssh://green@gcc.gnu.org/svn/gcc

View File

@@ -1,7 +1,7 @@
10
dir
155472
155499
svn+ssh://green@gcc.gnu.org/svn/gcc/trunk/libffi/src/x86
svn+ssh://green@gcc.gnu.org/svn/gcc