A portable foreign-function interface library.

Related tags

Scripting libffi
Overview

Status

Build Status Build status

libffi-3.4 was released on TBD. Check the libffi web page for updates: URL:http://sourceware.org/libffi/.

What is libffi?

Compilers for high level languages generate code that follow certain conventions. These conventions are necessary, in part, for separate compilation to work. One such convention is the "calling convention". The "calling convention" is essentially a set of assumptions made by the compiler about where function arguments will be found on entry to a function. A "calling convention" also specifies where the return value for a function is found.

Some programs may not know at the time of compilation what arguments are to be passed to a function. For instance, an interpreter may be told at run-time about the number and types of arguments used to call a given function. Libffi can be used in such programs to provide a bridge from the interpreter program to compiled code.

The libffi library provides a portable, high level programming interface to various calling conventions. This allows a programmer to call any function specified by a call interface description at run time.

FFI stands for Foreign Function Interface. A foreign function interface is the popular name for the interface that allows code written in one language to call code written in another language. The libffi library really only provides the lowest, machine dependent layer of a fully featured foreign function interface. A layer must exist above libffi that handles type conversions for values passed between the two languages.

Supported Platforms

Libffi has been ported to many different platforms.

At the time of release, the following basic configurations have been tested:

Architecture Operating System Compiler
AArch64 (ARM64) iOS Clang
AArch64 Linux GCC
AArch64 Windows MSVC
Alpha Linux GCC
Alpha Tru64 GCC
ARC Linux GCC
ARM Linux GCC
ARM iOS GCC
ARM Windows MSVC
AVR32 Linux GCC
Blackfin uClinux GCC
CSKY Linux GCC
HPPA HPUX GCC
KVX Linux GCC
IA-64 Linux GCC
M68K FreeMiNT GCC
M68K Linux GCC
M68K RTEMS GCC
M88K OpenBSD/mvme88k GCC
Meta Linux GCC
MicroBlaze Linux GCC
MIPS IRIX GCC
MIPS Linux GCC
MIPS RTEMS GCC
MIPS64 Linux GCC
Moxie Bare metal GCC
Nios II Linux GCC
OpenRISC Linux GCC
PowerPC 32-bit AIX IBM XL C
PowerPC 64-bit AIX IBM XL C
PowerPC AMIGA GCC
PowerPC Linux GCC
PowerPC Mac OSX GCC
PowerPC FreeBSD GCC
PowerPC 64-bit FreeBSD GCC
PowerPC 64-bit Linux ELFv1 GCC
PowerPC 64-bit Linux ELFv2 GCC
RISC-V 32-bit Linux GCC
RISC-V 64-bit Linux GCC
S390 Linux GCC
S390X Linux GCC
SPARC Linux GCC
SPARC Solaris GCC
SPARC Solaris Oracle Solaris Studio C
SPARC64 Linux GCC
SPARC64 FreeBSD GCC
SPARC64 Solaris Oracle Solaris Studio C
TILE-Gx/TILEPro Linux GCC
VAX OpenBSD/vax GCC
X86 FreeBSD GCC
X86 GNU HURD GCC
X86 Interix GCC
X86 kFreeBSD GCC
X86 Linux GCC
X86 OpenBSD GCC
X86 OS/2 GCC
X86 Solaris GCC
X86 Solaris Oracle Solaris Studio C
X86 Windows/Cygwin GCC
X86 Windows/MingW GCC
X86-64 FreeBSD GCC
X86-64 Linux GCC
X86-64 Linux/x32 GCC
X86-64 OpenBSD GCC
X86-64 Solaris Oracle Solaris Studio C
X86-64 Windows/Cygwin GCC
X86-64 Windows/MingW GCC
X86-64 Mac OSX GCC
Xtensa Linux GCC

Please send additional platform test results to [email protected].

Installing libffi

First you must configure the distribution for your particular system. Go to the directory you wish to build libffi in and run the "configure" program found in the root directory of the libffi source distribution. Note that building libffi requires a C99 compatible compiler.

If you're building libffi directly from git hosted sources, configure won't exist yet; run ./autogen.sh first. This will require that you install autoconf, automake and libtool.

You may want to tell configure where to install the libffi library and header files. To do that, use the --prefix configure switch. Libffi will install under /usr/local by default.

If you want to enable extra run-time debugging checks use the the --enable-debug configure switch. This is useful when your program dies mysteriously while using libffi.

Another useful configure switch is --enable-purify-safety. Using this will add some extra code which will suppress certain warnings when you are using Purify with libffi. Only use this switch when using Purify, as it will slow down the library.

If you don't want to build documentation, use the --disable-docs configure switch.

It's also possible to build libffi on Windows platforms with Microsoft's Visual C++ compiler. In this case, use the msvcc.sh wrapper script during configuration like so:

path/to/configure CC=path/to/msvcc.sh CXX=path/to/msvcc.sh LD=link CPP="cl -nologo -EP" CPPFLAGS="-DFFI_BUILDING_DLL"

For 64-bit Windows builds, use CC="path/to/msvcc.sh -m64" and CXX="path/to/msvcc.sh -m64". You may also need to specify --build appropriately.

It is also possible to build libffi on Windows platforms with the LLVM project's clang-cl compiler, like below:

path/to/configure CC="path/to/msvcc.sh -clang-cl" CXX="path/to/msvcc.sh -clang-cl" LD=link CPP="clang-cl -EP" 

When building with MSVC under a MingW environment, you may need to remove the line in configure that sets 'fix_srcfile_path' to a 'cygpath' command. ('cygpath' is not present in MingW, and is not required when using MingW-style paths.)

To build static library for ARM64 with MSVC using visual studio solution, msvc_build folder have aarch64/Ffi_staticLib.sln required header files in aarch64/aarch64_include/

SPARC Solaris builds require the use of the GNU assembler and linker. Point AS and LD environment variables at those tool prior to configuration.

For iOS builds, the libffi.xcodeproj Xcode project is available.

Configure has many other options. Use configure --help to see them all.

Once configure has finished, type "make". Note that you must be using GNU make. You can ftp GNU make from ftp.gnu.org:/pub/gnu/make .

To ensure that libffi is working as advertised, type "make check". This will require that you have DejaGNU installed.

To install the library and header files, type make install.

History

See the git log for details at http://github.com/libffi/libffi.

3.4 TBD
	Add support for Alibaba's CSKY architecture.
    Add support for Intel Control-flow Enforcement Technology (CET).
Add support for ARM Pointer Authentication (PA).
Fix 32-bit PPC regression.
Fix MIPS soft-float problem.

3.3 Nov-23-19
    Add RISC-V support.
    New API in support of GO closures.
    Add IEEE754 binary128 long double support for 64-bit Power
    Default to Microsoft's 64 bit long double ABI with Visual C++.
    GNU compiler uses 80 bits (128 in memory) FFI_GNUW64 ABI.
    Add Windows on ARM64 (WOA) support.
    Add Windows 32-bit ARM support.
    Raw java (gcj) API deprecated.
    Add pre-built PDF documentation to source distribution.
    Many new test cases and bug fixes.
    
3.2.1 Nov-12-14
    Build fix for non-iOS AArch64 targets.

3.2 Nov-11-14
    Add C99 Complex Type support (currently only supported on
      s390).
    Add support for PASCAL and REGISTER calling conventions on x86
      Windows/Linux.
    Add OpenRISC and Cygwin-64 support.
    Bug fixes.

3.1 May-19-14
    Add AArch64 (ARM64) iOS support.
    Add Nios II support.
    Add m88k and DEC VAX support.
    Add support for stdcall, thiscall, and fastcall on non-Windows
      32-bit x86 targets such as Linux.
    Various Android, MIPS N32, x86, FreeBSD and UltraSPARC IIi
      fixes.
    Make the testsuite more robust: eliminate several spurious
      failures, and respect the $CC and $CXX environment variables.
    Archive off the manually maintained ChangeLog in favor of git
      log.

3.0.13 Mar-17-13
    Add Meta support.
    Add missing Moxie bits.
    Fix stack alignment bug on 32-bit x86.
    Build fix for m68000 targets.
    Build fix for soft-float Power targets.
    Fix the install dir location for some platforms when building
      with GCC (OS X, Solaris).
    Fix Cygwin regression.

3.0.12 Feb-11-13
    Add Moxie support.
    Add AArch64 support.
    Add Blackfin support.
    Add TILE-Gx/TILEPro support.
    Add MicroBlaze support.
    Add Xtensa support.
    Add support for PaX enabled kernels with MPROTECT.
    Add support for native vendor compilers on
      Solaris and AIX.
    Work around LLVM/GCC interoperability issue on x86_64.

3.0.11 Apr-11-12
    Lots of build fixes.
    Add support for variadic functions (ffi_prep_cif_var).
    Add Linux/x32 support.
    Add thiscall, fastcall and MSVC cdecl support on Windows.
    Add Amiga and newer MacOS support.
    Add m68k FreeMiNT support.
    Integration with iOS' xcode build tools.
    Fix Octeon and MC68881 support.
    Fix code pessimizations.

3.0.10 Aug-23-11
    Add support for Apple's iOS.
    Add support for ARM VFP ABI.
    Add RTEMS support for MIPS and M68K.
    Fix instruction cache clearing problems on
      ARM and SPARC.
    Fix the N64 build on mips-sgi-irix6.5.
    Enable builds with Microsoft's compiler.
    Enable x86 builds with Oracle's Solaris compiler.
    Fix support for calling code compiled with Oracle's Sparc
      Solaris compiler.
    Testsuite fixes for Tru64 Unix.
    Additional platform support.

3.0.9 Dec-31-09
    Add AVR32 and win64 ports.  Add ARM softfp support.
    Many fixes for AIX, Solaris, HP-UX, *BSD.
    Several PowerPC and x86-64 bug fixes.
    Build DLL for windows.

3.0.8 Dec-19-08
    Add *BSD, BeOS, and PA-Linux support.

3.0.7 Nov-11-08
    Fix for ppc FreeBSD.
    (thanks to Andreas Tobler)

3.0.6 Jul-17-08
    Fix for closures on sh.
    Mark the sh/sh64 stack as non-executable.
    (both thanks to Kaz Kojima)

3.0.5 Apr-3-08
    Fix libffi.pc file.
    Fix #define ARM for IcedTea users.
    Fix x86 closure bug.

3.0.4 Feb-24-08
    Fix x86 OpenBSD configury.

3.0.3 Feb-22-08
    Enable x86 OpenBSD thanks to Thomas Heller, and
      x86-64 FreeBSD thanks to Björn König and Andreas Tobler.
    Clean up test instruction in README.

3.0.2 Feb-21-08
    Improved x86 FreeBSD support.
    Thanks to Björn König.

3.0.1 Feb-15-08
    Fix instruction cache flushing bug on MIPS.
    Thanks to David Daney.

3.0.0 Feb-15-08
    Many changes, mostly thanks to the GCC project.
    Cygnus Solutions is now Red Hat.

  [10 years go by...]

1.20 Oct-5-98
    Raffaele Sena produces ARM port.

1.19 Oct-5-98
    Fixed x86 long double and long long return support.
    m68k bug fixes from Andreas Schwab.
    Patch for DU assembler compatibility for the Alpha from Richard
      Henderson.

1.18 Apr-17-98
    Bug fixes and MIPS configuration changes.

1.17 Feb-24-98
    Bug fixes and m68k port from Andreas Schwab. PowerPC port from
    Geoffrey Keating. Various bug x86, Sparc and MIPS bug fixes.

1.16 Feb-11-98
    Richard Henderson produces Alpha port.

1.15 Dec-4-97
    Fixed an n32 ABI bug. New libtool, auto* support.

1.14 May-13-97
    libtool is now used to generate shared and static libraries.
    Fixed a minor portability problem reported by Russ McManus
    <[email protected]>.

1.13 Dec-2-96
    Added --enable-purify-safety to keep Purify from complaining
      about certain low level code.
    Sparc fix for calling functions with < 6 args.
    Linux x86 a.out fix.

1.12 Nov-22-96
    Added missing ffi_type_void, needed for supporting void return 
      types. Fixed test case for non MIPS machines. Cygnus Support 
      is now Cygnus Solutions. 

1.11 Oct-30-96
    Added notes about GNU make.

1.10 Oct-29-96
    Added configuration fix for non GNU compilers.

1.09 Oct-29-96
    Added --enable-debug configure switch. Clean-ups based on LCLint 
    feedback. ffi_mips.h is always installed. Many configuration 
    fixes. Fixed ffitest.c for sparc builds.

1.08 Oct-15-96
    Fixed n32 problem. Many clean-ups.

1.07 Oct-14-96
    Gordon Irlam rewrites v8.S again. Bug fixes.

1.06 Oct-14-96
    Gordon Irlam improved the sparc port. 

1.05 Oct-14-96
    Interface changes based on feedback.

1.04 Oct-11-96
    Sparc port complete (modulo struct passing bug).

1.03 Oct-10-96
    Passing struct args, and returning struct values works for
    all architectures/calling conventions. Expanded tests.

1.02 Oct-9-96
    Added SGI n32 support. Fixed bugs in both o32 and Linux support.
    Added "make test".

1.01 Oct-8-96
    Fixed float passing bug in mips version. Restructured some
    of the code. Builds cleanly with SGI tools.

1.00 Oct-7-96
    First release. No public announcement.

Authors & Credits

libffi was originally written by Anthony Green [email protected].

The developers of the GNU Compiler Collection project have made innumerable valuable contributions. See the ChangeLog file for details.

Some of the ideas behind libffi were inspired by Gianni Mariani's free gencall library for Silicon Graphics machines.

The closure mechanism was designed and implemented by Kresten Krab Thorup.

Major processor architecture ports were contributed by the following developers:

aarch64             Marcus Shawcroft, James Greenhalgh
alpha               Richard Henderson
arc                 Hackers at Synopsis
arm                 Raffaele Sena
avr32               Bradley Smith
blackfin            Alexandre Keunecke I. de Mendonca
cris                Simon Posnjak, Hans-Peter Nilsson
csky		Ma Jun, Zhang Wenmeng
frv                 Anthony Green
ia64                Hans Boehm
m32r                Kazuhiro Inaoka
m68k                Andreas Schwab
m88k                Miod Vallat
metag               Hackers at Imagination Technologies
microblaze          Nathan Rossi
mips                Anthony Green, Casey Marshall
mips64              David Daney
moxie               Anthony Green
nios ii             Sandra Loosemore
openrisc            Sebastian Macke
pa                  Randolph Chung, Dave Anglin, Andreas Tobler
powerpc             Geoffrey Keating, Andreas Tobler,
                    David Edelsohn, John Hornkvist
powerpc64           Jakub Jelinek
riscv               Michael Knyszek, Andrew Waterman, Stef O'Rear
s390                Gerhard Tonn, Ulrich Weigand
sh                  Kaz Kojima
sh64                Kaz Kojima
sparc               Anthony Green, Gordon Irlam
tile-gx/tilepro     Walter Lee
vax                 Miod Vallat
x86                 Anthony Green, Jon Beniston
x86-64              Bo Thorsen
xtensa              Chris Zankel

Jesper Skov and Andrew Haley both did more than their fair share of stepping through the code and tracking down bugs.

Thanks also to Tom Tromey for bug fixes, documentation and configuration help.

Thanks to Jim Blandy, who provided some useful feedback on the libffi interface.

Andreas Tobler has done a tremendous amount of work on the testsuite.

Alex Oliva solved the executable page problem for SElinux.

The list above is almost certainly incomplete and inaccurate. I'm happy to make corrections or additions upon request.

If you have a problem, or have found a bug, please send a note to the author at [email protected], or the project mailing list at [email protected].

Issues
  • New Release Version?

    New Release Version?

    Given that the latest libffi release can't be compiled with llvm for armv7 due to the unified assembly syntax, it would be interesting to know what the remaining open tasks are to get a 4.0 release out the door. Especially for projects that depend on libffi, but do not want to use some unofficial release this would be nice.

    opened by angerman 21
  • x86: fix double/long double handling on Win64

    x86: fix double/long double handling on Win64

    On Windows 64-bit double == long double. Ensure that we guard the long double case properly and explicitly list float and double types in the switch. Fixes FFI of long double types.

    opened by compnerd 20
  • fix ios builds

    fix ios builds

    This patch updates generate-darwin-source-and-headers.py and the libffi.xcodeproj to include all currently relevant source files.

    #include <mach/vm_param.h> was changed to #include <mach/machine/vm_param.h> as the former is failing with an undefined mnemonic, not sure why though.

    Some Xcode compiler configuration is updated as well.

    The Xcode buid rule is adapted, so that autoconf is called as well and a sourceregeneration is only done when necessary.

    opened by ksjogo 15
  • New RISC-V port

    New RISC-V port

    This patch adds support for RISC-V. I sent it to the ML earlier but was requested to create a PR instead.

    I did not write the code in this patch; it is a cleaned up and rebased version of a port by Michael Knyszek et al of UC Berkeley.

    RISC-V is a free and open standard instruction set architecture originally developed at UC Berkeley and now seeing significant interest from independent hardware vendors, with interoperable prototypes from several independent groups. Alex Bradbury's recent RFC to the LLVM community has a much better explanation of what RISC-V is and why you should care about it.

    While the privileged architecture is still in some flux, the architecture which is visible to user space and the C calling convention have been unchanged in nearly two years and are now considered frozen, so ports like this one are very likely to remain valid.

    I am interested in being the responsible party to get this code into a mergable condition. I am familiar with the RISC-V ISA and calling convention and with libffi's broad principles of operation, but not with the details of libffi internals.

    How shall we proceed?


    RISC-V instruction set reference, including C calling convention and encoding details


    I've run the full testsuite on qemu system and user emulation. The user emulation is the easiest way to follow along, although it's still a bit touchy. Follow the instructions on https://hub.docker.com/r/sorear/fedora-riscv-wip/ to set up an emulated RISC-V user environment (assuming you have an amd64 Linux host).

    Next, build the latest qemu-user from https://github.com/arsv/riscv-qemu for an important bugfix. Build it with --enable-static --target-list=riscv64-linux-user, and copy the generated static binary riscv64-linux-user/qemu-riscv64 into the container root.

    Next, install the following packages in the container:

    autoconf-2.69-22.fc24.noarch
    automake-1.15-7.fc25.noarch
    dejagnu-1.6-1.fc25.noarch
    expect-5.45-22.fc24.riscv64
    tcl-8.6.6-1.fc24.riscv64
    libtool-ltdl-2.4.6-11.fc24.riscv64
    libtool-ltdl-devel-2.4.6-11.fc24.riscv64
    tcl-devel-8.6.6-1.fc24.riscv64
    expect-devel-5.45-22.fc24.riscv64
    expectk-5.45-22.fc24.riscv64
    libtool-2.4.6-11.fc24.riscv64
    bash-4.3.43-1.fc24.riscv64
    bash-doc-4.3.43-1.fc24.riscv64
    make-devel-4.1-5.fc24.riscv64
    make-4.1-5.fc24.riscv64
    texinfo-6.1-3.fc24.riscv64
    perl-5.24.0-377.fc25.riscv64
    perl-libintl-1.24-3.fc24.riscv64
    perl-core-5.24.0-377.fc25.riscv64
    perl-libs-5.24.0-377.fc25.riscv64
    perl-Encode-2.86-1.fc25.riscv64
    perl-Storable-2.56-366.fc25.riscv64
    perl-Unicode-Normalize-1.25-365.fc25.riscv64
    perl-Unicode-EastAsianWidth-1.33-8.fc25.noarch
    perl-Text-Unidecode-1.27-3.fc25.noarch
    perl-IO-1.36-377.fc25.riscv64
    

    Source noarch packages from koji, riscv64 packages from https://github.com/rwmjones/fedora-riscv.

    Once the environment is set up, it is possible to check out the code, (you may need to hack config.guess to return the correct result), sh autogen.sh, ./configure --host=riscv64-unknown-linux-gnu --build=riscv64-unknown-linux-gnu, make check.

    config.sub has supported RISC-V for cross compilation purposes for some time, and is already updated in libffi; config.guess does not.

    opened by sorear 15
  • libffi doesn't build in Xcode 5.1

    libffi doesn't build in Xcode 5.1

    I am getting the following error in ffi_common.h: Unknown type name ffi_status Unknown type name ffi_cif

    These types are clearly being defined in the main ffi_arm.h and ffi_i386.h

    opened by ghost 15
  • Error: unknown pseudo-op: `.private_extern' in src/arm/sysv.S

    Error: unknown pseudo-op: `.private_extern' in src/arm/sysv.S

    System Details

    OS Fedora 27

    armv7l-unknown-linux-gnueabihf

    binutils-2.29-13.fc27.armv7hl gcc-7.3.1-5.fc27.armv7hl

    Problems Description

    After commit 1d704051b2 build fails with

    libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I. -I../include -Iinclude -I../src -I. -I../include -Iinclude -I../src -MT src/arm/sysv.lo -MD -MP -MF src/arm/.deps/sysv.Tpo -c ../src/arm/sysv.S  -fPIC -DPIC -o src/arm/.libs/sysv.o
    ../src/arm/sysv.S: Assembler messages:
    ../src/arm/sysv.S:126: Error: unknown pseudo-op: `.private_extern'
    ../src/arm/sysv.S:142: Error: unknown pseudo-op: `.private_extern'
    ../src/arm/sysv.S:216: Error: unknown pseudo-op: `.private_extern'
    ../src/arm/sysv.S:227: Error: unknown pseudo-op: `.private_extern'
    ../src/arm/sysv.S:263: Error: unknown pseudo-op: `.private_extern'
    ../src/arm/sysv.S:274: Error: unknown pseudo-op: `.private_extern'
    ../src/arm/sysv.S:374: Error: unknown pseudo-op: `.private_extern'
    make[3]: *** [Makefile:1190: src/arm/sysv.lo] Error 1
    

    Are newer binutils required?

    opened by sharkcz 14
  • update config.{guess,sub}

    update config.{guess,sub}

    This change is primarily for aarch64 macOS support, since that configuration is now properly supported upstream.

    opened by froydnj 13
  • iOS arm support broken in last version

    iOS arm support broken in last version

    Can't build for ARMV7 with clang, only ARM64, fix please

    Regards

    opened by felipejfc 13
  • iOS Xcode support

    iOS Xcode support

    Added Xcode project that builds libffi like a normal iOS library

    This allows a user to add libffi as a subproject and should make integrating (and building) it much easier

    generate-ios-source-and-headers.py creates a shadow copy of the source tree and ifdefs files based on their architecture so your an compile everything for both targets and easily make a universal binary

    opened by mikelikespie 12
  • bug in function ffi_closure_SYSV_inner in aarch64 (big endian) ILP32

    bug in function ffi_closure_SYSV_inner in aarch64 (big endian) ILP32

    System Details

    Problems Description

    opened by gjinhui 1
  • function ffi_call_int bug in aarch64

    function ffi_call_int bug in aarch64

    System Details

    Problems Description

    opened by gjinhui 1
  • Two patches missing from GCC source version of libffi

    Two patches missing from GCC source version of libffi

    The following two commits are not upstream from the GCC sources (and even went missing from the GCC sources during a merge from upstream libffi):

    https://gcc.gnu.org/git/?p=gcc.git&a=commit;h=a03bd0056c58764adeda4797f5829ff031859646 https://gcc.gnu.org/git/?p=gcc.git&a=commit;h=bb8c2886dbf838805777d2c7952f46bbeba7987f

    opened by apinski-cavium 0
  • Support for C99 _Bool

    Support for C99 _Bool

    Would be nice for languages where boolean is a distinct type.

    opened by lloda 0
  • checking whether the C compiler works... no

    checking whether the C compiler works... no

    System Details

    Ubuntsu、buildozer、kivy

    Problems Description

    When I built an app with buildozer using Ubuntsu, an error occurred and the build stopped. I'm trying to develop an android app. I am a Japanese who uses github for the first time. please help me.

    error on ubuntu

    checking for arm-linux-androideabi-gcc... /home/takumi/.buildozer/android/platform/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -target armv7a-linux-androideabi21 -fomit-frame-pointer -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb -fPIC
    checking whether the C compiler works... no
    configure: error: in `/home/takumi/colorblind/.buildozer/android/platform/build/build/other_builds/libffi/armeabi-v7a__ndk_target_21/libffi':
    configure: error: C compiler cannot create executables
    See `config.log' for more details  
    

    config.log

    configure:3849: checking whether the C compiler works
    configure:3871: /home/takumi/.buildozer/android/platform/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -target armv7a-linux-androideabi21 -fomit-frame-pointer -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb -fPIC -target armv7a-linux-androideabi21 -fomit-frame-pointer -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb -fPIC -DANDROID -D__ANDROID_API__=21 -I/home/takumi/.buildozer/android/platform/android-ndk-r19c/sysroot/usr/include/arm-linux-androideabi -I/home/takumi/colorblind/.buildozer/android/platform/build/build/python-installs/color/include/python3.8   -L/home/takumi/colorblind/.buildozer/android/platform/build/build/libs_collections/color/armeabi-v7a conftest.c  >&5
    /home/takumi/colorblind/.buildozer/android/platform/build/build/other_builds/libffi/armeabi-v7a__ndk_target_21/libffi/configure: line 3873: /home/takumi/.buildozer/android/platform/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/bin/clang: Permission denied
    configure:3875: $? = 126
    configure:3913: result: no
    configure: failed program was:
    | /* confdefs.h */
    | #define PACKAGE_NAME "libffi"
    | #define PACKAGE_TARNAME "libffi"
    | #define PACKAGE_VERSION "3.3"
    | #define PACKAGE_STRING "libffi 3.3"
    | #define PACKAGE_BUGREPORT "http://github.com/libffi/libffi/issues"
    | #define PACKAGE_URL ""
    | #define PACKAGE "libffi"
    | #define VERSION "3.3"
    | /* end confdefs.h.  */ 
    
    opened by beetaku 0
  • Fix build with Oracle Studio cc (#670)

    Fix build with Oracle Studio cc (#670)

    • Don't use -x assembler-with-cpp.
    • Fix src/sparc/v8.S syntax.
    • Provide non-gcc ffi_flush_icache in src/sparc/v9.S.
    opened by rorth 0
  • libffi doesn't compile with Oracle Studio cc

    libffi doesn't compile with Oracle Studio cc

    System Details

    Solaris 11.4: sparc-sun-solaris2.11, sparcv9-sun-solaris2.11, x86_64-pc-solaris2.11

    $ cc -V
    cc: Studio 12.6 Sun C 5.15 SunOS_sparc 152881-06 2020/04/07
    

    Problems Description

    Contrary to what README.md claims, libffi doesn't compile with Oracle Studio cc on either SPARC or x86:

    • libffi.map cannot be built with cc on Solaris, both SPARC and x86:
      cc -DHAVE_CONFIG_H -I. -I/vol/gcc/src/libffi/libffi/local  -I. -I/vol/gcc/src/libffi/libffi/local/include -Iinclude -I/vol/gcc/src/libffi/libffi/local/src   -native -fast -xO5 -dalign -DX86 -DGENERATE_LIBFFI_MAP \
       -E -x assembler-with-cpp -o libffi.map /vol/gcc/src/libffi/libffi/local/libffi.map.in
      cc: Warning: Option -x passed to ld, if ld is invoked, ignored otherwise
      cc: -o cannot be used when producing multiple output files
      make[2]: *** [Makefile:1814: libffi.map] Error 1
      

      -x assembler-with-cpp is an unportable gcc extension and, it seems, unnecessary here.

    • src/sparc/v8.S doesnt' assemble on 32-bit SPARC:
      /vol/studio-12.6/bin/fbe: "/tmp/cpp.1634904968.11419.01.s", line 480: error: invalid register
      cc: fbe failed for /vol/gcc/src/libffi/libffi/local/src/sparc/v8.S
      make[2]: *** [Makefile:1218: src/sparc/v8.lo] Error 1
      

      l.480 corresponds to

      ffi_flush_icache:
      1:      iflush %o0
              iflush %o+8		<=
      

      in v8.S. The gcc equivalent is in src/sparc/ffi.c (ffi_flush_icache):

      /* SPARC v8 requires 5 instructions for flush to be visible */
      asm volatile ("iflush %0; iflush %0+8; nop; nop; nop; nop; nop"
                    : : "r" (p) : "memory"); 
      

      Changing the iflush to iflush %o0+8 lets it compile.

    • libffi.so doesn't link on 64-bit SPARC:
      Undefined                       first referenced
       symbol                             in file
      ffi_flush_icache                    src/sparc/.libs/ffi64.o
      ld: fatal: symbol referencing errors
      make[2]: *** [Makefile:1031: libffi.la] Error 2
      

      There's no v9.S equivalent to src/sparc/ffi64.c's ffi_flush_icache:

      asm volatile ("flush  %0; flush %0+8" : : "r" (p) : "memory");
      

      which can easily be added following the v8.S example.

    opened by rorth 0
  • src/x86/win64.S: Use #define instead of .macro (#665)

    src/x86/win64.S: Use #define instead of .macro (#665)

    The Solaris/x86 assembler doesn't support .macro/.endm, so use #define since win64.S is passed through cpp anyway.

    opened by rorth 0
  • ppc64 won't buld with GCC 12

    ppc64 won't buld with GCC 12

    GCC 12 as of

    commit 7518e4c2f0758daac5d650d400565cf49ac3c8c5 Author: Andrew Pinski [email protected] Date: Sat Oct 23 19:24:43 2021 +0000

    Fix PR 102908: wrongly removing null pointer loads
    

    fails to build on powerpc64-unknown-linux-gnu:

    [[email protected] build-ppc64-linux]$ /home/hjl/work/build/gnu/tools-build/gcc-debug/release/usr/gcc-12.0.0-ppc64/bin/gcc -DHAVE_CONFIG_H -I. -I/home/hjl/work/git/github/libffi -I. -I/home/hjl/work/git/github/libffi/include -Iinclude -I/home/hjl/work/git/github/libffi/src -I. -I/home/hjl/work/git/github/libffi/include -Iinclude -I/home/hjl/work/git/github/libffi/src -MT src/powerpc/linux64.lo -MD -MP -MF src/powerpc/.deps/linux64.Tpo -c /home/hjl/work/git/github/libffi/src/powerpc/linux64.S  -fPIC -DPIC -o src/powerpc/.libs/linux64.o
    /home/hjl/work/git/github/libffi/src/powerpc/linux64.S: Assembler messages:
    /home/hjl/work/git/github/libffi/src/powerpc/linux64.S:151: Error: unrecognized opcode: `lvx'
    /home/hjl/work/git/github/libffi/src/powerpc/linux64.S:153: Error: unrecognized opcode: `lvx'
    /home/hjl/work/git/github/libffi/src/powerpc/linux64.S:155: Error: unrecognized opcode: `lvx'
    /home/hjl/work/git/github/libffi/src/powerpc/linux64.S:157: Error: unrecognized opcode: `lvx'
    /home/hjl/work/git/github/libffi/src/powerpc/linux64.S:159: Error: unrecognized opcode: `lvx'
    /home/hjl/work/git/github/libffi/src/powerpc/linux64.S:161: Error: unrecognized opcode: `lvx'
    /home/hjl/work/git/github/libffi/src/powerpc/linux64.S:163: Error: unrecognized opcode: `lvx'
    /home/hjl/work/git/github/libffi/src/powerpc/linux64.S:165: Error: unrecognized opcode: `lvx'
    /home/hjl/work/git/github/libffi/src/powerpc/linux64.S:167: Error: unrecognized opcode: `lvx'
    /home/hjl/work/git/github/libffi/src/powerpc/linux64.S:169: Error: unrecognized opcode: `lvx'
    /home/hjl/work/git/github/libffi/src/powerpc/linux64.S:171: Error: unrecognized opcode: `lvx'
    /home/hjl/work/git/github/libffi/src/powerpc/linux64.S:173: Error: unrecognized opcode: `lvx'
    /home/hjl/work/git/github/libffi/src/powerpc/linux64.S:210: Error: unrecognized opcode: `stvx'
    /home/hjl/work/git/github/libffi/src/powerpc/linux64.S:252: Error: unrecognized opcode: `stvx'
    /home/hjl/work/git/github/libffi/src/powerpc/linux64.S:254: Error: unrecognized opcode: `stvx'
    /home/hjl/work/git/github/libffi/src/powerpc/linux64.S:256: Error: unrecognized opcode: `stvx'
    /home/hjl/work/git/github/libffi/src/powerpc/linux64.S:258: Error: unrecognized opcode: `stvx'
    /home/hjl/work/git/github/libffi/src/powerpc/linux64.S:260: Error: unrecognized opcode: `stvx'
    /home/hjl/work/git/github/libffi/src/powerpc/linux64.S:262: Error: unrecognized opcode: `stvx'
    /home/hjl/work/git/github/libffi/src/powerpc/linux64.S:264: Error: unrecognized opcode: `stvx'
    /home/hjl/work/git/github/libffi/src/powerpc/linux64.S:266: Error: unrecognized opcode: `stvx'
    [[email protected] build-ppc64-linux]$ /home/hjl/work/build/gnu/tools-build/gcc-debug/release/usr/gcc-12.0.0-ppc64/bin/gcc -DHAVE_CONFIG_H -I. -I/home/hjl/work/git/github/libffi -I. -I/home/hjl/work/git/github/libffi/include -Iinclude -I/home/hjl/work/git/github/libffi/src -I. -I/home/hjl/work/git/github/libffi/include -Iinclude -I/home/hjl/work/git/github/libffi/src -MT src/powerpc/linux64_closure.lo -MD -MP -MF src/powerpc/.deps/linux64_closure.Tpo -c /home/hjl/work/git/github/libffi/src/powerpc/linux64_closure.S  -fPIC -DPIC -o src/powerpc/.libs/linux64_closure.o
    /home/hjl/work/git/github/libffi/src/powerpc/linux64_closure.S: Assembler messages:
    /home/hjl/work/git/github/libffi/src/powerpc/linux64_closure.S:363: Error: unrecognized opcode: `lvx'
    /home/hjl/work/git/github/libffi/src/powerpc/linux64_closure.S:368: Error: unrecognized opcode: `lvx'
    /home/hjl/work/git/github/libffi/src/powerpc/linux64_closure.S:391: Error: unrecognized opcode: `lvx'
    /home/hjl/work/git/github/libffi/src/powerpc/linux64_closure.S:393: Error: unrecognized opcode: `lvx'
    /home/hjl/work/git/github/libffi/src/powerpc/linux64_closure.S:395: Error: unrecognized opcode: `lvx'
    /home/hjl/work/git/github/libffi/src/powerpc/linux64_closure.S:398: Error: unrecognized opcode: `lvx'
    /home/hjl/work/git/github/libffi/src/powerpc/linux64_closure.S:400: Error: unrecognized opcode: `lvx'
    /home/hjl/work/git/github/libffi/src/powerpc/linux64_closure.S:402: Error: unrecognized opcode: `lvx'
    /home/hjl/work/git/github/libffi/src/powerpc/linux64_closure.S:404: Error: unrecognized opcode: `lvx'
    [[email protected] build-ppc64-linux]$ 
    
    opened by hjl-tools 4
  • Don't dereference beyond the last array entry.

    Don't dereference beyond the last array entry.

    A static code checker complained about this. This should quiesce the checker.

    opened by atgreen 0
Releases(v3.4.2)
  • v3.4.2(Jun 29, 2021)

    3.4.2 Jun-28-21
        Add static trampoline support for Linux on x86_64 and ARM64.
        Add support for Alibaba's CSKY architecture.
        Add support for Kalray's KVX architecture.
        Add support for Intel Control-flow Enforcement Technology (CET).
        Add support for ARM Pointer Authentication (PA).
        Fix 32-bit PPC regression.
        Fix MIPS soft-float problem.
        Enable tmpdir override with the $LIBFFI_TMPDIR environment variable.
        Enable compatibility with MSVC runtime stack checking.
        Reject float and small integer argument in ffi_prep_cif_var().
          Callers must promote these types themselves.
    
    Source code(tar.gz)
    Source code(zip)
    libffi-3.4.2.tar.gz(1.28 MB)
  • v3.4.0-rc2(Jun 28, 2021)

  • v3.4-rc1(Jun 26, 2021)

  • v3.3(Nov 23, 2019)

    3.3 Nov-23-19
        Add RISC-V support.
        New API in support of GO closures.
        Add IEEE754 binary128 long double support for 64-bit Power
        Default to Microsoft's 64-bit long double ABI with Visual C++.
        GNU compiler uses 80 bits (128 in memory) FFI_GNUW64 ABI.
        Add Windows on ARM64 (WOA) support.
        Add Windows 32-bit ARM support.
        Raw java (gcj) API deprecated.
        Add pre-built PDF documentation to source distribution.
        Many new test cases and bug fixes.
    
    Source code(tar.gz)
    Source code(zip)
    libffi-3.3.tar.gz(1.24 MB)
  • v3.3-rc2(Nov 2, 2019)

    This is a TEST RELEASE of the coming libffi 3.3 release.

    Please test this release. Problems should be reported at https://github.com/libffi/libffi/issues .

    Test results for posting at https://github.com/libffi/libffi/wiki can also be filed as issues on the issue tracker.

    Thanks!

    Source code(tar.gz)
    Source code(zip)
    libffi-3.3-rc2.tar.gz(1.07 MB)
  • v3.3-rc1(Oct 24, 2019)

    This is a TEST RELEASE of the coming libffi 3.3 release.

    Please test this release. Problems should be reported at https://github.com/libffi/libffi/issues .

    Test results for posting at https://github.com/libffi/libffi/wiki can also be filed as issues on the issue tracker.

    Thanks!

    Source code(tar.gz)
    Source code(zip)
    libffi-3.3-rc1.tar.gz(1.07 MB)
  • v3.3-rc0(Apr 2, 2018)

    This is a TEST RELEASE of the coming libffi 3.3 release.

    Please test this release. Problems should be reported at https://github.com/libffi/libffi/issues .

    Test results for posting at https://github.com/libffi/libffi/wiki can also be filed as issues on the issue tracker.

    Thanks!

    Source code(tar.gz)
    Source code(zip)
    libffi-3.3-rc0.tar.gz(1.03 MB)
A tool for generating cross-language type declarations and interface bindings.

Djinni Djinni is a tool for generating cross-language type declarations and interface bindings. It's designed to connect C++ with either Java or Objec

Dropbox 2.8k Nov 24, 2021
Erlang interface to eBPF

ebpf Erlang eBPF library Overview ebpf facilitates basic interaction with the Linux eBPF system from Erlang.

null 35 Oct 9, 2021
A lightweight, dependency-free library for binding Lua to C++

LuaBridge 2.6 LuaBridge is a lightweight and dependency-free library for mapping data, functions, and classes back and forth between C++ and Lua (a po

Vinnie Falco 1.2k Nov 29, 2021
:sparkles: Magical headers that make your C++ library accessible from JavaScript :rocket:

Quick start | Requirements | Features | User guide | Contributing | License nbind is a set of headers that make your C++11 library accessible from Jav

charto 1.8k Dec 2, 2021
Library to build PHP extensions with C++

PHP-CPP The PHP-CPP library is a C++ library for developing PHP extensions. It offers a collection of well documented and easy-to-use classes that can

Copernica 1.3k Dec 1, 2021
Structy is an irresponsibly dumb and simple struct serialization/deserialization library for C, Python, and vanilla JavaScript.

Structy Structy is an irresponsibly dumb and simple struct serialization/deserialization library for C, Python, and vanilla JavaScript. You can think

Stargirl Flowers 43 Nov 15, 2021
A foreign function interface for bash.

ctypes.sh This is ctypes.sh, a foreign function interface for bash. ctypes.sh is a bash plugin that provides a foreign function interface directly in

Tavis Ormandy 1.7k Dec 2, 2021
The DSiLanguagePatcher increases accessibility to foreign region DSi consoles by providing a mean to change the user interface language.

DSi Language Patcher The DSi Language patcher is a small tool, which runs on your DSi (homebrew execution required) and create a copy of your original

null 14 Oct 9, 2021
Collection of DLL function export forwards for DLL export function proxying

dll-exports Collection of DLL function export forwards for DLL export function proxying. Typical usecase is for backdooring applications for persisten

Magnus Stubman 17 Aug 30, 2021
Legion Low Level Rendering Interface provides a graphics API agnostic rendering interface with minimal CPU overhead and low level access to verbose GPU operations.

Legion-LLRI Legion-LLRI, or “Legion Low Level Rendering Interface” is a rendering API that aims to provide a graphics API agnostic approach to graphic

Rythe Interactive 23 Nov 14, 2021
F Graphics Library (FGL) is a small graphics C++ portable library for LCD displays on embedded systems

F Graphics Library (FGL) Full documentation: fgl.docsforge.com (By Filipe Chagas) F Graphics Library is a C++ library that I created for use in embedd

Filipe Chagas 9 Nov 7, 2021
A modern, portable, easy to use crypto library.

Sodium is a new, easy-to-use software library for encryption, decryption, signatures, password hashing and more. It is a portable, cross-compilable, i

Frank Denis 9.7k Nov 30, 2021
An open source, portable, easy to use, readable and flexible SSL library

README for Mbed TLS Mbed TLS is a C library that implements cryptographic primitives, X.509 certificate manipulation and the SSL/TLS and DTLS protocol

Arm Mbed 3.3k Dec 1, 2021
Simple and portable (but not inflexible) GUI library in C that uses the native GUI technologies of each platform it supports.

libui: a portable GUI library for C This README is being written. Status It has come to my attention that I have not been particularly clear about how

Pietro Gagliardi 10.1k Nov 27, 2021
Portable, simple and extensible C++ logging library

Plog - portable, simple and extensible C++ logging library Pretty powerful logging library in about 1000 lines of code Introduction Hello log! Feature

Sergey Podobry 1.3k Dec 1, 2021
Scalable, Portable and Distributed Gradient Boosting (GBDT, GBRT or GBM) Library, for Python, R, Java, Scala, C++ and more. Runs on single machine, Hadoop, Spark, Dask, Flink and DataFlow

eXtreme Gradient Boosting Community | Documentation | Resources | Contributors | Release Notes XGBoost is an optimized distributed gradient boosting l

Distributed (Deep) Machine Learning Community 21.9k Dec 2, 2021
LibTomMath is a free open source portable number theoretic multiple-precision integer library written entirely in C.

libtommath This is the git repository for LibTomMath, a free open source portable number theoretic multiple-precision integer (MPI) library written en

libtom 482 Dec 2, 2021
A portable, simple zip library written in C

A portable (OSX/Linux/Windows), simple zip library written in C This is done by hacking awesome miniz library and layering functions on top of the min

Kuba Podgórski 758 Dec 2, 2021
A small and portable INI file library with read/write support

minIni minIni is a portable and configurable library for reading and writing ".INI" files. At just below 900 lines of commented source code, minIni tr

Thiadmer Riemersma 196 Nov 25, 2021
Scalable, Portable and Distributed Gradient Boosting (GBDT, GBRT or GBM) Library, for Python, R, Java, Scala, C++ and more. Runs on single machine, Hadoop, Spark, Dask, Flink and DataFlow

eXtreme Gradient Boosting Community | Documentation | Resources | Contributors | Release Notes XGBoost is an optimized distributed gradient boosting l

Distributed (Deep) Machine Learning Community 21.9k Dec 4, 2021
PortAudio is a portable audio I/O library designed for cross-platform support of audio

PortAudio is a cross-platform, open-source C language library for real-time audio input and output.

PortAudio 441 Dec 1, 2021
Portable header-only C++ low level SIMD library

libsimdpp libsimdpp is a portable header-only zero-overhead C++ low level SIMD library. The library presents a single interface over SIMD instruction

Povilas Kanapickas 975 Nov 21, 2021
Feature-rich C99 library for memory scanning purposes, designed for Windows running machines, meant to work on both 32-bit and 64-bit portable executables. Has a modern C++ wrapper.

memscan Feature-rich C99 library for memory scanning purposes, designed for Windows running machines, meant to work on both 32-bit and 64-bit portable

cristei 7 Nov 16, 2021
Epoxy is a library for handling OpenGL function pointer management for you

Epoxy is a library for handling OpenGL function pointer management for you. It hides the complexity of dlopen(), dlsym(), glXGetProcAddress(), eglGetP

Eric Anholt 517 Nov 29, 2021
Epoxy is a library for handling OpenGL function pointer management for you

Epoxy is a library for handling OpenGL function pointer management for you. It hides the complexity of dlopen(), dlsym(), glXGetProcAddress(), eglGetP

Eric Anholt 517 Nov 29, 2021
The libxo library allows an application to generate text, XML, JSON, and HTML output using a common set of function calls. The application decides at run time which output style should be produced.

libxo libxo - A Library for Generating Text, XML, JSON, and HTML Output The libxo library allows an application to generate text, XML, JSON, and HTML

Juniper Networks 218 Nov 18, 2021
LibSWIFFT - A fast C/C++ library for the SWIFFT secure homomorphic hash function

LibSWIFFT - A fast C/C++ library for the SWIFFT secure homomorphic hash function Official Repository LibSWIFFT is a production-ready C/C++ library pro

Gvili Tech Ltd 21 Jun 19, 2021
Repository created to store a C function library to use in 42 School

Libft of 42. Make with ❤︎ for Luiz Cezario ?? Index What's this Repo? List of Functions Technologies How to Run Find a Bug? Or somenthing need to chan

Luiz lima cezario 9 Nov 12, 2021