Commit 6350c02c by Alan Modra Committed by Alan Modra

prep_cif.c (initialize_aggregate): Include tail padding in structure size.

	* src/prep_cif.c (initialize_aggregate): Include tail padding in
	structure size.
	* src/powerpc/linux64_closure.S (ffi_closure_LINUX64): Correct
	placement of float result.
	* testsuite/libffi.special/unwindtest.cc (closure_test_fn1): Correct
	cast of "resp" for big-endian 64 bit machines.

From-SVN: r71323
parent fe27b7cc
2003-09-12 Alan Modra <amodra@bigpond.net.au>
* src/prep_cif.c (initialize_aggregate): Include tail padding in
structure size.
* src/powerpc/linux64_closure.S (ffi_closure_LINUX64): Correct
placement of float result.
* testsuite/libffi.special/unwindtest.cc (closure_test_fn1): Correct
cast of "resp" for big-endian 64 bit machines.
2003-09-11 Alan Modra <amodra@bigpond.net.au>
* src/types.c (double, longdouble): Merge identical SH and ARM
......
......@@ -97,7 +97,7 @@ ffi_closure_LINUX64:
addi %r1, %r1, 224
blr
# case FFI_TYPE_FLOAT
lfs %f1, 112+4(%r1)
lfs %f1, 112+0(%r1)
mtlr %r0
addi %r1, %r1, 224
blr
......
......@@ -64,6 +64,15 @@ static ffi_status initialize_aggregate(/*@out@*/ ffi_type *arg)
ptr++;
}
/* Structure size includes tail padding. This is important for
structures that fit in one register on ABIs like the PowerPC64
Linux ABI that right justify small structs in a register.
It's also needed for nested structure layout, for example
struct A { long a; char b; }; struct B { struct A x; char y; };
should find y at an offset of 2*sizeof(long) and result in a
total size of 3*sizeof(long). */
arg->size = ALIGN (arg->size, arg->alignment);
if (arg->size == 0)
return FFI_BAD_TYPEDEF;
else
......
......@@ -37,9 +37,9 @@ void closure_test_fn1(ffi_cif* cif,void* resp,void** args,
(int)(*(int *)args[10]), (int)(*(float *)args[11]),
(int)*(int *)args[12], (int)(*(int *)args[13]),
(int)(*(int *)args[14]), *(int *)args[15],
(int)(long)userdata, *(int*)resp);
(int)(long)userdata, (int)*(ffi_arg*)resp);
throw *(int*)resp;
throw (int)*(ffi_arg*)resp;
}
typedef int (*closure_test_type1)(float, float, float, float, signed short,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment