Update to GCC 13

The latest version of GCC.

Luckily this allows for a bunch of patches to be dropped - apart from
that, no significant change.
This commit is contained in:
fosslinux 2023-05-09 22:41:45 +10:00
parent e2ceb13e57
commit aa2d6c4137
10 changed files with 4 additions and 81 deletions

101
sysc/gcc-13.1.0/gcc-13.1.0.sh Executable file
View file

@ -0,0 +1,101 @@
# 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
local 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.cc
# 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
LDFLAGS="-static" \
../configure \
--prefix="${PREFIX}" \
--libdir="${LIBDIR}" \
--build=i386-unknown-linux-musl \
--target=i386-unknown-linux-musl \
--host=i386-unknown-linux-musl \
--enable-bootstrap \
--enable-static \
--enable-default-pie \
--enable-default-ssp \
--disable-plugins \
--disable-libssp \
--disable-libsanitizer \
--program-transform-name= \
--enable-languages=c,c++ \
--with-system-zlib \
--disable-multilib \
--enable-threads=posix
}
src_compile() {
make "${MAKEJOBS}" BOOT_LDFLAGS="-static"
}

View file

@ -0,0 +1,35 @@
SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
SPDX-FileCopyrightText: 2020 Timo Teräs <timo.teras@iki.fi>
SPDX-License-Identifier: GPL-3.0-or-later
The original motivation from this patch from Alpine Linux:
Subject: [PATCH] Alpine musl package provides libssp_nonshared.a. We link to
it unconditionally, as otherwise we get link failures if some objects are
-fstack-protector built and final link happens with -fno-stack-protector.
This seems to be the common case when bootstrapping gcc, the piepatches do
not seem to fully fix the crosstoolchain and bootstrap sequence wrt.
stack-protector flag usage.
Which matches precisely the problem when compiling GCC with --enable-bootstrap
in live-bootstrap.
---
gcc/gcc.cc | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git gcc/gcc.cc gcc/gcc.cc
index cc99d0b7aa1..c60a75371f8 100644
--- gcc/gcc.cc
+++ gcc/gcc.cc
@@ -1004,8 +1004,7 @@ proper position among the other output files. */
#ifndef LINK_SSP_SPEC
#ifdef TARGET_LIBC_PROVIDES_SSP
-#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
- "|fstack-protector-strong|fstack-protector-explicit:}"
+#define LINK_SSP_SPEC "-lssp_nonshared"
#else
#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
"|fstack-protector-strong|fstack-protector-explicit" \

View file

@ -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.])

1
sysc/gcc-13.1.0/sources Normal file
View file

@ -0,0 +1 @@
https://ftp.gnu.org/gnu/gcc/gcc-13.1.0/gcc-13.1.0.tar.xz 61d684f0aa5e76ac6585ad8898a2427aade8979ed5e7f85492286c4dfc13ee86