diff options
author | Alan Modra <amodra@bigpond.net.au> | 2003-09-11 23:54:40 +0000 |
---|---|---|
committer | Alan Modra <amodra@gcc.gnu.org> | 2003-09-12 09:24:40 +0930 |
commit | 6350c02cb6a7cdbd69403046fe466a9ea1367934 (patch) | |
tree | 04f3459481dd95299d45c55d0dfb47440783644e | |
parent | fe27b7cc414a7b57ef801872157b596f4f39c1f6 (diff) | |
download | gcc-6350c02cb6a7cdbd69403046fe466a9ea1367934.zip gcc-6350c02cb6a7cdbd69403046fe466a9ea1367934.tar.gz gcc-6350c02cb6a7cdbd69403046fe466a9ea1367934.tar.bz2 |
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
-rw-r--r-- | libffi/ChangeLog | 9 | ||||
-rw-r--r-- | libffi/src/powerpc/linux64_closure.S | 2 | ||||
-rw-r--r-- | libffi/src/prep_cif.c | 9 | ||||
-rw-r--r-- | libffi/testsuite/libffi.special/unwindtest.cc | 4 |
4 files changed, 21 insertions, 3 deletions
diff --git a/libffi/ChangeLog b/libffi/ChangeLog index 2efe64b..15f9c6d 100644 --- a/libffi/ChangeLog +++ b/libffi/ChangeLog @@ -1,3 +1,12 @@ +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 diff --git a/libffi/src/powerpc/linux64_closure.S b/libffi/src/powerpc/linux64_closure.S index 6cad16a..2d44d67 100644 --- a/libffi/src/powerpc/linux64_closure.S +++ b/libffi/src/powerpc/linux64_closure.S @@ -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 diff --git a/libffi/src/prep_cif.c b/libffi/src/prep_cif.c index d3c89c3..d60d98e 100644 --- a/libffi/src/prep_cif.c +++ b/libffi/src/prep_cif.c @@ -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 diff --git a/libffi/testsuite/libffi.special/unwindtest.cc b/libffi/testsuite/libffi.special/unwindtest.cc index 97b1536..b6be367 100644 --- a/libffi/testsuite/libffi.special/unwindtest.cc +++ b/libffi/testsuite/libffi.special/unwindtest.cc @@ -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, |