N64: Upgrade GCC, Binutils and Newlib to support C++11

This commit is contained in:
Cameron Cawley
2022-11-30 16:42:25 +00:00
committed by Le Philousophe
parent 70df003511
commit b24eadff3f
4 changed files with 10 additions and 224 deletions
@@ -1,9 +1,12 @@
#! /bin/sh
# These versions are the ones used on the old buildbot
BINUTILS_VERSION=2.19.1
GCC_VERSION=4.4.2
NEWLIB_VERSION=1.17.0
# GCC has been upgraded from 4.4.2 to 4.9.4 to support C++11
# Binutils has been upgraded from 2.19.1 to 2.25 to support DWARF v4
# Newlib has been upgraded from 1.17.0 to 1.19.0 for compatibility with newer GCC
BINUTILS_VERSION=2.25
GCC_VERSION=4.9.4
NEWLIB_VERSION=1.19.0
# This package is inspired by dc-chain scripts for KallistiOS. Credits go to them.
@@ -23,7 +26,7 @@ export PATH="${PATH}:${prefix}/bin"
# Binutils
do_http_fetch binutils "https://ftp.gnu.org/gnu/binutils/binutils-${BINUTILS_VERSION}.tar.bz2" 'tar xjf'
CFLAGS="-fcommon -std=gnu89" CXXFLAGS="-fcommon" \
CFLAGS="-fcommon -std=gnu89" CXXFLAGS="-fcommon -std=gnu++11" \
./configure --target=${target} --prefix="${prefix}" --disable-werror
do_make
do_make install
@@ -32,7 +35,6 @@ cd ..
# GCC...
do_http_fetch gcc "https://ftp.gnu.org/gnu/gcc/gcc-${GCC_VERSION}/gcc-${GCC_VERSION}.tar.bz2" 'tar xjf'
do_patch gcc
# Do off tree build
GCC_DIR=$(pwd)
@@ -43,7 +45,7 @@ cd ..
mkdir gcc-build-stage1
cd gcc-build-stage1
CFLAGS="-fcommon -std=gnu89" CXXFLAGS="-fcommon" \
CFLAGS="-fcommon -std=gnu89" CXXFLAGS="-fcommon -std=gnu++11" \
"${GCC_DIR}"/configure \
--target=${target} \
--prefix="${prefix}" \
@@ -62,7 +64,7 @@ cd ..
# Newlib
do_http_fetch newlib "ftp://sourceware.org/pub/newlib/newlib-${NEWLIB_VERSION}.tar.gz" 'tar xzf'
CFLAGS_FOR_BUILD="-fcommon -std=gnu89" CXXFLAGS_FOR_BUILD="-fcommon" \
CFLAGS_FOR_BUILD="-fcommon -std=gnu89" CXXFLAGS_FOR_BUILD="-fcommon -std=gnu++11" \
CC_FOR_TARGET="${prefix}/bin/${target}-gcc" ./configure \
--target=${target} \
--prefix="${prefix}" \
@@ -77,7 +79,7 @@ cd ..
mkdir gcc-build-stage2
cd gcc-build-stage2
CFLAGS="-fcommon -std=gnu89" CXXFLAGS="-fcommon" \
CFLAGS="-fcommon -std=gnu89" CXXFLAGS="-fcommon -std=gnu++11" \
"${GCC_DIR}"/configure \
--target=${target} \
--prefix="${prefix}" \
@@ -1,140 +0,0 @@
From adb8b9225914e2138c980cd1e186a0764295bff9 Mon Sep 17 00:00:00 2001
From: Le Philousophe <lephilousophe@users.noreply.github.com>
Date: Mon, 11 Oct 2021 20:35:56 +0200
Subject: [PATCH 1/3] Fix texi files for modern texinfo
---
gcc/doc/c-tree.texi | 4 ++--
gcc/doc/cppopts.texi | 2 +-
gcc/doc/gcc.texi | 6 +++---
gcc/doc/invoke.texi | 14 +++++++-------
gcc/doc/sourcebuild.texi | 2 +-
5 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/gcc/doc/c-tree.texi b/gcc/doc/c-tree.texi
index 6eabd34a..451f5230 100644
--- a/gcc/doc/c-tree.texi
+++ b/gcc/doc/c-tree.texi
@@ -2338,13 +2338,13 @@ generate these expressions anyhow, if it can tell that strictness does
not matter. The type of the operands and that of the result are
always of @code{BOOLEAN_TYPE} or @code{INTEGER_TYPE}.
-@itemx POINTER_PLUS_EXPR
+@item POINTER_PLUS_EXPR
This node represents pointer arithmetic. The first operand is always
a pointer/reference type. The second operand is always an unsigned
integer type compatible with sizetype. This is the only binary
arithmetic operand that can operate on pointer types.
-@itemx PLUS_EXPR
+@item PLUS_EXPR
@itemx MINUS_EXPR
@itemx MULT_EXPR
These nodes represent various binary arithmetic operations.
diff --git a/gcc/doc/cppopts.texi b/gcc/doc/cppopts.texi
index 2fca3664..2c499766 100644
--- a/gcc/doc/cppopts.texi
+++ b/gcc/doc/cppopts.texi
@@ -758,7 +758,7 @@ Replacement: [ ] @{ @} # \ ^ | ~
Enable special code to work around file systems which only permit very
short file names, such as MS-DOS@.
-@itemx --help
+@item --help
@itemx --target-help
@opindex help
@opindex target-help
diff --git a/gcc/doc/gcc.texi b/gcc/doc/gcc.texi
index 41031752..276cadf3 100644
--- a/gcc/doc/gcc.texi
+++ b/gcc/doc/gcc.texi
@@ -84,11 +84,11 @@ This file documents the use of the GNU compilers.
Published by:
@multitable @columnfractions 0.5 0.5
@item GNU Press
-@tab Website: www.gnupress.org
+@tab Website: @uref{www.gnupress.org}
@item a division of the
-@tab General: @tex press@@gnu.org @end tex
+@tab General: @uref{press@@gnu.org}
@item Free Software Foundation
-@tab Orders: @tex sales@@gnu.org @end tex
+@tab Orders: @uref{sales@@gnu.org}
@item 51 Franklin Street, Fifth Floor
@tab Tel 617-542-5942
@item Boston, MA 02110-1301 USA
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index ccb2776f..ecd1bac7 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -4645,11 +4645,11 @@ Dump after duplicating the computed gotos.
@option{-fdump-rtl-ce3} enable dumping after the three
if conversion passes.
-@itemx -fdump-rtl-cprop_hardreg
+@item -fdump-rtl-cprop_hardreg
@opindex fdump-rtl-cprop_hardreg
Dump after hard register copy propagation.
-@itemx -fdump-rtl-csa
+@item -fdump-rtl-csa
@opindex fdump-rtl-csa
Dump after combining stack adjustments.
@@ -4660,11 +4660,11 @@ Dump after combining stack adjustments.
@option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
the two common sub-expression elimination passes.
-@itemx -fdump-rtl-dce
+@item -fdump-rtl-dce
@opindex fdump-rtl-dce
Dump after the standalone dead code elimination passes.
-@itemx -fdump-rtl-dbr
+@item -fdump-rtl-dbr
@opindex fdump-rtl-dbr
Dump after delayed branch scheduling.
@@ -4709,7 +4709,7 @@ Dump after the initialization of the registers.
@opindex fdump-rtl-initvals
Dump after the computation of the initial value sets.
-@itemx -fdump-rtl-into_cfglayout
+@item -fdump-rtl-into_cfglayout
@opindex fdump-rtl-into_cfglayout
Dump after converting to cfglayout mode.
@@ -4739,7 +4739,7 @@ Dump after removing redundant mode switches.
@opindex fdump-rtl-rnreg
Dump after register renumbering.
-@itemx -fdump-rtl-outof_cfglayout
+@item -fdump-rtl-outof_cfglayout
@opindex fdump-rtl-outof_cfglayout
Dump after converting from cfglayout mode.
@@ -4751,7 +4751,7 @@ Dump after the peephole pass.
@opindex fdump-rtl-postreload
Dump after post-reload optimizations.
-@itemx -fdump-rtl-pro_and_epilogue
+@item -fdump-rtl-pro_and_epilogue
@opindex fdump-rtl-pro_and_epilogue
Dump after generating the function pro and epilogues.
diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
index fb639826..4c515897 100644
--- a/gcc/doc/sourcebuild.texi
+++ b/gcc/doc/sourcebuild.texi
@@ -573,7 +573,7 @@ standard rule in @file{gcc/Makefile.in} to the variable
@code{lang_checks}.
@table @code
-@itemx all.cross
+@item all.cross
@itemx start.encap
@itemx rest.encap
FIXME: exactly what goes in each of these targets?
--
2.49.1
@@ -1,25 +0,0 @@
From 0b91adacd5db6d263436891e2efebf6e0ae16442 Mon Sep 17 00:00:00 2001
From: Le Philousophe <lephilousophe@users.noreply.github.com>
Date: Mon, 11 Oct 2021 20:37:00 +0200
Subject: [PATCH 2/3] Fix toplev compilation
---
gcc/toplev.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/toplev.h b/gcc/toplev.h
index 2324b068..7f0cf5ee 100644
--- a/gcc/toplev.h
+++ b/gcc/toplev.h
@@ -174,7 +174,7 @@ extern int exact_log2 (unsigned HOST_WIDE_INT);
extern int floor_log2 (unsigned HOST_WIDE_INT);
/* Inline versions of the above for speed. */
-#if GCC_VERSION >= 3004
+#if GCC_VERSION >= 3004 && defined(__cplusplus)
# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
# define CLZ_HWI __builtin_clzl
# define CTZ_HWI __builtin_ctzl
--
2.49.1
@@ -1,51 +0,0 @@
From 6c68035cbcbeda0f3bbff602fdae788ef0e1e05d Mon Sep 17 00:00:00 2001
From: Le Philousophe <lephilousophe@users.noreply.github.com>
Date: Mon, 11 Oct 2021 20:47:00 +0200
Subject: [PATCH 3/3] Fix gperf code for modern gcc
---
gcc/cp/cfns.gperf | 3 ---
gcc/cp/cfns.h | 6 ------
2 files changed, 9 deletions(-)
diff --git a/gcc/cp/cfns.gperf b/gcc/cp/cfns.gperf
index c713eb0c..30f7a39e 100644
--- a/gcc/cp/cfns.gperf
+++ b/gcc/cp/cfns.gperf
@@ -3,9 +3,6 @@
__inline
#endif
static unsigned int hash (const char *, unsigned int);
-#ifdef __GNUC__
-__inline
-#endif
const char * libc_name_p (const char *, unsigned int);
%}
%%
diff --git a/gcc/cp/cfns.h b/gcc/cp/cfns.h
index e6d43d8a..cf3f2432 100644
--- a/gcc/cp/cfns.h
+++ b/gcc/cp/cfns.h
@@ -34,9 +34,6 @@
__inline
#endif
static unsigned int hash (const char *, unsigned int);
-#ifdef __GNUC__
-__inline
-#endif
const char * libc_name_p (const char *, unsigned int);
/* maximum key range = 391, duplicates = 0 */
@@ -105,9 +102,6 @@ hash (register const char *str, register unsigned int len)
return hval + asso_values[(unsigned char)str[len - 1]];
}
-#ifdef __GNUC__
-__inline
-#endif
const char *
libc_name_p (register const char *str, register unsigned int len)
{
--
2.49.1