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