README 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  1. Status
  2. ======
  3. libffi-4?? was released on TBD. Check the libffi web
  4. page for updates: <URL:http://sourceware.org/libffi/>.
  5. What is libffi?
  6. ===============
  7. Compilers for high level languages generate code that follow certain
  8. conventions. These conventions are necessary, in part, for separate
  9. compilation to work. One such convention is the "calling
  10. convention". The "calling convention" is essentially a set of
  11. assumptions made by the compiler about where function arguments will
  12. be found on entry to a function. A "calling convention" also specifies
  13. where the return value for a function is found.
  14. Some programs may not know at the time of compilation what arguments
  15. are to be passed to a function. For instance, an interpreter may be
  16. told at run-time about the number and types of arguments used to call
  17. a given function. Libffi can be used in such programs to provide a
  18. bridge from the interpreter program to compiled code.
  19. The libffi library provides a portable, high level programming
  20. interface to various calling conventions. This allows a programmer to
  21. call any function specified by a call interface description at run
  22. time.
  23. FFI stands for Foreign Function Interface. A foreign function
  24. interface is the popular name for the interface that allows code
  25. written in one language to call code written in another language. The
  26. libffi library really only provides the lowest, machine dependent
  27. layer of a fully featured foreign function interface. A layer must
  28. exist above libffi that handles type conversions for values passed
  29. between the two languages.
  30. Supported Platforms
  31. ===================
  32. Libffi has been ported to many different platforms.
  33. For specific configuration details and testing status, please
  34. refer to the wiki page here:
  35. http://www.moxielogic.org/wiki/index.php?title=Libffi_3.2
  36. At the time of release, the following basic configurations have been
  37. tested:
  38. |-----------------+------------------+-------------------------|
  39. | Architecture | Operating System | Compiler |
  40. |-----------------+------------------+-------------------------|
  41. | AArch64 (ARM64) | iOS | Clang |
  42. | AArch64 | Linux | GCC |
  43. | Alpha | Linux | GCC |
  44. | Alpha | Tru64 | GCC |
  45. | ARC | Linux | GCC |
  46. | ARM | Linux | GCC |
  47. | ARM | iOS | GCC |
  48. | AVR32 | Linux | GCC |
  49. | Blackfin | uClinux | GCC |
  50. | HPPA | HPUX | GCC |
  51. | IA-64 | Linux | GCC |
  52. | M68K | FreeMiNT | GCC |
  53. | M68K | Linux | GCC |
  54. | M68K | RTEMS | GCC |
  55. | M88K | OpenBSD/mvme88k | GCC |
  56. | Meta | Linux | GCC |
  57. | MicroBlaze | Linux | GCC |
  58. | MIPS | IRIX | GCC |
  59. | MIPS | Linux | GCC |
  60. | MIPS | RTEMS | GCC |
  61. | MIPS64 | Linux | GCC |
  62. | Moxie | Bare metal | GCC |
  63. | Nios II | Linux | GCC |
  64. | OpenRISC | Linux | GCC |
  65. | PowerPC 32-bit | AIX | IBM XL C |
  66. | PowerPC 64-bit | AIX | IBM XL C |
  67. | PowerPC | AMIGA | GCC |
  68. | PowerPC | Linux | GCC |
  69. | PowerPC | Mac OSX | GCC |
  70. | PowerPC | FreeBSD | GCC |
  71. | PowerPC 64-bit | FreeBSD | GCC |
  72. | PowerPC 64-bit | Linux ELFv1 | GCC |
  73. | PowerPC 64-bit | Linux ELFv2 | GCC |
  74. | S390 | Linux | GCC |
  75. | S390X | Linux | GCC |
  76. | SPARC | Linux | GCC |
  77. | SPARC | Solaris | GCC |
  78. | SPARC | Solaris | Oracle Solaris Studio C |
  79. | SPARC64 | Linux | GCC |
  80. | SPARC64 | FreeBSD | GCC |
  81. | SPARC64 | Solaris | Oracle Solaris Studio C |
  82. | TILE-Gx/TILEPro | Linux | GCC |
  83. | VAX | OpenBSD/vax | GCC |
  84. | X86 | FreeBSD | GCC |
  85. | X86 | GNU HURD | GCC |
  86. | X86 | Interix | GCC |
  87. | X86 | kFreeBSD | GCC |
  88. | X86 | Linux | GCC |
  89. | X86 | Mac OSX | GCC |
  90. | X86 | OpenBSD | GCC |
  91. | X86 | OS/2 | GCC |
  92. | X86 | Solaris | GCC |
  93. | X86 | Solaris | Oracle Solaris Studio C |
  94. | X86 | Windows/Cygwin | GCC |
  95. | X86 | Windows/MingW | GCC |
  96. | X86-64 | FreeBSD | GCC |
  97. | X86-64 | Linux | GCC |
  98. | X86-64 | Linux/x32 | GCC |
  99. | X86-64 | OpenBSD | GCC |
  100. | X86-64 | Solaris | Oracle Solaris Studio C |
  101. | X86-64 | Windows/Cygwin | GCC |
  102. | X86-64 | Windows/MingW | GCC |
  103. | Xtensa | Linux | GCC |
  104. |-----------------+------------------+-------------------------|
  105. Please send additional platform test results to
  106. libffi-discuss@sourceware.org and feel free to update the wiki page
  107. above.
  108. Installing libffi
  109. =================
  110. First you must configure the distribution for your particular
  111. system. Go to the directory you wish to build libffi in and run the
  112. "configure" program found in the root directory of the libffi source
  113. distribution.
  114. If you're building libffi directly from version control, configure won't
  115. exist yet; run ./autogen.sh first.
  116. You may want to tell configure where to install the libffi library and
  117. header files. To do that, use the --prefix configure switch. Libffi
  118. will install under /usr/local by default.
  119. If you want to enable extra run-time debugging checks use the the
  120. --enable-debug configure switch. This is useful when your program dies
  121. mysteriously while using libffi.
  122. Another useful configure switch is --enable-purify-safety. Using this
  123. will add some extra code which will suppress certain warnings when you
  124. are using Purify with libffi. Only use this switch when using
  125. Purify, as it will slow down the library.
  126. It's also possible to build libffi on Windows platforms with
  127. Microsoft's Visual C++ compiler. In this case, use the msvcc.sh
  128. wrapper script during configuration like so:
  129. path/to/configure CC=path/to/msvcc.sh CXX=path/to/msvcc.sh LD=link CPP="cl -nologo -EP"
  130. For 64-bit Windows builds, use CC="path/to/msvcc.sh -m64" and
  131. CXX="path/to/msvcc.sh -m64". You may also need to specify --build
  132. appropriately.
  133. It is also possible to build libffi on Windows platforms with the LLVM
  134. project's clang-cl compiler, like below:
  135. path/to/configure CC="path/to/msvcc.sh -clang-cl" CXX="path/to/msvcc.sh -clang-cl" LD=link CPP="clang-cl -EP"
  136. When building with MSVC under a MingW environment, you may need to
  137. remove the line in configure that sets 'fix_srcfile_path' to a 'cygpath'
  138. command. ('cygpath' is not present in MingW, and is not required when
  139. using MingW-style paths.)
  140. For iOS builds, the 'libffi.xcodeproj' Xcode project is available.
  141. Configure has many other options. Use "configure --help" to see them all.
  142. Once configure has finished, type "make". Note that you must be using
  143. GNU make. You can ftp GNU make from ftp.gnu.org:/pub/gnu/make .
  144. To ensure that libffi is working as advertised, type "make check".
  145. This will require that you have DejaGNU installed.
  146. To install the library and header files, type "make install".
  147. History
  148. =======
  149. See the git log for details at http://github.com/atgreen/libffi.
  150. 4.0 TBD
  151. New API in support of GO closures.
  152. 3.2.1 Nov-12-14
  153. Build fix for non-iOS AArch64 targets.
  154. 3.2 Nov-11-14
  155. Add C99 Complex Type support (currently only supported on
  156. s390).
  157. Add support for PASCAL and REGISTER calling conventions on x86
  158. Windows/Linux.
  159. Add OpenRISC and Cygwin-64 support.
  160. Bug fixes.
  161. 3.1 May-19-14
  162. Add AArch64 (ARM64) iOS support.
  163. Add Nios II support.
  164. Add m88k and DEC VAX support.
  165. Add support for stdcall, thiscall, and fastcall on non-Windows
  166. 32-bit x86 targets such as Linux.
  167. Various Android, MIPS N32, x86, FreeBSD and UltraSPARC IIi
  168. fixes.
  169. Make the testsuite more robust: eliminate several spurious
  170. failures, and respect the $CC and $CXX environment variables.
  171. Archive off the manually maintained ChangeLog in favor of git
  172. log.
  173. 3.0.13 Mar-17-13
  174. Add Meta support.
  175. Add missing Moxie bits.
  176. Fix stack alignment bug on 32-bit x86.
  177. Build fix for m68000 targets.
  178. Build fix for soft-float Power targets.
  179. Fix the install dir location for some platforms when building
  180. with GCC (OS X, Solaris).
  181. Fix Cygwin regression.
  182. 3.0.12 Feb-11-13
  183. Add Moxie support.
  184. Add AArch64 support.
  185. Add Blackfin support.
  186. Add TILE-Gx/TILEPro support.
  187. Add MicroBlaze support.
  188. Add Xtensa support.
  189. Add support for PaX enabled kernels with MPROTECT.
  190. Add support for native vendor compilers on
  191. Solaris and AIX.
  192. Work around LLVM/GCC interoperability issue on x86_64.
  193. 3.0.11 Apr-11-12
  194. Lots of build fixes.
  195. Add support for variadic functions (ffi_prep_cif_var).
  196. Add Linux/x32 support.
  197. Add thiscall, fastcall and MSVC cdecl support on Windows.
  198. Add Amiga and newer MacOS support.
  199. Add m68k FreeMiNT support.
  200. Integration with iOS' xcode build tools.
  201. Fix Octeon and MC68881 support.
  202. Fix code pessimizations.
  203. 3.0.10 Aug-23-11
  204. Add support for Apple's iOS.
  205. Add support for ARM VFP ABI.
  206. Add RTEMS support for MIPS and M68K.
  207. Fix instruction cache clearing problems on
  208. ARM and SPARC.
  209. Fix the N64 build on mips-sgi-irix6.5.
  210. Enable builds with Microsoft's compiler.
  211. Enable x86 builds with Oracle's Solaris compiler.
  212. Fix support for calling code compiled with Oracle's Sparc
  213. Solaris compiler.
  214. Testsuite fixes for Tru64 Unix.
  215. Additional platform support.
  216. 3.0.9 Dec-31-09
  217. Add AVR32 and win64 ports. Add ARM softfp support.
  218. Many fixes for AIX, Solaris, HP-UX, *BSD.
  219. Several PowerPC and x86-64 bug fixes.
  220. Build DLL for windows.
  221. 3.0.8 Dec-19-08
  222. Add *BSD, BeOS, and PA-Linux support.
  223. 3.0.7 Nov-11-08
  224. Fix for ppc FreeBSD.
  225. (thanks to Andreas Tobler)
  226. 3.0.6 Jul-17-08
  227. Fix for closures on sh.
  228. Mark the sh/sh64 stack as non-executable.
  229. (both thanks to Kaz Kojima)
  230. 3.0.5 Apr-3-08
  231. Fix libffi.pc file.
  232. Fix #define ARM for IcedTea users.
  233. Fix x86 closure bug.
  234. 3.0.4 Feb-24-08
  235. Fix x86 OpenBSD configury.
  236. 3.0.3 Feb-22-08
  237. Enable x86 OpenBSD thanks to Thomas Heller, and
  238. x86-64 FreeBSD thanks to Björn König and Andreas Tobler.
  239. Clean up test instruction in README.
  240. 3.0.2 Feb-21-08
  241. Improved x86 FreeBSD support.
  242. Thanks to Björn König.
  243. 3.0.1 Feb-15-08
  244. Fix instruction cache flushing bug on MIPS.
  245. Thanks to David Daney.
  246. 3.0.0 Feb-15-08
  247. Many changes, mostly thanks to the GCC project.
  248. Cygnus Solutions is now Red Hat.
  249. [10 years go by...]
  250. 1.20 Oct-5-98
  251. Raffaele Sena produces ARM port.
  252. 1.19 Oct-5-98
  253. Fixed x86 long double and long long return support.
  254. m68k bug fixes from Andreas Schwab.
  255. Patch for DU assembler compatibility for the Alpha from Richard
  256. Henderson.
  257. 1.18 Apr-17-98
  258. Bug fixes and MIPS configuration changes.
  259. 1.17 Feb-24-98
  260. Bug fixes and m68k port from Andreas Schwab. PowerPC port from
  261. Geoffrey Keating. Various bug x86, Sparc and MIPS bug fixes.
  262. 1.16 Feb-11-98
  263. Richard Henderson produces Alpha port.
  264. 1.15 Dec-4-97
  265. Fixed an n32 ABI bug. New libtool, auto* support.
  266. 1.14 May-13-97
  267. libtool is now used to generate shared and static libraries.
  268. Fixed a minor portability problem reported by Russ McManus
  269. <mcmanr@eq.gs.com>.
  270. 1.13 Dec-2-96
  271. Added --enable-purify-safety to keep Purify from complaining
  272. about certain low level code.
  273. Sparc fix for calling functions with < 6 args.
  274. Linux x86 a.out fix.
  275. 1.12 Nov-22-96
  276. Added missing ffi_type_void, needed for supporting void return
  277. types. Fixed test case for non MIPS machines. Cygnus Support
  278. is now Cygnus Solutions.
  279. 1.11 Oct-30-96
  280. Added notes about GNU make.
  281. 1.10 Oct-29-96
  282. Added configuration fix for non GNU compilers.
  283. 1.09 Oct-29-96
  284. Added --enable-debug configure switch. Clean-ups based on LCLint
  285. feedback. ffi_mips.h is always installed. Many configuration
  286. fixes. Fixed ffitest.c for sparc builds.
  287. 1.08 Oct-15-96
  288. Fixed n32 problem. Many clean-ups.
  289. 1.07 Oct-14-96
  290. Gordon Irlam rewrites v8.S again. Bug fixes.
  291. 1.06 Oct-14-96
  292. Gordon Irlam improved the sparc port.
  293. 1.05 Oct-14-96
  294. Interface changes based on feedback.
  295. 1.04 Oct-11-96
  296. Sparc port complete (modulo struct passing bug).
  297. 1.03 Oct-10-96
  298. Passing struct args, and returning struct values works for
  299. all architectures/calling conventions. Expanded tests.
  300. 1.02 Oct-9-96
  301. Added SGI n32 support. Fixed bugs in both o32 and Linux support.
  302. Added "make test".
  303. 1.01 Oct-8-96
  304. Fixed float passing bug in mips version. Restructured some
  305. of the code. Builds cleanly with SGI tools.
  306. 1.00 Oct-7-96
  307. First release. No public announcement.
  308. Authors & Credits
  309. =================
  310. libffi was originally written by Anthony Green <green@moxielogic.com>.
  311. The developers of the GNU Compiler Collection project have made
  312. innumerable valuable contributions. See the ChangeLog file for
  313. details.
  314. Some of the ideas behind libffi were inspired by Gianni Mariani's free
  315. gencall library for Silicon Graphics machines.
  316. The closure mechanism was designed and implemented by Kresten Krab
  317. Thorup.
  318. Major processor architecture ports were contributed by the following
  319. developers:
  320. aarch64 Marcus Shawcroft, James Greenhalgh
  321. alpha Richard Henderson
  322. arm Raffaele Sena
  323. blackfin Alexandre Keunecke I. de Mendonca
  324. cris Simon Posnjak, Hans-Peter Nilsson
  325. frv Anthony Green
  326. ia64 Hans Boehm
  327. m32r Kazuhiro Inaoka
  328. m68k Andreas Schwab
  329. m88k Miod Vallat
  330. microblaze Nathan Rossi
  331. mips Anthony Green, Casey Marshall
  332. mips64 David Daney
  333. moxie Anthony Green
  334. nios ii Sandra Loosemore
  335. openrisc Sebastian Macke
  336. pa Randolph Chung, Dave Anglin, Andreas Tobler
  337. powerpc Geoffrey Keating, Andreas Tobler,
  338. David Edelsohn, John Hornkvist
  339. powerpc64 Jakub Jelinek
  340. s390 Gerhard Tonn, Ulrich Weigand
  341. sh Kaz Kojima
  342. sh64 Kaz Kojima
  343. sparc Anthony Green, Gordon Irlam
  344. tile-gx/tilepro Walter Lee
  345. vax Miod Vallat
  346. x86 Anthony Green, Jon Beniston
  347. x86-64 Bo Thorsen
  348. xtensa Chris Zankel
  349. Jesper Skov and Andrew Haley both did more than their fair share of
  350. stepping through the code and tracking down bugs.
  351. Thanks also to Tom Tromey for bug fixes, documentation and
  352. configuration help.
  353. Thanks to Jim Blandy, who provided some useful feedback on the libffi
  354. interface.
  355. Andreas Tobler has done a tremendous amount of work on the testsuite.
  356. Alex Oliva solved the executable page problem for SElinux.
  357. The list above is almost certainly incomplete and inaccurate. I'm
  358. happy to make corrections or additions upon request.
  359. If you have a problem, or have found a bug, please send a note to the
  360. author at green@moxielogic.com, or the project mailing list at
  361. libffi-discuss@sourceware.org.