]> gcc.gnu.org Git - gcc.git/blame - libffi/README
re PR libffi/41908 (closures fail for some structure arguments containing floats)
[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
062b8279 64 x86-64 mingw
491e6ad1
AH
65 x86-64 darwin
66 x86-64 linux
67 x86-64 OS X
68 x86-64 freebsd
69 x86-64 solaris
70
71Please send additional platform test results to
72libffi-discuss@sourceware.org.
63e5e3e0
AG
73
74Installing libffi
75=================
76
77[Note: before actually performing any of these installation steps,
78 you may wish to read the "Platform Specific Notes" below.]
79
80First you must configure the distribution for your particular
81system. Go to the directory you wish to build libffi in and run the
82"configure" program found in the root directory of the libffi source
83distribution.
84
85You may want to tell configure where to install the libffi library and
86header files. To do that, use the --prefix configure switch. Libffi
87will install under /usr/local by default.
88
89If you want to enable extra run-time debugging checks use the the
90--enable-debug configure switch. This is useful when your program dies
91mysteriously while using libffi.
92
93Another useful configure switch is --enable-purify-safety. Using this
94will add some extra code which will suppress certain warnings when you
95are using Purify with libffi. Only use this switch when using
96Purify, as it will slow down the library.
97
98Configure has many other options. Use "configure --help" to see them all.
99
100Once configure has finished, type "make". Note that you must be using
491e6ad1 101GNU make. You can ftp GNU make from prep.ai.mit.edu:/pub/gnu.
63e5e3e0 102
491e6ad1
AH
103To ensure that libffi is working as advertised, type "make check".
104This will require that you have DejaGNU installed.
63e5e3e0
AG
105
106To install the library and header files, type "make install".
107
108
63e5e3e0
AG
109Platform Specific Notes
110=======================
111
63e5e3e0
AG
112 MIPS - Irix 5.3 & 6.x
113 ---------------------
114
115Irix 6.2 and better supports three different calling conventions: o32,
116n32 and n64. Currently, libffi only supports both o32 and n32 under
117Irix 6.x, but only o32 under Irix 5.3. Libffi will automatically be
118configured for whichever calling convention it was built for.
119
120By default, the configure script will try to build libffi with the GNU
121development tools. To build libffi with the SGI development tools, set
122the environment variable CC to either "cc -32" or "cc -n32" before
123running configure under Irix 6.x (depending on whether you want an o32
124or n32 library), or just "cc" for Irix 5.3.
125
126With the n32 calling convention, when returning structures smaller
127than 16 bytes, be sure to provide an RVALUE that is 8 byte aligned.
128Here's one way of forcing this:
129
130 double struct_storage[2];
131 my_small_struct *s = (my_small_struct *) struct_storage;
132 /* Use s for RVALUE */
133
134If you don't do this you are liable to get spurious bus errors.
135
136"long long" values are not supported yet.
137
138You must use GNU Make to build libffi on SGI platforms.
139
63e5e3e0
AG
140
141 PowerPC System V ABI
142 --------------------
143
144There are two `System V ABI's which libffi implements for PowerPC.
145They differ only in how small structures are returned from functions.
146
147In the FFI_SYSV version, structures that are 8 bytes or smaller are
148returned in registers. This is what GCC does when it is configured
149for solaris, and is what the System V ABI I have (dated September
1501995) says.
151
152In the FFI_GCC_SYSV version, all structures are returned the same way:
153by passing a pointer as the first argument to the function. This is
154what GCC does when it is configured for linux or a generic sysv
155target.
156
157EGCS 1.0.1 (and probably other versions of EGCS/GCC) also has a
158inconsistency with the SysV ABI: When a procedure is called with many
159floating-point arguments, some of them get put on the stack. They are
160all supposed to be stored in double-precision format, even if they are
161only single-precision, but EGCS stores single-precision arguments as
162single-precision anyway. This causes one test to fail (the `many
163arguments' test).
164
165
63e5e3e0
AG
166History
167=======
168
491e6ad1
AH
1693.0.7 Nov-11-08
170 Fix for ppc FreeBSD.
171 (thanks to Andreas Tobler)
172
1733.0.6 Jul-17-08
174 Fix for closures on sh.
175 Mark the sh/sh64 stack as non-executable.
176 (both thanks to Kaz Kojima)
177
1783.0.5 Apr-3-08
179 Fix libffi.pc file.
180 Fix #define ARM for IcedTea users.
181 Fix x86 closure bug.
182
1833.0.4 Feb-24-08
184 Fix x86 OpenBSD configury.
185
1863.0.3 Feb-22-08
187 Enable x86 OpenBSD thanks to Thomas Heller, and
188 x86-64 FreeBSD thanks to Björn König and Andreas Tobler.
189 Clean up test instruction in README.
190
1913.0.2 Feb-21-08
192 Improved x86 FreeBSD support.
193 Thanks to Björn König.
194
1953.0.1 Feb-15-08
196 Fix instruction cache flushing bug on MIPS.
197 Thanks to David Daney.
198
1993.0.0 Feb-15-08
200 Many changes, mostly thanks to the GCC project.
201 Cygnus Solutions is now Red Hat.
202
203 [10 years go by...]
204
63e5e3e0
AG
2051.20 Oct-5-98
206 Raffaele Sena produces ARM port.
207
2081.19 Oct-5-98
209 Fixed x86 long double and long long return support.
210 m68k bug fixes from Andreas Schwab.
211 Patch for DU assembler compatibility for the Alpha from Richard
212 Henderson.
213
2141.18 Apr-17-98
215 Bug fixes and MIPS configuration changes.
216
2171.17 Feb-24-98
218 Bug fixes and m68k port from Andreas Schwab. PowerPC port from
219 Geoffrey Keating. Various bug x86, Sparc and MIPS bug fixes.
220
2211.16 Feb-11-98
222 Richard Henderson produces Alpha port.
223
2241.15 Dec-4-97
225 Fixed an n32 ABI bug. New libtool, auto* support.
226
2271.14 May-13-97
228 libtool is now used to generate shared and static libraries.
229 Fixed a minor portability problem reported by Russ McManus
230 <mcmanr@eq.gs.com>.
231
2321.13 Dec-2-96
233 Added --enable-purify-safety to keep Purify from complaining
234 about certain low level code.
235 Sparc fix for calling functions with < 6 args.
236 Linux x86 a.out fix.
237
2381.12 Nov-22-96
239 Added missing ffi_type_void, needed for supporting void return
240 types. Fixed test case for non MIPS machines. Cygnus Support
241 is now Cygnus Solutions.
242
2431.11 Oct-30-96
244 Added notes about GNU make.
245
2461.10 Oct-29-96
247 Added configuration fix for non GNU compilers.
248
2491.09 Oct-29-96
250 Added --enable-debug configure switch. Clean-ups based on LCLint
251 feedback. ffi_mips.h is always installed. Many configuration
252 fixes. Fixed ffitest.c for sparc builds.
253
2541.08 Oct-15-96
255 Fixed n32 problem. Many clean-ups.
256
2571.07 Oct-14-96
258 Gordon Irlam rewrites v8.S again. Bug fixes.
259
2601.06 Oct-14-96
261 Gordon Irlam improved the sparc port.
262
2631.05 Oct-14-96
264 Interface changes based on feedback.
265
2661.04 Oct-11-96
267 Sparc port complete (modulo struct passing bug).
268
2691.03 Oct-10-96
270 Passing struct args, and returning struct values works for
271 all architectures/calling conventions. Expanded tests.
272
2731.02 Oct-9-96
274 Added SGI n32 support. Fixed bugs in both o32 and Linux support.
275 Added "make test".
276
2771.01 Oct-8-96
278 Fixed float passing bug in mips version. Restructured some
279 of the code. Builds cleanly with SGI tools.
280
2811.00 Oct-7-96
282 First release. No public announcement.
283
284
285Authors & Credits
286=================
287
491e6ad1
AH
288libffi was originally written by Anthony Green <green@redhat.com>.
289
290The developers of the GNU Compiler Collection project have made
291innumerable valuable contributions. See the ChangeLog file for
292details.
63e5e3e0 293
491e6ad1
AH
294Some of the ideas behind libffi were inspired by Gianni Mariani's free
295gencall library for Silicon Graphics machines.
63e5e3e0
AG
296
297The closure mechanism was designed and implemented by Kresten Krab
298Thorup.
299
491e6ad1
AH
300Major processor architecture ports were contributed by the following
301developers:
302
303alpha Richard Henderson
304arm Raffaele Sena
305cris Simon Posnjak, Hans-Peter Nilsson
306frv Anthony Green
307ia64 Hans Boehm
308m32r Kazuhiro Inaoka
309m68k Andreas Schwab
310mips Anthony Green, Casey Marshall
311mips64 David Daney
312pa Randolph Chung, Dave Anglin, Andreas Tobler
313powerpc Geoffrey Keating, Andreas Tobler,
314 David Edelsohn, John Hornkvist
315powerpc64 Jakub Jelinek
316s390 Gerhard Tonn, Ulrich Weigand
317sh Kaz Kojima
318sh64 Kaz Kojima
319sparc Anthony Green, Gordon Irlam
320x86 Anthony Green, Jon Beniston
321x86-64 Bo Thorsen
63e5e3e0
AG
322
323Jesper Skov and Andrew Haley both did more than their fair share of
324stepping through the code and tracking down bugs.
325
491e6ad1
AH
326Thanks also to Tom Tromey for bug fixes, documentation and
327configuration help.
63e5e3e0
AG
328
329Thanks to Jim Blandy, who provided some useful feedback on the libffi
330interface.
331
491e6ad1
AH
332Andreas Tobler has done a tremendous amount of work on the testsuite.
333
334Alex Oliva solved the executable page problem for SElinux.
335
336The list above is almost certainly incomplete and inaccurate. I'm
337happy to make corrections or additions upon request.
338
63e5e3e0 339If you have a problem, or have found a bug, please send a note to
491e6ad1 340green@redhat.com.
This page took 0.704843 seconds and 5 git commands to generate.