AArch64: Add initial support for AArch64
This is the first patch out of a series of patches that add support for
AArch64, the new 64bit execution state of the ARMv8 Architecture. The
patches add support for LP64 programming model.
The patch adds:
* "arch-aarch64" to the architecture directories.
* "arch-aarch64/include" - headers used by libc
* "arch-aarch64/bionic":
- crtbegin, crtend support;
- aarch64 specific syscall stubs;
- setjmp, clone, vfork assembly files.
Change-Id: If72b859f81928d03ad05d4ccfcb54c2f5dbf99a5
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
diff --git a/libc/Android.mk b/libc/Android.mk
index 962365e..94664d1 100644
--- a/libc/Android.mk
+++ b/libc/Android.mk
@@ -1,4 +1,4 @@
-LOCAL_PATH:= $(call my-dir)
+LOCAL_PATH := $(call my-dir)
include $(LOCAL_PATH)/arch-$(TARGET_ARCH)/syscalls.mk
@@ -506,6 +506,40 @@
endif # x86_64
+ifeq ($(TARGET_ARCH), aarch64)
+#TODO: Replace C stubs with optimised assembly
+libc_common_src_files += \
+ bionic/memchr.c \
+ bionic/memcmp.c \
+ bionic/memcpy.c \
+ bionic/memmove.c \
+ bionic/memrchr.c \
+ bionic/memset.c \
+ bionic/strchr.cpp \
+ bionic/strnlen.c \
+ string/bcopy.c \
+ string/index.c \
+ string/memcmp16.c \
+ string/strcat.c \
+ string/strcmp.c \
+ string/strcpy.c \
+ string/strlcat.c \
+ string/strlcpy.c \
+ string/strlen.c \
+ string/strncat.c \
+ string/strncmp.c \
+ string/strncpy.c \
+ string/strrchr.c \
+ upstream-freebsd/lib/libc/string/wcscat.c \
+ upstream-freebsd/lib/libc/string/wcschr.c \
+ upstream-freebsd/lib/libc/string/wcscmp.c \
+ upstream-freebsd/lib/libc/string/wcscpy.c \
+ upstream-freebsd/lib/libc/string/wcslen.c \
+ upstream-freebsd/lib/libc/string/wcsrchr.c \
+ upstream-freebsd/lib/libc/string/wmemcmp.c \
+
+endif # aarch64
+
ifeq ($(TARGET_ARCH),arm)
ifeq ($(strip $(TARGET_CPU_VARIANT)),)
$(warning TARGET_ARCH is arm, but TARGET_CPU_VARIANT is not defined)
@@ -628,7 +662,7 @@
# which are needed to build all other objects (shared/static libs and
# executables)
# ==========================================================================
-# ARM, MIPS, and x86 all need crtbegin_so/crtend_so.
+# AArch64, ARM, MIPS, and x86 all need crtbegin_so/crtend_so.
#
# For x86, the .init section must point to a function that calls all
# entries in the .ctors section. (on ARM this is done through the
@@ -641,6 +675,10 @@
libc_crt_target_crtbegin_file := $(LOCAL_PATH)/arch-common/bionic/crtbegin.c
libc_crt_target_crtbegin_so_file := $(LOCAL_PATH)/arch-common/bionic/crtbegin_so.c
+ifeq ($(TARGET_ARCH),aarch64)
+ libc_crt_target_so_cflags :=
+ libc_crt_target_crtbegin_file := $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin.c
+endif
ifeq ($(TARGET_ARCH),arm)
libc_crt_target_so_cflags :=
endif
@@ -1065,6 +1103,8 @@
# ========================================================
# libc_malloc_debug_qemu.so
# ========================================================
+#TODO: We do not build this library for now
+ifneq ($(TARGET_ARCH),aarch64)
include $(CLEAR_VARS)
LOCAL_CFLAGS := \
@@ -1090,6 +1130,7 @@
include $(BUILD_SHARED_LIBRARY)
+endif #!aarch64
endif #!user