summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorJiaojinxing <jiaojinxing1987@gmail.com>2018-10-16 14:36:30 (GMT)
committer Jiaojinxing <jiaojinxing1987@gmail.com>2018-10-16 14:36:30 (GMT)
commitb392296320d185a551ca04a534d9c1e94b7a5ad4 (patch)
treea83f6635bc551166b27e3ece79058f2c8cab5abc
parentf7a0133838d9a0e7f705bd4a960d1abad8e8d0e7 (diff)
downloadlibffi-b392296320d185a551ca04a534d9c1e94b7a5ad4.zip
libffi-b392296320d185a551ca04a534d9c1e94b7a5ad4.tar.gz
libffi-b392296320d185a551ca04a534d9c1e94b7a5ad4.tar.bz2
Add ARM64(AArch64) architecture support.
-rw-r--r--libffi.mk4
-rw-r--r--libffi/include/README6
-rw-r--r--libffi/include/aarch64/fficonfig.h212
-rw-r--r--libffi/include/ffi.h3
-rw-r--r--libffi/include/fficonfig.h3
-rw-r--r--libffi/include/ffitarget.h3
-rw-r--r--libffi/src/aarch64/ffi.c4
7 files changed, 234 insertions, 1 deletions
diff --git a/libffi.mk b/libffi.mk
index c2f8f92..46d3747 100644
--- a/libffi.mk
+++ b/libffi.mk
@@ -43,6 +43,10 @@ LOCAL_ARM_SRCS := \
./libffi/src/arm/ffi.c \
./libffi/src/arm/sysv.S
+LOCAL_ARM64_SRCS := \
+./libffi/src/aarch64/ffi.c \
+./libffi/src/aarch64/sysv.S
+
LOCAL_MIPS_SRCS := \
./libffi/src/mips/ffi.c \
./libffi/src/mips/o32.S
diff --git a/libffi/include/README b/libffi/include/README
index 7a00524..9759e0a 100644
--- a/libffi/include/README
+++ b/libffi/include/README
@@ -28,4 +28,8 @@ export CC=x86_64-sylixos-elf-gcc
export CFLAGS='-march=rv64imafdc -mabi=lp64d -mcmodel=medany -mno-save-restore -DSYLIXOS -I/home/user/libffi/libsylixos/SylixOS -I/home/user/libffi/libsylixos/SylixOS/include -I/home/user/libffi/libsylixos/SylixOS/include/network'
export CC=riscv-sylixos-embed-gcc
-./configure --host=riscv64 \ No newline at end of file
+./configure --host=riscv64
+
+export CFLAGS='-mstrict-align -ffixed-x18 -DSYLIXOS -I/home/user/libffi/libsylixos/SylixOS -I/home/user/libffi/libsylixos/SylixOS/include -I/home/user/libffi/libsylixos/SylixOS/include/network'
+export CC=aarch64-sylixos-elf-gcc
+./configure --host=aarch64 \ No newline at end of file
diff --git a/libffi/include/aarch64/fficonfig.h b/libffi/include/aarch64/fficonfig.h
new file mode 100644
index 0000000..07cf6b6
--- /dev/null
+++ b/libffi/include/aarch64/fficonfig.h
@@ -0,0 +1,212 @@
+/* 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 one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
+ systems. This function is required for `alloca.c' support on those systems.
+ */
+/* #undef CRAY_STACKSEG_END */
+
+/* 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 */
+
+/* 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 */
+/* #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 you have <alloca.h> and it should be used (not on Ultrix).
+ */
+#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. */
+/* #undef HAVE_AS_X86_64_UNWIND_SECTION_TYPE */
+
+/* Define if your assembler supports PC relative relocs. */
+/* #undef HAVE_AS_X86_PCREL */
+
+/* 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. */
+/* #undef HAVE_MEMCPY */
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `mkostemp' function. */
+/* #undef HAVE_MKOSTEMP */
+
+/* Define to 1 if you have the `mmap' function. */
+/* #undef HAVE_MMAP */
+
+/* Define if mmap with MAP_ANON(YMOUS) works. */
+/* #undef HAVE_MMAP_ANON */
+
+/* Define if mmap of /dev/zero works. */
+/* #undef HAVE_MMAP_DEV_ZERO */
+
+/* Define if read-only mmap of a plain file works. */
+/* #undef HAVE_MMAP_FILE */
+
+/* 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 <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/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. */
+/* #undef LIBFFI_GNU_SYMBOL_VERSIONING */
+
+/* Define to the sub-directory in which 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.3-rc0"
+
+/* 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.3-rc0"
+
+/* 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 you have the ANSI C header files. */
+#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.3-rc0"
+
+/* 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
+#define FFI_HIDDEN(name) .hidden name
+#else
+#define FFI_HIDDEN __attribute__ ((visibility ("hidden")))
+#endif
+#else
+#ifdef LIBFFI_ASM
+#define FFI_HIDDEN(name)
+#else
+#define FFI_HIDDEN
+#endif
+#endif
+
diff --git a/libffi/include/ffi.h b/libffi/include/ffi.h
index 5f8efba..b7c0bab 100644
--- a/libffi/include/ffi.h
+++ b/libffi/include/ffi.h
@@ -37,6 +37,9 @@
#if defined(__arm__)
#include "arm/ffi.h"
+#elif defined(__aarch64__)
+#include "aarch64/ffi.h"
+
#elif defined(__mips64)
#include "mips64/ffi.h"
diff --git a/libffi/include/fficonfig.h b/libffi/include/fficonfig.h
index 135ce34..09ff627 100644
--- a/libffi/include/fficonfig.h
+++ b/libffi/include/fficonfig.h
@@ -37,6 +37,9 @@
#if defined(__arm__)
#include "arm/fficonfig.h"
+#elif defined(__aarch64__)
+#include "aarch64/fficonfig.h"
+
#elif defined(__mips64)
#include "mips64/fficonfig.h"
diff --git a/libffi/include/ffitarget.h b/libffi/include/ffitarget.h
index ab4ef8a..6013302 100644
--- a/libffi/include/ffitarget.h
+++ b/libffi/include/ffitarget.h
@@ -37,6 +37,9 @@
#if defined(__arm__)
#include "arm/ffitarget.h"
+#elif defined(__aarch64__)
+#include "aarch64/ffitarget.h"
+
#elif defined(__mips64)
#include "mips64/ffitarget.h"
diff --git a/libffi/src/aarch64/ffi.c b/libffi/src/aarch64/ffi.c
index 4400b61..7751526 100644
--- a/libffi/src/aarch64/ffi.c
+++ b/libffi/src/aarch64/ffi.c
@@ -73,8 +73,12 @@ ffi_clear_cache (void *start, void *end)
#if defined (__clang__) && defined (__APPLE__)
sys_icache_invalidate (start, (char *)end - (char *)start);
#elif defined (__GNUC__)
+#ifndef SYLIXOS
__builtin___clear_cache (start, end);
#else
+ API_CacheTextUpdate(start, (char *)end - (char *)start);
+#endif
+#else
#error "Missing builtin to flush instruction cache"
#endif
}