diff options
author | Alan Modra <amodra@gcc.gnu.org> | 2013-11-18 01:05:08 +1030 |
---|---|---|
committer | Alan Modra <amodra@gcc.gnu.org> | 2013-11-18 01:05:08 +1030 |
commit | 3521ba8b2e5c974c021853b2b829313029b4eda8 (patch) | |
tree | dd3c7417bef8e7912052a55fffdfbd91018418c1 /libffi/doc | |
parent | abe6cd5d35c0ec893ffff056f46f3729a3c8bf52 (diff) | |
download | gcc-3521ba8b2e5c974c021853b2b829313029b4eda8.zip gcc-3521ba8b2e5c974c021853b2b829313029b4eda8.tar.gz gcc-3521ba8b2e5c974c021853b2b829313029b4eda8.tar.bz2 |
PowerPC64 ELFv2 support
PowerPC64 ELFv2 support
* src/powerpc/ffitarget.h: Import from upstream.
* src/powerpc/ffi.c: Likewise.
* src/powerpc/linux64.S: Likewise.
* src/powerpc/linux64_closure.S: Likewise.
* doc/libffi.texi: Likewise.
* testsuite/libffi.call/cls_double_va.c: Likewise.
* testsuite/libffi.call/cls_longdouble_va.c: Likewise.
From-SVN: r204917
Diffstat (limited to 'libffi/doc')
-rw-r--r-- | libffi/doc/libffi.texi | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/libffi/doc/libffi.texi b/libffi/doc/libffi.texi index f0e6517..57dae0b 100644 --- a/libffi/doc/libffi.texi +++ b/libffi/doc/libffi.texi @@ -184,11 +184,11 @@ This calls the function @var{fn} according to the description given in @var{rvalue} is a pointer to a chunk of memory that will hold the result of the function call. This must be large enough to hold the -result and must be suitably aligned; it is the caller's responsibility +result, no smaller than the system register size (generally 32 or 64 +bits), and must be suitably aligned; it is the caller's responsibility to ensure this. If @var{cif} declares that the function returns @code{void} (using @code{ffi_type_void}), then @var{rvalue} is -ignored. If @var{rvalue} is @samp{NULL}, then the return value is -discarded. +ignored. @var{avalues} is a vector of @code{void *} pointers that point to the memory locations holding the argument values for a call. If @var{cif} @@ -214,7 +214,7 @@ int main() ffi_type *args[1]; void *values[1]; char *s; - int rc; + ffi_arg rc; /* Initialize the argument info vectors */ args[0] = &ffi_type_pointer; @@ -222,7 +222,7 @@ int main() /* Initialize the cif */ if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, - &ffi_type_uint, args) == FFI_OK) + &ffi_type_sint, args) == FFI_OK) @{ s = "Hello World!"; ffi_call(&cif, puts, &rc, values); @@ -360,7 +360,7 @@ You must first describe the structure to @samp{libffi} by creating a new @code{ffi_type} object for it. @tindex ffi_type -@deftp ffi_type +@deftp {Data type} ffi_type The @code{ffi_type} has the following members: @table @code @item size_t size @@ -414,6 +414,7 @@ Here is the corresponding code to describe this struct to int i; tm_type.size = tm_type.alignment = 0; + tm_type.type = FFI_TYPE_STRUCT; tm_type.elements = &tm_type_elements; for (i = 0; i < 9; i++) @@ -540,21 +541,23 @@ A trivial example that creates a new @code{puts} by binding #include <ffi.h> /* Acts like puts with the file given at time of enclosure. */ -void puts_binding(ffi_cif *cif, unsigned int *ret, void* args[], - FILE *stream) +void puts_binding(ffi_cif *cif, void *ret, void* args[], + void *stream) @{ - *ret = fputs(*(char **)args[0], stream); + *(ffi_arg *)ret = fputs(*(char **)args[0], (FILE *)stream); @} +typedef int (*puts_t)(char *); + int main() @{ ffi_cif cif; ffi_type *args[1]; ffi_closure *closure; - int (*bound_puts)(char *); + void *bound_puts; int rc; - + /* Allocate closure and bound_puts */ closure = ffi_closure_alloc(sizeof(ffi_closure), &bound_puts); @@ -565,13 +568,13 @@ int main() /* Initialize the cif */ if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, - &ffi_type_uint, args) == FFI_OK) + &ffi_type_sint, args) == FFI_OK) @{ /* Initialize the closure, setting stream to stdout */ - if (ffi_prep_closure_loc(closure, &cif, puts_binding, + if (ffi_prep_closure_loc(closure, &cif, puts_binding, stdout, bound_puts) == FFI_OK) @{ - rc = bound_puts("Hello World!"); + rc = ((puts_t)bound_puts)("Hello World!"); /* rc now holds the result of the call to fputs */ @} @} |