diff options
author | Gregory P. Smith <greg@krypto.org> | 2013-04-30 06:45:38 (GMT) |
---|---|---|
committer | Gregory P. Smith <greg@krypto.org> | 2013-04-30 06:45:38 (GMT) |
commit | 933059710c4fe1ada77301bdb62ce5425308c533 (patch) | |
tree | ffacec34bc6c1ba16e8ec5ebbc701f170289755e /Modules | |
parent | 11692acffa7adfa3856ef4cd58140a20905f5016 (diff) | |
download | cpython-933059710c4fe1ada77301bdb62ce5425308c533.zip cpython-933059710c4fe1ada77301bdb62ce5425308c533.tar.gz cpython-933059710c4fe1ada77301bdb62ce5425308c533.tar.bz2 |
* Fix issue 17192 for 3.2 - reapply the issue11729 patch that was undone
in the merge fun from upstream which already had it in 3.0.13.
* Add the missing update to libffi.info.
Diffstat (limited to 'Modules')
-rwxr-xr-x | Modules/_ctypes/libffi/configure | 6 | ||||
-rw-r--r-- | Modules/_ctypes/libffi/configure.ac | 6 | ||||
-rw-r--r-- | Modules/_ctypes/libffi/doc/libffi.info | 79 |
3 files changed, 58 insertions, 33 deletions
diff --git a/Modules/_ctypes/libffi/configure b/Modules/_ctypes/libffi/configure index 3d8f61a..8230830 100755 --- a/Modules/_ctypes/libffi/configure +++ b/Modules/_ctypes/libffi/configure @@ -14505,10 +14505,10 @@ if ${libffi_cv_as_x86_pcrel+:} false; then : $as_echo_n "(cached) " >&6 else - libffi_cv_as_x86_pcrel=yes + libffi_cv_as_x86_pcrel=no echo '.text; foo: nop; .data; .long foo-.; .text' > conftest.s - if $CC $CFLAGS -c conftest.s 2>&1 | grep -i warning > /dev/null; then - libffi_cv_as_x86_pcrel=no + if $CC $CFLAGS -c conftest.s > /dev/null 2>&1; then + libffi_cv_as_x86_pcrel=yes fi fi diff --git a/Modules/_ctypes/libffi/configure.ac b/Modules/_ctypes/libffi/configure.ac index f5b9f38..7fe5ff5 100644 --- a/Modules/_ctypes/libffi/configure.ac +++ b/Modules/_ctypes/libffi/configure.ac @@ -367,10 +367,10 @@ fi if test x$TARGET = xX86 || test x$TARGET = xX86_WIN32 || test x$TARGET = xX86_64; then AC_CACHE_CHECK([assembler supports pc related relocs], libffi_cv_as_x86_pcrel, [ - libffi_cv_as_x86_pcrel=yes + libffi_cv_as_x86_pcrel=no echo '.text; foo: nop; .data; .long foo-.; .text' > conftest.s - if $CC $CFLAGS -c conftest.s 2>&1 | grep -i warning > /dev/null; then - libffi_cv_as_x86_pcrel=no + if $CC $CFLAGS -c conftest.s > /dev/null 2>&1; then + libffi_cv_as_x86_pcrel=yes fi ]) if test "x$libffi_cv_as_x86_pcrel" = xyes; then diff --git a/Modules/_ctypes/libffi/doc/libffi.info b/Modules/_ctypes/libffi/doc/libffi.info index 896a5ec..6d5acf8 100644 --- a/Modules/_ctypes/libffi/doc/libffi.info +++ b/Modules/_ctypes/libffi/doc/libffi.info @@ -4,7 +4,7 @@ from ../libffi/doc/libffi.texi. This manual is for Libffi, a portable foreign-function interface library. - Copyright (C) 2008, 2010 Red Hat, Inc. + Copyright (C) 2008, 2010, 2011 Red Hat, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License as @@ -27,7 +27,7 @@ libffi This manual is for Libffi, a portable foreign-function interface library. - Copyright (C) 2008, 2010 Red Hat, Inc. + Copyright (C) 2008, 2010, 2011 Red Hat, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License as @@ -115,8 +115,6 @@ To prepare a call interface object, use the function `ffi_prep_cif'. want. *note Multiple ABIs:: for more information. NARGS is the number of arguments that this function accepts. - `libffi' does not yet handle varargs functions; see *note Missing - Features:: for more information. RTYPE is a pointer to an `ffi_type' structure that describes the return type of the function. *Note Types::. @@ -129,6 +127,30 @@ To prepare a call interface object, use the function `ffi_prep_cif'. properly; `FFI_BAD_TYPEDEF' if one of the `ffi_type' objects is incorrect; or `FFI_BAD_ABI' if the ABI parameter is invalid. + If the function being called is variadic (varargs) then +`ffi_prep_cif_var' must be used instead of `ffi_prep_cif'. + + -- Function: ffi_status ffi_prep_cif_var (ffi_cif *CIF, ffi_abi + varabi, unsigned int NFIXEDARGS, unsigned int varntotalargs, + ffi_type *RTYPE, ffi_type **ARGTYPES) + This initializes CIF according to the given parameters for a call + to a variadic function. In general it's operation is the same as + for `ffi_prep_cif' except that: + + NFIXEDARGS is the number of fixed arguments, prior to any variadic + arguments. It must be greater than zero. + + NTOTALARGS the total number of arguments, including variadic and + fixed arguments. + + Note that, different cif's must be prepped for calls to the same + function when different numbers of arguments are passed. + + Also note that a call to `ffi_prep_cif_var' with + NFIXEDARGS=NOTOTALARGS is NOT equivalent to a call to + `ffi_prep_cif'. + + To call a function using an initialized `ffi_cif', use the `ffi_call' function: @@ -147,7 +169,9 @@ To prepare a call interface object, use the function `ffi_prep_cif'. AVALUES is a vector of `void *' pointers that point to the memory locations holding the argument values for a call. If CIF declares that the function has no arguments (i.e., NARGS was 0), then - AVALUES is ignored. + AVALUES is ignored. Note that argument values may be modified by + the callee (for instance, structs passed by value); the burden of + copying pass-by-value arguments is placed on the caller. File: libffi.info, Node: Simple Example, Next: Types, Prev: The Basics, Up: Using libffi @@ -294,7 +318,7 @@ is perfectly happy passing structures back and forth. You must first describe the structure to `libffi' by creating a new `ffi_type' object for it. - -- ffi_type: + -- Data type: ffi_type The `ffi_type' has the following members: `size_t size' This is set by `libffi'; you should initialize it to zero. @@ -509,9 +533,7 @@ File: libffi.info, Node: Missing Features, Next: Index, Prev: Using libffi, `libffi' is missing a few features. We welcome patches to add support for these. - * There is no support for calling varargs functions. This may work - on some platforms, depending on how the ABI is defined, but it is - not reliable. + * Variadic closures. * There is no support for bit fields in structures. @@ -519,6 +541,9 @@ for these. * The "raw" API is undocumented. + Note that variadic support is very new and tested on a relatively +small number of platforms. + File: libffi.info, Node: Index, Prev: Missing Features, Up: Top @@ -528,7 +553,6 @@ Index * Menu: -* : Structures. (line 12) * ABI: Introduction. (line 13) * Application Binary Interface: Introduction. (line 13) * calling convention: Introduction. (line 13) @@ -536,11 +560,12 @@ Index * closure API: The Closure API. (line 13) * closures: The Closure API. (line 13) * FFI: Introduction. (line 31) -* ffi_call: The Basics. (line 41) -* ffi_closure_alloca: The Closure API. (line 19) +* ffi_call: The Basics. (line 63) +* ffi_closure_alloc: The Closure API. (line 19) * ffi_closure_free: The Closure API. (line 26) * FFI_CLOSURES: The Closure API. (line 13) * ffi_prep_cif: The Basics. (line 16) +* ffi_prep_cif_var: The Basics. (line 39) * ffi_prep_closure_loc: The Closure API. (line 34) * ffi_status <1>: The Closure API. (line 37) * ffi_status: The Basics. (line 18) @@ -568,24 +593,24 @@ Index * ffi_type_void: Primitive Types. (line 10) * Foreign Function Interface: Introduction. (line 31) * void <1>: The Closure API. (line 20) -* void: The Basics. (line 43) +* void: The Basics. (line 65) Tag Table: -Node: Top706 -Node: Introduction1448 -Node: Using libffi3084 -Node: The Basics3570 -Node: Simple Example6177 -Node: Types7204 -Node: Primitive Types7487 -Node: Structures9307 -Node: Type Example10167 -Node: Multiple ABIs11390 -Node: The Closure API11761 -Node: Closure Example14705 -Node: Missing Features16264 -Node: Index16757 +Node: Top712 +Node: Introduction1460 +Node: Using libffi3096 +Node: The Basics3582 +Node: Simple Example7224 +Node: Types8251 +Node: Primitive Types8534 +Node: Structures10354 +Node: Type Example11224 +Node: Multiple ABIs12447 +Node: The Closure API12818 +Node: Closure Example15762 +Node: Missing Features17321 +Node: Index17774 End Tag Table |