aboutsummaryrefslogtreecommitdiff
blob: c4e6d9bd21e17d556eecd7532fccb9cffa1ac8d7 (plain)
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
https://gcc.gnu.org/ml/gcc-patches/2014-11/msg03092.html
https://gcc.gnu.org/PR57125
https://gcc.gnu.org/PR61899
https://bugs.gentoo.org/463796
https://bugs.gentoo.org/487398
https://bugs.gentoo.org/545010

fix parallel build issues around config.h/bconfig.h inclusion

note: this also includes:
commit ea38f4be892b22b61a540a102bed374ddb381b9a
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@202894 138bc75d-0d04-0410-961f-82ee72b054a4
which adds to-wrapper.o to ALL_HOST_BACKEND_OBJS

note: this also includes a small change to the flex command:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57125#c9

From ed89620f0e3de714864805f5d29dbab0341a1746 Mon Sep 17 00:00:00 2001
From: jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Wed, 3 Dec 2014 16:44:27 +0000
Subject: [PATCH] Fix building of gengtype

Found bootstrap failures even with this patch (dunno what changed on my box
that I started getting these last night, make has not changed), that time
with errors.o and gcc-ar.o.
The generated headers are solved these days in automatic dependencies world
through
# In order for parallel make to really start compiling the expensive
# objects from $(OBJS) as early as possible, build all their
# prerequisites strictly before all objects.
$(ALL_HOST_OBJS) : | $(generated_files)
and build/*.o have explicit dependencies.
I've tried to compare $(ALL_HOST_OBJS) on my box with all *.o */*.o files
I had in stage3 directory, and besides build/*.o, I found:

crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o crtfastmath.o crtprec32.o crtprec64.o crtprec80.o
errors.o gcc-ar.o gcc-nm.o gcc-ranlib.o gengtype-lex.o gengtype.o gengtype-parse.o gengtype-state.o

not being listed in ALL_HOST_OBJS.  The crt*.o files come from libgcc build
and thus are ok, the rest I've tried to handle in the following updated
patch.  If the #define GENERATOR_FILE inside of the 5 files is too ugly,
another alternative might be to define both -DHOST_GENERATOR_FILE -DGENERATOR_FILE
in Makefile.in and don't error in config.h if GENERATOR_FILE is defined,
if HOST_GENERATOR_FILE is also defined.

2014-12-03  Jakub Jelinek  <jakub@redhat.com>

	* Makefile.in (ALL_HOST_BACKEND_OBJS): Add $(GENGTYPE_OBJS),
	gcc-ar.o, gcc-nm.o and gcc-ranlib.o.
	(GENGTYPE_OBJS): New.
	(gengtype-lex.o, gengtype-parse.o, gengtype-state.o, gengtype.o):
	Remove explicit dependencies.
	(CFLAGS-gengtype-lex.o, CFLAGS-gengtype-parse.o,
	CFLAGS-gengtype-state.o, CFLAGS-gengtype.o): Add -DHOST_GENERATOR_FILE
	instead of -DGENERATOR_FILE.
	(CFLAGS-errors.o): New.
	* gengtype.c: Instead of testing GENERATOR_FILE define, test
	HOST_GENERATOR_FILE.  If defined, include config.h and define
	GENERATOR_FILE afterwards, otherwise include bconfig.h.
	* gengtype-parse.c: Likewise.
	* gengtype-state.c: Likewise.
	* gengtype-lex.l: Likewise.
	* errors.c: Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@218325 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog        | 75 ++++++++++++++++++++++++++++++++--------------------
 gcc/Makefile.in      | 20 +++++++-------
 gcc/errors.c         |  7 ++---
 gcc/gengtype-lex.l   |  7 ++---
 gcc/gengtype-parse.c |  7 ++---
 gcc/gengtype-state.c |  7 ++---
 gcc/gengtype.c       |  7 ++---
 7 files changed, 77 insertions(+), 53 deletions(-)

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 204bd85..3820d0b 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -1509,6 +1509,7 @@ ALL_HOST_FRONTEND_OBJS = $(foreach v,$(CONFIG_LANGUAGES),$($(v)_OBJS))
 ALL_HOST_BACKEND_OBJS = $(GCC_OBJS) $(OBJS) $(OBJS-libcommon) \
   $(OBJS-libcommon-target) @TREEBROWSER@ main.o c-family/cppspec.o \
-  $(COLLECT2_OBJS) $(EXTRA_GCC_OBJS) $(GCOV_OBJS) $(GCOV_DUMP_OBJS)
+  $(COLLECT2_OBJS) $(EXTRA_GCC_OBJS) $(GCOV_OBJS) $(GCOV_DUMP_OBJS) \
+  lto-wrapper.o $(GENGTYPE_OBJS) gcc-ar.o gcc-nm.o gcc-ranlib.o
 
 # This lists all host object files, whether they are included in this
 # compilation or not.
@@ -2484,31 +2485,32 @@ build/gengenrtl.o : gengenrtl.c $(BCONFIG_H) $(SYSTEM_H) rtl.def
 # on BCONFIG_H.  For the build objects, add -DGENERATOR_FILE manually,
 # the build-%: rule doesn't apply to them.
 
+GENGTYPE_OBJS = gengtype.o gengtype-parse.o gengtype-state.o \
+  gengtype-lex.o errors.o
+
 gengtype-lex.o build/gengtype-lex.o : gengtype-lex.c gengtype.h $(SYSTEM_H)
-gengtype-lex.o: $(CONFIG_H) $(BCONFIG_H)
-CFLAGS-gengtype-lex.o += -DGENERATOR_FILE
+CFLAGS-gengtype-lex.o += -DHOST_GENERATOR_FILE
 build/gengtype-lex.o: $(BCONFIG_H)
 
 gengtype-parse.o build/gengtype-parse.o : gengtype-parse.c gengtype.h \
   $(SYSTEM_H)
-gengtype-parse.o: $(CONFIG_H)
-CFLAGS-gengtype-parse.o += -DGENERATOR_FILE
+CFLAGS-gengtype-parse.o += -DHOST_GENERATOR_FILE
 build/gengtype-parse.o: $(BCONFIG_H)
 
 gengtype-state.o build/gengtype-state.o: gengtype-state.c $(SYSTEM_H) \
   gengtype.h errors.h double-int.h version.h $(HASHTAB_H) $(OBSTACK_H) \
   $(XREGEX_H)
-gengtype-state.o: $(CONFIG_H)
-CFLAGS-gengtype-state.o += -DGENERATOR_FILE
+CFLAGS-gengtype-state.o += -DHOST_GENERATOR_FILE
 build/gengtype-state.o: $(BCONFIG_H)
 
 gengtype.o build/gengtype.o : gengtype.c $(SYSTEM_H) gengtype.h 	\
   rtl.def insn-notes.def errors.h double-int.h version.h $(HASHTAB_H) \
   $(OBSTACK_H) $(XREGEX_H)
-gengtype.o: $(CONFIG_H)
-CFLAGS-gengtype.o += -DGENERATOR_FILE
+CFLAGS-gengtype.o += -DHOST_GENERATOR_FILE
 build/gengtype.o: $(BCONFIG_H)
 
+CFLAGS-errors.o += -DHOST_GENERATOR_FILE
+
 build/genmddeps.o: genmddeps.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h	\
   errors.h $(READ_MD_H)
 build/genmodes.o : genmodes.c $(BCONFIG_H) $(SYSTEM_H) errors.h		\
@@ -2623,11 +2623,7 @@
 # bconfig.h because AIX requires _LARGE_FILES to be defined before
 # any system header is included.
 gengtype-lex.c : gengtype-lex.l
-	-$(FLEX) $(FLEXFLAGS) -o$@ $< && { \
-	  echo '#include "bconfig.h"' > $@.tmp; \
-	  cat $@ >> $@.tmp; \
-	  mv $@.tmp $@; \
-	}
+	$(FLEX) $(FLEXFLAGS) -o$@ $<
 
 #
 # Remake internationalization support.
diff --git a/gcc/errors.c b/gcc/errors.c
index be38b1f..a6a30fe 100644
--- a/gcc/errors.c
+++ b/gcc/errors.c
@@ -21,10 +21,11 @@ along with GCC; see the file COPYING3.  If not see
    in the generator programs; the compiler has a more elaborate suite
    of diagnostic printers, found in diagnostic.c.  */
 
-#ifdef GENERATOR_FILE
-#include "bconfig.h"
-#else
+#ifdef HOST_GENERATOR_FILE
 #include "config.h"
+#define GENERATOR_FILE 1
+#else
+#include "bconfig.h"
 #endif
 #include "system.h"
 #include "errors.h"
diff --git a/gcc/gengtype-lex.l b/gcc/gengtype-lex.l
index 5e12885..0866603 100644
--- a/gcc/gengtype-lex.l
+++ b/gcc/gengtype-lex.l
@@ -21,10 +21,11 @@ along with GCC; see the file COPYING3.  If not see
 %option noinput
 
 %{
-#ifdef GENERATOR_FILE
-#include "bconfig.h"
-#else
+#ifdef HOST_GENERATOR_FILE
 #include "config.h"
+#define GENERATOR_FILE 1
+#else
+#include "bconfig.h"
 #endif
 #include "system.h"
 
diff --git a/gcc/gengtype-parse.c b/gcc/gengtype-parse.c
index 0f11cec..87b6917 100644
--- a/gcc/gengtype-parse.c
+++ b/gcc/gengtype-parse.c
@@ -17,10 +17,11 @@
    along with GCC; see the file COPYING3.  If not see
    <http://www.gnu.org/licenses/>.  */
 
-#ifdef GENERATOR_FILE
-#include "bconfig.h"
-#else
+#ifdef HOST_GENERATOR_FILE
 #include "config.h"
+#define GENERATOR_FILE 1
+#else
+#include "bconfig.h"
 #endif
 #include "system.h"
 #include "gengtype.h"
diff --git a/gcc/gengtype-state.c b/gcc/gengtype-state.c
index 5b7017f..7634f74 100644
--- a/gcc/gengtype-state.c
+++ b/gcc/gengtype-state.c
@@ -23,10 +23,11 @@
    and Basile Starynkevitch <basile@starynkevitch.net>
 */
 
-#ifdef GENERATOR_FILE
-#include "bconfig.h"
-#else
+#ifdef HOST_GENERATOR_FILE
 #include "config.h"
+#define GENERATOR_FILE 1
+#else
+#include "bconfig.h"
 #endif
 #include "system.h"
 #include "errors.h"	/* For fatal.  */
diff --git a/gcc/gengtype.c b/gcc/gengtype.c
index 2dc857e..39d2918 100644
--- a/gcc/gengtype.c
+++ b/gcc/gengtype.c
@@ -17,10 +17,11 @@
    along with GCC; see the file COPYING3.  If not see
    <http://www.gnu.org/licenses/>.  */
 
-#ifdef GENERATOR_FILE
-#include "bconfig.h"
-#else
+#ifdef HOST_GENERATOR_FILE
 #include "config.h"
+#define GENERATOR_FILE 1
+#else
+#include "bconfig.h"
 #endif
 #include "system.h"
 #include "errors.h"		/* for fatal */
-- 
2.3.4