diff mbox

Fix building of gengtype

Message ID 20141125082726.GP1674@tucnak.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek Nov. 25, 2014, 8:27 a.m. UTC
On Tue, Nov 25, 2014 at 12:35:09AM +0100, Jakub Jelinek wrote:
> My last 2 bootstraps failed, both because of a race while building
> host gengtype (each time different gengtype*.o).

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-11-25  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.



	Jakub

Comments

Jakub Jelinek Dec. 3, 2014, 10:45 a.m. UTC | #1
Hi!

I'd like to ping this patch to fix gcc/Makefile dependencies
for gengtype objects as well as gcc-{ar,nm,ranlib} objects.
https://gcc.gnu.org/ml/gcc-patches/2014-11/msg03092.html

	Jakub
Richard Biener Dec. 3, 2014, 10:49 a.m. UTC | #2
On Wed, Dec 3, 2014 at 11:45 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> I'd like to ping this patch to fix gcc/Makefile dependencies
> for gengtype objects as well as gcc-{ar,nm,ranlib} objects.
> https://gcc.gnu.org/ml/gcc-patches/2014-11/msg03092.html

Ok.

Thanks,
Richard.

>         Jakub
diff mbox

Patch

--- gcc/Makefile.in.jj	2014-11-25 00:06:43.122178737 +0100
+++ gcc/Makefile.in	2014-11-25 08:55:34.727300843 +0100
@@ -1509,7 +1509,8 @@  ALL_HOST_FRONTEND_OBJS = $(foreach v,$(C
 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) \
-  $(GCOV_TOOL_OBJS) lto-wrapper.o collect-utils.o
+  $(GCOV_TOOL_OBJS) $(GENGTYPE_OBJS) gcc-ar.o gcc-nm.o gcc-ranlib.o \
+  lto-wrapper.o collect-utils.o
 
 # This lists all host object files, whether they are included in this
 # compilation or not.
@@ -2484,30 +2485,31 @@  build/gengenrtl.o : gengenrtl.c $(BCONFI
 # 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		\
--- gcc/gengtype.c.jj	2014-11-21 10:17:06.135695325 +0100
+++ gcc/gengtype.c	2014-11-25 08:56:18.042523089 +0100
@@ -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 */
--- gcc/gengtype-parse.c.jj	2014-05-14 09:46:09.765372893 +0200
+++ gcc/gengtype-parse.c	2014-11-25 08:56:02.688798776 +0100
@@ -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"
--- gcc/gengtype-state.c.jj	2014-05-26 09:05:23.194152567 +0200
+++ gcc/gengtype-state.c	2014-11-25 08:56:10.978649926 +0100
@@ -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.  */
--- gcc/gengtype-lex.l.jj	2014-05-30 10:51:15.820882837 +0200
+++ gcc/gengtype-lex.l	2014-11-25 08:55:48.782048481 +0100
@@ -21,10 +21,11 @@  along with GCC; see the file COPYING3.
 %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"
 
--- gcc/errors.c.jj	2014-01-03 11:40:37.000000000 +0100
+++ gcc/errors.c	2014-11-25 08:56:49.630955898 +0100
@@ -21,10 +21,11 @@  along with GCC; see the file COPYING3.
    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"