Index: src/powerpc/ffitarget.h =================================================================== --- src/powerpc/ffitarget.h (revision 139196) +++ src/powerpc/ffitarget.h (working copy) @@ -1,6 +1,6 @@ /* -----------------------------------------------------------------*-C-*- ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. - Copyright (C) 2007 Free Software Foundation, Inc + Copyright (C) 2007, 2008 Free Software Foundation, Inc Target configuration macros for PowerPC. Permission is hereby granted, free of charge, to any person obtaining @@ -77,6 +77,8 @@ FFI_SYSV, FFI_GCC_SYSV, FFI_LINUX64, + FFI_LINUX, + FFI_LINUX_SOFT_FLOAT, FFI_DEFAULT_ABI = FFI_SYSV, #endif Index: src/powerpc/ffi.c =================================================================== --- src/powerpc/ffi.c (revision 139196) +++ src/powerpc/ffi.c (working copy) @@ -1,6 +1,6 @@ /* ----------------------------------------------------------------------- ffi.c - Copyright (c) 1998 Geoffrey Keating - Copyright (C) 2007 Free Software Foundation, Inc + Copyright (C) 2007, 2008 Free Software Foundation, Inc PowerPC Foreign Function Interface @@ -679,14 +679,14 @@ The same applies for the structs returned in r3/r4. */ if (size <= 4) { - flags |= 1 << (31 - FFI_SYSV_TYPE_SMALL_STRUCT - 1); + flags |= 1 << (31 - FFI_SYSV_TYPE_SMALL_STRUCT + 1); flags |= 8 * (4 - size) << 4; break; } /* These structs are returned in r3 and r4. See above. */ if (size <= 8) { - flags |= 1 << (31 - FFI_SYSV_TYPE_SMALL_STRUCT - 2); + flags |= 1 << (31 - FFI_SYSV_TYPE_SMALL_STRUCT); flags |= 8 * (8 - size) << 4; break; } @@ -1251,7 +1251,7 @@ we have to tell ffi_closure_SYSV how to treat them. */ if (cif->abi == FFI_SYSV && cif->rtype->type == FFI_TYPE_STRUCT && size <= 8) - return FFI_SYSV_TYPE_SMALL_STRUCT + size; + return (FFI_SYSV_TYPE_SMALL_STRUCT - 1) + size; #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE else if (cif->rtype->type == FFI_TYPE_LONGDOUBLE && cif->abi != FFI_LINUX && cif->abi != FFI_LINUX_SOFT_FLOAT)