1 |
732 |
jeremybenn |
This directory contains the libffi package, which is not part of GCC but
|
2 |
|
|
shipped with GCC as convenience.
|
3 |
|
|
|
4 |
|
|
Status
|
5 |
|
|
======
|
6 |
|
|
|
7 |
|
|
libffi-3.0.9 was released on December 31, 2009. Check the libffi web
|
8 |
|
|
page for updates: .
|
9 |
|
|
|
10 |
|
|
|
11 |
|
|
What is libffi?
|
12 |
|
|
===============
|
13 |
|
|
|
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.
|
21 |
|
|
|
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.
|
27 |
|
|
|
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
|
31 |
|
|
time.
|
32 |
|
|
|
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.
|
40 |
|
|
|
41 |
|
|
|
42 |
|
|
Supported Platforms
|
43 |
|
|
===================
|
44 |
|
|
|
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:
|
48 |
|
|
|
49 |
|
|
http://www.moxielogic.org/wiki/index.php?title=Libffi_3.0.9
|
50 |
|
|
|
51 |
|
|
At the time of release, the following basic configurations have been
|
52 |
|
|
tested:
|
53 |
|
|
|
54 |
|
|
|--------------+------------------|
|
55 |
|
|
| Architecture | Operating System |
|
56 |
|
|
|--------------+------------------|
|
57 |
|
|
| Alpha | Linux |
|
58 |
|
|
| ARM | Linux |
|
59 |
|
|
| AVR32 | Linux |
|
60 |
|
|
| HPPA | HPUX |
|
61 |
|
|
| IA-64 | Linux |
|
62 |
|
|
| MIPS | IRIX |
|
63 |
|
|
| MIPS | Linux |
|
64 |
|
|
| MIPS64 | Linux |
|
65 |
|
|
| PowerPC | Linux |
|
66 |
|
|
| PowerPC | Mac OSX |
|
67 |
|
|
| PowerPC | FreeBSD |
|
68 |
|
|
| PowerPC64 | Linux |
|
69 |
|
|
| S390 | Linux |
|
70 |
|
|
| S390X | Linux |
|
71 |
|
|
| SPARC | Linux |
|
72 |
|
|
| SPARC | Solaris |
|
73 |
|
|
| SPARC64 | Linux |
|
74 |
|
|
| SPARC64 | FreeBSD |
|
75 |
|
|
| X86 | FreeBSD |
|
76 |
|
|
| X86 | kFreeBSD |
|
77 |
|
|
| X86 | Linux |
|
78 |
|
|
| X86 | Mac OSX |
|
79 |
|
|
| X86 | OpenBSD |
|
80 |
|
|
| X86 | OS/2 |
|
81 |
|
|
| X86 | Solaris |
|
82 |
|
|
| X86 | Windows/Cygwin |
|
83 |
|
|
| X86 | Windows/MingW |
|
84 |
|
|
| X86-64 | FreeBSD |
|
85 |
|
|
| X86-64 | Linux |
|
86 |
|
|
| X86-64 | OpenBSD |
|
87 |
|
|
|--------------+------------------|
|
88 |
|
|
|
89 |
|
|
Please send additional platform test results to
|
90 |
|
|
libffi-discuss@sourceware.org and feel free to update the wiki page
|
91 |
|
|
above.
|
92 |
|
|
|
93 |
|
|
Installing libffi
|
94 |
|
|
=================
|
95 |
|
|
|
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
|
99 |
|
|
distribution.
|
100 |
|
|
|
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.
|
104 |
|
|
|
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.
|
108 |
|
|
|
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.
|
113 |
|
|
|
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:
|
117 |
|
|
|
118 |
|
|
path/to/configure --enable-shared --enable-static \
|
119 |
|
|
CC=path/to/msvcc.sh LD=link \
|
120 |
|
|
CPP=\"cl -nologo -EP\"
|
121 |
|
|
|
122 |
|
|
Configure has many other options. Use "configure --help" to see them all.
|
123 |
|
|
|
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.
|
126 |
|
|
|
127 |
|
|
To ensure that libffi is working as advertised, type "make check".
|
128 |
|
|
This will require that you have DejaGNU installed.
|
129 |
|
|
|
130 |
|
|
To install the library and header files, type "make install".
|
131 |
|
|
|
132 |
|
|
|
133 |
|
|
History
|
134 |
|
|
=======
|
135 |
|
|
|
136 |
|
|
See the ChangeLog files for details.
|
137 |
|
|
|
138 |
|
|
3.0.10 ???-??-??
|
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.
|
143 |
|
|
|
144 |
|
|
3.0.9 Dec-31-09
|
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.
|
149 |
|
|
|
150 |
|
|
3.0.8 Dec-19-08
|
151 |
|
|
Add *BSD, BeOS, and PA-Linux support.
|
152 |
|
|
|
153 |
|
|
3.0.7 Nov-11-08
|
154 |
|
|
Fix for ppc FreeBSD.
|
155 |
|
|
(thanks to Andreas Tobler)
|
156 |
|
|
|
157 |
|
|
3.0.6 Jul-17-08
|
158 |
|
|
Fix for closures on sh.
|
159 |
|
|
Mark the sh/sh64 stack as non-executable.
|
160 |
|
|
(both thanks to Kaz Kojima)
|
161 |
|
|
|
162 |
|
|
3.0.5 Apr-3-08
|
163 |
|
|
Fix libffi.pc file.
|
164 |
|
|
Fix #define ARM for IcedTea users.
|
165 |
|
|
Fix x86 closure bug.
|
166 |
|
|
|
167 |
|
|
3.0.4 Feb-24-08
|
168 |
|
|
Fix x86 OpenBSD configury.
|
169 |
|
|
|
170 |
|
|
3.0.3 Feb-22-08
|
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.
|
174 |
|
|
|
175 |
|
|
3.0.2 Feb-21-08
|
176 |
|
|
Improved x86 FreeBSD support.
|
177 |
|
|
Thanks to Björn König.
|
178 |
|
|
|
179 |
|
|
3.0.1 Feb-15-08
|
180 |
|
|
Fix instruction cache flushing bug on MIPS.
|
181 |
|
|
Thanks to David Daney.
|
182 |
|
|
|
183 |
|
|
3.0.0 Feb-15-08
|
184 |
|
|
Many changes, mostly thanks to the GCC project.
|
185 |
|
|
Cygnus Solutions is now Red Hat.
|
186 |
|
|
|
187 |
|
|
[10 years go by...]
|
188 |
|
|
|
189 |
|
|
1.20 Oct-5-98
|
190 |
|
|
Raffaele Sena produces ARM port.
|
191 |
|
|
|
192 |
|
|
1.19 Oct-5-98
|
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
|
196 |
|
|
Henderson.
|
197 |
|
|
|
198 |
|
|
1.18 Apr-17-98
|
199 |
|
|
Bug fixes and MIPS configuration changes.
|
200 |
|
|
|
201 |
|
|
1.17 Feb-24-98
|
202 |
|
|
Bug fixes and m68k port from Andreas Schwab. PowerPC port from
|
203 |
|
|
Geoffrey Keating. Various bug x86, Sparc and MIPS bug fixes.
|
204 |
|
|
|
205 |
|
|
1.16 Feb-11-98
|
206 |
|
|
Richard Henderson produces Alpha port.
|
207 |
|
|
|
208 |
|
|
1.15 Dec-4-97
|
209 |
|
|
Fixed an n32 ABI bug. New libtool, auto* support.
|
210 |
|
|
|
211 |
|
|
1.14 May-13-97
|
212 |
|
|
libtool is now used to generate shared and static libraries.
|
213 |
|
|
Fixed a minor portability problem reported by Russ McManus
|
214 |
|
|
.
|
215 |
|
|
|
216 |
|
|
1.13 Dec-2-96
|
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.
|
220 |
|
|
Linux x86 a.out fix.
|
221 |
|
|
|
222 |
|
|
1.12 Nov-22-96
|
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.
|
226 |
|
|
|
227 |
|
|
1.11 Oct-30-96
|
228 |
|
|
Added notes about GNU make.
|
229 |
|
|
|
230 |
|
|
1.10 Oct-29-96
|
231 |
|
|
Added configuration fix for non GNU compilers.
|
232 |
|
|
|
233 |
|
|
1.09 Oct-29-96
|
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.
|
237 |
|
|
|
238 |
|
|
1.08 Oct-15-96
|
239 |
|
|
Fixed n32 problem. Many clean-ups.
|
240 |
|
|
|
241 |
|
|
1.07 Oct-14-96
|
242 |
|
|
Gordon Irlam rewrites v8.S again. Bug fixes.
|
243 |
|
|
|
244 |
|
|
1.06 Oct-14-96
|
245 |
|
|
Gordon Irlam improved the sparc port.
|
246 |
|
|
|
247 |
|
|
1.05 Oct-14-96
|
248 |
|
|
Interface changes based on feedback.
|
249 |
|
|
|
250 |
|
|
1.04 Oct-11-96
|
251 |
|
|
Sparc port complete (modulo struct passing bug).
|
252 |
|
|
|
253 |
|
|
1.03 Oct-10-96
|
254 |
|
|
Passing struct args, and returning struct values works for
|
255 |
|
|
all architectures/calling conventions. Expanded tests.
|
256 |
|
|
|
257 |
|
|
1.02 Oct-9-96
|
258 |
|
|
Added SGI n32 support. Fixed bugs in both o32 and Linux support.
|
259 |
|
|
Added "make test".
|
260 |
|
|
|
261 |
|
|
1.01 Oct-8-96
|
262 |
|
|
Fixed float passing bug in mips version. Restructured some
|
263 |
|
|
of the code. Builds cleanly with SGI tools.
|
264 |
|
|
|
265 |
|
|
1.00 Oct-7-96
|
266 |
|
|
First release. No public announcement.
|
267 |
|
|
|
268 |
|
|
|
269 |
|
|
Authors & Credits
|
270 |
|
|
=================
|
271 |
|
|
|
272 |
|
|
libffi was originally written by Anthony Green .
|
273 |
|
|
|
274 |
|
|
The developers of the GNU Compiler Collection project have made
|
275 |
|
|
innumerable valuable contributions. See the ChangeLog file for
|
276 |
|
|
details.
|
277 |
|
|
|
278 |
|
|
Some of the ideas behind libffi were inspired by Gianni Mariani's free
|
279 |
|
|
gencall library for Silicon Graphics machines.
|
280 |
|
|
|
281 |
|
|
The closure mechanism was designed and implemented by Kresten Krab
|
282 |
|
|
Thorup.
|
283 |
|
|
|
284 |
|
|
Major processor architecture ports were contributed by the following
|
285 |
|
|
developers:
|
286 |
|
|
|
287 |
|
|
alpha Richard Henderson
|
288 |
|
|
arm Raffaele Sena
|
289 |
|
|
cris Simon Posnjak, Hans-Peter Nilsson
|
290 |
|
|
frv Anthony Green
|
291 |
|
|
ia64 Hans Boehm
|
292 |
|
|
m32r Kazuhiro Inaoka
|
293 |
|
|
m68k Andreas Schwab
|
294 |
|
|
mips Anthony Green, Casey Marshall
|
295 |
|
|
mips64 David Daney
|
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
|
301 |
|
|
sh Kaz Kojima
|
302 |
|
|
sh64 Kaz Kojima
|
303 |
|
|
sparc Anthony Green, Gordon Irlam
|
304 |
|
|
x86 Anthony Green, Jon Beniston
|
305 |
|
|
x86-64 Bo Thorsen
|
306 |
|
|
|
307 |
|
|
Jesper Skov and Andrew Haley both did more than their fair share of
|
308 |
|
|
stepping through the code and tracking down bugs.
|
309 |
|
|
|
310 |
|
|
Thanks also to Tom Tromey for bug fixes, documentation and
|
311 |
|
|
configuration help.
|
312 |
|
|
|
313 |
|
|
Thanks to Jim Blandy, who provided some useful feedback on the libffi
|
314 |
|
|
interface.
|
315 |
|
|
|
316 |
|
|
Andreas Tobler has done a tremendous amount of work on the testsuite.
|
317 |
|
|
|
318 |
|
|
Alex Oliva solved the executable page problem for SElinux.
|
319 |
|
|
|
320 |
|
|
The list above is almost certainly incomplete and inaccurate. I'm
|
321 |
|
|
happy to make corrections or additions upon request.
|
322 |
|
|
|
323 |
|
|
If you have a problem, or have found a bug, please send a note to
|
324 |
|
|
green@redhat.com.
|