coreboot-kgpe-d16/util/crossgcc/patches/gcc-13.2.0_gnat.patch
Elyes Haouas 2731fa619b crossgcc: Upgrade GCC from 11.4.0 to 13.2.0
Changelogs:
  * https://gcc.gnu.org/gcc-12/changes.html
  * https://gcc.gnu.org/gcc-13/changes.html

Porting guides:
  * https://gcc.gnu.org/gcc-12/porting_to.html
  * https://gcc.gnu.org/gcc-13/porting_to.html

Change-Id: I4f2ed4de4811abaa13528906de71eee29a8f2910
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Signed-off-by: Nico Huber <nico.h@gmx.de>
Signed-off-by: Felix Singer <felixsinger@posteo.net>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/70771
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Martin L Roth <gaumless@gmail.com>
2023-11-24 23:31:03 +00:00

108 lines
3 KiB
Diff

From b1b16478729aea709e7ef81224995b6d26b38a87 Mon Sep 17 00:00:00 2001
From: Nico Huber <nico.h@gmx.de>
Date: Sun, 16 Jul 2023 00:30:03 +0200
Subject: [PATCH] GNAT: Build cross compilers with host runtime
When building with an older host toolchain, the shipped libgnat
sources may not be compatible. So rely on the host runtime just
like we do for a stage1 build.
Signed-off-by: Nico Huber <nico.h@gmx.de>
---
gcc/ada/gcc-interface/Make-lang.in | 16 +++++++++++++---
gcc/ada/init.c | 4 ++++
2 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/gcc/ada/gcc-interface/Make-lang.in b/gcc/ada/gcc-interface/Make-lang.in
index 9507f2f09203..cf7ec4cc1662 100644
--- a/gcc/ada/gcc-interface/Make-lang.in
+++ b/gcc/ada/gcc-interface/Make-lang.in
@@ -57,18 +57,21 @@ WARN_ADAFLAGS= -W -Wall
# checks fully active.
STAGE1=False
+HOST_RT=False
GNATBIND_FLAGS=
GNATLIB=
+ADAFLAGS=$(COMMON_ADAFLAGS) -gnatwns
ifeq ($(CROSS),)
- ADAFLAGS=$(COMMON_ADAFLAGS) -gnatwns
ifeq ($(if $(wildcard ../stage_current),$(shell cat ../stage_current),stage1),stage1)
STAGE1=True
GNATBIND_FLAGS=-t
+ HOST_RT=True
endif
else
- ADAFLAGS=$(COMMON_ADAFLAGS)
+ GNATBIND_FLAGS=-t
+ HOST_RT=True
endif
ALL_ADAFLAGS = \
@@ -87,7 +89,7 @@ ifeq ($(strip $(filter-out hpux%,$(host_os))),)
STAGE1_LIBS=/usr/lib/libcl.a
endif
-ifeq ($(STAGE1),True)
+ifeq ($(HOST_RT),True)
ADA_INCLUDES=$(COMMON_ADA_INCLUDES)
adalib=$(dir $(shell $(CC) -print-libgcc-file-name))adalib
GNATLIB=$(adalib)/$(if $(wildcard $(adalib)/libgnat.a),libgnat.a,libgnat.so) $(STAGE1_LIBS)
@@ -485,6 +487,7 @@ GNAT1_C_OBJS+= \
ada/rtinit.o \
ada/seh_init.o
+ifeq ($(HOST_RT),False)
GNAT_ADA_OBJS+= \
ada/gcc-interface/system.o \
ada/libgnat/a-assert.o \
@@ -555,6 +558,7 @@ GNAT_ADA_OBJS+= \
ada/libgnat/s-wchstw.o \
ada/libgnat/s-widuns.o
endif
+endif
# Object files for gnat executables
GNAT1_ADA_OBJS = $(GNAT_ADA_OBJS) ada/back_end.o ada/gnat1drv.o
@@ -656,6 +660,9 @@ GNATBIND_OBJS += \
ada/rtfinal.o \
ada/rtinit.o \
ada/seh_init.o \
+
+ifeq ($(HOST_RT),False)
+GNATBIND_OBJS += \
ada/gcc-interface/system.o \
ada/libgnat/a-assert.o \
ada/libgnat/a-elchha.o \
@@ -707,6 +714,9 @@ GNATBIND_OBJS += \
ada/libgnat/s-wchjis.o \
ada/libgnat/s-wchstw.o \
ada/libgnat/s-widuns.o \
+
+endif
+GNATBIND_OBJS += \
ada/adaint.o \
ada/argv.o \
ada/cio.o \
diff --git a/gcc/ada/init.c b/gcc/ada/init.c
index 5212a38490d3..5ae2efd32ef3 100644
--- a/gcc/ada/init.c
+++ b/gcc/ada/init.c
@@ -93,8 +93,12 @@ extern struct Exception_Data storage_error;
#ifdef CERT
#define Raise_From_Signal_Handler __gnat_raise_exception
#else
+#if __GNUC__ < 12
+#define Raise_From_Signal_Handler ada__exceptions__raise_from_signal_handler
+#else
#define Raise_From_Signal_Handler __gnat_raise_from_signal_handler
#endif
+#endif
extern void Raise_From_Signal_Handler (struct Exception_Data *, const void *)
ATTRIBUTE_NORETURN;
--
2.39.0