diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-05-10 06:57:49 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-05-10 06:57:49 +0000 |
commit | bf31600a8c9308f4dc498941339aac8dd543194f (patch) | |
tree | 50eba57786513b47bc0d5cdbb87d32db0a378c2d | |
parent | 1cdd0767e0dc40369758193904745a1d20ede0ee (diff) | |
parent | 47314d07bf1eea83e5599a7b158586da9d5920c6 (diff) | |
download | libffi-android13-mainline-adbd-release.tar.gz |
Snap for 8564071 from 47314d07bf1eea83e5599a7b158586da9d5920c6 to mainline-adbd-releaseaml_adb_331610000aml_adb_331314020aml_adb_331113120aml_adb_331011050aml_adb_331011040android13-mainline-adbd-release
Change-Id: Ib926f81be69ca40357bcd424a4548c583bd27807
-rw-r--r-- | CMakeLists.txt | 68 | ||||
-rw-r--r-- | METADATA | 10 | ||||
-rw-r--r-- | windows-msvc-x86_64/fficonfig.h | 211 |
3 files changed, 284 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..41239f0b --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,68 @@ +# Copyright 2021 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# +# Build libffi for Windows x86_64 using MSVC. +# + +project(libffi LANGUAGES C ASM_MASM) +cmake_minimum_required(VERSION 3.18.1) + +set(src ${CMAKE_CURRENT_SOURCE_DIR}) +set(out ${CMAKE_CURRENT_BINARY_DIR}) + +set(TARGET X86_WIN64) +set(HAVE_LONG_DOUBLE 0) +set(FFI_EXEC_TRAMPOLINE_TABLE 0) +configure_file(include/ffi.h.in ${out}/ffi.h @ONLY) + +add_library(libffi SHARED + src/prep_cif.c + src/types.c + src/raw_api.c + src/java_raw_api.c + src/closures.c + src/x86/ffiw64.c + ${out}/win64_intel.asm +) + +configure_file(src/x86/ffitarget.h ${out}/dist/include/ffitarget.h COPYONLY) +configure_file(${out}/ffi.h ${out}/dist/include/ffi.h COPYONLY) + +set(defines + -DHAVE_CONFIG_H=1 + -DFFI_BUILDING_DLL=1 +) + +set(include_dirs + ${src}/include + ${src}/windows-msvc-x86_64 + ${src}/src/x86 + ${out} +) + +target_compile_definitions(libffi PRIVATE ${defines}) +target_include_directories(libffi PUBLIC ${include_dirs}) + +list(TRANSFORM include_dirs PREPEND -I OUTPUT_VARIABLE include_dir_args) + +# Preprocess this .S file before assembling it with ml64. It's not clear to me whether CMake is +# supposed to support this inherently. The msvc_build/aarch64/Ffi_staticLib.vcxproj project also +# uses a CustomBuild step. This step won't rebuild if an included file changes, which might be +# fixable (someday), perhaps using the DEPFILE argument to add_custom_command. +add_custom_command( + OUTPUT ${out}/win64_intel.asm + COMMAND cl /EP ${src}/src/x86/win64_intel.S ${defines} ${include_dir_args} >${out}/win64_intel.asm + DEPENDS src/x86/win64_intel.S ${out}/ffi.h +) @@ -6,11 +6,11 @@ third_party { value: "https://github.com/libffi/libffi.git" } version: "v3.3" - # would be NOTICE save for: - # .travis/ - # testsuite/lib*/ - # libtool-ldflags - # LICENSE-BUILDTOOLS + license_note: "would be NOTICE save for:\n" + " .travis/\n" + " testsuite/lib*/\n" + " libtool-ldflags\n" + " LICENSE-BUILDTOOLS" license_type: RESTRICTED last_upgrade_date { year: 2020 diff --git a/windows-msvc-x86_64/fficonfig.h b/windows-msvc-x86_64/fficonfig.h new file mode 100644 index 00000000..94ae1f3a --- /dev/null +++ b/windows-msvc-x86_64/fficonfig.h @@ -0,0 +1,211 @@ +/* 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. */ +/* #undef EH_FRAME_FLAGS */ + +/* 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 <alloca.h> works. */ +/* #undef HAVE_ALLOCA_H */ + +/* Define if your assembler supports .cfi_* directives. */ +/* #undef HAVE_AS_CFI_PSEUDO_OP */ + +/* 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. */ +#define HAVE_AS_X86_PCREL 1 + +/* Define to 1 if you have the <dlfcn.h> header file. */ +/* #undef HAVE_DLFCN_H */ + +/* Define if __attribute__((visibility("hidden"))) is supported. */ +/* #undef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE */ + +/* 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 */ +/* #undef HAVE_LONG_DOUBLE */ + +/* 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 `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. */ +/* #undef HAVE_RO_EH_FRAME */ + +/* 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. */ +/* #undef HAVE_STRINGS_H */ + +/* 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. */ +/* #undef HAVE_SYS_MMAN_H */ + +/* 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. */ +/* #undef HAVE_UNISTD_H */ + +/* Define to 1 if GNU symbol versioning is used for libatomic. */ +/* #undef LIBFFI_GNU_SYMBOL_VERSIONING */ + +/* 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.3" + +/* 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" + +/* 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 8 + +/* 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.3" + +/* 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 + |