Browse Source

Replace gcc with clang

Only clang has official support for Android, and trying to maintain
a working gcc will only get messier over time.

Remove gcc and g++ packages, and setup gcc and g++ as symlinks to
clang.

Let clang replace gcc, but note that 'apt dist-upgrade' needs to
be run once if a user has both clang and gcc installed.

Fixes #369.
android-5
Fredrik Fornwall 8 years ago
parent
commit
768ce14ecc
  1. 2
      build-package.sh
  2. 17
      packages/clang/build.sh
  3. 85
      packages/gcc/build.sh
  4. 3
      packages/gcc/g++.subpackage.sh
  5. 67
      packages/gcc/gcc-config-aarch64-aarch64-linux-android.h.patch
  6. 21
      packages/gcc/gcc-config-aarch64-aarch64-linux.h.patch
  7. 14
      packages/gcc/gcc-config-arm-arm.h.patch
  8. 14
      packages/gcc/gcc-config-arm-arm.md.patch
  9. 14
      packages/gcc/gcc-config-arm-arm.opt.patch
  10. 34
      packages/gcc/gcc-config-arm-elf.h.patch
  11. 21
      packages/gcc/gcc-config-arm-linux-eabi.h.patch
  12. 19
      packages/gcc/gcc-config-i386-gnu-user.h.patch
  13. 17
      packages/gcc/gcc-config-i386-gnu-user64.h.patch
  14. 18
      packages/gcc/gcc-config-i386-linux-common.h.patch
  15. 27
      packages/gcc/gcc-config-linux-android.h.patch
  16. 22
      packages/gcc/gcc-config.gcc.patch
  17. 12
      packages/gcc/gcc-cp-g++specc.patch
  18. 3
      packages/gcc/gcov.subpackage.sh
  19. 18
      packages/gcc/libcpp-files.c.patch
  20. 16
      packages/gcc/libcpp-macro.c.patch
  21. 154
      packages/gcc/system.h.patch

2
build-package.sh

@ -260,6 +260,7 @@ TERMUX_PKG_KEEP_STATIC_LIBRARIES="false"
TERMUX_PKG_KEEP_HEADER_FILES="false"
TERMUX_PKG_ESSENTIAL=""
TERMUX_PKG_CONFLICTS="" # https://www.debian.org/doc/debian-policy/ch-relationships.html#s-conflicts
TERMUX_PKG_REPLACES=""
TERMUX_PKG_CONFFILES=""
TERMUX_PKG_INCLUDE_IN_DEVPACKAGE=""
TERMUX_PKG_DEVPACKAGE_DEPENDS=""
@ -837,6 +838,7 @@ HERE
test ! -z "$TERMUX_PKG_DEPENDS" && echo "Depends: $TERMUX_PKG_DEPENDS" >> DEBIAN/control
test ! -z "$TERMUX_PKG_ESSENTIAL" && echo "Essential: yes" >> DEBIAN/control
test ! -z "$TERMUX_PKG_CONFLICTS" && echo "Conflicts: $TERMUX_PKG_CONFLICTS" >> DEBIAN/control
test ! -z "$TERMUX_PKG_REPLACES" && echo "Replaces: $TERMUX_PKG_REPLACES" >> DEBIAN/control
# Create DEBIAN/conffiles (see https://www.debian.org/doc/debian-policy/ap-pkg-conffiles.html):
for f in $TERMUX_PKG_CONFFILES; do echo $TERMUX_PREFIX/$f >> DEBIAN/conffiles; done

17
packages/clang/build.sh

@ -2,10 +2,14 @@ TERMUX_PKG_HOMEPAGE=http://clang.llvm.org/
TERMUX_PKG_DESCRIPTION="C and C++ frontend for the LLVM compiler"
_PKG_MAJOR_VERSION=3.8
TERMUX_PKG_VERSION=${_PKG_MAJOR_VERSION}.1
TERMUX_PKG_BUILD_REVISION=1
TERMUX_PKG_SRCURL=http://llvm.org/releases/${TERMUX_PKG_VERSION}/llvm-${TERMUX_PKG_VERSION}.src.tar.xz
TERMUX_PKG_HOSTBUILD=true
TERMUX_PKG_RM_AFTER_INSTALL="bin/macho-dump bin/bugpoint bin/llvm-tblgen lib/BugpointPasses.so lib/LLVMHello.so"
TERMUX_PKG_DEPENDS="binutils, ncurses, ndk-sysroot, ndk-stl, libgcc"
# Replace gcc since gcc is deprecated by google on android and is not maintained upstream.
TERMUX_PKG_CONFLICTS=gcc
TERMUX_PKG_REPLACES=gcc
termux_step_post_extract_package () {
CLANG_SRC_TAR=cfe-${TERMUX_PKG_VERSION}.src.tar.xz
@ -72,6 +76,15 @@ termux_step_configure () {
}
termux_step_post_make_install () {
(cd $TERMUX_PREFIX/bin && ln -f -s clang-${_PKG_MAJOR_VERSION} clang && ln -f -s clang-${_PKG_MAJOR_VERSION} clang++)
(cd $TERMUX_PREFIX/bin && ln -f -s clang-${_PKG_MAJOR_VERSION} cc && ln -f -s clang-${_PKG_MAJOR_VERSION} c++)
cd $TERMUX_PREFIX/bin
ln -f -s clang-${_PKG_MAJOR_VERSION} clang
ln -f -s clang-${_PKG_MAJOR_VERSION} clang++
ln -f -s clang-${_PKG_MAJOR_VERSION} cc
ln -f -s clang-${_PKG_MAJOR_VERSION} c++
ln -f -s clang-${_PKG_MAJOR_VERSION} gcc
ln -f -s clang-${_PKG_MAJOR_VERSION} g++
ln -f -s clang-${_PKG_MAJOR_VERSION} ${TERMUX_HOST_PLATFORM}-gcc
ln -f -s clang-${_PKG_MAJOR_VERSION} ${TERMUX_HOST_PLATFORM}-g++
}

85
packages/gcc/build.sh

@ -1,85 +0,0 @@
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=6.1.0
TERMUX_PKG_BUILD_REVISION=2
TERMUX_PKG_SRCURL=ftp://ftp.gnu.org/gnu/gcc/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"
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --with-gmp=$TERMUX_PREFIX --with-mpfr=$TERMUX_PREFIX --with-mpc=$TERMUX_PREFIX"
# To build gcc as a PIE binary:
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --with-stage1-ldflags=\"-specs=$TERMUX_SCRIPTDIR/termux.spec\""
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=softfp"
elif [ "$TERMUX_ARCH" = "aarch64" ]; then
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --with-arch=armv8-a"
elif [ "$TERMUX_ARCH" = "i686" ]; then
# -mstackrealign -msse3 -m32
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --with-arch=i686 --with-tune=atom --with-fpmath=sse"
fi
TERMUX_PKG_RM_AFTER_INSTALL="bin/gcc-ar bin/gcc-ranlib bin/*c++ bin/gcc-nm lib/gcc/*-linux-*/${TERMUX_PKG_VERSION}/plugin lib/gcc/*-linux-*/${TERMUX_PKG_VERSION}/include-fixed lib/gcc/*-linux-*/$TERMUX_PKG_VERSION/install-tools libexec/gcc/*-linux-*/${TERMUX_PKG_VERSION}/plugin libexec/gcc/*-linux-*/${TERMUX_PKG_VERSION}/install-tools share/man/man7"
export AR_FOR_TARGET="$AR"
export AS_FOR_TARGET="$AS"
export CC_FOR_TARGET="$CC"
export CFLAGS_FOR_TARGET="$CFLAGS"
export CPP_FOR_TARGET="$CPP"
export CPPFLAGS_FOR_TARGET="$CPPFLAGS"
export CXXFLAGS_FOR_TARGET="$CXXFLAGS"
export CXX_FOR_TARGET="$CXX"
export LDFLAGS_FOR_TARGET="$LDFLAGS"
export LD_FOR_TARGET="$LD"
export PKG_CONFIG_FOR_TARGET="$PKG_CONFIG"
export RANLIB_FOR_TARGET="$RANLIB"
unset AR
unset AS
unset CC
unset CFLAGS
unset CPP
unset CPPFLAGS
unset CXXFLAGS
unset CXX
unset LDFLAGS
unset LD
unset PKG_CONFIG
unset RANLIB
termux_step_make () {
make -j $TERMUX_MAKE_PROCESSES all-gcc
}
termux_step_make_install () {
make install-gcc
}
termux_step_post_make_install () {
# Android 5.0 only supports PIE binaries, so build that by default with a specs file:
local GCC_SPECS=$TERMUX_PREFIX/lib/gcc/$TERMUX_HOST_PLATFORM/$TERMUX_PKG_VERSION/specs
cp $TERMUX_SCRIPTDIR/termux.spec $GCC_SPECS
if [ $TERMUX_ARCH = "i686" ]; then
# See https://github.com/termux/termux-packages/issues/3
# and https://github.com/termux/termux-packages/issues/14
cat >> $GCC_SPECS <<HERE
*link_emulation:
elf_i386
*dynamic_linker:
/system/bin/linker
HERE
fi
# Replace hardlinks with symlinks:
cd $TERMUX_PREFIX/bin
rm ${TERMUX_HOST_PLATFORM}-g++; ln -s g++ ${TERMUX_HOST_PLATFORM}-g++
rm ${TERMUX_HOST_PLATFORM}-gcc; ln -s gcc ${TERMUX_HOST_PLATFORM}-gcc
rm ${TERMUX_HOST_PLATFORM}-gcc-${TERMUX_PKG_VERSION}; ln -s gcc ${TERMUX_HOST_PLATFORM}-gcc-${TERMUX_PKG_VERSION}
}

3
packages/gcc/g++.subpackage.sh

@ -1,3 +0,0 @@
TERMUX_SUBPKG_INCLUDE="bin/g++ bin/*-g++ share/man/man1/g++.1"
TERMUX_SUBPKG_DESCRIPTION="GNU C++ compiler"
TERMUX_SUBPKG_DEPENDS="gcc,ndk-stl"

67
packages/gcc/gcc-config-aarch64-aarch64-linux-android.h.patch

@ -1,67 +0,0 @@
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.
+
+ This file is part of GCC.
+
+ GCC is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3, or (at your option)
+ any later version.
+
+ GCC is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GCC; see the file COPYING3. If not see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef GCC_AARCH64_LINUX_ANDROID_H
+#define GCC_AARCH64_LINUX_ANDROID_H
+
+
+#undef TARGET_OS_CPP_BUILTINS
+#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("-fpic"))
+
+#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)
+
+#ifdef IN_LIBGCC2
+#define LIBGCC2_UNWIND_ATTRIBUTE __attribute__((visibility("default")))
+#endif
+
+#endif /* GCC_AARCH64_LINUX_ANDROID_H */

21
packages/gcc/gcc-config-aarch64-aarch64-linux.h.patch

@ -1,21 +0,0 @@
From https://github.com/crystax/android-toolchain-gcc-6/blob/master/gcc/config/aarch64/aarch64-linux.h
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"
+#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
+#endif
+#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"

14
packages/gcc/gcc-config-arm-arm.h.patch

@ -1,14 +0,0 @@
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 \

14
packages/gcc/gcc-config-arm-arm.md.patch

@ -1,14 +0,0 @@
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;

14
packages/gcc/gcc-config-arm-arm.opt.patch

@ -1,14 +0,0 @@
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.

34
packages/gcc/gcc-config-arm-elf.h.patch

@ -1,34 +0,0 @@
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"

21
packages/gcc/gcc-config-arm-linux-eabi.h.patch

@ -1,21 +0,0 @@
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, \

19
packages/gcc/gcc-config-i386-gnu-user.h.patch

@ -1,19 +0,0 @@
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 \

17
packages/gcc/gcc-config-i386-gnu-user64.h.patch

@ -1,17 +0,0 @@
Patch from https://github.com/crystax/android-toolchain-gcc-6
diff -u -r ../gcc-6.1.0/gcc/config/i386/gnu-user64.h ./gcc/config/i386/gnu-user64.h
--- ../gcc-6.1.0/gcc/config/i386/gnu-user64.h 2016-01-04 09:30:50.000000000 -0500
+++ ./gcc/config/i386/gnu-user64.h 2016-06-19 17:26:43.129238919 -0400
@@ -46,6 +46,11 @@
#define SPEC_X32 "mx32"
#endif
+#undef ANDROID_TARGET_CC1_SPEC
+#define ANDROID_TARGET_CC1_SPEC \
+ "%{m32:-mssse3 -fno-short-enums}" \
+ "%{!m32:-msse4.2 -mpopcnt}"
+
#undef ASM_SPEC
#define ASM_SPEC "%{" SPEC_32 ":--32} \
%{" SPEC_64 ":--64} \

18
packages/gcc/gcc-config-i386-linux-common.h.patch

@ -1,18 +0,0 @@
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 \

27
packages/gcc/gcc-config-linux-android.h.patch

@ -1,27 +0,0 @@
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}"

22
packages/gcc/gcc-config.gcc.patch

@ -1,22 +0,0 @@
diff -u -r ../gcc-5.3.0/gcc/config.gcc ./gcc/config.gcc
--- ../gcc-5.3.0/gcc/config.gcc 2015-09-10 10:17:53.000000000 -0400
+++ ./gcc/config.gcc 2016-03-19 21:07:44.888339715 -0400
@@ -910,13 +910,17 @@
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-*)
tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
;;
+ aarch64*-*-linux-android*)
+ tm_file="${tm_file} aarch64/aarch64-linux-android.h"
+ ;;
esac
aarch64_multilibs="${with_multilib_list}"
if test "$aarch64_multilibs" = "default"; then

12
packages/gcc/gcc-cp-g++specc.patch

@ -1,12 +0,0 @@
diff -u -r ../gcc-6.1.0/gcc/cp/g++spec.c ./gcc/cp/g++spec.c
--- ../gcc-6.1.0/gcc/cp/g++spec.c 2016-01-04 09:30:50.000000000 -0500
+++ ./gcc/cp/g++spec.c 2016-05-02 16:35:07.495988169 -0400
@@ -46,7 +46,7 @@
#endif
#ifndef LIBSTDCXX
-#define LIBSTDCXX "stdc++"
+#define LIBSTDCXX "gnustl_shared"
#endif
#ifndef LIBSTDCXX_PROFILE
#define LIBSTDCXX_PROFILE LIBSTDCXX

3
packages/gcc/gcov.subpackage.sh

@ -1,3 +0,0 @@
TERMUX_SUBPKG_INCLUDE="bin/gcov bin/gcov-tool share/man/man1/gcov.1 lib/gcc/arm-linux-androideabi/4.9.1/libgcov.a"
TERMUX_SUBPKG_DESCRIPTION="GNU coverage testing tool"
TERMUX_SUBPKG_DEPENDS="gcc"

18
packages/gcc/libcpp-files.c.patch

@ -1,18 +0,0 @@
diff -u -r ../gcc-4.8.2/libcpp/files.c ./libcpp/files.c
--- ../gcc-4.8.2/libcpp/files.c 2013-03-06 17:18:40.000000000 +0100
+++ ./libcpp/files.c 2014-01-09 00:29:34.940181542 +0100
@@ -716,11 +716,13 @@
cpp_error (pfile, CPP_DL_WARNING,
"%s is shorter than expected", file->path);
+ off_t ot = (off_t) &file->st.st_size;
file->buffer = _cpp_convert_input (pfile,
CPP_OPTION (pfile, input_charset),
buf, size + 16, total,
&file->buffer_start,
- &file->st.st_size);
+ &ot);
+ file->st.st_size = ot;
file->buffer_valid = true;
return true;

16
packages/gcc/libcpp-macro.c.patch

@ -1,16 +0,0 @@
diff -u -r ../gcc-4.8.2/libcpp/macro.c ./libcpp/macro.c
--- ../gcc-4.8.2/libcpp/macro.c 2013-01-14 19:13:59.000000000 +0100
+++ ./libcpp/macro.c 2014-01-09 00:30:49.416179764 +0100
@@ -245,8 +245,10 @@
looks like "Sun Sep 16 01:03:52 1973". */
struct tm *tb = NULL;
struct stat *st = _cpp_get_file_stat (file);
- if (st)
- tb = localtime (&st->st_mtime);
+ if (st) {
+ const time_t mtime = (const time_t) st->st_mtime;
+ tb = localtime (&mtime);
+ }
if (tb)
{
char *str = asctime (tb);

154
packages/gcc/system.h.patch

@ -1,154 +0,0 @@
diff -u -r ../gcc-5.2.0/gcc/system.h ./gcc/system.h
--- ../gcc-5.2.0/gcc/system.h 2015-01-05 07:33:28.000000000 -0500
+++ ./gcc/system.h 2015-08-09 09:11:10.048889012 -0400
@@ -50,150 +50,6 @@
#define NULL 0
#endif
-/* Use the unlocked open routines from libiberty. */
-
-/* Some of these are #define on some systems, e.g. on AIX to redirect
- the names to 64bit capable functions for LARGE_FILES support. These
- redefs are pointless here so we can override them. */
-
-#undef fopen
-#undef freopen
-
-#define fopen(PATH, MODE) fopen_unlocked (PATH, MODE)
-#define fdopen(FILDES, MODE) fdopen_unlocked (FILDES, MODE)
-#define freopen(PATH, MODE, STREAM) freopen_unlocked (PATH, MODE, STREAM)
-
-/* The compiler is not a multi-threaded application and therefore we
- do not have to use the locking functions. In fact, using the locking
- functions can cause the compiler to be significantly slower under
- I/O bound conditions (such as -g -O0 on very large source files).
-
- HAVE_DECL_PUTC_UNLOCKED actually indicates whether or not the stdio
- code is multi-thread safe by default. If it is set to 0, then do
- not worry about using the _unlocked functions.
-
- fputs_unlocked, fwrite_unlocked, and fprintf_unlocked are
- extensions and need to be prototyped by hand (since we do not
- define _GNU_SOURCE). */
-
-#if defined HAVE_DECL_PUTC_UNLOCKED && HAVE_DECL_PUTC_UNLOCKED
-
-# ifdef HAVE_PUTC_UNLOCKED
-# undef putc
-# define putc(C, Stream) putc_unlocked (C, Stream)
-# endif
-# ifdef HAVE_PUTCHAR_UNLOCKED
-# undef putchar
-# define putchar(C) putchar_unlocked (C)
-# endif
-# ifdef HAVE_GETC_UNLOCKED
-# undef getc
-# define getc(Stream) getc_unlocked (Stream)
-# endif
-# ifdef HAVE_GETCHAR_UNLOCKED
-# undef getchar
-# define getchar() getchar_unlocked ()
-# endif
-# ifdef HAVE_FPUTC_UNLOCKED
-# undef fputc
-# define fputc(C, Stream) fputc_unlocked (C, Stream)
-# endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-# ifdef HAVE_CLEARERR_UNLOCKED
-# undef clearerr
-# define clearerr(Stream) clearerr_unlocked (Stream)
-# if defined (HAVE_DECL_CLEARERR_UNLOCKED) && !HAVE_DECL_CLEARERR_UNLOCKED
-extern void clearerr_unlocked (FILE *);
-# endif
-# endif
-# ifdef HAVE_FEOF_UNLOCKED
-# undef feof
-# define feof(Stream) feof_unlocked (Stream)
-# if defined (HAVE_DECL_FEOF_UNLOCKED) && !HAVE_DECL_FEOF_UNLOCKED
-extern int feof_unlocked (FILE *);
-# endif
-# endif
-# ifdef HAVE_FILENO_UNLOCKED
-# undef fileno
-# define fileno(Stream) fileno_unlocked (Stream)
-# if defined (HAVE_DECL_FILENO_UNLOCKED) && !HAVE_DECL_FILENO_UNLOCKED
-extern int fileno_unlocked (FILE *);
-# endif
-# endif
-# ifdef HAVE_FFLUSH_UNLOCKED
-# undef fflush
-# define fflush(Stream) fflush_unlocked (Stream)
-# if defined (HAVE_DECL_FFLUSH_UNLOCKED) && !HAVE_DECL_FFLUSH_UNLOCKED
-extern int fflush_unlocked (FILE *);
-# endif
-# endif
-# ifdef HAVE_FGETC_UNLOCKED
-# undef fgetc
-# define fgetc(Stream) fgetc_unlocked (Stream)
-# if defined (HAVE_DECL_FGETC_UNLOCKED) && !HAVE_DECL_FGETC_UNLOCKED
-extern int fgetc_unlocked (FILE *);
-# endif
-# endif
-# ifdef HAVE_FGETS_UNLOCKED
-# undef fgets
-# define fgets(S, n, Stream) fgets_unlocked (S, n, Stream)
-# if defined (HAVE_DECL_FGETS_UNLOCKED) && !HAVE_DECL_FGETS_UNLOCKED
-extern char *fgets_unlocked (char *, int, FILE *);
-# endif
-# endif
-# ifdef HAVE_FPUTS_UNLOCKED
-# undef fputs
-# define fputs(String, Stream) fputs_unlocked (String, Stream)
-# if defined (HAVE_DECL_FPUTS_UNLOCKED) && !HAVE_DECL_FPUTS_UNLOCKED
-extern int fputs_unlocked (const char *, FILE *);
-# endif
-# endif
-# ifdef HAVE_FERROR_UNLOCKED
-# undef ferror
-# define ferror(Stream) ferror_unlocked (Stream)
-# if defined (HAVE_DECL_FERROR_UNLOCKED) && !HAVE_DECL_FERROR_UNLOCKED
-extern int ferror_unlocked (FILE *);
-# endif
-# endif
-# ifdef HAVE_FREAD_UNLOCKED
-# undef fread
-# define fread(Ptr, Size, N, Stream) fread_unlocked (Ptr, Size, N, Stream)
-# if defined (HAVE_DECL_FREAD_UNLOCKED) && !HAVE_DECL_FREAD_UNLOCKED
-extern size_t fread_unlocked (void *, size_t, size_t, FILE *);
-# endif
-# endif
-# ifdef HAVE_FWRITE_UNLOCKED
-# undef fwrite
-# define fwrite(Ptr, Size, N, Stream) fwrite_unlocked (Ptr, Size, N, Stream)
-# if defined (HAVE_DECL_FWRITE_UNLOCKED) && !HAVE_DECL_FWRITE_UNLOCKED
-extern size_t fwrite_unlocked (const void *, size_t, size_t, FILE *);
-# endif
-# endif
-# ifdef HAVE_FPRINTF_UNLOCKED
-# undef fprintf
-/* We can't use a function-like macro here because we don't know if
- we have varargs macros. */
-# define fprintf fprintf_unlocked
-# if defined (HAVE_DECL_FPRINTF_UNLOCKED) && !HAVE_DECL_FPRINTF_UNLOCKED
-extern int fprintf_unlocked (FILE *, const char *, ...);
-# endif
-# endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-/* ??? Glibc's fwrite/fread_unlocked macros cause
- "warning: signed and unsigned type in conditional expression". */
-#undef fread_unlocked
-#undef fwrite_unlocked
-
/* Include <string> before "safe-ctype.h" to avoid GCC poisoning
the ctype macros through safe-ctype.h */
Loading…
Cancel
Save