aboutsummaryrefslogtreecommitdiff
path: root/libffi/src/ia64
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2021-08-31 07:14:47 -0700
committerH.J. Lu <hjl.tools@gmail.com>2021-10-20 05:35:52 -0700
commit92456a4e5658e138e2cea79e390e3306b07685b0 (patch)
tree6ef878e933b504a902035f1ae89510fde96a976d /libffi/src/ia64
parentd738405e7fe62cc8eb9580948a6ea39005cd7170 (diff)
downloadgcc-92456a4e5658e138e2cea79e390e3306b07685b0.zip
gcc-92456a4e5658e138e2cea79e390e3306b07685b0.tar.gz
gcc-92456a4e5658e138e2cea79e390e3306b07685b0.tar.bz2
libffi: Sync with libffi 3.4.2
Merged commit: f9ea41683444ebe11cfa45b05223899764df28fb
Diffstat (limited to 'libffi/src/ia64')
-rw-r--r--libffi/src/ia64/ffi.c30
-rw-r--r--libffi/src/ia64/ffitarget.h3
-rw-r--r--libffi/src/ia64/unix.S9
3 files changed, 34 insertions, 8 deletions
diff --git a/libffi/src/ia64/ffi.c b/libffi/src/ia64/ffi.c
index b77a836..b1d04c3 100644
--- a/libffi/src/ia64/ffi.c
+++ b/libffi/src/ia64/ffi.c
@@ -220,8 +220,8 @@ hfa_element_type (ffi_type *type, int nested)
/* Perform machine dependent cif processing. */
-ffi_status
-ffi_prep_cif_machdep(ffi_cif *cif)
+static ffi_status
+ffi_prep_cif_machdep_core(ffi_cif *cif)
{
int flags;
@@ -271,6 +271,22 @@ ffi_prep_cif_machdep(ffi_cif *cif)
return FFI_OK;
}
+ffi_status
+ffi_prep_cif_machdep(ffi_cif *cif)
+{
+ cif->nfixedargs = cif->nargs;
+ return ffi_prep_cif_machdep_core(cif);
+}
+
+ffi_status
+ffi_prep_cif_machdep_var(ffi_cif *cif,
+ unsigned int nfixedargs,
+ unsigned int ntotalargs MAYBE_UNUSED)
+{
+ cif->nfixedargs = nfixedargs;
+ return ffi_prep_cif_machdep_core(cif);
+}
+
extern int ffi_call_unix (struct ia64_args *, PTR64, void (*)(void), UINT64);
void
@@ -454,10 +470,11 @@ ffi_closure_unix_inner (ffi_closure *closure, struct ia64_args *stack,
ffi_cif *cif;
void **avalue;
ffi_type **p_arg;
- long i, avn, gpcount, fpcount;
+ long i, avn, gpcount, fpcount, nfixedargs;
cif = closure->cif;
avn = cif->nargs;
+ nfixedargs = cif->nfixedargs;
avalue = alloca (avn * sizeof (void *));
/* If the structure return value is passed in memory get that location
@@ -468,6 +485,7 @@ ffi_closure_unix_inner (ffi_closure *closure, struct ia64_args *stack,
gpcount = fpcount = 0;
for (i = 0, p_arg = cif->arg_types; i < avn; i++, p_arg++)
{
+ int named = i < nfixedargs;
switch ((*p_arg)->type)
{
case FFI_TYPE_SINT8:
@@ -491,7 +509,7 @@ ffi_closure_unix_inner (ffi_closure *closure, struct ia64_args *stack,
break;
case FFI_TYPE_FLOAT:
- if (gpcount < 8 && fpcount < 8)
+ if (named && gpcount < 8 && fpcount < 8)
{
fpreg *addr = &stack->fp_regs[fpcount++];
float result;
@@ -505,7 +523,7 @@ ffi_closure_unix_inner (ffi_closure *closure, struct ia64_args *stack,
break;
case FFI_TYPE_DOUBLE:
- if (gpcount < 8 && fpcount < 8)
+ if (named && gpcount < 8 && fpcount < 8)
{
fpreg *addr = &stack->fp_regs[fpcount++];
double result;
@@ -521,7 +539,7 @@ ffi_closure_unix_inner (ffi_closure *closure, struct ia64_args *stack,
case FFI_TYPE_LONGDOUBLE:
if (gpcount & 1)
gpcount++;
- if (LDBL_MANT_DIG == 64 && gpcount < 8 && fpcount < 8)
+ if (LDBL_MANT_DIG == 64 && named && gpcount < 8 && fpcount < 8)
{
fpreg *addr = &stack->fp_regs[fpcount++];
__float80 result;
diff --git a/libffi/src/ia64/ffitarget.h b/libffi/src/ia64/ffitarget.h
index e68cea6..fd5b9a0 100644
--- a/libffi/src/ia64/ffitarget.h
+++ b/libffi/src/ia64/ffitarget.h
@@ -50,6 +50,7 @@ typedef enum ffi_abi {
#define FFI_TRAMPOLINE_SIZE 24 /* Really the following struct, which */
/* can be interpreted as a C function */
/* descriptor: */
+#define FFI_TARGET_SPECIFIC_VARIADIC 1
+#define FFI_EXTRA_CIF_FIELDS unsigned nfixedargs
#endif
-
diff --git a/libffi/src/ia64/unix.S b/libffi/src/ia64/unix.S
index 4d2a86d..e2547e0 100644
--- a/libffi/src/ia64/unix.S
+++ b/libffi/src/ia64/unix.S
@@ -175,7 +175,6 @@ ffi_call_unix:
;;
.Lst_small_struct:
- add sp = -16, sp
cmp.lt p6, p0 = 8, in3
cmp.lt p7, p0 = 16, in3
cmp.lt p8, p0 = 24, in3
@@ -191,6 +190,12 @@ ffi_call_unix:
(p8) st8 [r18] = r11
mov out1 = sp
mov out2 = in3
+ ;;
+ // ia64 software calling convention requires
+ // top 16 bytes of stack to be scratch space
+ // PLT resolver uses that scratch space at
+ // 'memcpy' symbol reolution time
+ add sp = -16, sp
br.call.sptk.many b0 = memcpy#
;;
mov ar.pfs = loc0
@@ -529,6 +534,7 @@ ffi_closure_unix:
data8 @pcrel(.Lst_int64) // FFI_TYPE_SINT64
data8 @pcrel(.Lst_void) // FFI_TYPE_STRUCT
data8 @pcrel(.Lst_int64) // FFI_TYPE_POINTER
+ data8 @pcrel(.Lst_void) // FFI_TYPE_COMPLEX (not implemented)
data8 @pcrel(.Lst_small_struct) // FFI_IA64_TYPE_SMALL_STRUCT
data8 @pcrel(.Lst_hfa_float) // FFI_IA64_TYPE_HFA_FLOAT
data8 @pcrel(.Lst_hfa_double) // FFI_IA64_TYPE_HFA_DOUBLE
@@ -550,6 +556,7 @@ ffi_closure_unix:
data8 @pcrel(.Lld_int) // FFI_TYPE_SINT64
data8 @pcrel(.Lld_void) // FFI_TYPE_STRUCT
data8 @pcrel(.Lld_int) // FFI_TYPE_POINTER
+ data8 @pcrel(.Lld_void) // FFI_TYPE_COMPLEX (not implemented)
data8 @pcrel(.Lld_small_struct) // FFI_IA64_TYPE_SMALL_STRUCT
data8 @pcrel(.Lld_hfa_float) // FFI_IA64_TYPE_HFA_FLOAT
data8 @pcrel(.Lld_hfa_double) // FFI_IA64_TYPE_HFA_DOUBLE