• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Status
2======
3
4libffi-3.0.6 was released on July 17, 2008. Check the libffi web
5page for updates: <URL:http://sourceware.org/libffi/>.
6
7
8What is libffi?
9===============
10
11Compilers for high level languages generate code that follow certain
12conventions.  These conventions are necessary, in part, for separate
13compilation to work.  One such convention is the "calling convention".
14The "calling convention" is a set of assumptions made by the compiler
15about where function arguments will be found on entry to a function.
16A "calling convention" also specifies where the return value for a
17function is found.
18
19Some programs may not know at the time of compilation what arguments
20are to be passed to a function.  For instance, an interpreter may be
21told at run-time about the number and types of arguments used to call
22a given function.  Libffi can be used in such programs to provide a
23bridge from the interpreter program to compiled code.
24
25The libffi library provides a portable, high level programming
26interface to various calling conventions.  This allows a programmer to
27call any function specified by a call interface description at run
28time.
29
30FFI stands for Foreign Function Interface.  A foreign function
31interface is the popular name for the interface that allows code
32written in one language to call code written in another language.  The
33libffi library really only provides the lowest, machine dependent
34layer of a fully featured foreign function interface. A layer must
35exist above libffi that handles type conversions for values passed
36between the two languages.
37
38
39Supported Platforms
40===================
41
42Libffi has been ported to many different platforms, although this
43release was only tested on:
44
45     arm oabi linux
46     arm eabi linux
47     hppa linux
48     mips o32 linux (little endian)
49     powerpc darwin
50     powerpc64 linux
51     sparc solaris
52     sparc64 solaris
53     x86 cygwin
54     x86 darwin
55     x86 freebsd
56     x86 linux
57     x86 openbsd
58     x86-64 darwin
59     x86-64 linux
60     x86-64 OS X
61     x86-64 freebsd
62
63Please send additional platform test results to
64libffi-discuss@sourceware.org.
65
66Installing libffi
67=================
68
69[Note: before actually performing any of these installation steps,
70 you may wish to read the "Platform Specific Notes" below.]
71
72First you must configure the distribution for your particular
73system. Go to the directory you wish to build libffi in and run the
74"configure" program found in the root directory of the libffi source
75distribution.
76
77You may want to tell configure where to install the libffi library and
78header files. To do that, use the --prefix configure switch.  Libffi
79will install under /usr/local by default.
80
81If you want to enable extra run-time debugging checks use the the
82--enable-debug configure switch. This is useful when your program dies
83mysteriously while using libffi.
84
85Another useful configure switch is --enable-purify-safety. Using this
86will add some extra code which will suppress certain warnings when you
87are using Purify with libffi. Only use this switch when using
88Purify, as it will slow down the library.
89
90Configure has many other options. Use "configure --help" to see them all.
91
92Once configure has finished, type "make". Note that you must be using
93GNU make.  You can ftp GNU make from prep.ai.mit.edu:/pub/gnu.
94
95To ensure that libffi is working as advertised, type "make check".
96This will require that you have DejaGNU installed.
97
98To install the library and header files, type "make install".
99
100
101Platform Specific Notes
102=======================
103
104	MIPS - Irix 5.3 & 6.x
105	---------------------
106
107Irix 6.2 and better supports three different calling conventions: o32,
108n32 and n64. Currently, libffi only supports both o32 and n32 under
109Irix 6.x, but only o32 under Irix 5.3. Libffi will automatically be
110configured for whichever calling convention it was built for.
111
112By default, the configure script will try to build libffi with the GNU
113development tools. To build libffi with the SGI development tools, set
114the environment variable CC to either "cc -32" or "cc -n32" before
115running configure under Irix 6.x (depending on whether you want an o32
116or n32 library), or just "cc" for Irix 5.3.
117
118With the n32 calling convention, when returning structures smaller
119than 16 bytes, be sure to provide an RVALUE that is 8 byte aligned.
120Here's one way of forcing this:
121
122	double struct_storage[2];
123	my_small_struct *s = (my_small_struct *) struct_storage;
124	/* Use s for RVALUE */
125
126If you don't do this you are liable to get spurious bus errors.
127
128"long long" values are not supported yet.
129
130You must use GNU Make to build libffi on SGI platforms.
131
132
133	PowerPC System V ABI
134	--------------------
135
136There are two `System V ABI's which libffi implements for PowerPC.
137They differ only in how small structures are returned from functions.
138
139In the FFI_SYSV version, structures that are 8 bytes or smaller are
140returned in registers.  This is what GCC does when it is configured
141for solaris, and is what the System V ABI I have (dated September
1421995) says.
143
144In the FFI_GCC_SYSV version, all structures are returned the same way:
145by passing a pointer as the first argument to the function.  This is
146what GCC does when it is configured for linux or a generic sysv
147target.
148
149EGCS 1.0.1 (and probably other versions of EGCS/GCC) also has a
150inconsistency with the SysV ABI: When a procedure is called with many
151floating-point arguments, some of them get put on the stack.  They are
152all supposed to be stored in double-precision format, even if they are
153only single-precision, but EGCS stores single-precision arguments as
154single-precision anyway.  This causes one test to fail (the `many
155arguments' test).
156
157
158History
159=======
160
1613.0.6 Jul-17-08
162        Fix for closures on sh.
163	Mark the sh/sh64 stack as non-executable.
164	(both thanks to Kaz Kojima)
165
1663.0.5 Apr-3-08
167        Fix libffi.pc file.
168	Fix #define ARM for IcedTea users.
169	Fix x86 closure bug.
170
1713.0.4 Feb-24-08
172        Fix x86 OpenBSD configury.
173
1743.0.3 Feb-22-08
175        Enable x86 OpenBSD thanks to Thomas Heller, and
176	x86-64 FreeBSD thanks to Björn König and Andreas Tobler.
177	Clean up test instruction in README.
178
1793.0.2 Feb-21-08
180        Improved x86 FreeBSD support.
181	Thanks to Björn König.
182
1833.0.1 Feb-15-08
184        Fix instruction cache flushing bug on MIPS.
185	Thanks to David Daney.
186
1873.0.0 Feb-15-08
188        Many changes, mostly thanks to the GCC project.
189	Cygnus Solutions is now Red Hat.
190
191  [10 years go by...]
192
1931.20 Oct-5-98
194	Raffaele Sena produces ARM port.
195
1961.19 Oct-5-98
197	Fixed x86 long double and long long return support.
198	m68k bug fixes from Andreas Schwab.
199	Patch for DU assembler compatibility for the Alpha from Richard
200	Henderson.
201
2021.18 Apr-17-98
203	Bug fixes and MIPS configuration changes.
204
2051.17 Feb-24-98
206	Bug fixes and m68k port from Andreas Schwab. PowerPC port from
207	Geoffrey Keating. Various bug x86, Sparc and MIPS bug fixes.
208
2091.16 Feb-11-98
210	Richard Henderson produces Alpha port.
211
2121.15 Dec-4-97
213	Fixed an n32 ABI bug. New libtool, auto* support.
214
2151.14 May-13-97
216	libtool is now used to generate shared and static libraries.
217	Fixed a minor portability problem reported by Russ McManus
218	<mcmanr@eq.gs.com>.
219
2201.13 Dec-2-96
221	Added --enable-purify-safety to keep Purify from complaining
222	about certain low level code.
223	Sparc fix for calling functions with < 6 args.
224	Linux x86 a.out fix.
225
2261.12 Nov-22-96
227	Added missing ffi_type_void, needed for supporting void return
228	types. Fixed test case for non MIPS machines. Cygnus Support
229	is now Cygnus Solutions.
230
2311.11 Oct-30-96
232	Added notes about GNU make.
233
2341.10 Oct-29-96
235	Added configuration fix for non GNU compilers.
236
2371.09 Oct-29-96
238	Added --enable-debug configure switch. Clean-ups based on LCLint
239	feedback. ffi_mips.h is always installed. Many configuration
240	fixes. Fixed ffitest.c for sparc builds.
241
2421.08 Oct-15-96
243	Fixed n32 problem. Many clean-ups.
244
2451.07 Oct-14-96
246	Gordon Irlam rewrites v8.S again. Bug fixes.
247
2481.06 Oct-14-96
249	Gordon Irlam improved the sparc port.
250
2511.05 Oct-14-96
252	Interface changes based on feedback.
253
2541.04 Oct-11-96
255	Sparc port complete (modulo struct passing bug).
256
2571.03 Oct-10-96
258	Passing struct args, and returning struct values works for
259	all architectures/calling conventions. Expanded tests.
260
2611.02 Oct-9-96
262	Added SGI n32 support. Fixed bugs in both o32 and Linux support.
263	Added "make test".
264
2651.01 Oct-8-96
266	Fixed float passing bug in mips version. Restructured some
267	of the code. Builds cleanly with SGI tools.
268
2691.00 Oct-7-96
270	First release. No public announcement.
271
272
273Authors & Credits
274=================
275
276libffi was originally written by Anthony Green <green@redhat.com>.
277
278The developers of the GNU Compiler Collection project have made
279innumerable valuable contributions.  See the ChangeLog file for
280details.
281
282Some of the ideas behind libffi were inspired by Gianni Mariani's free
283gencall library for Silicon Graphics machines.
284
285The closure mechanism was designed and implemented by Kresten Krab
286Thorup.
287
288Major processor architecture ports were contributed by the following
289developers:
290
291alpha		Richard Henderson
292arm		Raffaele Sena
293cris		Simon Posnjak, Hans-Peter Nilsson
294frv		Anthony Green
295ia64		Hans Boehm
296m32r		Kazuhiro Inaoka
297m68k		Andreas Schwab
298mips		Anthony Green, Casey Marshall
299mips64		David Daney
300pa		Randolph Chung, Dave Anglin, Andreas Tobler
301powerpc		Geoffrey Keating, Andreas Tobler,
302			 David Edelsohn, John Hornkvist
303powerpc64	Jakub Jelinek
304s390		Gerhard Tonn, Ulrich Weigand
305sh		Kaz Kojima
306sh64		Kaz Kojima
307sparc		Anthony Green, Gordon Irlam
308x86		Anthony Green, Jon Beniston
309x86-64		Bo Thorsen
310
311Jesper Skov and Andrew Haley both did more than their fair share of
312stepping through the code and tracking down bugs.
313
314Thanks also to Tom Tromey for bug fixes, documentation and
315configuration help.
316
317Thanks to Jim Blandy, who provided some useful feedback on the libffi
318interface.
319
320Andreas Tobler has done a tremendous amount of work on the testsuite.
321
322Alex Oliva solved the executable page problem for SElinux.
323
324The list above is almost certainly incomplete and inaccurate.  I'm
325happy to make corrections or additions upon request.
326
327If you have a problem, or have found a bug, please send a note to
328green@redhat.com.
329