gcc: Update from 4.93 to 5.3.0

Also, start depending on the libgcc package for the libgcc.a runtime
library taken from the NDK instead of trying to build it ourselves.
This commit is contained in:
Fredrik Fornwall 2016-03-20 18:59:41 -04:00
parent 3e902b5f00
commit 98cc1d7b97
13 changed files with 133 additions and 213 deletions

View File

@ -1,67 +0,0 @@
TERMUX_PKG_HOMEPAGE=http://gcc.gnu.org/
TERMUX_PKG_DESCRIPTION="GNU C compiler"
TERMUX_PKG_DEPENDS="binutils, libgmp, libmpfr, libmpc, ndk-sysroot"
TERMUX_PKG_VERSION=5.3.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+=" --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+=" --without-headers --with-local-prefix=$TERMUX_PREFIX/include" # FIXME: gcc5 trying
if [ "$TERMUX_ARCH" = "arm" ]; then
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --with-arch=armv7-a --with-fpu=neon --with-float=hard"
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_KEEP_STATIC_LIBRARIES="true"
TERMUX_PKG_RM_AFTER_INSTALL="bin/gcc-ar bin/gcc-ranlib bin/c++ bin/gcc-nm bin/*-linux-* 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_PKG_EXTRA_CONFIGURE_ARGS+=" --host=x86-linux-android"
termux_step_make () {
make -j $TERMUX_MAKE_PROCESSES all-gcc
make -j $TERMUX_MAKE_PROCESSES all-target-libgcc
}
termux_step_make_install () {
make install-gcc
make install-target-libgcc
}
termux_step_post_make_install () {
if [ $TERMUX_ARCH = "arm" ]; then
# Note that moving to $TERMUX_PREFIX/lib/gcc/arm-linux-androideabi/${TERMUX_PKG_VERSION}/
# allows compilation but fails to link at runtime
mv $TERMUX_PREFIX/lib/armv7-a/hard/libgcc_s* $TERMUX_PREFIX/lib/
fi
# Android 5.0 only supports PIE binaries, so build that by default with a specs file:
cp $TERMUX_SCRIPTDIR/termux.spec $TERMUX_PREFIX/lib/gcc/$TERMUX_HOST_PLATFORM/$TERMUX_PKG_VERSION/specs
}

View File

@ -1,3 +0,0 @@
TERMUX_SUBPKG_INCLUDE="bin/g++ share/man/man1/g++.1 libexec/gcc/arm-linux-androideabi/4.9.2/cc1plus"
TERMUX_SUBPKG_DESCRIPTION="GNU C++ compiler"
TERMUX_SUBPKG_DEPENDS="gcc,ndk-stl"

View File

@ -1,3 +0,0 @@
TERMUX_SUBPKG_INCLUDE="bin/gcov 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"

View File

@ -1,21 +1,26 @@
TERMUX_PKG_HOMEPAGE=http://gcc.gnu.org/
TERMUX_PKG_DESCRIPTION="GNU C compiler"
TERMUX_PKG_DEPENDS="binutils, libgmp, libmpfr, libmpc, ndk-sysroot"
TERMUX_PKG_VERSION=4.9.3
TERMUX_PKG_BUILD_REVISION=5
TERMUX_PKG_DEPENDS="binutils, libgmp, libmpfr, libmpc, ndk-sysroot, libgcc, libisl"
TERMUX_PKG_VERSION=5.3.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"
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+=" --without-headers --with-local-prefix=$TERMUX_PREFIX/include" # FIXME: gcc5 trying
if [ "$TERMUX_ARCH" = "arm" ]; then
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --with-arch=armv7-a --with-fpu=neon --with-float=hard"
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_KEEP_STATIC_LIBRARIES="true"
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"
TERMUX_PKG_RM_AFTER_INSTALL="bin/gcc-ar bin/gcc-ranlib bin/c++ bin/gcc-nm bin/*-linux-* 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"
@ -45,21 +50,13 @@ unset RANLIB
termux_step_make () {
make -j $TERMUX_MAKE_PROCESSES all-gcc
make -j $TERMUX_MAKE_PROCESSES all-target-libgcc
}
termux_step_make_install () {
make install-gcc
make install-target-libgcc
make install-gcc
}
termux_step_post_make_install () {
if [ $TERMUX_ARCH = "arm" ]; then
# Note that moving to $TERMUX_PREFIX/lib/gcc/arm-linux-androideabi/${TERMUX_PKG_VERSION}/
# allows compilation but fails to link at runtime
mv $TERMUX_PREFIX/lib/armv7-a/hard/libgcc_s* $TERMUX_PREFIX/lib/
fi
# 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

View File

@ -1,58 +0,0 @@
The first block is to install aliases such as arm-linux-androideabi-gcc->gcc
as symlinks instead of hard links.
diff -u -r ../gcc-4.9.3/gcc/Makefile.in ./gcc/Makefile.in
--- ../gcc-4.9.3/gcc/Makefile.in 2014-10-16 09:50:42.000000000 -0400
+++ ./gcc/Makefile.in 2015-08-16 18:12:44.446098799 -0400
@@ -260,7 +260,7 @@
INSTALL = @INSTALL@
# Some systems may be missing symbolic links, regular links, or both.
# Allow configure to check this and use "ln -s", "ln", or "cp" as appropriate.
-LN=@LN@
+LN=@LN_S@
LN_S=@LN_S@
# These permit overriding just for certain files.
INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -2430,27 +2430,29 @@
gengtype-lex.o build/gengtype-lex.o : gengtype-lex.c gengtype.h $(SYSTEM_H)
gengtype-lex.o: $(CONFIG_H) $(BCONFIG_H)
-CFLAGS-gengtype-lex.o += -DGENERATOR_FILE
+CFLAGS-build/gengtype-lex.o += -DGENERATOR_FILE
build/gengtype-lex.o: $(BCONFIG_H)
gengtype-parse.o build/gengtype-parse.o : gengtype-parse.c gengtype.h \
$(SYSTEM_H)
gengtype-parse.o: $(CONFIG_H)
-CFLAGS-gengtype-parse.o += -DGENERATOR_FILE
+CFLAGS-build/gengtype-parse.o += -DGENERATOR_FILE
build/gengtype-parse.o: $(BCONFIG_H)
gengtype-state.o build/gengtype-state.o: gengtype-state.c $(SYSTEM_H) \
gengtype.h errors.h double-int.h version.h $(HASHTAB_H) $(OBSTACK_H) \
$(XREGEX_H)
gengtype-state.o: $(CONFIG_H)
-CFLAGS-gengtype-state.o += -DGENERATOR_FILE
+CFLAGS-gengtype-state.o += -DGENERATOR_FILE2
+CFLAGS-build/gengtype-state.o += -DGENERATOR_FILE
build/gengtype-state.o: $(BCONFIG_H)
gengtype.o build/gengtype.o : gengtype.c $(SYSTEM_H) gengtype.h \
rtl.def insn-notes.def errors.h double-int.h version.h $(HASHTAB_H) \
$(OBSTACK_H) $(XREGEX_H)
gengtype.o: $(CONFIG_H)
-CFLAGS-gengtype.o += -DGENERATOR_FILE
+CFLAGS-gengtype.o += -DGENERATOR_FILE2
+CFLAGS-build/gengtype.o += -DGENERATOR_FILE
build/gengtype.o: $(BCONFIG_H)
build/genmddeps.o: genmddeps.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h \
@@ -2515,7 +2517,7 @@
# any system header is included.
gengtype-lex.c : gengtype-lex.l
-$(FLEX) $(FLEXFLAGS) -o$@ $< && { \
- echo '#include "bconfig.h"' > $@.tmp; \
+ echo '' > $@.tmp; \
cat $@ >> $@.tmp; \
mv $@.tmp $@; \
}

View File

@ -0,0 +1,65 @@
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 @@
+/* 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)
+
+#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_ANDROID_H */

View File

@ -0,0 +1,18 @@
From https://github.com/crystax/android-toolchain-gcc-5/commit/1e57465b9b81699ce8eb603dd4794a839a74c635
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 @@
#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 */
+#ifdef 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}"

View File

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

View File

@ -1,51 +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;
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);
Index: gcc-4.8.1/gcc/double-int.h
===================================================================
--- ../gcc-4.8.1.orig/gcc/double-int.h 2013-01-30 11:04:30.000000000 +0000
+++ ./gcc/double-int.h 2013-08-19 11:41:51.564012719 +0000
@@ -448,10 +448,12 @@
#ifndef GENERATOR_FILE
+#ifndef GENERATOR_FILE2
/* Conversion to and from GMP integer representations. */
void mpz_set_double_int (mpz_t, double_int, bool);
double_int mpz_get_double_int (const_tree, mpz_t, bool);
#endif
+#endif
#endif /* DOUBLE_INT_H */

View File

@ -1,3 +1,3 @@
TERMUX_SUBPKG_INCLUDE="bin/gcov share/man/man1/gcov.1 lib/gcc/arm-linux-androideabi/4.9.1/libgcov.a"
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"

View File

@ -16,19 +16,3 @@ diff -u -r ../gcc-4.8.2/libcpp/files.c ./libcpp/files.c
file->buffer_valid = true;
return true;
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);

View File

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