Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e9d0633

Browse files
committed
* Fix PART of issue 17192 for 3.3 - 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.
2 parents fe1b22a + 9330597 commit e9d0633

3 files changed

Lines changed: 58 additions & 33 deletions

File tree

Modules/_ctypes/libffi/configure

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14505,10 +14505,10 @@ if ${libffi_cv_as_x86_pcrel+:} false; then :
1450514505
$as_echo_n "(cached) " >&6
1450614506
else
1450714507

14508-
libffi_cv_as_x86_pcrel=yes
14508+
libffi_cv_as_x86_pcrel=no
1450914509
echo '.text; foo: nop; .data; .long foo-.; .text' > conftest.s
14510-
if $CC $CFLAGS -c conftest.s 2>&1 | grep -i warning > /dev/null; then
14511-
libffi_cv_as_x86_pcrel=no
14510+
if $CC $CFLAGS -c conftest.s > /dev/null 2>&1; then
14511+
libffi_cv_as_x86_pcrel=yes
1451214512
fi
1451314513

1451414514
fi

Modules/_ctypes/libffi/configure.ac

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -367,10 +367,10 @@ fi
367367
if test x$TARGET = xX86 || test x$TARGET = xX86_WIN32 || test x$TARGET = xX86_64; then
368368
AC_CACHE_CHECK([assembler supports pc related relocs],
369369
libffi_cv_as_x86_pcrel, [
370-
libffi_cv_as_x86_pcrel=yes
370+
libffi_cv_as_x86_pcrel=no
371371
echo '.text; foo: nop; .data; .long foo-.; .text' > conftest.s
372-
if $CC $CFLAGS -c conftest.s 2>&1 | grep -i warning > /dev/null; then
373-
libffi_cv_as_x86_pcrel=no
372+
if $CC $CFLAGS -c conftest.s > /dev/null 2>&1; then
373+
libffi_cv_as_x86_pcrel=yes
374374
fi
375375
])
376376
if test "x$libffi_cv_as_x86_pcrel" = xyes; then

Modules/_ctypes/libffi/doc/libffi.info

Lines changed: 52 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ from ../libffi/doc/libffi.texi.
44
This manual is for Libffi, a portable foreign-function interface
55
library.
66

7-
Copyright (C) 2008, 2010 Red Hat, Inc.
7+
Copyright (C) 2008, 2010, 2011 Red Hat, Inc.
88

99
Permission is granted to copy, distribute and/or modify this
1010
document under the terms of the GNU General Public License as
@@ -27,7 +27,7 @@ libffi
2727
This manual is for Libffi, a portable foreign-function interface
2828
library.
2929

30-
Copyright (C) 2008, 2010 Red Hat, Inc.
30+
Copyright (C) 2008, 2010, 2011 Red Hat, Inc.
3131

3232
Permission is granted to copy, distribute and/or modify this
3333
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'.
115115
want. *note Multiple ABIs:: for more information.
116116

117117
NARGS is the number of arguments that this function accepts.
118-
`libffi' does not yet handle varargs functions; see *note Missing
119-
Features:: for more information.
120118

121119
RTYPE is a pointer to an `ffi_type' structure that describes the
122120
return type of the function. *Note Types::.
@@ -129,6 +127,30 @@ To prepare a call interface object, use the function `ffi_prep_cif'.
129127
properly; `FFI_BAD_TYPEDEF' if one of the `ffi_type' objects is
130128
incorrect; or `FFI_BAD_ABI' if the ABI parameter is invalid.
131129

130+
If the function being called is variadic (varargs) then
131+
`ffi_prep_cif_var' must be used instead of `ffi_prep_cif'.
132+
133+
-- Function: ffi_status ffi_prep_cif_var (ffi_cif *CIF, ffi_abi
134+
varabi, unsigned int NFIXEDARGS, unsigned int varntotalargs,
135+
ffi_type *RTYPE, ffi_type **ARGTYPES)
136+
This initializes CIF according to the given parameters for a call
137+
to a variadic function. In general it's operation is the same as
138+
for `ffi_prep_cif' except that:
139+
140+
NFIXEDARGS is the number of fixed arguments, prior to any variadic
141+
arguments. It must be greater than zero.
142+
143+
NTOTALARGS the total number of arguments, including variadic and
144+
fixed arguments.
145+
146+
Note that, different cif's must be prepped for calls to the same
147+
function when different numbers of arguments are passed.
148+
149+
Also note that a call to `ffi_prep_cif_var' with
150+
NFIXEDARGS=NOTOTALARGS is NOT equivalent to a call to
151+
`ffi_prep_cif'.
152+
153+
132154
To call a function using an initialized `ffi_cif', use the
133155
`ffi_call' function:
134156

@@ -147,7 +169,9 @@ To prepare a call interface object, use the function `ffi_prep_cif'.
147169
AVALUES is a vector of `void *' pointers that point to the memory
148170
locations holding the argument values for a call. If CIF declares
149171
that the function has no arguments (i.e., NARGS was 0), then
150-
AVALUES is ignored.
172+
AVALUES is ignored. Note that argument values may be modified by
173+
the callee (for instance, structs passed by value); the burden of
174+
copying pass-by-value arguments is placed on the caller.
151175

152176

153177
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
294318
describe the structure to `libffi' by creating a new `ffi_type' object
295319
for it.
296320

297-
-- ffi_type:
321+
-- Data type: ffi_type
298322
The `ffi_type' has the following members:
299323
`size_t size'
300324
This is set by `libffi'; you should initialize it to zero.
@@ -509,16 +533,17 @@ File: libffi.info, Node: Missing Features, Next: Index, Prev: Using libffi,
509533
`libffi' is missing a few features. We welcome patches to add support
510534
for these.
511535

512-
* There is no support for calling varargs functions. This may work
513-
on some platforms, depending on how the ABI is defined, but it is
514-
not reliable.
536+
* Variadic closures.
515537

516538
* There is no support for bit fields in structures.
517539

518540
* The closure API is
519541

520542
* The "raw" API is undocumented.
521543

544+
Note that variadic support is very new and tested on a relatively
545+
small number of platforms.
546+
522547

523548
File: libffi.info, Node: Index, Prev: Missing Features, Up: Top
524549

@@ -528,19 +553,19 @@ Index
528553
[index]
529554
* Menu:
530555

531-
* : Structures. (line 12)
532556
* ABI: Introduction. (line 13)
533557
* Application Binary Interface: Introduction. (line 13)
534558
* calling convention: Introduction. (line 13)
535559
* cif: The Basics. (line 14)
536560
* closure API: The Closure API. (line 13)
537561
* closures: The Closure API. (line 13)
538562
* FFI: Introduction. (line 31)
539-
* ffi_call: The Basics. (line 41)
540-
* ffi_closure_alloca: The Closure API. (line 19)
563+
* ffi_call: The Basics. (line 63)
564+
* ffi_closure_alloc: The Closure API. (line 19)
541565
* ffi_closure_free: The Closure API. (line 26)
542566
* FFI_CLOSURES: The Closure API. (line 13)
543567
* ffi_prep_cif: The Basics. (line 16)
568+
* ffi_prep_cif_var: The Basics. (line 39)
544569
* ffi_prep_closure_loc: The Closure API. (line 34)
545570
* ffi_status <1>: The Closure API. (line 37)
546571
* ffi_status: The Basics. (line 18)
@@ -568,24 +593,24 @@ Index
568593
* ffi_type_void: Primitive Types. (line 10)
569594
* Foreign Function Interface: Introduction. (line 31)
570595
* void <1>: The Closure API. (line 20)
571-
* void: The Basics. (line 43)
596+
* void: The Basics. (line 65)
572597

573598

574599

575600
Tag Table:
576-
Node: Top706
577-
Node: Introduction1448
578-
Node: Using libffi3084
579-
Node: The Basics3570
580-
Node: Simple Example6177
581-
Node: Types7204
582-
Node: Primitive Types7487
583-
Node: Structures9307
584-
Node: Type Example10167
585-
Node: Multiple ABIs11390
586-
Node: The Closure API11761
587-
Node: Closure Example14705
588-
Node: Missing Features16264
589-
Node: Index16757
601+
Node: Top712
602+
Node: Introduction1460
603+
Node: Using libffi3096
604+
Node: The Basics3582
605+
Node: Simple Example7224
606+
Node: Types8251
607+
Node: Primitive Types8534
608+
Node: Structures10354
609+
Node: Type Example11224
610+
Node: Multiple ABIs12447
611+
Node: The Closure API12818
612+
Node: Closure Example15762
613+
Node: Missing Features17321
614+
Node: Index17774
590615

591616
End Tag Table

0 commit comments

Comments
 (0)