diff mbox series

m2: Fix up dependencies some more

Message ID ZysrRC2FPnxoIU7N@tucnak
State New
Headers show
Series m2: Fix up dependencies some more | expand

Commit Message

Jakub Jelinek Nov. 6, 2024, 8:39 a.m. UTC
Hi!

Every now and then my x86_64-linux bootstrap fails due to missing
dependencies somewhere in m2, usually during stage3.  I'm using
make -j32 and run 2 bootstraps concurrently (x86_64-linux and i686-linux)
on the same box.

Last night the same happened to me again,
with the first error
In file included from ./tm.h:29,
                 from ../../gcc/backend.h:28,
                 from ../../gcc/m2/gm2-gcc/gcc-consolidation.h:27,
                 from m2/gm2-compiler-boot/M2AsmUtil.c:26:
../../gcc/config/i386/i386.h:2484:10: fatal error: insn-attr-common.h: No such file or directory
 2484 | #include "insn-attr-common.h"
      |          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[3]: *** [../../gcc/m2/Make-lang.in:1576: m2/gm2-compiler-boot/M2AsmUtil.o] Error 1
make[3]: *** Waiting for unfinished jobs....

Now, gcc/Makefile.in has a general rule:
# 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)
which ensures that everything that might depend on the generated files
waits for those to be generated.
The above error clearly shows that such waiting didn't happen for
m2/gm2-compiler-boot/M2AsmUtil.o and some others.
ALL_HOST_OBJS includes $(ALL_HOST_FRONTEND_OBJS),
where the latter is
ALL_HOST_FRONTEND_OBJS = $(foreach v,$(CONFIG_LANGUAGES),$($(v)_OBJS))
m2_OBJS already includes various *.o files, for all those we wait until
the generated files are generated.  Though, seems
cc1gm2 depends on m2/stage1/cc1gm2 (which is just copied there),
and that depends on m2/gm2-compiler-boot/m2flex.o,
$(GM2_C_OBJS) and m2/gm2-gcc/rtegraph.o already included in m2_OBJS,
but also on
$(GM2_LIBS_BOOT) $(MC_LIBS)
where
MC_LIBS=m2/mc-boot-ch/Glibc.o m2/mc-boot-ch/Gmcrts.o
GM2_LIBS_BOOT     = m2/gm2-compiler-boot/gm2.a \
                    m2/gm2-libs-boot/libgm2.a \
                    $(GM2-BOOT-O)
GM2-BOOT-O isn't defined, and the 2 libraries depend on
$(BUILD-LIBS-BOOT) $(BUILD-COMPILER-BOOT)

So, the following patch adds those to m2_OBJS.

I'm not sure if something further is needed, like some objects
used to build the helper programs, mc and whatever else is needed,
I guess it depends on if they use or can use say tm.h or similar
headers which depend on the generated headers.

Anyway, bootstrapped/regtested successfully on x86_64-linux and i686-linux,
ok for trunk?  That doesn't mean all dependencies are correct, just that
this change didn't make things worse.

2024-11-06  Jakub Jelinek  <jakub@redhat.com>

gcc/m2/
	* Make-lang.in (m2_OBJS): Add $(BUILD-LIBS-BOOT),
	$(BUILD-COMPILER-BOOT) and $(MC_LIBS).



	Jakub
diff mbox series

Patch

--- gcc/m2/Make-lang.in.jj	2024-09-24 15:14:54.098162284 +0200
+++ gcc/m2/Make-lang.in	2024-11-05 23:49:33.832987242 +0100
@@ -580,7 +580,8 @@  GM2_LIBS_BOOT     = m2/gm2-compiler-boot
                     $(GM2-BOOT-O)
 
 m2_OBJS = $(GM2_C_OBJS) m2/gm2-gcc/rtegraph.o \
-	m2/gm2-compiler-boot/m2flex.o
+	m2/gm2-compiler-boot/m2flex.o \
+	$(BUILD-LIBS-BOOT) $(BUILD-COMPILER-BOOT) $(MC_LIBS)
 
 cc1gm2$(exeext): m2/stage1/cc1gm2$(exeext) $(m2.prev)
 	cp -p $< $@