From 65453211e00f83dee15ba04e3297852d1683160d Mon Sep 17 00:00:00 2001 From: Ben Cheng Date: Wed, 2 Apr 2014 13:57:00 -0700 Subject: [4.9] Apply aarch64 patches for Android toolchain build. - The changes in gcc/config.gcc and gcc/config/aarch64/aarch64-linux.h will be upstreamed. - libatomic is disabled for now. - md_unwind_header in libgcc/config.host is also disabled for now due to lack of sys/ucontext.h. Change-Id: Idad7c75a9eaf27e6737fe3a217ff2791b4bf8358 --- gcc-4.9/gcc/config.gcc | 3 ++- gcc-4.9/gcc/config/aarch64/aarch64-linux.h | 30 ++++++++++++++++++++++++++++-- gcc-4.9/libatomic/configure.tgt | 5 +++++ gcc-4.9/libgcc/config.host | 3 ++- 4 files changed, 37 insertions(+), 4 deletions(-) diff --git a/gcc-4.9/gcc/config.gcc b/gcc-4.9/gcc/config.gcc index 3c55c88..7e51940 100644 --- a/gcc-4.9/gcc/config.gcc +++ b/gcc-4.9/gcc/config.gcc @@ -903,8 +903,9 @@ aarch64*-*-elf) TM_MULTILIB_CONFIG=`echo $TM_MULTILIB_CONFIG | sed 's/^,//'` ;; aarch64*-*-linux*) - tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h" + tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h linux-android.h glibc-stdint.h" tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-linux.h" + extra_options="${extra_options} linux-android.opt" tmake_file="${tmake_file} aarch64/t-aarch64 aarch64/t-aarch64-linux" case $target in aarch64_be-*) diff --git a/gcc-4.9/gcc/config/aarch64/aarch64-linux.h b/gcc-4.9/gcc/config/aarch64/aarch64-linux.h index a8f0771..4eacdb2 100644 --- a/gcc-4.9/gcc/config/aarch64/aarch64-linux.h +++ b/gcc-4.9/gcc/config/aarch64/aarch64-linux.h @@ -22,6 +22,7 @@ #define GCC_AARCH64_LINUX_H #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64%{mbig-endian:_be}.so.1" +#define BIONIC_DYNAMIC_LINKER "/system/bin/linker64" #define CPP_SPEC "%{pthread:-D_REENTRANT}" @@ -35,13 +36,38 @@ %{mbig-endian:-EB} %{mlittle-endian:-EL} \ -maarch64linux%{mbig-endian:b}" -#define LINK_SPEC LINUX_TARGET_LINK_SPEC - #define TARGET_OS_CPP_BUILTINS() \ do \ { \ GNU_USER_TARGET_OS_CPP_BUILTINS(); \ + ANDROID_TARGET_OS_CPP_BUILTINS(); \ } \ while (0) +#undef LINK_SPEC +#define LINK_SPEC \ + LINUX_OR_ANDROID_LD (LINUX_TARGET_LINK_SPEC, \ + LINUX_TARGET_LINK_SPEC " " ANDROID_LINK_SPEC) + +#undef CC1_SPEC +#define CC1_SPEC \ + LINUX_OR_ANDROID_CC (GNU_USER_TARGET_CC1_SPEC, \ + GNU_USER_TARGET_CC1_SPEC " " ANDROID_CC1_SPEC) + +#define CC1PLUS_SPEC \ + LINUX_OR_ANDROID_CC ("", ANDROID_CC1PLUS_SPEC) + +#undef LIB_SPEC +#define LIB_SPEC \ + LINUX_OR_ANDROID_LD (GNU_USER_TARGET_LIB_SPEC, \ + GNU_USER_TARGET_NO_PTHREADS_LIB_SPEC " " ANDROID_LIB_SPEC) + +#undef STARTFILE_SPEC +#define STARTFILE_SPEC \ + LINUX_OR_ANDROID_LD (GNU_USER_TARGET_STARTFILE_SPEC, ANDROID_STARTFILE_SPEC) + +#undef ENDFILE_SPEC +#define ENDFILE_SPEC \ + LINUX_OR_ANDROID_LD (GNU_USER_TARGET_ENDFILE_SPEC, ANDROID_ENDFILE_SPEC) + #endif /* GCC_AARCH64_LINUX_H */ diff --git a/gcc-4.9/libatomic/configure.tgt b/gcc-4.9/libatomic/configure.tgt index a3757ef..3904e66 100644 --- a/gcc-4.9/libatomic/configure.tgt +++ b/gcc-4.9/libatomic/configure.tgt @@ -95,6 +95,11 @@ fi # Other system configury case "${target}" in + aarch64*) + # ANDROID - This is currently not supported in AArch64. + UNSUPPORTED=1 + ;; + arm*-*-linux*) # OS support for atomic primitives. config_path="${config_path} linux/arm posix" diff --git a/gcc-4.9/libgcc/config.host b/gcc-4.9/libgcc/config.host index f8f74cc..91d4962 100644 --- a/gcc-4.9/libgcc/config.host +++ b/gcc-4.9/libgcc/config.host @@ -320,7 +320,8 @@ aarch64*-*-elf) tmake_file="${tmake_file} ${cpu_type}/t-softfp t-softfp" ;; aarch64*-*-linux*) - md_unwind_header=aarch64/linux-unwind.h + # ANDROID - uncomment when sysroot contains sys/ucontext.h + # md_unwind_header=aarch64/linux-unwind.h tmake_file="${tmake_file} ${cpu_type}/t-aarch64" tmake_file="${tmake_file} ${cpu_type}/t-softfp t-softfp" ;; -- cgit v1.1