OSDN Git Service

Add arm64 build target.
authorGarfield Tan <xutan@google.com>
Tue, 17 Oct 2017 18:13:15 +0000 (11:13 -0700)
committerGarfield Tan <xutan@google.com>
Tue, 17 Oct 2017 22:44:30 +0000 (15:44 -0700)
Fix the weird blueprint file scheme. multilib is not necessary to build
multiple libraries for 64 bit targets.

Test: "mma -j128" built external/libffi for
aosp_(x86,x86_64,arm,arm64)-eng.
Change-Id: Ic102141e5768aaa8750f50c98e0be729553675aa

Android.bp
linux-arm64/ffi.h [new file with mode: 0644]
linux-arm64/fficonfig.h [new file with mode: 0644]
linux-arm64/ffitarget.h [new file with mode: 0644]

index 3b66314..984892d 100644 (file)
@@ -20,22 +20,6 @@ genrule {
     tool_files: ["gen_ffi_header.sh"],
 }
 
-arm_srcs = [
-    "src/arm/sysv.S",
-    "src/arm/ffi.c",
-]
-
-x86_srcs = [
-    "src/x86/ffi.c",
-    "src/x86/sysv.S",
-    "src/x86/win32.S",
-]
-
-x86_64_srcs = [
-    "src/x86/ffi64.c",
-    "src/x86/unix64.S",
-]
-
 cc_library_static {
     name: "libffi",
     cflags: ["-Wno-unused-parameter", "-Wno-sign-compare"],
@@ -49,36 +33,42 @@ cc_library_static {
         "src/raw_api.c",
         "src/types.c",
     ],
-    multilib: {
-        lib64: {
-            srcs: x86_64_srcs,
-        },
-        lib32: {
-            srcs: arm_srcs + x86_srcs,
-        },
-    },
     arch: {
         arm: {
-            exclude_srcs: x86_srcs + x86_64_srcs,
-            local_include_dirs: ["linux-arm"],
+            srcs: [
+                "src/arm/sysv.S",
+                "src/arm/ffi.c",
+            ],
             export_include_dirs: ["linux-arm"],
         },
+        arm64: {
+            srcs: [
+                "src/aarch64/sysv.S",
+                "src/aarch64/ffi.c",
+            ],
+            export_include_dirs: ["linux-arm64"],
+        },
         x86: {
-            exclude_srcs: arm_srcs,
+            srcs: [
+                "src/x86/ffi.c",
+                "src/x86/sysv.S",
+                "src/x86/win32.S",
+            ],
             asflags: [
                 "-DHAVE_AS_X86_PCREL",
                 "-DHAVE_AS_ASCII_PSEUDO_OP",
             ],
-            local_include_dirs: ["linux-x86"],
             export_include_dirs: ["linux-x86"],
         },
         x86_64: {
-            exclude_srcs: arm_srcs,
+            srcs: [
+                "src/x86/ffi64.c",
+                "src/x86/unix64.S",
+            ],
             asflags: [
                 "-DHAVE_AS_X86_PCREL",
                 "-DHAVE_AS_ASCII_PSEUDO_OP",
             ],
-            local_include_dirs: ["linux-x86_64"],
             export_include_dirs: ["linux-x86_64"],
         },
     },
diff --git a/linux-arm64/ffi.h b/linux-arm64/ffi.h
new file mode 100644 (file)
index 0000000..521e0fd
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2015, 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.
+ */
+#ifndef LIBFFI_H
+
+#define ARM
+#define CONF_HAVE_LONG_DOUBLE 1
+
+#define LIBFFI_H
+#include "../src/aarch64/ffitarget.h"
+#undef LIBFFI_H
+
+#include "ffi_gen.h"
+
+#endif
diff --git a/linux-arm64/fficonfig.h b/linux-arm64/fficonfig.h
new file mode 100644 (file)
index 0000000..1055e03
--- /dev/null
@@ -0,0 +1,160 @@
+/* fficonfig.h.in.  Generated from configure.ac by autoheader.  */
+
+/* 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 "aw"
+
+/* Define this if you want extra debugging. */
+#undef FFI_DEBUG
+
+/* Define this is you do not want support for the raw API. */
+#undef FFI_NO_RAW_API
+
+/* Define this is 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. */
+#undef HAVE_AS_CFI_PSEUDO_OP
+
+/* Define if your assembler supports .register. */
+#undef HAVE_AS_REGISTER_PSEUDO_OP
+
+/* Define if your assembler and linker support unaligned PC relative relocs.
+   */
+#undef HAVE_AS_SPARC_UA_PCREL
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define HAVE_DLFCN_H 1
+
+/* 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 to 1 if you have the `memcpy' function. */
+#define HAVE_MEMCPY 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 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 .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 <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. */
+#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 your C compiler doesn't accept -c and -o together. */
+#undef NO_MINUS_C_MINUS_O
+
+/* Name of package */
+#define PACKAGE "libffi"
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* The size of `double', as computed by sizeof. */
+#define SIZEOF_DOUBLE 8
+
+/* The size of `long double', as computed by sizeof. */
+#undef SIZEOF_LONG_DOUBLE
+
+/* 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 this if you are using Purify and want to suppress spurious messages.
+   */
+#undef USING_PURIFY
+
+/* Version number of package */
+#undef VERSION
+
+/* Define to 1 if your processor stores words with the most significant byte
+   first (like Motorola and SPARC, unlike Intel and VAX). */
+#undef WORDS_BIGENDIAN
+
+
+#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/linux-arm64/ffitarget.h b/linux-arm64/ffitarget.h
new file mode 100644 (file)
index 0000000..0346c28
--- /dev/null
@@ -0,0 +1,18 @@
+/*
+ * Copyright 2015, 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.
+ */
+#ifndef LIBFFI_TARGET_H
+#include "../src/aarch64/ffitarget.h"
+#endif