Index: libffi/ChangeLog =================================================================== --- libffi.orig/ChangeLog +++ libffi/ChangeLog @@ -1,3 +1,16 @@ +2011-02-11 Anthony Green + + From Tom Honermann : + * src/powerpc/aix.S (ffi_call_AIX): Support for xlc toolchain on + AIX. Declare .ffi_prep_args. Insert nops after branch + instructions so that the AIX linker can insert TOC reload + instructions. + * src/powerpc/aix_closure.S: Declare .ffi_closure_helper_DARWIN. + +2011-02-08 Uli Link + + * include/ffi.h.in (FFI_64_BIT_MAX): Define and use. + 2011-02-08 Rafael Avila de Espindola * configure.ac: Fix x86 test for pc related relocs. Index: libffi/include/ffi.h.in =================================================================== --- libffi.orig/include/ffi.h.in +++ libffi/include/ffi.h.in @@ -1,16 +1,17 @@ /* -----------------------------------------------------------------*-C-*- - libffi @VERSION@ - Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc. + libffi @VERSION@ - Copyright (c) 2011 Anthony Green + - Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc. - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the ``Software''), to deal in the Software without + restriction, including without limitation the rights to use, copy, + modify, merge, publish, distribute, sublicense, and/or sell copies + of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF @@ -77,6 +78,9 @@ extern "C" { /* LONG_LONG_MAX is not always defined (not if STRICT_ANSI, for example). But we can find it either under the correct ANSI name, or under GNU C's internal name. */ + +#define FFI_64_BIT_MAX 9223372036854775807 + #ifdef LONG_LONG_MAX # define FFI_LONG_LONG_MAX LONG_LONG_MAX #else @@ -86,6 +90,15 @@ extern "C" { # ifdef __GNUC__ # define FFI_LONG_LONG_MAX __LONG_LONG_MAX__ # endif +# ifdef _AIX +# ifndef __PPC64__ +# if defined (__IBMC__) || defined (__IBMCPP__) +# define FFI_LONG_LONG_MAX LONGLONG_MAX +# endif +# endif /* __PPC64__ */ +# undef FFI_64_BIT_MAX +# define FFI_64_BIT_MAX 9223372036854775807LL +# endif # endif #endif @@ -132,17 +145,17 @@ typedef struct _ffi_type #endif #if LONG_MAX == 2147483647 -# if FFI_LONG_LONG_MAX != 9223372036854775807 +# if FFI_LONG_LONG_MAX != FFI_64_BIT_MAX #error "no 64-bit data type supported" # endif -#elif LONG_MAX != 9223372036854775807 +#elif LONG_MAX != FFI_64_BIT_MAX #error "long size not supported" #endif #if LONG_MAX == 2147483647 # define ffi_type_ulong ffi_type_uint32 # define ffi_type_slong ffi_type_sint32 -#elif LONG_MAX == 9223372036854775807 +#elif LONG_MAX == FFI_64_BIT_MAX # define ffi_type_ulong ffi_type_uint64 # define ffi_type_slong ffi_type_sint64 #else @@ -195,7 +208,7 @@ typedef struct { #ifndef FFI_SIZEOF_ARG # if LONG_MAX == 2147483647 # define FFI_SIZEOF_ARG 4 -# elif LONG_MAX == 9223372036854775807 +# elif LONG_MAX == FFI_64_BIT_MAX # define FFI_SIZEOF_ARG 8 # endif #endif Index: libffi/src/powerpc/aix.S =================================================================== --- libffi.orig/src/powerpc/aix.S +++ libffi/src/powerpc/aix.S @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------- - aix.S - Copyright (c) 2002,2009 Free Software Foundation, Inc. + aix.S - Copyright (c) 2002, 2009 Free Software Foundation, Inc. based on darwin.S by John Hornkvist PowerPC Assembly glue. @@ -79,6 +79,8 @@ .set f20,20 .set f21,21 + .extern .ffi_prep_args + #define LIBFFI_ASM #include #include @@ -125,6 +127,7 @@ ffi_call_AIX: /* Call ffi_prep_args. */ mr r4, r1 bl .ffi_prep_args + nop /* Now do the call. */ ld r0, 0(r29) @@ -226,6 +229,7 @@ L(float_return_value): /* Call ffi_prep_args. */ mr r4, r1 bl .ffi_prep_args + nop /* Now do the call. */ lwz r0, 0(r29) Index: libffi/src/powerpc/aix_closure.S =================================================================== --- libffi.orig/src/powerpc/aix_closure.S +++ libffi/src/powerpc/aix_closure.S @@ -79,6 +79,8 @@ .set f20,20 .set f21,21 + .extern .ffi_closure_helper_DARWIN + #define LIBFFI_ASM #define JUMPTARGET(name) name #define L(x) x