From: Fredrik Fornwall Date: Fri, 29 Apr 2016 11:47:38 +0000 (-0400) Subject: gcc: Update from 5.3.0 to 6.1.0 X-Git-Url: https://git.distorted.org.uk/~mdw/termux-packages/commitdiff_plain/b257fed926f4f9cc70948ca64dfbaa21cda8c0a2?hp=4c96d3fbe537f6824872822f07e4422003a5f72e gcc: Update from 5.3.0 to 6.1.0 Also add patches from crystax --- diff --git a/packages/gcc/build.sh b/packages/gcc/build.sh index e44afc5d..f685fefc 100755 --- a/packages/gcc/build.sh +++ b/packages/gcc/build.sh @@ -1,8 +1,7 @@ TERMUX_PKG_HOMEPAGE=http://gcc.gnu.org/ TERMUX_PKG_DESCRIPTION="GNU C compiler" -TERMUX_PKG_DEPENDS="binutils, libgmp, libmpfr, libmpc, ndk-sysroot, libgcc, libisl" -TERMUX_PKG_VERSION=5.3.0 -TERMUX_PKG_BUILD_REVISION=2 +TERMUX_PKG_DEPENDS="binutils, libgmp, libmpfr, libmpc, ndk-sysroot, libgcc, libisl, libgnustl" +TERMUX_PKG_VERSION=6.1.0 TERMUX_PKG_SRCURL=ftp://ftp.fu-berlin.de/unix/languages/gcc/releases/gcc-${TERMUX_PKG_VERSION}/gcc-${TERMUX_PKG_VERSION}.tar.bz2 TERMUX_PKG_EXTRA_CONFIGURE_ARGS="--enable-languages=c,c++ --with-system-zlib --disable-multilib --disable-lto" TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --target=$TERMUX_HOST_PLATFORM" @@ -12,6 +11,8 @@ TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --with-stage1-ldflags=\"-specs=$TERMUX_SCRIPT TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --with-isl-include=$TERMUX_PREFIX/include --with-isl-lib=$TERMUX_PREFIX/lib" TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --disable-isl-version-check" TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --disable-tls" +TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --enable-host-shared" +TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --enable-default-pie" if [ "$TERMUX_ARCH" = "arm" ]; then TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --with-arch=armv7-a --with-fpu=neon --with-float=hard" diff --git a/packages/gcc/gcc-config-aarch64-aarch64-linux-android.h.patch b/packages/gcc/gcc-config-aarch64-aarch64-linux-android.h.patch index 5a10924e..8a90ee22 100644 --- a/packages/gcc/gcc-config-aarch64-aarch64-linux-android.h.patch +++ b/packages/gcc/gcc-config-aarch64-aarch64-linux-android.h.patch @@ -1,9 +1,7 @@ -From https://github.com/crystax/android-toolchain-gcc-5/commit/1e57465b9b81699ce8eb603dd4794a839a74c635 - -diff -N -u -r ../gcc-5.3.0/gcc/config/aarch64/aarch64-linux-android.h ./gcc/config/aarch64/aarch64-linux-android.h ---- ../gcc-5.3.0/gcc/config/aarch64/aarch64-linux-android.h 1969-12-31 19:00:00.000000000 -0500 -+++ ./gcc/config/aarch64/aarch64-linux-android.h 2016-03-19 21:08:15.423913071 -0400 -@@ -0,0 +1,59 @@ +diff -N -u -r ../gcc-6.1.0/gcc/config/aarch64/aarch64-linux-android.h ./gcc/config/aarch64/aarch64-linux-android.h +--- ../gcc-6.1.0/gcc/config/aarch64/aarch64-linux-android.h 1969-12-31 19:00:00.000000000 -0500 ++++ ./gcc/config/aarch64/aarch64-linux-android.h 2016-04-29 05:16:37.417191309 -0400 +@@ -0,0 +1,63 @@ +/* Machine description for AArch64 architecture. + Copyright (C) 2014 Free Software Foundation, Inc. + @@ -44,7 +42,7 @@ diff -N -u -r ../gcc-5.3.0/gcc/config/aarch64/aarch64-linux-android.h ./gcc/conf +#undef CC1_SPEC +#define CC1_SPEC \ + LINUX_OR_ANDROID_CC (GNU_USER_TARGET_CC1_SPEC, \ -+ GNU_USER_TARGET_CC1_SPEC " " ANDROID_CC1_SPEC) ++ GNU_USER_TARGET_CC1_SPEC " " ANDROID_CC1_SPEC("-fpic")) + +#define CC1PLUS_SPEC \ + LINUX_OR_ANDROID_CC ("", ANDROID_CC1PLUS_SPEC) @@ -62,4 +60,8 @@ diff -N -u -r ../gcc-5.3.0/gcc/config/aarch64/aarch64-linux-android.h ./gcc/conf +#define ENDFILE_SPEC \ + LINUX_OR_ANDROID_LD (GNU_USER_TARGET_ENDFILE_SPEC, ANDROID_ENDFILE_SPEC) + ++#ifdef IN_LIBGCC2 ++#define LIBGCC2_UNWIND_ATTRIBUTE __attribute__((visibility("default"))) ++#endif ++ +#endif /* GCC_AARCH64_LINUX_ANDROID_H */ diff --git a/packages/gcc/gcc-config-aarch64-aarch64-linux.h.patch b/packages/gcc/gcc-config-aarch64-aarch64-linux.h.patch index 11f2a8aa..42c29613 100644 --- a/packages/gcc/gcc-config-aarch64-aarch64-linux.h.patch +++ b/packages/gcc/gcc-config-aarch64-aarch64-linux.h.patch @@ -1,18 +1,21 @@ -From https://github.com/crystax/android-toolchain-gcc-5/commit/1e57465b9b81699ce8eb603dd4794a839a74c635 +From https://github.com/crystax/android-toolchain-gcc-6/blob/master/gcc/config/aarch64/aarch64-linux.h -diff -u -r ../gcc-5.3.0/gcc/config/aarch64/aarch64-linux.h ./gcc/config/aarch64/aarch64-linux.h ---- ../gcc-5.3.0/gcc/config/aarch64/aarch64-linux.h 2015-07-24 12:00:26.000000000 -0400 -+++ ./gcc/config/aarch64/aarch64-linux.h 2016-03-19 21:35:07.467502590 -0400 -@@ -23,6 +23,12 @@ +diff -u -r ../gcc-6.1.0/gcc/config/aarch64/aarch64-linux.h ./gcc/config/aarch64/aarch64-linux.h +--- ../gcc-6.1.0/gcc/config/aarch64/aarch64-linux.h 2016-03-10 08:29:48.000000000 -0500 ++++ ./gcc/config/aarch64/aarch64-linux.h 2016-04-29 04:12:35.207444421 -0400 +@@ -21,7 +21,14 @@ + #ifndef GCC_AARCH64_LINUX_H + #define GCC_AARCH64_LINUX_H - #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1" - -+/* Use /sysystem/bin/linker64 as linker instead of 32-bit /system/bin/linker */ +-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1" ++#ifndef RUNTIME_ROOT_PREFIX ++#define RUNTIME_ROOT_PREFIX "" ++#endif ++#define GLIBC_DYNAMIC_LINKER RUNTIME_ROOT_PREFIX "/lib/ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1" +#ifdef BIONIC_DYNAMIC_LINKER -+# undef BIONIC_DYNAMIC_LINKER ++#undef BIONIC_DYNAMIC_LINKER +#endif -+#define BIONIC_DYNAMIC_LINKER "/system/bin/linker64" -+ - #undef ASAN_CC1_SPEC - #define ASAN_CC1_SPEC "%{%:sanitize(address):-funwind-tables}" ++#define BIONIC_DYNAMIC_LINKER RUNTIME_ROOT_PREFIX "/system/bin/linker64" + #undef MUSL_DYNAMIC_LINKER + #define MUSL_DYNAMIC_LINKER "/lib/ld-musl-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1" diff --git a/packages/gcc/gcc-config-arm-arm.h.patch b/packages/gcc/gcc-config-arm-arm.h.patch new file mode 100644 index 00000000..2be5cb68 --- /dev/null +++ b/packages/gcc/gcc-config-arm-arm.h.patch @@ -0,0 +1,14 @@ +From https://github.com/crystax/android-toolchain-gcc-6/blob/master/gcc/config/arm/arm.h + +diff -u -r ../gcc-6.1.0/gcc/config/arm/arm.h ./gcc/config/arm/arm.h +--- ../gcc-6.1.0/gcc/config/arm/arm.h 2016-04-01 10:58:53.000000000 -0400 ++++ ./gcc/config/arm/arm.h 2016-04-29 04:39:20.736198856 -0400 +@@ -1891,7 +1891,7 @@ + && (optimize_size || flag_pic))) + + #define CASE_VECTOR_SHORTEN_MODE(min, max, body) \ +- (TARGET_THUMB1 \ ++ (TARGET_THUMB1 && !inline_thumb1_jump_table \ + ? (min >= 0 && max < 512 \ + ? (ADDR_DIFF_VEC_FLAGS (body).offset_unsigned = 1, QImode) \ + : min >= -256 && max < 256 \ diff --git a/packages/gcc/gcc-config-arm-arm.md.patch b/packages/gcc/gcc-config-arm-arm.md.patch new file mode 100644 index 00000000..b1be7f7e --- /dev/null +++ b/packages/gcc/gcc-config-arm-arm.md.patch @@ -0,0 +1,14 @@ +From https://github.com/crystax/android-toolchain-gcc-6/blob/master/gcc/config/arm/arm.md + +diff -u -r ../gcc-6.1.0/gcc/config/arm/arm.md ./gcc/config/arm/arm.md +--- ../gcc-6.1.0/gcc/config/arm/arm.md 2016-03-03 02:42:02.000000000 -0500 ++++ ./gcc/config/arm/arm.md 2016-04-29 04:40:58.734797301 -0400 +@@ -8179,7 +8179,7 @@ + (match_operand:SI 2 "const_int_operand" "") ; total range + (match_operand:SI 3 "" "") ; table label + (match_operand:SI 4 "" "")] ; Out of range label +- "TARGET_32BIT || optimize_size || flag_pic" ++ "TARGET_32BIT || ((optimize_size || flag_pic) && !inline_thumb1_jump_table)" + " + { + enum insn_code code; diff --git a/packages/gcc/gcc-config-arm-arm.opt.patch b/packages/gcc/gcc-config-arm-arm.opt.patch new file mode 100644 index 00000000..c28defe8 --- /dev/null +++ b/packages/gcc/gcc-config-arm-arm.opt.patch @@ -0,0 +1,14 @@ +diff -u -r ../gcc-6.1.0/gcc/config/arm/arm.opt ./gcc/config/arm/arm.opt +--- ../gcc-6.1.0/gcc/config/arm/arm.opt 2016-01-04 09:30:50.000000000 -0500 ++++ ./gcc/config/arm/arm.opt 2016-04-29 04:51:45.773163392 -0400 +@@ -193,6 +193,10 @@ + Target Report Mask(INTERWORK) + Support calls between Thumb and ARM instruction sets. + ++minline-thumb1-jumptable ++Target Report Var(inline_thumb1_jump_table) ++Inline Thumb1 Jump table code ++ + mtls-dialect= + Target RejectNegative Joined Enum(tls_type) Var(target_tls_dialect) Init(TLS_GNU) + Specify thread local storage scheme. diff --git a/packages/gcc/gcc-config-arm-elf.h.patch b/packages/gcc/gcc-config-arm-elf.h.patch new file mode 100644 index 00000000..8694040b --- /dev/null +++ b/packages/gcc/gcc-config-arm-elf.h.patch @@ -0,0 +1,34 @@ +From https://github.com/crystax/android-toolchain-gcc-6/blob/master/gcc/config/arm/elf.h +diff -u -r ../gcc-6.1.0/gcc/config/arm/elf.h ./gcc/config/arm/elf.h +--- ../gcc-6.1.0/gcc/config/arm/elf.h 2016-01-04 09:30:50.000000000 -0500 ++++ ./gcc/config/arm/elf.h 2016-04-29 04:47:31.773001584 -0400 +@@ -56,8 +56,7 @@ + #undef SUBSUBTARGET_EXTRA_SPECS + #define SUBSUBTARGET_EXTRA_SPECS + +-#ifndef ASM_SPEC +-#define ASM_SPEC "\ ++#define DEFAULT_ASM_SPEC "\ + %{mbig-endian:-EB} \ + %{mlittle-endian:-EL} \ + %(asm_cpu_spec) \ +@@ -66,6 +65,9 @@ + %{mthumb-interwork:-mthumb-interwork} \ + %{mfloat-abi=*} %{mfpu=*} \ + %(subtarget_extra_asm_spec)" ++ ++#ifndef ASM_SPEC ++ #define ASM_SPEC DEFAULT_ASM_SPEC + #endif + + /* The ARM uses @ are a comment character so we need to redefine +@@ -104,7 +106,8 @@ + the code more efficient, but for Thumb-1 it's better to put them out of + band unless we are generating compressed tables. */ + #define JUMP_TABLES_IN_TEXT_SECTION \ +- (TARGET_32BIT || (TARGET_THUMB && (optimize_size || flag_pic))) ++ (TARGET_32BIT || (TARGET_THUMB && !inline_thumb1_jump_table \ ++ && (optimize_size || flag_pic))) + + #ifndef LINK_SPEC + #define LINK_SPEC "%{mbig-endian:-EB} %{mlittle-endian:-EL} -X" diff --git a/packages/gcc/gcc-config-arm-linux-eabi.h.patch b/packages/gcc/gcc-config-arm-linux-eabi.h.patch new file mode 100644 index 00000000..a6639252 --- /dev/null +++ b/packages/gcc/gcc-config-arm-linux-eabi.h.patch @@ -0,0 +1,21 @@ +diff -u -r ../gcc-6.1.0/gcc/config/arm/linux-eabi.h ./gcc/config/arm/linux-eabi.h +--- ../gcc-6.1.0/gcc/config/arm/linux-eabi.h 2016-01-04 09:30:50.000000000 -0500 ++++ ./gcc/config/arm/linux-eabi.h 2016-04-29 04:54:39.834509023 -0400 +@@ -108,11 +108,16 @@ + #define CC1_SPEC \ + LINUX_OR_ANDROID_CC (GNU_USER_TARGET_CC1_SPEC " " ASAN_CC1_SPEC, \ + GNU_USER_TARGET_CC1_SPEC " " ASAN_CC1_SPEC " " \ +- ANDROID_CC1_SPEC) ++ ANDROID_CC1_SPEC("-fpic")) + + #define CC1PLUS_SPEC \ + LINUX_OR_ANDROID_CC ("", ANDROID_CC1PLUS_SPEC) + ++#undef ASM_SPEC ++#define ASM_SPEC \ ++ LINUX_OR_ANDROID_CC (DEFAULT_ASM_SPEC, \ ++ DEFAULT_ASM_SPEC " " ANDROID_ASM_SPEC) ++ + #undef LIB_SPEC + #define LIB_SPEC \ + LINUX_OR_ANDROID_LD (GNU_USER_TARGET_LIB_SPEC, \ diff --git a/packages/gcc/gcc-config-i386-gnu-user.h.patch b/packages/gcc/gcc-config-i386-gnu-user.h.patch new file mode 100644 index 00000000..565b2c1b --- /dev/null +++ b/packages/gcc/gcc-config-i386-gnu-user.h.patch @@ -0,0 +1,19 @@ +diff -u -r ../gcc-6.1.0/gcc/config/i386/gnu-user.h ./gcc/config/i386/gnu-user.h +--- ../gcc-6.1.0/gcc/config/i386/gnu-user.h 2016-01-04 09:30:50.000000000 -0500 ++++ ./gcc/config/i386/gnu-user.h 2016-04-29 05:02:49.942975771 -0400 +@@ -65,9 +65,14 @@ + When the -shared link option is used a final link is not being + done. */ + ++#undef ANDROID_TARGET_CC1_SPEC ++#define ANDROID_TARGET_CC1_SPEC \ ++ " -mssse3 -fno-short-enums " \ ++ + #undef ASM_SPEC + #define ASM_SPEC \ +- "--32 %{!mno-sse2avx:%{mavx:-msse2avx}} %{msse2avx:%{!mavx:-msse2avx}}" ++ "--32 %{!mno-sse2avx:%{mavx:-msse2avx}} %{msse2avx:%{!mavx:-msse2avx}} " \ ++ LINUX_OR_ANDROID_CC ("", ANDROID_ASM_SPEC) + + #undef SUBTARGET_EXTRA_SPECS + #define SUBTARGET_EXTRA_SPECS \ diff --git a/packages/gcc/gcc-config-i386-linux-common.h.patch b/packages/gcc/gcc-config-i386-linux-common.h.patch new file mode 100644 index 00000000..3d3cabdc --- /dev/null +++ b/packages/gcc/gcc-config-i386-linux-common.h.patch @@ -0,0 +1,18 @@ +diff -u -r ../gcc-6.1.0/gcc/config/i386/linux-common.h ./gcc/config/i386/linux-common.h +--- ../gcc-6.1.0/gcc/config/i386/linux-common.h 2016-01-04 09:30:50.000000000 -0500 ++++ ./gcc/config/i386/linux-common.h 2016-04-29 05:05:00.192965005 -0400 +@@ -30,7 +30,13 @@ + #undef CC1_SPEC + #define CC1_SPEC \ + LINUX_OR_ANDROID_CC (GNU_USER_TARGET_CC1_SPEC, \ +- GNU_USER_TARGET_CC1_SPEC " " ANDROID_CC1_SPEC) ++ GNU_USER_TARGET_CC1_SPEC \ ++ ANDROID_TARGET_CC1_SPEC \ ++ " " \ ++ ANDROID_CC1_SPEC("-fPIC")) ++ ++#define CC1PLUS_SPEC \ ++ LINUX_OR_ANDROID_CC ("", ANDROID_CC1PLUS_SPEC) + + #undef LINK_SPEC + #define LINK_SPEC \ diff --git a/packages/gcc/gcc-config-linux-android.h.patch b/packages/gcc/gcc-config-linux-android.h.patch new file mode 100644 index 00000000..8910029c --- /dev/null +++ b/packages/gcc/gcc-config-linux-android.h.patch @@ -0,0 +1,27 @@ +diff -u -r ../gcc-6.1.0/gcc/config/linux-android.h ./gcc/config/linux-android.h +--- ../gcc-6.1.0/gcc/config/linux-android.h 2016-01-04 09:30:50.000000000 -0500 ++++ ./gcc/config/linux-android.h 2016-04-29 05:09:14.697030172 -0400 +@@ -38,15 +38,18 @@ + "%{" NOANDROID "|tno-android-ld:" LINUX_SPEC ";:" ANDROID_SPEC "}" + + #define ANDROID_LINK_SPEC \ +- "%{shared: -Bsymbolic}" ++ "%{shared: -Bsymbolic} -z noexecstack -z relro -z now" + +-#define ANDROID_CC1_SPEC \ ++#define ANDROID_CC1_SPEC(ANDROID_PIC_DEFAULT) \ + "%{!mglibc:%{!muclibc:%{!mbionic: -mbionic}}} " \ +- "%{!fno-pic:%{!fno-PIC:%{!fpic:%{!fPIC: -fPIC}}}}" ++ "%{!fno-pic:%{!fno-PIC:%{!fpic:%{!fPIC: " ANDROID_PIC_DEFAULT "}}}}" + + #define ANDROID_CC1PLUS_SPEC \ +- "%{!fexceptions:%{!fno-exceptions: -fno-exceptions}} " \ +- "%{!frtti:%{!fno-rtti: -fno-rtti}}" ++ "%{!fexceptions:%{!fno-exceptions: -fexceptions}} " \ ++ "%{!frtti:%{!fno-rtti: -frtti}}" ++ ++#define ANDROID_ASM_SPEC \ ++ "--noexecstack" + + #define ANDROID_LIB_SPEC \ + "%{!static: -ldl}"