commit: dd8bf0921f741096a70d0c719d6e92b981782364
parent d854915ad3fbe65d8273e52452e095f0076be8bc
Author: fosslinux <fosslinux@aussies.space>
Date: Fri, 27 Jan 2023 17:01:52 +1100
Add GCC 10.4.0
Last version of GCC that can be compiled with GCC 4.7.
Diffstat:
10 files changed, 346 insertions(+), 0 deletions(-)
diff --git a/parts.rst b/parts.rst
@@ -1074,3 +1074,13 @@ Differences to 3.8.16:
* Very recent Python versions allow for the use of ``SOURCE_DATE_EPOCH`` to
remove determinism from precompiled Python libraries (``.pyc``). Finally, we
can re-enable compiling of Python modules.
+
+GCC 10.4.0
+==========
+
+GCC 10.x series is the last version of GCC that is able to be built with the
+C/C++ standards available in GCC 4.7. Instead of manually configuring & compiling
+every subdirectory, since we now have ``autogen`` available we are able to use
+the top-level configure to build the project. We do not use GCC's bootstrap mode,
+where GCC is recompiled with itself after being built, since we're just going
+to use this GCC to compile GCC 12, it adds build time for little benefit.
diff --git a/sysa/SHA256SUMS.pkgs b/sysa/SHA256SUMS.pkgs
@@ -51,6 +51,7 @@ f55c11b091361536774b436abe86b17f759cd7a66522cd20c7a2190da92db67a findutils-4.2.
000147c1a33feff5c5b4cb10c2cf6c2b2f4ef92a90c9e659b25f1766a83d4afc flex-2.6.4_0.tar.bz2
92fe0ffd0971a40fd98c70b075d5bb12f2d8093ef8fb3333aac2b532bd53a591 gawk-3.0.4_0.tar.bz2
458b64a564ca1ef32ed1c682187caa59743a772210fc51a2bc7f11859bdc98f8 gc-8.0.4_0.tar.bz2
+38668df6892e41f7a44e260cec6a5c21bb2bd176b7bada1cd75b55de2a5b40ee gcc-10.4.0_0.tar.bz2
ebbc144e18ca908295845c707f10df82a3337732cc167fcc251b6e6c508d454e gcc-4.0.4_0.tar.bz2
5d3d9bae0069fd4388392b91a47bba4d7ce6733ca9075742ef0d4a4cab899803 gcc-4.0.4_1.tar.bz2
ef44ca57e0b263bc4caae7c375af8930b4e3cf0c58fec98092678d622e37a4a6 gcc-4.7.4_0.tar.bz2
diff --git a/sysc/gcc-10.4.0/gcc-10.4.0.sh b/sysc/gcc-10.4.0/gcc-10.4.0.sh
@@ -0,0 +1,115 @@
+# SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
+#
+# SPDX-License-Identifier: GPL-3.0-or-later
+
+src_prepare() {
+ default
+
+ # Remove vendored zlib
+ rm -r zlib/
+
+ # Regen gperf file (because GCC's make rules suck)
+ rm gcc/cp/cfns.h
+ # (taken directly from gcc/cp/Make-lang.in)
+ gperf -o -C -E -k '1-6,$' -j1 -D -N 'libc_name_p' -L C++ \
+ gcc/cp/cfns.gperf --output-file gcc/cp/cfns.h
+
+ # Regenerate autogen stuff
+ autogen Makefile.def
+ pushd fixincludes
+ ./genfixes
+ popd
+
+ # Regenerate autotools
+ # configure
+ find . -name configure | sed 's:/configure::' | while read d; do
+ pushd "${d}"
+ AUTOMAKE=automake-1.15 ACLOCAL=aclocal-1.15 autoreconf-2.69 -fiv
+ popd
+ done
+ # Because GCC is stupid, copy depcomp back in
+ cp "${PREFIX}/share/automake-1.15/depcomp" .
+ # Makefile.in only
+ BACK="${PWD}"
+ find . -type d \
+ -exec test -e "{}/Makefile.am" -a ! -e "{}/configure" \; \
+ -print | while read d; do
+ d="$(readlink -f "${d}")"
+ cd "${d}"
+ # Find the appropriate configure script for automake
+ while [ ! -e configure ]; do
+ cd ..
+ done
+ automake-1.15 -fai "${d}/Makefile"
+ cd "${BACK}"
+ done
+
+ # Remove bison generated files
+ rm intl/plural.c
+
+ # Remove flex generated files
+ rm gcc/gengtype-lex.c
+
+ # Remove unused generated files
+ rm -r libgfortran/generated
+
+ # intl/ Makefile is a bit broken because of new gettext
+ sed -i 's/@USE_INCLUDED_LIBINTL@/no/' intl/Makefile.in
+
+ # Regenerate crc table in libiberty/crc32.c
+ pushd libiberty
+ sed -n -e '38,65p' crc32.c > crcgen.c
+ gcc -o crcgen crcgen.c
+ head -n 69 crc32.c > crc32.c.new
+ ./crcgen >> crc32.c.new
+ tail -n +138 crc32.c >> crc32.c.new
+ mv crc32.c.new crc32.c
+ popd
+
+ # Remove docs/translation
+ find . -name "*.gmo" -delete
+ find . -name "*.info" -delete
+}
+
+src_configure() {
+ mkdir build
+ cd build
+
+ # std=gnu11 is the default for GCC10, so that is what it makes most
+ # sense to build with. (default, std=gnu90 is too outdated).
+ # For this GCC, we only build one stage, as extra is superfluous,
+ # since we build GCC 12 straight after.
+ CFLAGS="-std=gnu11" \
+ LDFLAGS="-static" \
+ ../configure \
+ --prefix="${PREFIX}" \
+ --libdir="${LIBDIR}" \
+ --build=i386-unknown-linux-musl \
+ --target=i386-unknown-linux-musl \
+ --host=i386-unknown-linux-musl \
+ --disable-bootstrap \
+ --enable-static \
+ --program-transform-name= \
+ --enable-languages=c,c++ \
+ --with-system-zlib \
+ --disable-sjlj-exceptions \
+ --disable-multilib \
+ --enable-threads=posix \
+ --disable-libsanitizer
+}
+
+src_install() {
+ default
+
+ # Reduce final size of GCC 10.
+ find "${DESTDIR}" -type f | while read f; do
+ case "$(file -bi "${f}")" in
+ application/x-executable*|\
+ application/x-sharedlib*|\
+ application/x-pie-executable*|\
+ application/x-archive*)
+ strip "${f}"
+ ;;
+ esac
+ done
+}
diff --git a/sysc/gcc-10.4.0/patches/fix-autoreconf.patch b/sysc/gcc-10.4.0/patches/fix-autoreconf.patch
@@ -0,0 +1,37 @@
+SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
+SPDX-FileCopyrightText: 2022 Thomas Schwinge <thomas@codesourcery.com>
+
+SPDX-License-Identifier: GPL-3.0-or-later
+
+Backport of commit 25861cf3a88a07c8dca3fb32d098c0ad756bbe38
+
+====
+
+[PATCH] Make 'autoreconf' work for 'gcc', 'libobjc'
+
+With that, we may then run plain 'autoreconf' for all of GCC's subpackages,
+instead of for some of those (that don't use Automake) manually having to run
+the applicable combination of 'aclocal', 'autoconf', 'autoheader'.
+
+See also 'AC_CONFIG_MACRO_DIRS'/'AC_CONFIG_MACRO_DIR' usage elsewhere.
+
+--- gcc/configure.ac 2023-01-22 16:22:57.833166450 +1100
++++ gcc/configure.ac 2023-01-22 16:23:08.971274603 +1100
+@@ -25,6 +25,7 @@
+
+ AC_INIT
+ AC_CONFIG_SRCDIR(tree.c)
++AC_CONFIG_MACRO_DIRS([../config] [..])
+ AC_CONFIG_HEADER(auto-host.h:config.in)
+
+ gcc_version=`cat $srcdir/BASE-VER`
+--- libobjc/configure.ac 2023-01-22 16:23:42.648601085 +1100
++++ libobjc/configure.ac 2023-01-22 16:23:28.937468262 +1100
+@@ -20,6 +20,7 @@
+
+ AC_INIT(package-unused, version-unused,, libobjc)
+ AC_CONFIG_SRCDIR([objc/objc.h])
++AC_CONFIG_MACRO_DIRS([../config] [..])
+ GCC_TOPLEV_SUBDIRS
+
+ # We need the following definitions because AC_PROG_LIBTOOL relies on them
diff --git a/sysc/gcc-10.4.0/patches/includes.patch b/sysc/gcc-10.4.0/patches/includes.patch
@@ -0,0 +1,25 @@
+SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
+
+SPDX-License-Identifier: GPL-3.0-or-later
+
+Two fold issue.
+
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63966
+Pre-5.0 GCC does not have a cpuid.h header installed on the system, so
+we use the one from this source tree.
+
+https://stackoverflow.com/questions/22160093/inconsistent-operand-constraints-in-an-asm
+Pre-5.0 GCC does not support PIC inline ASM that touches ebx (as
+presumably the cpuid call does); so we must disable PIC.
+
+--- libgcc/Makefile.in 2023-01-25 16:03:45.928059755 +1100
++++ libgcc/Makefile.in 2023-01-25 16:04:06.711464255 +1100
+@@ -282,7 +282,7 @@
+ # subdirectory rather than in the source directory.
+ # -I$(@D) and -I$(srcdir)/$(@D) cause the subdirectory of the file
+ # currently being compiled, in both source trees, to be examined as well.
+-INCLUDES = -I. -I$(@D) -I$(gcc_objdir) \
++INCLUDES = -I. -I$(@D) -I$(gcc_objdir) -I../../gcc/include -fno-pic \
+ -I$(srcdir) -I$(srcdir)/$(@D) -I$(srcdir)/../gcc \
+ -I$(srcdir)/../include $(DECNUMINC)
+
diff --git a/sysc/gcc-10.4.0/patches/libgcc-xfmode.patch b/sysc/gcc-10.4.0/patches/libgcc-xfmode.patch
@@ -0,0 +1,120 @@
+SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
+SPDX-FileCopyrightText: 2022 Christophe Lyon <christophe.lyon@arm.com>
+
+SPDX-License-Identifier: GPL-3.0-or-later
+
+In our context, some construct has decided that we don't support
+XF mode (which is not true for the architecture, in general, as
+this patch supports, but is sufficient for our strange environment).
+
+Backport of commit 43ccb7e445329dd9557b42e7289a87a8071ab0f7.
+
+[PATCH] libgcc: Enable XF mode conversions to/from DFP modes only if
+ supported
+
+Some targets do not support XF mode (eg AArch64), so don't build the
+corresponding to/from DFP modes convertion routines if
+__LIBGCC_HAS_XF_MODE__ is not defined.
+
+diff --git libgcc/config/libbid/_dd_to_xf.c libgcc/config/libbid/_dd_to_xf.c
+index 5a2abbbb1f4..e4b12e8ac4f 100644
+--- libgcc/config/libbid/_dd_to_xf.c
++++ libgcc/config/libbid/_dd_to_xf.c
+@@ -25,6 +25,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ #include "bid_functions.h"
+ #include "bid_gcc_intrinsics.h"
+
++#ifdef __LIBGCC_HAS_XF_MODE__
+ XFtype
+ __bid_extendddxf (_Decimal64 x) {
+ XFtype res;
+@@ -34,3 +35,4 @@ __bid_extendddxf (_Decimal64 x) {
+ res = __bid64_to_binary80 (ux.i);
+ return (res);
+ }
++#endif
+diff --git libgcc/config/libbid/_sd_to_xf.c libgcc/config/libbid/_sd_to_xf.c
+index 9af09913684..288ccb25075 100644
+--- libgcc/config/libbid/_sd_to_xf.c
++++ libgcc/config/libbid/_sd_to_xf.c
+@@ -25,6 +25,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ #include "bid_functions.h"
+ #include "bid_gcc_intrinsics.h"
+
++#ifdef __LIBGCC_HAS_XF_MODE__
+ XFtype
+ __bid_extendsdxf (_Decimal32 x) {
+ XFtype res;
+@@ -34,3 +35,4 @@ __bid_extendsdxf (_Decimal32 x) {
+ res = __bid32_to_binary80 (ux.i);
+ return (res);
+ }
++#endif
+diff --git libgcc/config/libbid/_td_to_xf.c libgcc/config/libbid/_td_to_xf.c
+index b0c76a71497..e990282162d 100644
+--- libgcc/config/libbid/_td_to_xf.c
++++ libgcc/config/libbid/_td_to_xf.c
+@@ -25,6 +25,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ #include "bid_functions.h"
+ #include "bid_gcc_intrinsics.h"
+
++#ifdef __LIBGCC_HAS_XF_MODE__
+ XFtype
+ __bid_trunctdxf (_Decimal128 x) {
+ XFtype res;
+@@ -34,3 +35,4 @@ __bid_trunctdxf (_Decimal128 x) {
+ res = __bid128_to_binary80 (ux.i);
+ return (res);
+ }
++#endif
+diff --git libgcc/config/libbid/_xf_to_dd.c libgcc/config/libbid/_xf_to_dd.c
+index 9feb0f2c3d6..e3246a1c2e1 100644
+--- libgcc/config/libbid/_xf_to_dd.c
++++ libgcc/config/libbid/_xf_to_dd.c
+@@ -25,9 +25,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ #include "bid_functions.h"
+ #include "bid_gcc_intrinsics.h"
+
++#ifdef __LIBGCC_HAS_XF_MODE__
+ _Decimal64
+ __bid_truncxfdd (XFtype x) {
+ union decimal64 res;
+ res.i = __binary80_to_bid64 (x);
+ return (res.d);
+ }
++#endif
+diff --git libgcc/config/libbid/_xf_to_sd.c libgcc/config/libbid/_xf_to_sd.c
+index 7d46548af6c..9147e979182 100644
+--- libgcc/config/libbid/_xf_to_sd.c
++++ libgcc/config/libbid/_xf_to_sd.c
+@@ -25,9 +25,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ #include "bid_functions.h"
+ #include "bid_gcc_intrinsics.h"
+
++#ifdef __LIBGCC_HAS_XF_MODE__
+ _Decimal32
+ __bid_truncxfsd (XFtype x) {
+ union decimal32 res;
+ res.i = __binary80_to_bid32 (x);
+ return (res.d);
+ }
++#endif
+diff --git libgcc/config/libbid/_xf_to_td.c libgcc/config/libbid/_xf_to_td.c
+index 07987fdcc3a..c8d102b0b7f 100644
+--- libgcc/config/libbid/_xf_to_td.c
++++ libgcc/config/libbid/_xf_to_td.c
+@@ -25,9 +25,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ #include "bid_functions.h"
+ #include "bid_gcc_intrinsics.h"
+
++#ifdef __LIBGCC_HAS_XF_MODE__
+ _Decimal128
+ __bid_extendxftd (XFtype x) {
+ union decimal128 res;
+ res.i = __binary80_to_bid128 (x);
+ return (res.d);
+ }
++#endif
+--
+2.31.1
+
diff --git a/sysc/gcc-10.4.0/patches/new-gettext.patch b/sysc/gcc-10.4.0/patches/new-gettext.patch
@@ -0,0 +1,17 @@
+SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
+
+SPDX-License-Identifier: GPL-3.0-or-later
+
+In new gettext external is required for AM_GNU_GETTEXT.
+
+--- intl/configure.ac 2023-02-07 18:43:58.989786230 +1100
++++ intl/configure.ac 2023-02-07 18:43:02.182632631 +1100
+@@ -4,7 +4,7 @@
+ AC_CONFIG_HEADER(config.h)
+ AC_CONFIG_MACRO_DIR(../config)
+ AM_GNU_GETTEXT_VERSION(0.12.1)
+-AM_GNU_GETTEXT([], [need-ngettext])
++AM_GNU_GETTEXT([external], [need-ngettext])
+
+ # This replaces the extensive use of DEFS in the original Makefile.in.
+ AC_DEFINE(IN_LIBINTL, 1, [Define because this is libintl.])
diff --git a/sysc/gcc-10.4.0/patches/no-isolate-erroneous-paths-dereference.patch b/sysc/gcc-10.4.0/patches/no-isolate-erroneous-paths-dereference.patch
@@ -0,0 +1,18 @@
+SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
+
+SPDX-License-Identifier: GPL-3.0-or-later
+
+GCC 4.7 doesn't have fisolate-erroneous-paths-dereference. Hence
+this line does nothing.
+
+--- libgcc/generic-morestack.c 2023-01-25 16:52:35.382471998 +1100
++++ libgcc/generic-morestack.c 2023-01-25 16:52:40.773585043 +1100
+@@ -23,8 +23,6 @@
+ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+-#pragma GCC optimize ("no-isolate-erroneous-paths-dereference")
+-
+ /* powerpc 32-bit not supported. */
+ #if !defined __powerpc__ || defined __powerpc64__
+
diff --git a/sysc/gcc-10.4.0/sources b/sysc/gcc-10.4.0/sources
@@ -0,0 +1 @@
+http://ftp.gnu.org/gnu/gcc/gcc-10.4.0/gcc-10.4.0.tar.xz c9297d5bcd7cb43f3dfc2fed5389e948c9312fd962ef6a4ce455cff963ebe4f1
diff --git a/sysc/run2.sh b/sysc/run2.sh
@@ -130,6 +130,8 @@ build python-3.8.16
build python-3.11.1
+build gcc-10.4.0
+
if [ "$FORCE_TIMESTAMPS" = True ] ; then
echo 'Forcing all files timestamps to be 0 unix time.'
canonicalise_all_files_timestamp