blob: 6df1805183f1560e0f3454d36ba6c18c5f7b3198 [file] [log] [blame]
Anthony Greenc6dddbd2009-10-04 08:11:33 -04001Status
2======
3
Anthony Greenf7c0bc62009-12-25 01:22:11 -05004libffi-3.0.9 was released on December XX, 2009. Check the libffi web
Anthony Greenc6dddbd2009-10-04 08:11:33 -04005page 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
14convention". The "calling convention" is essentially a set of
15assumptions made by the compiler about where function arguments will
16be found on entry to a function. A "calling convention" also specifies
17where the return value for a function 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 powerpc freebsd
51 powerpc64 linux
52 sparc solaris
53 sparc64 freebsd
54 sparc64 solaris
55 x86 cygwin
56 x86 darwin
57 x86 freebsd
58 x86 linux
59 x86 openbsd
60 x86 solaris
61 x86-64 mingw
62 x86-64 darwin
63 x86-64 linux
64 x86-64 OS X
65 x86-64 freebsd
66 x86-64 solaris
67
68Please send additional platform test results to
69libffi-discuss@sourceware.org.
70
71Installing libffi
72=================
73
74[Note: before actually performing any of these installation steps,
75 you may wish to read the "Platform Specific Notes" below.]
76
77First you must configure the distribution for your particular
78system. Go to the directory you wish to build libffi in and run the
79"configure" program found in the root directory of the libffi source
80distribution.
81
82You may want to tell configure where to install the libffi library and
83header files. To do that, use the --prefix configure switch. Libffi
84will install under /usr/local by default.
85
86If you want to enable extra run-time debugging checks use the the
87--enable-debug configure switch. This is useful when your program dies
88mysteriously while using libffi.
89
90Another useful configure switch is --enable-purify-safety. Using this
91will add some extra code which will suppress certain warnings when you
92are using Purify with libffi. Only use this switch when using
93Purify, as it will slow down the library.
94
95Configure has many other options. Use "configure --help" to see them all.
96
97Once configure has finished, type "make". Note that you must be using
98GNU make. You can ftp GNU make from prep.ai.mit.edu:/pub/gnu.
99
100To ensure that libffi is working as advertised, type "make check".
101This will require that you have DejaGNU installed.
102
103To install the library and header files, type "make install".
104
105
106Platform Specific Notes
107=======================
108
109 MIPS - Irix 5.3 & 6.x
110 ---------------------
111
112Irix 6.2 and better supports three different calling conventions: o32,
113n32 and n64. Currently, libffi only supports both o32 and n32 under
114Irix 6.x, but only o32 under Irix 5.3. Libffi will automatically be
115configured for whichever calling convention it was built for.
116
117By default, the configure script will try to build libffi with the GNU
118development tools. To build libffi with the SGI development tools, set
119the environment variable CC to either "cc -32" or "cc -n32" before
120running configure under Irix 6.x (depending on whether you want an o32
121or n32 library), or just "cc" for Irix 5.3.
122
123With the n32 calling convention, when returning structures smaller
124than 16 bytes, be sure to provide an RVALUE that is 8 byte aligned.
125Here's one way of forcing this:
126
127 double struct_storage[2];
128 my_small_struct *s = (my_small_struct *) struct_storage;
129 /* Use s for RVALUE */
130
131If you don't do this you are liable to get spurious bus errors.
132
133"long long" values are not supported yet.
134
135You must use GNU Make to build libffi on SGI platforms.
136
137
138 PowerPC System V ABI
139 --------------------
140
141There are two `System V ABI's which libffi implements for PowerPC.
142They differ only in how small structures are returned from functions.
143
144In the FFI_SYSV version, structures that are 8 bytes or smaller are
145returned in registers. This is what GCC does when it is configured
146for solaris, and is what the System V ABI I have (dated September
1471995) says.
148
149In the FFI_GCC_SYSV version, all structures are returned the same way:
150by passing a pointer as the first argument to the function. This is
151what GCC does when it is configured for linux or a generic sysv
152target.
153
154EGCS 1.0.1 (and probably other versions of EGCS/GCC) also has a
155inconsistency with the SysV ABI: When a procedure is called with many
156floating-point arguments, some of them get put on the stack. They are
157all supposed to be stored in double-precision format, even if they are
158only single-precision, but EGCS stores single-precision arguments as
159single-precision anyway. This causes one test to fail (the `many
160arguments' test).
161
162
163History
164=======
165
Anthony Greenf7c0bc62009-12-25 01:22:11 -0500166See the ChangeLog files for details.
167
1683.0.9 Dec-xx-09
169 Add AVR32 and win64 ports. Add ARM softfp support.
170 Many fixes for AIX, Solaris, HP-UX, *BSD.
171 Fix x86-64 closure bug.
172
1733.0.8 Dec-19-08
174 Add *BSD, BeOS, and PA-Linux support.
175
Anthony Greenc6dddbd2009-10-04 08:11:33 -04001763.0.7 Nov-11-08
177 Fix for ppc FreeBSD.
178 (thanks to Andreas Tobler)
179
1803.0.6 Jul-17-08
181 Fix for closures on sh.
182 Mark the sh/sh64 stack as non-executable.
183 (both thanks to Kaz Kojima)
184
1853.0.5 Apr-3-08
186 Fix libffi.pc file.
187 Fix #define ARM for IcedTea users.
188 Fix x86 closure bug.
189
1903.0.4 Feb-24-08
191 Fix x86 OpenBSD configury.
192
1933.0.3 Feb-22-08
194 Enable x86 OpenBSD thanks to Thomas Heller, and
195 x86-64 FreeBSD thanks to Björn König and Andreas Tobler.
196 Clean up test instruction in README.
197
1983.0.2 Feb-21-08
199 Improved x86 FreeBSD support.
200 Thanks to Björn König.
201
2023.0.1 Feb-15-08
203 Fix instruction cache flushing bug on MIPS.
204 Thanks to David Daney.
205
2063.0.0 Feb-15-08
207 Many changes, mostly thanks to the GCC project.
208 Cygnus Solutions is now Red Hat.
209
210 [10 years go by...]
211
2121.20 Oct-5-98
213 Raffaele Sena produces ARM port.
214
2151.19 Oct-5-98
216 Fixed x86 long double and long long return support.
217 m68k bug fixes from Andreas Schwab.
218 Patch for DU assembler compatibility for the Alpha from Richard
219 Henderson.
220
2211.18 Apr-17-98
222 Bug fixes and MIPS configuration changes.
223
2241.17 Feb-24-98
225 Bug fixes and m68k port from Andreas Schwab. PowerPC port from
226 Geoffrey Keating. Various bug x86, Sparc and MIPS bug fixes.
227
2281.16 Feb-11-98
229 Richard Henderson produces Alpha port.
230
2311.15 Dec-4-97
232 Fixed an n32 ABI bug. New libtool, auto* support.
233
2341.14 May-13-97
235 libtool is now used to generate shared and static libraries.
236 Fixed a minor portability problem reported by Russ McManus
237 <mcmanr@eq.gs.com>.
238
2391.13 Dec-2-96
240 Added --enable-purify-safety to keep Purify from complaining
241 about certain low level code.
242 Sparc fix for calling functions with < 6 args.
243 Linux x86 a.out fix.
244
2451.12 Nov-22-96
246 Added missing ffi_type_void, needed for supporting void return
247 types. Fixed test case for non MIPS machines. Cygnus Support
248 is now Cygnus Solutions.
249
2501.11 Oct-30-96
251 Added notes about GNU make.
252
2531.10 Oct-29-96
254 Added configuration fix for non GNU compilers.
255
2561.09 Oct-29-96
257 Added --enable-debug configure switch. Clean-ups based on LCLint
258 feedback. ffi_mips.h is always installed. Many configuration
259 fixes. Fixed ffitest.c for sparc builds.
260
2611.08 Oct-15-96
262 Fixed n32 problem. Many clean-ups.
263
2641.07 Oct-14-96
265 Gordon Irlam rewrites v8.S again. Bug fixes.
266
2671.06 Oct-14-96
268 Gordon Irlam improved the sparc port.
269
2701.05 Oct-14-96
271 Interface changes based on feedback.
272
2731.04 Oct-11-96
274 Sparc port complete (modulo struct passing bug).
275
2761.03 Oct-10-96
277 Passing struct args, and returning struct values works for
278 all architectures/calling conventions. Expanded tests.
279
2801.02 Oct-9-96
281 Added SGI n32 support. Fixed bugs in both o32 and Linux support.
282 Added "make test".
283
2841.01 Oct-8-96
285 Fixed float passing bug in mips version. Restructured some
286 of the code. Builds cleanly with SGI tools.
287
2881.00 Oct-7-96
289 First release. No public announcement.
290
291
292Authors & Credits
293=================
294
Anthony Greenda11bec2009-12-24 05:34:46 -0500295libffi was originally written by Anthony Green <green@redhat.com>.
Anthony Greenc6dddbd2009-10-04 08:11:33 -0400296
297The developers of the GNU Compiler Collection project have made
298innumerable valuable contributions. See the ChangeLog file for
299details.
300
301Some of the ideas behind libffi were inspired by Gianni Mariani's free
302gencall library for Silicon Graphics machines.
303
304The closure mechanism was designed and implemented by Kresten Krab
305Thorup.
306
307Major processor architecture ports were contributed by the following
308developers:
309
310alpha Richard Henderson
311arm Raffaele Sena
312cris Simon Posnjak, Hans-Peter Nilsson
313frv Anthony Green
314ia64 Hans Boehm
315m32r Kazuhiro Inaoka
316m68k Andreas Schwab
317mips Anthony Green, Casey Marshall
318mips64 David Daney
319pa Randolph Chung, Dave Anglin, Andreas Tobler
320powerpc Geoffrey Keating, Andreas Tobler,
321 David Edelsohn, John Hornkvist
322powerpc64 Jakub Jelinek
323s390 Gerhard Tonn, Ulrich Weigand
324sh Kaz Kojima
325sh64 Kaz Kojima
326sparc Anthony Green, Gordon Irlam
327x86 Anthony Green, Jon Beniston
328x86-64 Bo Thorsen
329
330Jesper Skov and Andrew Haley both did more than their fair share of
331stepping through the code and tracking down bugs.
332
333Thanks also to Tom Tromey for bug fixes, documentation and
334configuration help.
335
336Thanks to Jim Blandy, who provided some useful feedback on the libffi
337interface.
338
339Andreas Tobler has done a tremendous amount of work on the testsuite.
340
341Alex Oliva solved the executable page problem for SElinux.
342
343The list above is almost certainly incomplete and inaccurate. I'm
344happy to make corrections or additions upon request.
345
346If you have a problem, or have found a bug, please send a note to
347green@redhat.com.