https://gcc.gnu.org/g:29113379577b90b18458de4ec62d40ed5e342fa8

commit r13-9571-g29113379577b90b18458de4ec62d40ed5e342fa8
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Sat Nov 9 16:45:44 2024 +0100

    m2: Fix up dependencies some more
    
    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.
    
    2024-11-09  Jakub Jelinek  <ja...@redhat.com>
    
    gcc/m2/
            * Make-lang.in (m2_OBJS): Add $(BUILD-LIBS-BOOT),
            $(BUILD-COMPILER-BOOT) and $(MC_LIBS).
    
    (cherry picked from commit 44682fbead3bba7345e0a575a8a680d10e75ae48)

Diff:
---
 gcc/m2/Make-lang.in | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/m2/Make-lang.in b/gcc/m2/Make-lang.in
index 0ae3e1839770..c8916d24bda4 100644
--- a/gcc/m2/Make-lang.in
+++ b/gcc/m2/Make-lang.in
@@ -534,7 +534,8 @@ GM2_LIBS_BOOT     = m2/gm2-compiler-boot/gm2.a \
                     $(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 $< $@

Reply via email to