treewide: Move device_tree to commonlib
[coreboot2.git] / util / crossgcc / patches / gcc-14.1.0_gnat.patch
blob2a37b155c42b8ea774b3e3920548fcc01910d1d4
1 From b1b16478729aea709e7ef81224995b6d26b38a87 Mon Sep 17 00:00:00 2001
2 From: Nico Huber <nico.h@gmx.de>
3 Date: Sun, 16 Jul 2023 00:30:03 +0200
4 Subject: [PATCH] GNAT: Build cross compilers with host runtime
6 When building with an older host toolchain, the shipped libgnat
7 sources may not be compatible. So rely on the host runtime just
8 like we do for a stage1 build.
10 Signed-off-by: Nico Huber <nico.h@gmx.de>
11 ---
12 gcc/ada/gcc-interface/Make-lang.in | 16 +++++++++++++---
13 gcc/ada/init.c | 4 ++++
14 2 files changed, 17 insertions(+), 3 deletions(-)
16 diff --git a/gcc/ada/gcc-interface/Make-lang.in b/gcc/ada/gcc-interface/Make-lang.in
17 index 9507f2f09203..cf7ec4cc1662 100644
18 --- a/gcc/ada/gcc-interface/Make-lang.in
19 +++ b/gcc/ada/gcc-interface/Make-lang.in
20 @@ -57,18 +57,21 @@ WARN_ADAFLAGS= -W -Wall
21 # checks fully active.
23 STAGE1=False
24 +HOST_RT=False
25 GNATBIND_FLAGS=
26 GNATLIB=
28 +ADAFLAGS=$(COMMON_ADAFLAGS) -gnatwns
29 ifeq ($(CROSS),)
30 - ADAFLAGS=$(COMMON_ADAFLAGS) -gnatwns
32 ifeq ($(if $(wildcard ../stage_current),$(shell cat ../stage_current),stage1),stage1)
33 STAGE1=True
34 GNATBIND_FLAGS=-t
35 + HOST_RT=True
36 endif
37 else
38 - ADAFLAGS=$(COMMON_ADAFLAGS)
39 + GNATBIND_FLAGS=-t
40 + HOST_RT=True
41 endif
43 ALL_ADAFLAGS = \
44 @@ -87,7 +89,7 @@ ifeq ($(strip $(filter-out hpux%,$(host_os))),)
45 STAGE1_LIBS=/usr/lib/libcl.a
46 endif
48 -ifeq ($(STAGE1),True)
49 +ifeq ($(HOST_RT),True)
50 ADA_INCLUDES=$(COMMON_ADA_INCLUDES)
51 adalib=$(dir $(shell $(CC) -print-libgcc-file-name))adalib
52 GNATLIB=$(adalib)/$(if $(wildcard $(adalib)/libgnat.a),libgnat.a,libgnat.so) $(STAGE1_LIBS)
53 @@ -485,6 +487,7 @@ GNAT1_C_OBJS+= \
54 ada/rtinit.o \
55 ada/seh_init.o
57 +ifeq ($(HOST_RT),False)
58 GNAT_ADA_OBJS+= \
59 ada/gcc-interface/system.o \
60 ada/libgnat/a-assert.o \
61 @@ -555,6 +558,7 @@ GNAT_ADA_OBJS+= \
62 ada/libgnat/s-wchstw.o \
63 ada/libgnat/s-widuns.o
64 endif
65 +endif
67 # Object files for gnat executables
68 GNAT1_ADA_OBJS = $(GNAT_ADA_OBJS) ada/back_end.o ada/gnat1drv.o
69 @@ -656,6 +660,9 @@ GNATBIND_OBJS += \
70 ada/rtfinal.o \
71 ada/rtinit.o \
72 ada/seh_init.o \
74 +ifeq ($(HOST_RT),False)
75 +GNATBIND_OBJS += \
76 ada/gcc-interface/system.o \
77 ada/libgnat/a-assert.o \
78 ada/libgnat/a-elchha.o \
79 @@ -707,6 +714,9 @@ GNATBIND_OBJS += \
80 ada/libgnat/s-wchjis.o \
81 ada/libgnat/s-wchstw.o \
82 ada/libgnat/s-widuns.o \
84 +endif
85 +GNATBIND_OBJS += \
86 ada/adaint.o \
87 ada/argv.o \
88 ada/cio.o \
89 diff --git a/gcc/ada/init.c b/gcc/ada/init.c
90 index 5212a38490d3..5ae2efd32ef3 100644
91 --- a/gcc/ada/init.c
92 +++ b/gcc/ada/init.c
93 @@ -93,8 +93,12 @@ extern struct Exception_Data storage_error;
94 #ifdef CERT
95 #define Raise_From_Signal_Handler __gnat_raise_exception
96 #else
97 +#if __GNUC__ < 12
98 +#define Raise_From_Signal_Handler ada__exceptions__raise_from_signal_handler
99 +#else
100 #define Raise_From_Signal_Handler __gnat_raise_from_signal_handler
101 #endif
102 +#endif
104 extern void Raise_From_Signal_Handler (struct Exception_Data *, const void *)
105 ATTRIBUTE_NORETURN;
107 2.39.0