1Status
2======
3
4libffi-3.0.13 was released on March 17, 2013. 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
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.
43For specific configuration details and testing status, please
44refer to the wiki page here:
45
46 http://www.moxielogic.org/wiki/index.php?title=Libffi_3.0.13
47
48At the time of release, the following basic configurations have been
49tested:
50
51|-----------------+------------------+-------------------------|
52| Architecture | Operating System | Compiler |
53|-----------------+------------------+-------------------------|
54| AArch64 | Linux | GCC |
55| Alpha | Linux | GCC |
56| Alpha | Tru64 | GCC |
57| ARM | Linux | GCC |
58| ARM | iOS | GCC |
59| AVR32 | Linux | GCC |
60| Blackfin | uClinux | GCC |
61| HPPA | HPUX | GCC |
62| IA-64 | Linux | GCC |
63| M68K | FreeMiNT | GCC |
64| M68K | Linux | GCC |
65| M68K | RTEMS | GCC |
66| Meta | Linux | GCC |
67| MicroBlaze | Linux | GCC |
68| MIPS | IRIX | GCC |
69| MIPS | Linux | GCC |
70| MIPS | RTEMS | GCC |
71| MIPS64 | Linux | GCC |
72| Moxie | Bare metal | GCC
73| PowerPC 32-bit | AIX | IBM XL C |
74| PowerPC 64-bit | AIX | IBM XL C |
75| PowerPC | AMIGA | GCC |
76| PowerPC | Linux | GCC |
77| PowerPC | Mac OSX | GCC |
78| PowerPC | FreeBSD | GCC |
79| PowerPC 64-bit | FreeBSD | GCC |
80| PowerPC 64-bit | Linux | GCC |
81| S390 | Linux | GCC |
82| S390X | Linux | GCC |
83| SPARC | Linux | GCC |
84| SPARC | Solaris | GCC |
85| SPARC | Solaris | Oracle Solaris Studio C |
86| SPARC64 | Linux | GCC |
87| SPARC64 | FreeBSD | GCC |
88| SPARC64 | Solaris | Oracle Solaris Studio C |
89| TILE-Gx/TILEPro | Linux | GCC |
90| X86 | FreeBSD | GCC |
91| X86 | GNU HURD | GCC |
92| X86 | Interix | GCC |
93| X86 | kFreeBSD | GCC |
94| X86 | Linux | GCC |
95| X86 | Mac OSX | GCC |
96| X86 | OpenBSD | GCC |
97| X86 | OS/2 | GCC |
98| X86 | Solaris | GCC |
99| X86 | Solaris | Oracle Solaris Studio C |
100| X86 | Windows/Cygwin | GCC |
101| X86 | Windows/MingW | GCC |
102| X86-64 | FreeBSD | GCC |
103| X86-64 | Linux | GCC |
104| X86-64 | Linux/x32 | GCC |
105| X86-64 | OpenBSD | GCC |
106| X86-64 | Solaris | Oracle Solaris Studio C |
107| X86-64 | Windows/MingW | GCC |
108| Xtensa | Linux | GCC |
109|-----------------+------------------+-------------------------|
110
111Please send additional platform test results to
112libffi-discuss@sourceware.org and feel free to update the wiki page
113above.
114
115Installing libffi
116=================
117
118First you must configure the distribution for your particular
119system. Go to the directory you wish to build libffi in and run the
120"configure" program found in the root directory of the libffi source
121distribution.
122
123You may want to tell configure where to install the libffi library and
124header files. To do that, use the --prefix configure switch. Libffi
125will install under /usr/local by default.
126
127If you want to enable extra run-time debugging checks use the the
128--enable-debug configure switch. This is useful when your program dies
129mysteriously while using libffi.
130
131Another useful configure switch is --enable-purify-safety. Using this
132will add some extra code which will suppress certain warnings when you
133are using Purify with libffi. Only use this switch when using
134Purify, as it will slow down the library.
135
136It's also possible to build libffi on Windows platforms with
137Microsoft's Visual C++ compiler. In this case, use the msvcc.sh
138wrapper script during configuration like so:
139
140path/to/configure CC=path/to/msvcc.sh LD=link CPP=\"cl -nologo -EP\"
141
142For 64-bit Windows builds, use CC="path/to/msvcc.sh -m64".
143You may also need to specify --build appropriately. When building with MSVC
144under a MingW environment, you may need to remove the line in configure
145that sets 'fix_srcfile_path' to a 'cygpath' command. ('cygpath' is not
146present in MingW, and is not required when using MingW-style paths.)
147
148For iOS builds, the 'libffi.xcodeproj' Xcode project is available.
149
150Configure has many other options. Use "configure --help" to see them all.
151
152Once configure has finished, type "make". Note that you must be using
153GNU make. You can ftp GNU make from ftp.gnu.org:/pub/gnu/make .
154
155To ensure that libffi is working as advertised, type "make check".
156This will require that you have DejaGNU installed.
157
158To install the library and header files, type "make install".
159
160
161History
162=======
163
164See the ChangeLog files for details.
165
1663.0.13 Mar-17-13
167 Add Meta support.
168 Add missing Moxie bits.
169 Fix stack alignment bug on 32-bit x86.
170 Build fix for m68000 targets.
171 Build fix for soft-float Power targets.
172 Fix the install dir location for some platforms when building
173 with GCC (OS X, Solaris).
174 Fix Cygwin regression.
175
1763.0.12 Feb-11-13
177 Add Moxie support.
178 Add AArch64 support.
179 Add Blackfin support.
180 Add TILE-Gx/TILEPro support.
181 Add MicroBlaze support.
182 Add Xtensa support.
183 Add support for PaX enabled kernels with MPROTECT.
184 Add support for native vendor compilers on
185 Solaris and AIX.
186 Work around LLVM/GCC interoperability issue on x86_64.
187
1883.0.11 Apr-11-12
189 Lots of build fixes.
190 Add Amiga newer MacOS support.
191 Add support for variadic functions (ffi_prep_cif_var).
192 Add Linux/x32 support.
193 Add thiscall, fastcall and MSVC cdecl support on Windows.
194 Add Amiga and newer MacOS support.
195 Add m68k FreeMiNT support.
196 Integration with iOS' xcode build tools.
197 Fix Octeon and MC68881 support.
198 Fix code pessimizations.
199
2003.0.10 Aug-23-11
201 Add support for Apple's iOS.
202 Add support for ARM VFP ABI.
203 Add RTEMS support for MIPS and M68K.
204 Fix instruction cache clearing problems on
205 ARM and SPARC.
206 Fix the N64 build on mips-sgi-irix6.5.
207 Enable builds with Microsoft's compiler.
208 Enable x86 builds with Oracle's Solaris compiler.
209 Fix support for calling code compiled with Oracle's Sparc
210 Solaris compiler.
211 Testsuite fixes for Tru64 Unix.
212 Additional platform support.
213
2143.0.9 Dec-31-09
215 Add AVR32 and win64 ports. Add ARM softfp support.
216 Many fixes for AIX, Solaris, HP-UX, *BSD.
217 Several PowerPC and x86-64 bug fixes.
218 Build DLL for windows.
219
2203.0.8 Dec-19-08
221 Add *BSD, BeOS, and PA-Linux support.
222
2233.0.7 Nov-11-08
224 Fix for ppc FreeBSD.
225 (thanks to Andreas Tobler)
226
2273.0.6 Jul-17-08
228 Fix for closures on sh.
229 Mark the sh/sh64 stack as non-executable.
230 (both thanks to Kaz Kojima)
231
2323.0.5 Apr-3-08
233 Fix libffi.pc file.
234 Fix #define ARM for IcedTea users.
235 Fix x86 closure bug.
236
2373.0.4 Feb-24-08
238 Fix x86 OpenBSD configury.
239
2403.0.3 Feb-22-08
241 Enable x86 OpenBSD thanks to Thomas Heller, and
242 x86-64 FreeBSD thanks to Björn König and Andreas Tobler.
243 Clean up test instruction in README.
244
2453.0.2 Feb-21-08
246 Improved x86 FreeBSD support.
247 Thanks to Björn König.
248
2493.0.1 Feb-15-08
250 Fix instruction cache flushing bug on MIPS.
251 Thanks to David Daney.
252
2533.0.0 Feb-15-08
254 Many changes, mostly thanks to the GCC project.
255 Cygnus Solutions is now Red Hat.
256
257 [10 years go by...]
258
2591.20 Oct-5-98
260 Raffaele Sena produces ARM port.
261
2621.19 Oct-5-98
263 Fixed x86 long double and long long return support.
264 m68k bug fixes from Andreas Schwab.
265 Patch for DU assembler compatibility for the Alpha from Richard
266 Henderson.
267
2681.18 Apr-17-98
269 Bug fixes and MIPS configuration changes.
270
2711.17 Feb-24-98
272 Bug fixes and m68k port from Andreas Schwab. PowerPC port from
273 Geoffrey Keating. Various bug x86, Sparc and MIPS bug fixes.
274
2751.16 Feb-11-98
276 Richard Henderson produces Alpha port.
277
2781.15 Dec-4-97
279 Fixed an n32 ABI bug. New libtool, auto* support.
280
2811.14 May-13-97
282 libtool is now used to generate shared and static libraries.
283 Fixed a minor portability problem reported by Russ McManus
284 <mcmanr@eq.gs.com>.
285
2861.13 Dec-2-96
287 Added --enable-purify-safety to keep Purify from complaining
288 about certain low level code.
289 Sparc fix for calling functions with < 6 args.
290 Linux x86 a.out fix.
291
2921.12 Nov-22-96
293 Added missing ffi_type_void, needed for supporting void return
294 types. Fixed test case for non MIPS machines. Cygnus Support
295 is now Cygnus Solutions.
296
2971.11 Oct-30-96
298 Added notes about GNU make.
299
3001.10 Oct-29-96
301 Added configuration fix for non GNU compilers.
302
3031.09 Oct-29-96
304 Added --enable-debug configure switch. Clean-ups based on LCLint
305 feedback. ffi_mips.h is always installed. Many configuration
306 fixes. Fixed ffitest.c for sparc builds.
307
3081.08 Oct-15-96
309 Fixed n32 problem. Many clean-ups.
310
3111.07 Oct-14-96
312 Gordon Irlam rewrites v8.S again. Bug fixes.
313
3141.06 Oct-14-96
315 Gordon Irlam improved the sparc port.
316
3171.05 Oct-14-96
318 Interface changes based on feedback.
319
3201.04 Oct-11-96
321 Sparc port complete (modulo struct passing bug).
322
3231.03 Oct-10-96
324 Passing struct args, and returning struct values works for
325 all architectures/calling conventions. Expanded tests.
326
3271.02 Oct-9-96
328 Added SGI n32 support. Fixed bugs in both o32 and Linux support.
329 Added "make test".
330
3311.01 Oct-8-96
332 Fixed float passing bug in mips version. Restructured some
333 of the code. Builds cleanly with SGI tools.
334
3351.00 Oct-7-96
336 First release. No public announcement.
337
338
339Authors & Credits
340=================
341
342libffi was originally written by Anthony Green <green@redhat.com>.
343
344The developers of the GNU Compiler Collection project have made
345innumerable valuable contributions. See the ChangeLog file for
346details.
347
348Some of the ideas behind libffi were inspired by Gianni Mariani's free
349gencall library for Silicon Graphics machines.
350
351The closure mechanism was designed and implemented by Kresten Krab
352Thorup.
353
354Major processor architecture ports were contributed by the following
355developers:
356
357aarch64 Marcus Shawcroft, James Greenhalgh
358alpha Richard Henderson
359arm Raffaele Sena
360blackfin Alexandre Keunecke I. de Mendonca
361cris Simon Posnjak, Hans-Peter Nilsson
362frv Anthony Green
363ia64 Hans Boehm
364m32r Kazuhiro Inaoka
365m68k Andreas Schwab
366microblaze Nathan Rossi
367mips Anthony Green, Casey Marshall
368mips64 David Daney
369moxie Anthony Green
370pa Randolph Chung, Dave Anglin, Andreas Tobler
371powerpc Geoffrey Keating, Andreas Tobler,
372 David Edelsohn, John Hornkvist
373powerpc64 Jakub Jelinek
374s390 Gerhard Tonn, Ulrich Weigand
375sh Kaz Kojima
376sh64 Kaz Kojima
377sparc Anthony Green, Gordon Irlam
378tile-gx/tilepro Walter Lee
379x86 Anthony Green, Jon Beniston
380x86-64 Bo Thorsen
381xtensa Chris Zankel
382
383Jesper Skov and Andrew Haley both did more than their fair share of
384stepping through the code and tracking down bugs.
385
386Thanks also to Tom Tromey for bug fixes, documentation and
387configuration help.
388
389Thanks to Jim Blandy, who provided some useful feedback on the libffi
390interface.
391
392Andreas Tobler has done a tremendous amount of work on the testsuite.
393
394Alex Oliva solved the executable page problem for SElinux.
395
396The list above is almost certainly incomplete and inaccurate. I'm
397happy to make corrections or additions upon request.
398
399If you have a problem, or have found a bug, please send a note to the
400author at green@moxielogic.com, or the project mailing list at
401libffi-discuss@sourceware.org.
402