-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Port upstream libffi 3.4.4 for x86_64
This change ports the parts of libffi 3.4.4 relevant to x86 to unikraft. Signed-off-by: Andrei Tatar <andrei@unikraft.io>
- Loading branch information
Showing
6 changed files
with
1,067 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
menuconfig LIBFFI | ||
bool "libffi - Portable Foreign Function Interface Library" | ||
default n | ||
|
||
if LIBFFI | ||
config LIBFFI_TYPES | ||
bool "Provide ffi_type_* definitions" | ||
default n | ||
|
||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
# libffi Makefile.uk | ||
# | ||
# Authors: Andrei Tatar <andrei@unikraft.io> | ||
# | ||
# Copyright (c) 2023, Unikraft GmbH and The Unikraft Authors. | ||
# | ||
# Redistribution and use in source and binary forms, with or without | ||
# modification, are permitted provided that the following conditions | ||
# are met: | ||
# | ||
# 1. Redistributions of source code must retain the above copyright | ||
# notice, this list of conditions and the following disclaimer. | ||
# 2. Redistributions in binary form must reproduce the above copyright | ||
# notice, this list of conditions and the following disclaimer in the | ||
# documentation and/or other materials provided with the distribution. | ||
# 3. Neither the name of the copyright holder nor the names of its | ||
# contributors may be used to endorse or promote products derived from | ||
# this software without specific prior written permission. | ||
# | ||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | ||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
# POSSIBILITY OF SUCH DAMAGE. | ||
# | ||
|
||
################################################################################ | ||
# Library registration | ||
################################################################################ | ||
$(eval $(call addlib_s,libffi,$(CONFIG_LIBFFI))) | ||
|
||
################################################################################ | ||
# Sources | ||
################################################################################ | ||
LIBFFI_VERSION=3.4.4 | ||
LIBFFI_URL=https://github.com/libffi/libffi/releases/download/v$(LIBFFI_VERSION)/libffi-$(LIBFFI_VERSION).tar.gz | ||
LIBFFI_DIRNAME=libffi-$(LIBFFI_VERSION) | ||
LIBFFI_PATCHDIR=$(LIBFFI_BASE)/patches | ||
$(eval $(call fetch,libffi,$(LIBFFI_URL))) | ||
$(eval $(call patch,libffi,$(LIBFFI_PATCHDIR),$(LIBFFI_DIRNAME))) | ||
|
||
################################################################################ | ||
# Helpers | ||
################################################################################ | ||
LIBFFI_SRC = $(LIBFFI_ORIGIN)/$(LIBFFI_DIRNAME) | ||
|
||
################################################################################ | ||
# Library includes | ||
################################################################################ | ||
# API | ||
LIBFFI__X86API += -I$(LIBFFI_BASE)/arch/x86_64/include | ||
|
||
ifeq ($(CONFIG_ARCH_X86_64),y) | ||
CINCLUDES-$(CONFIG_LIBFFI) += $(LIBFFI__X86API) | ||
CXXINCLUDES-$(CONFIG_LIBFFI) += $(LIBFFI__X86API) | ||
ASINCLUDES-$(CONFIG_LIBFFI) += $(LIBFFI__X86API) | ||
endif | ||
|
||
# Internal | ||
LIBFFI_INCLUDES-$(CONFIG_ARCH_X86_64) += -I$(LIBFFI_BASE)/arch/x86_64 | ||
LIBFFI_INCLUDES-y += -I$(LIBFFI_SRC) | ||
LIBFFI_INCLUDES-y += -I$(LIBFFI_SRC)/include | ||
LIBFFI_INCLUDES-y += -I$(LIBFFI_SRC)/src | ||
|
||
LIBFFI_CINCLUDES-y += $(LIBFFI_INCLUDES-y) | ||
LIBFFI_ASINCLUDES-y += $(LIBFFI_INCLUDES-y) | ||
|
||
################################################################################ | ||
# Global flags | ||
################################################################################ | ||
LIBFFI_COMMONFLAGS += -DHAVE_CONFIG_H | ||
LIBFFI_COMMONFLAGS += -D__linux__ | ||
LIBFFI_FLAGS += -fstrict-aliasing | ||
LIBFFI_FLAGS += -ffast-math | ||
LIBFFI_FLAGS += -fexceptions | ||
LIBFFI_FLAGS += -Wall | ||
|
||
LIBFFI_CFLAGS += $(LIBFFI_COMMONFLAGS) $(LIBFFI_FLAGS) | ||
LIBFFI_ASFLAGS += $(LIBFFI_COMMONFLAGS) | ||
|
||
################################################################################ | ||
# Library sources | ||
################################################################################ | ||
# These are taken from what upstream builds and sorted in alphabetical order. | ||
# Please maintain this ordering when updating the library. | ||
################################################################################ | ||
LIBFFI_SRCS-y += $(LIBFFI_SRC)/src/closures.c | ||
LIBFFI_SRCS-y += $(LIBFFI_SRC)/src/java_raw_api.c | ||
LIBFFI_SRCS-y += $(LIBFFI_SRC)/src/prep_cif.c | ||
LIBFFI_SRCS-y += $(LIBFFI_SRC)/src/raw_api.c | ||
LIBFFI_SRCS-y += $(LIBFFI_SRC)/src/tramp.c | ||
LIBFFI_SRCS-$(CONFIG_LIBFFI_TYPES) += $(LIBFFI_SRC)/src/types.c | ||
|
||
LIBFFI_SRCS-$(CONFIG_ARCH_X86_64) += $(LIBFFI_SRC)/src/x86/ffi64.c | ||
LIBFFI_SRCS-$(CONFIG_ARCH_X86_64) += $(LIBFFI_SRC)/src/x86/ffiw64.c | ||
LIBFFI_SRCS-$(CONFIG_ARCH_X86_64) += $(LIBFFI_SRC)/src/x86/unix64.S | ||
LIBFFI_SRCS-$(CONFIG_ARCH_X86_64) += $(LIBFFI_SRC)/src/x86/win64.S |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,227 @@ | ||
/* fficonfig.h. Generated from fficonfig.h.in by configure. */ | ||
/* fficonfig.h.in. Generated from configure.ac by autoheader. */ | ||
|
||
/* Define if building universal (internal helper macro) */ | ||
/* #undef AC_APPLE_UNIVERSAL_BUILD */ | ||
|
||
/* Define to 1 if using 'alloca.c'. */ | ||
/* #undef C_ALLOCA */ | ||
|
||
/* Define to the flags needed for the .section .eh_frame directive. */ | ||
#define EH_FRAME_FLAGS "a" | ||
|
||
/* Define this if you want extra debugging. */ | ||
/* #undef FFI_DEBUG */ | ||
|
||
/* Define this if you want statically defined trampolines */ | ||
#define FFI_EXEC_STATIC_TRAMP 1 | ||
|
||
/* Cannot use PROT_EXEC on this target, so, we revert to alternative means */ | ||
/* #undef FFI_EXEC_TRAMPOLINE_TABLE */ | ||
|
||
/* Define this if you want to enable pax emulated trampolines (experimental) | ||
*/ | ||
/* #undef FFI_MMAP_EXEC_EMUTRAMP_PAX */ | ||
|
||
/* Cannot use malloc on this target, so, we revert to alternative means */ | ||
/* #undef FFI_MMAP_EXEC_WRIT */ | ||
|
||
/* Define this if you do not want support for the raw API. */ | ||
/* #undef FFI_NO_RAW_API */ | ||
|
||
/* Define this if you do not want support for aggregate types. */ | ||
/* #undef FFI_NO_STRUCTS */ | ||
|
||
/* Define to 1 if you have 'alloca', as a function or macro. */ | ||
#define HAVE_ALLOCA 1 | ||
|
||
/* Define to 1 if <alloca.h> works. */ | ||
#define HAVE_ALLOCA_H 1 | ||
|
||
/* Define if your assembler supports .cfi_* directives. */ | ||
#define HAVE_AS_CFI_PSEUDO_OP 1 | ||
|
||
/* Define if your assembler supports .register. */ | ||
/* #undef HAVE_AS_REGISTER_PSEUDO_OP */ | ||
|
||
/* Define if the compiler uses zarch features. */ | ||
/* #undef HAVE_AS_S390_ZARCH */ | ||
|
||
/* Define if your assembler and linker support unaligned PC relative relocs. | ||
*/ | ||
/* #undef HAVE_AS_SPARC_UA_PCREL */ | ||
|
||
/* Define if your assembler supports unwind section type. */ | ||
#define HAVE_AS_X86_64_UNWIND_SECTION_TYPE 1 | ||
|
||
/* Define if your assembler supports PC relative relocs. */ | ||
#define HAVE_AS_X86_PCREL 1 | ||
|
||
/* Define to 1 if you have the <dlfcn.h> header file. */ | ||
#define HAVE_DLFCN_H 1 | ||
|
||
/* Define if __attribute__((visibility("hidden"))) is supported. */ | ||
#define HAVE_HIDDEN_VISIBILITY_ATTRIBUTE 1 | ||
|
||
/* Define to 1 if you have the <inttypes.h> header file. */ | ||
#define HAVE_INTTYPES_H 1 | ||
|
||
/* Define if you have the long double type and it is bigger than a double */ | ||
#define HAVE_LONG_DOUBLE 1 | ||
|
||
/* Define if you support more than one size of the long double type */ | ||
/* #undef HAVE_LONG_DOUBLE_VARIANT */ | ||
|
||
/* Define to 1 if you have the `memcpy' function. */ | ||
#define HAVE_MEMCPY 1 | ||
|
||
/* Define to 1 if you have the `memfd_create' function. */ | ||
#define HAVE_MEMFD_CREATE 1 | ||
|
||
/* Define to 1 if you have the `mkostemp' function. */ | ||
#define HAVE_MKOSTEMP 1 | ||
|
||
/* Define to 1 if you have the `mkstemp' function. */ | ||
#define HAVE_MKSTEMP 1 | ||
|
||
/* Define to 1 if you have the `mmap' function. */ | ||
#define HAVE_MMAP 1 | ||
|
||
/* Define if mmap with MAP_ANON(YMOUS) works. */ | ||
#define HAVE_MMAP_ANON 1 | ||
|
||
/* Define if mmap of /dev/zero works. */ | ||
#define HAVE_MMAP_DEV_ZERO 1 | ||
|
||
/* Define if read-only mmap of a plain file works. */ | ||
#define HAVE_MMAP_FILE 1 | ||
|
||
/* Define if your compiler supports pointer authentication. */ | ||
/* #undef HAVE_PTRAUTH */ | ||
|
||
/* Define if .eh_frame sections should be read-only. */ | ||
#define HAVE_RO_EH_FRAME 1 | ||
|
||
/* Define to 1 if you have the <stdint.h> header file. */ | ||
#define HAVE_STDINT_H 1 | ||
|
||
/* Define to 1 if you have the <stdio.h> header file. */ | ||
#define HAVE_STDIO_H 1 | ||
|
||
/* Define to 1 if you have the <stdlib.h> header file. */ | ||
#define HAVE_STDLIB_H 1 | ||
|
||
/* Define to 1 if you have the <strings.h> header file. */ | ||
#define HAVE_STRINGS_H 1 | ||
|
||
/* Define to 1 if you have the <string.h> header file. */ | ||
#define HAVE_STRING_H 1 | ||
|
||
/* Define to 1 if you have the <sys/memfd.h> header file. */ | ||
/* #undef HAVE_SYS_MEMFD_H */ | ||
|
||
/* Define to 1 if you have the <sys/mman.h> header file. */ | ||
#define HAVE_SYS_MMAN_H 1 | ||
|
||
/* Define to 1 if you have the <sys/stat.h> header file. */ | ||
#define HAVE_SYS_STAT_H 1 | ||
|
||
/* Define to 1 if you have the <sys/types.h> header file. */ | ||
#define HAVE_SYS_TYPES_H 1 | ||
|
||
/* Define to 1 if you have the <unistd.h> header file. */ | ||
#define HAVE_UNISTD_H 1 | ||
|
||
/* Define to 1 if GNU symbol versioning is used for libatomic. */ | ||
#define LIBFFI_GNU_SYMBOL_VERSIONING 1 | ||
|
||
/* Define to the sub-directory where libtool stores uninstalled libraries. */ | ||
#define LT_OBJDIR ".libs/" | ||
|
||
/* Name of package */ | ||
#define PACKAGE "libffi" | ||
|
||
/* Define to the address where bug reports for this package should be sent. */ | ||
#define PACKAGE_BUGREPORT "http://github.com/libffi/libffi/issues" | ||
|
||
/* Define to the full name of this package. */ | ||
#define PACKAGE_NAME "libffi" | ||
|
||
/* Define to the full name and version of this package. */ | ||
#define PACKAGE_STRING "libffi 3.4.4" | ||
|
||
/* Define to the one symbol short name of this package. */ | ||
#define PACKAGE_TARNAME "libffi" | ||
|
||
/* Define to the home page for this package. */ | ||
#define PACKAGE_URL "" | ||
|
||
/* Define to the version of this package. */ | ||
#define PACKAGE_VERSION "3.4.4" | ||
|
||
/* The size of `double', as computed by sizeof. */ | ||
#define SIZEOF_DOUBLE 8 | ||
|
||
/* The size of `long double', as computed by sizeof. */ | ||
#define SIZEOF_LONG_DOUBLE 16 | ||
|
||
/* The size of `size_t', as computed by sizeof. */ | ||
#define SIZEOF_SIZE_T 8 | ||
|
||
/* If using the C implementation of alloca, define if you know the | ||
direction of stack growth for your system; otherwise it will be | ||
automatically deduced at runtime. | ||
STACK_DIRECTION > 0 => grows toward higher addresses | ||
STACK_DIRECTION < 0 => grows toward lower addresses | ||
STACK_DIRECTION = 0 => direction of growth unknown */ | ||
/* #undef STACK_DIRECTION */ | ||
|
||
/* Define to 1 if all of the C90 standard headers exist (not just the ones | ||
required in a freestanding environment). This macro is provided for | ||
backward compatibility; new code need not use it. */ | ||
#define STDC_HEADERS 1 | ||
|
||
/* Define if symbols are underscored. */ | ||
/* #undef SYMBOL_UNDERSCORE */ | ||
|
||
/* Define this if you are using Purify and want to suppress spurious messages. | ||
*/ | ||
/* #undef USING_PURIFY */ | ||
|
||
/* Version number of package */ | ||
#define VERSION "3.4.4" | ||
|
||
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most | ||
significant byte first (like Motorola and SPARC, unlike Intel). */ | ||
#if defined AC_APPLE_UNIVERSAL_BUILD | ||
# if defined __BIG_ENDIAN__ | ||
# define WORDS_BIGENDIAN 1 | ||
# endif | ||
#else | ||
# ifndef WORDS_BIGENDIAN | ||
/* # undef WORDS_BIGENDIAN */ | ||
# endif | ||
#endif | ||
|
||
/* Define to `unsigned int' if <sys/types.h> does not define. */ | ||
/* #undef size_t */ | ||
|
||
|
||
#ifdef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE | ||
#ifdef LIBFFI_ASM | ||
#ifdef __APPLE__ | ||
#define FFI_HIDDEN(name) .private_extern name | ||
#else | ||
#define FFI_HIDDEN(name) .hidden name | ||
#endif | ||
#else | ||
#define FFI_HIDDEN __attribute__ ((visibility ("hidden"))) | ||
#endif | ||
#else | ||
#ifdef LIBFFI_ASM | ||
#define FFI_HIDDEN(name) | ||
#else | ||
#define FFI_HIDDEN | ||
#endif | ||
#endif | ||
|
Oops, something went wrong.