1 This directory contains the libffi package, which is not part of GCC but
2 shipped with GCC as convenience.
7 libffi-3.0.9 was released on December 31, 2009. Check the libffi web
8 page for updates: <URL:http://sourceware.org/libffi/>.
14 Compilers for high level languages generate code that follow certain
15 conventions. These conventions are necessary, in part, for separate
16 compilation to work. One such convention is the "calling
17 convention". The "calling convention" is essentially a set of
18 assumptions made by the compiler about where function arguments will
19 be found on entry to a function. A "calling convention" also specifies
20 where the return value for a function is found.
22 Some programs may not know at the time of compilation what arguments
23 are to be passed to a function. For instance, an interpreter may be
24 told at run-time about the number and types of arguments used to call
25 a given function. Libffi can be used in such programs to provide a
26 bridge from the interpreter program to compiled code.
28 The libffi library provides a portable, high level programming
29 interface to various calling conventions. This allows a programmer to
30 call any function specified by a call interface description at run
33 FFI stands for Foreign Function Interface. A foreign function
34 interface is the popular name for the interface that allows code
35 written in one language to call code written in another language. The
36 libffi library really only provides the lowest, machine dependent
37 layer of a fully featured foreign function interface. A layer must
38 exist above libffi that handles type conversions for values passed
39 between the two languages.
45 Libffi has been ported to many different platforms.
46 For specific configuration details and testing status, please
47 refer to the wiki page here:
49 http://www.moxielogic.org/wiki/index.php?title=Libffi_3.0.9
51 At the time of release, the following basic configurations have been
54 |--------------+------------------|
55 | Architecture | Operating System |
56 |--------------+------------------|
82 | X86 | Windows/Cygwin |
83 | X86 | Windows/MingW |
87 |--------------+------------------|
89 Please send additional platform test results to
90 libffi-discuss@sourceware.org and feel free to update the wiki page
96 First you must configure the distribution for your particular
97 system. Go to the directory you wish to build libffi in and run the
98 "configure" program found in the root directory of the libffi source
101 You may want to tell configure where to install the libffi library and
102 header files. To do that, use the --prefix configure switch. Libffi
103 will install under /usr/local by default.
105 If you want to enable extra run-time debugging checks use the the
106 --enable-debug configure switch. This is useful when your program dies
107 mysteriously while using libffi.
109 Another useful configure switch is --enable-purify-safety. Using this
110 will add some extra code which will suppress certain warnings when you
111 are using Purify with libffi. Only use this switch when using
112 Purify, as it will slow down the library.
114 It's also possible to build libffi on Windows platforms with
115 Microsoft's Visual C++ compiler. In this case, use the msvcc.sh
116 wrapper script during configuration like so:
118 path/to/configure --enable-shared --enable-static \
119 CC=path/to/msvcc.sh LD=link \
120 CPP=\"cl -nologo -EP\"
122 Configure has many other options. Use "configure --help" to see them all.
124 Once configure has finished, type "make". Note that you must be using
125 GNU make. You can ftp GNU make from prep.ai.mit.edu:/pub/gnu.
127 To ensure that libffi is working as advertised, type "make check".
128 This will require that you have DejaGNU installed.
130 To install the library and header files, type "make install".
136 See the ChangeLog files for details.
139 Fix the N64 build on mips-sgi-irix6.5.
140 Testsuite fixes for Tru64 Unix.
141 Enable builds with Microsoft's compiler.
142 Enable x86 builds with Sun's compiler.
145 Add AVR32 and win64 ports. Add ARM softfp support.
146 Many fixes for AIX, Solaris, HP-UX, *BSD.
147 Several PowerPC and x86-64 bug fixes.
148 Build DLL for windows.
151 Add *BSD, BeOS, and PA-Linux support.
155 (thanks to Andreas Tobler)
158 Fix for closures on sh.
159 Mark the sh/sh64 stack as non-executable.
160 (both thanks to Kaz Kojima)
164 Fix #define ARM for IcedTea users.
168 Fix x86 OpenBSD configury.
171 Enable x86 OpenBSD thanks to Thomas Heller, and
172 x86-64 FreeBSD thanks to Björn König and Andreas Tobler.
173 Clean up test instruction in README.
176 Improved x86 FreeBSD support.
177 Thanks to Björn König.
180 Fix instruction cache flushing bug on MIPS.
181 Thanks to David Daney.
184 Many changes, mostly thanks to the GCC project.
185 Cygnus Solutions is now Red Hat.
190 Raffaele Sena produces ARM port.
193 Fixed x86 long double and long long return support.
194 m68k bug fixes from Andreas Schwab.
195 Patch for DU assembler compatibility for the Alpha from Richard
199 Bug fixes and MIPS configuration changes.
202 Bug fixes and m68k port from Andreas Schwab. PowerPC port from
203 Geoffrey Keating. Various bug x86, Sparc and MIPS bug fixes.
206 Richard Henderson produces Alpha port.
209 Fixed an n32 ABI bug. New libtool, auto* support.
212 libtool is now used to generate shared and static libraries.
213 Fixed a minor portability problem reported by Russ McManus
217 Added --enable-purify-safety to keep Purify from complaining
218 about certain low level code.
219 Sparc fix for calling functions with < 6 args.
223 Added missing ffi_type_void, needed for supporting void return
224 types. Fixed test case for non MIPS machines. Cygnus Support
225 is now Cygnus Solutions.
228 Added notes about GNU make.
231 Added configuration fix for non GNU compilers.
234 Added --enable-debug configure switch. Clean-ups based on LCLint
235 feedback. ffi_mips.h is always installed. Many configuration
236 fixes. Fixed ffitest.c for sparc builds.
239 Fixed n32 problem. Many clean-ups.
242 Gordon Irlam rewrites v8.S again. Bug fixes.
245 Gordon Irlam improved the sparc port.
248 Interface changes based on feedback.
251 Sparc port complete (modulo struct passing bug).
254 Passing struct args, and returning struct values works for
255 all architectures/calling conventions. Expanded tests.
258 Added SGI n32 support. Fixed bugs in both o32 and Linux support.
262 Fixed float passing bug in mips version. Restructured some
263 of the code. Builds cleanly with SGI tools.
266 First release. No public announcement.
272 libffi was originally written by Anthony Green <green@redhat.com>.
274 The developers of the GNU Compiler Collection project have made
275 innumerable valuable contributions. See the ChangeLog file for
278 Some of the ideas behind libffi were inspired by Gianni Mariani's free
279 gencall library for Silicon Graphics machines.
281 The closure mechanism was designed and implemented by Kresten Krab
284 Major processor architecture ports were contributed by the following
287 alpha Richard Henderson
289 cris Simon Posnjak, Hans-Peter Nilsson
294 mips Anthony Green, Casey Marshall
296 pa Randolph Chung, Dave Anglin, Andreas Tobler
297 powerpc Geoffrey Keating, Andreas Tobler,
298 David Edelsohn, John Hornkvist
299 powerpc64 Jakub Jelinek
300 s390 Gerhard Tonn, Ulrich Weigand
303 sparc Anthony Green, Gordon Irlam
304 x86 Anthony Green, Jon Beniston
307 Jesper Skov and Andrew Haley both did more than their fair share of
308 stepping through the code and tracking down bugs.
310 Thanks also to Tom Tromey for bug fixes, documentation and
313 Thanks to Jim Blandy, who provided some useful feedback on the libffi
316 Andreas Tobler has done a tremendous amount of work on the testsuite.
318 Alex Oliva solved the executable page problem for SElinux.
320 The list above is almost certainly incomplete and inaccurate. I'm
321 happy to make corrections or additions upon request.
323 If you have a problem, or have found a bug, please send a note to