crossgcc/default: fix build errors on host gcc 13.x

import a workaround from upstream for gnat builds, and
disable treating warnings as errors. i've pretty much
taken the bazooka approach here.

tested on a bleeding edge gnu+linux distro. boards
using coreboot/default should now compile on parabola,
for example.

also disable treating warnings as errors, when building
gcc 11.2 from coreboot crossgcc

Signed-off-by: Leah Rowe <info@minifree.org>
This commit is contained in:
Leah Rowe 2024-01-15 22:41:22 +00:00 committed by Leah Rowe
parent 526761153a
commit d7372a620b
2 changed files with 123 additions and 0 deletions

View File

@ -0,0 +1,55 @@
From c1b527867405e999f4231b30ab15eaf7c3b30e90 Mon Sep 17 00:00:00 2001
From: Leah Rowe <leah@libreboot.org>
Date: Sat, 19 Nov 2022 14:55:01 +0000
Subject: [PATCH 1/2] fix crossgcc build error
---
util/crossgcc/patches/gcc-11.2.0_gnat.patch | 32 ++++++++++++++++++++-
1 file changed, 31 insertions(+), 1 deletion(-)
diff --git a/util/crossgcc/patches/gcc-11.2.0_gnat.patch b/util/crossgcc/patches/gcc-11.2.0_gnat.patch
index 2d7cecee24..c22cec45d0 100644
--- a/util/crossgcc/patches/gcc-11.2.0_gnat.patch
+++ b/util/crossgcc/patches/gcc-11.2.0_gnat.patch
@@ -5,7 +5,37 @@
# Extra flags to pass to recursive makes.
-COMMON_ADAFLAGS= -gnatpg
-+COMMON_ADAFLAGS= -gnatpg -gnatwGUR
++COMMON_ADAFLAGS= -gnatpg -gnatwn
ifeq ($(TREECHECKING),)
CHECKING_ADAFLAGS=
else
+diff -Nurp gcc-11.2.0/gcc/ada/gcc-interface/Make-lang.in gcc-11.2.0.new/gcc/ada/gcc-interface/Make-lang.in
+--- gcc-11.2.0/gcc/ada/gcc-interface/Make-lang.in 2022-06-03 00:31:57.993273717 +0200
++++ gcc-11.2.0.new/gcc/ada/gcc-interface/Make-lang.in 2022-06-03 00:30:50.214166847 +0200
+@@ -334,6 +334,7 @@ GNAT_ADA_OBJS = \
+ ada/hostparm.o \
+ ada/impunit.o \
+ ada/inline.o \
++ ada/libgnat/i-c.o \
+ ada/libgnat/interfac.o \
+ ada/itypes.o \
+ ada/krunch.o \
+@@ -364,7 +365,10 @@ GNAT_ADA_OBJS = \
+ ada/rtsfind.o \
+ ada/libgnat/s-addope.o \
+ ada/libgnat/s-addima.o \
++ ada/libgnat/s-aotase.o \
+ ada/libgnat/s-assert.o \
++ ada/libgnat/s-atoope.o \
++ ada/libgnat/s-atopri.o \
+ ada/libgnat/s-bitops.o \
+ ada/libgnat/s-carun8.o \
+ ada/libgnat/s-casuti.o \
+@@ -548,6 +552,7 @@ GNATBIND_OBJS = \
+ ada/hostparm.o \
+ ada/init.o \
+ ada/initialize.o \
++ ada/libgnat/i-c.o \
+ ada/libgnat/interfac.o \
+ ada/krunch.o \
+ ada/lib.o \
--
2.39.2

View File

@ -0,0 +1,68 @@
From 67a1a6ac1667cf6968b8007888654b4b940ea820 Mon Sep 17 00:00:00 2001
From: Leah Rowe <leah@libreboot.org>
Date: Mon, 15 Jan 2024 22:39:12 +0000
Subject: [PATCH 2/2] disable warning-as-error when building gcc
needed, because newer host gcc will treat warnings as errors,
and some of this older code will trip on the newer handling.
Signed-off-by: Leah Rowe <info@minifree.org>
---
util/crossgcc/buildgcc | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/util/crossgcc/buildgcc b/util/crossgcc/buildgcc
index dd32ee6ba8..5e6a3310a7 100755
--- a/util/crossgcc/buildgcc
+++ b/util/crossgcc/buildgcc
@@ -609,7 +609,7 @@ set_hostcflags_from_gmp() {
# Now set CFLAGS to match GMP CFLAGS but strip out -pedantic
# as GCC 4.6.x fails if it's there.
HOSTCFLAGS="$(grep __GMP_CFLAGS "$DESTDIR$TARGETDIR/include/gmp.h" |cut -d\" -f2 |\
- sed s,-pedantic,,)"
+ sed s,-pedantic,,) -Wno-error -w"
export HOSTCFLAGS
}
@@ -698,13 +698,13 @@ build_BINUTILS() {
bootstrap_GCC() {
# shellcheck disable=SC2086
- CC="$(hostcc host)" CXX="$(hostcxx host)" \
- CFLAGS="$HOSTCFLAGS" \
- CFLAGS_FOR_BUILD="$HOSTCFLAGS" \
- CFLAGS_FOR_TARGET="$HOSTCFLAGS -fPIC" \
- CXXFLAGS="$HOSTCFLAGS" \
- CXXFLAGS_FOR_BUILD="$HOSTCFLAGS" \
- CXXFLAGS_FOR_TARGET="$HOSTCFLAGS -fPIC" \
+ CC="$(hostcc host) -Wno-error -w" CXX="$(hostcxx host) -Wno-error -w" \
+ CFLAGS="$HOSTCFLAGS -Wno-error -w" \
+ CFLAGS_FOR_BUILD="$HOSTCFLAGS -Wno-error -w" \
+ CFLAGS_FOR_TARGET="$HOSTCFLAGS -fPIC -Wno-error -w" \
+ CXXFLAGS="$HOSTCFLAGS -Wno-error -w" \
+ CXXFLAGS_FOR_BUILD="$HOSTCFLAGS -Wno-error -w" \
+ CXXFLAGS_FOR_TARGET="$HOSTCFLAGS -fPIC -Wno-error -w" \
../gcc-${GCC_VERSION}/configure \
--prefix="$TARGETDIR" --libexecdir="$TARGETDIR/lib" \
--enable-bootstrap \
@@ -1021,7 +1021,7 @@ if [ -n "$CC" ]; then
fi
else
if searchtool gnatgcc "Free Software Foundation" nofail > /dev/null; then
- CC=gnatgcc
+ CC="gnatgcc"
elif searchtool gcc "Free Software Foundation" nofail > /dev/null; then
CC=gcc
else
@@ -1143,7 +1143,7 @@ if ada_requested; then
fi
fi # GCC
-export HOSTCFLAGS="-Os"
+export HOSTCFLAGS="-Os -Wno-error -w"
if have_hostcflags_from_gmp; then
set_hostcflags_from_gmp
fi
--
2.39.2