1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
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
|