On 6/18/21 12:26 AM, Gaius Mulley wrote:
> 
> 
> Hello Richard, David, Matthias and GCC Steering Committee,
> 
> here are a set of patches which merge the gm2 front end into the
> GCC tree.  The patches have been bootstrapped under aarch64 GNU/Linux
> Debian Stretch using make -j 4, x86_64 GNU/Linux Debian Stretch built
> using make -j 24 and also under x86_64 GNU/Linux Debian Buster using
> make -j 4.
> 
> Tested on Debian Stretch x86_64
> ===============================
> 
> built GCC bootstrap 3 times:
> 
> 1.  built vanilla GCC (enabling bootstrap) enabling front ends:
>     c,c++,go,d,fortran and ran the regression tests.  (make -j 4).
> 
> 2.  the patches below were applied and associated tarball untarred.
>     The same front ends c,c++,go,d,fortran (again building from
>     bootstrap) were enabled (no m2) and ran the regression tests.
>     There were no changes to the regression test results between 1 and
>     2.
> 
> 3.  Then it was rebuilt (from bootstrap) enabling the front ends
>     c,c++,go,d,fortran,m2 and ran the
>     regression tests and again no extra failures were seen.
> 
> 4.  It has been built in source tree (./configure --enable-languages=m2)
>     and out of source tree with make -j 24.
> 
> Built on Debian Buster x86_64
> =============================
> 
> 1.  built vanilla GCC (enabling bootstrap) enabling front ends:
>     c,c++,go,d,fortran and ran the regression tests.
> 
> 2.  the patches below were applied and associated tarball untarred.
>     The same front ends c,c++,go,d,fortran (again building from
>     bootstrap) were enabled (no m2) and ran the regression tests.
>     There were no changes to the regression test results between 1 and
>     2.
> 
> 3.  Then it was rebuilt (from bootstrap) enabling the front ends
>     c,c++,go,d,fortran,m2 and ran the
>     regression tests and again no extra failures were seen.
> 
> Built a patched tree enabling bootstrap make -j 4 for front ends
> c,c++,m2 all compiled and bootstrapped.

I checked that with a profiled lto build.  The build succeeds with the attached
patch to respect the parallel linking limitations, which you can configure with
--enable-link-serialization=N

However the build fails in the installation step with:

[...]
Linking stage1/m2/cc1gm2 |>>>>>>>>>>>>>>>>--    | 0%
x86_64-linux-gnu-g++-10 -std=c++11 -no-pie   -g -O2 -DIN_GCC    -W -Wall
-Wno-narrowing -Wwrite-strings -Wcast-q
ual -Wno-error=format-diag -Wstrict-prototypes -Wmissing-prototypes
-Wno-error=format-diag  -Wold-style-definition -Wc++-compat -
fno-common  -DHAVE_CONFIG_H  -o stage1/m2/cc1gm2 m2/gm2-lang.o m2/stor-layout.o
m2/m2pp.o m2/gm2-gcc/m2assert.o m2/gm2-gcc/m2block.o m2/gm2-gcc/m2builtins.o
m2/gm2-gcc/m2except.o m2/gm2-gcc/m2convert.o m2/gm2-gcc/m2color.o
m2/gm2-gcc/m2decl.o m2/gm2-gcc/m2expr.o m2/gm2-gcc/m2linemap.o
m2/gm2-gcc/m2statement.o m2/gm2-gcc/m2type.o m2/gm2-gcc/m2tree.o
m2/gm2-gcc/m2treelib.o m2/gm2-gcc/m2top.o m2/gm2-gcc/m2misc.o m2/gm2-gcc/init.o
m2/gm2-compiler-boot/m2flex.o \
                            attribs.o \
                             m2/gm2-compiler-boot/gm2.a
m2/gm2-libs-boot/libgm2.a m2/mc-boot-ch/Glibc.o m2/mc-boot-ch/Gmcrts.o
m2/gm2-gcc/rtegraph.o \
                             libbackend.a main.o libcommon-target.a libcommon.a
../libcpp/libcpp.a ../libdecnumber/libdecnumber.a libcommon.a ../libcpp/libcpp.a
  ../libbacktrace/.libs/libbacktrace.a ../libiberty/libiberty.a
../libdecnumber/libdecnumber.a  -lisl -lmpc -lmpfr -lgmp -rdynamic -ldl  -lz 
-lzstd
lto1: fatal error: bytecode stream in file 'm2/gm2-compiler-boot/m2flex.o'
generated with LTO version 12.0 instead of the expected 9.2
compilation terminated.
lto-wrapper: fatal error: x86_64-linux-gnu-g++-10 returned 1 exit status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
Command exited with non-zero status 1

x86_64-linux-gnu-g++-10 is the compiler used for the bootstrap.  I haven't
checked if that is also seen for a normal bootstrap. Apparently it tries to
re-bootstrap the compiler.

The build is configured with --with-build-config=bootstrap-lto-lean, built with
make profiledbootstrap-lean


Matthias



2021-06-18  Matthias Klose  <d...@ubuntu.com>

	* Make-lang.in (m2.serial): New target.
	(cc1gm2): Depend on $(m2.prev).
	(stageN/m2/cc1gm2): Call LLINKER, also call LINK_PROGRESS.

--- a/gcc/m2/Make-lang.in
+++ b/gcc/m2/Make-lang.in
@@ -82,6 +82,7 @@ TEXISRC = $(objdir)/m2/images/gnu.eps \
 # Define the names for selecting GNU Modula-2 in LANGUAGES.
 m2 modula-2 modula2: gm2$(exeext) xgcc$(exeext) cc1gm2$(exeext) \
                  $(GCC_TOOLS_FOR_GM2)
+m2.serial = cc1gm2$(exeext)
 
 # Tell GNU make to ignore these if they exist.
 .PHONY: m2 modula-2 modula2
@@ -530,7 +531,7 @@ GM2_LIBS_PARANOID = m2/gm2-compiler-para
 
 gm2.paranoid: stage3/m2/cc1gm2$(exeext) gm2.verifyparanoid
 
-cc1gm2$(exeext): stage1/m2/cc1gm2$(exeext)
+cc1gm2$(exeext): stage1/m2/cc1gm2$(exeext) $(m2.prev)
 	cp -p $< $@
 
 gm2lcc$(exeext): stage1/m2/gm2lcc$(exeext)
@@ -551,29 +552,35 @@ gm2m$(exeext): stage1/m2/gm2m$(exeext)
 stage3/m2/cc1gm2$(exeext): stage2/m2/cc1gm2$(exeext) m2/gm2-compiler-paranoid/m2flex.o \
                             $(P) $(GM2_C_OBJS) $(BACKEND) $(LIBDEPS) $(GM2_LIBS_PARANOID) \
                             m2/gm2-gcc/rtegraph.o plugin/m2rte$(exeext).so
-	$(LINKER) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(GM2_C_OBJS) m2/gm2-compiler-paranoid/m2flex.o \
+	@$(call LINK_PROGRESS,$(INDEX.m2),start)
+	+$(LLINKER) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(GM2_C_OBJS) m2/gm2-compiler-paranoid/m2flex.o \
                             attribs.o \
                               $(GM2_LIBS_PARANOID) \
                               $(BACKEND) $(LIBS) m2/gm2-gcc/rtegraph.o \
                               $(BACKENDLIBS) $(LIBSTDCXX) -lm
+	@$(call LINK_PROGRESS,$(INDEX.m2),end)
 
 stage2/m2/cc1gm2$(exeext): stage1/m2/cc1gm2$(exeext) m2/gm2-compiler/m2flex.o $(P) \
                             $(GM2_C_OBJS) $(BACKEND) $(LIBDEPS) $(GM2_LIBS) \
                             m2/gm2-gcc/rtegraph.o plugin/m2rte$(exeext).so
-	$(LINKER) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(GM2_C_OBJS) m2/gm2-compiler/m2flex.o \
+	@$(call LINK_PROGRESS,$(INDEX.m2),start)
+	+$(LLINKER) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(GM2_C_OBJS) m2/gm2-compiler/m2flex.o \
                             attribs.o \
                               $(GM2_LIBS) \
                               $(BACKEND) $(LIBS) m2/gm2-gcc/rtegraph.o \
                               $(BACKENDLIBS) $(LIBSTDCXX) -lm
+	@$(call LINK_PROGRESS,$(INDEX.m2),end)
 
 stage1/m2/cc1gm2$(exeext): gm2$(exeext) m2/gm2-compiler-boot/m2flex.o \
                             $(P) $(GM2_C_OBJS) $(BACKEND) $(LIBDEPS) \
                             $(GM2_LIBS_BOOT) $(MC_LIBS) \
-                            m2/gm2-gcc/rtegraph.o plugin/m2rte$(exeext).so
-	$(LINKER) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(GM2_C_OBJS) m2/gm2-compiler-boot/m2flex.o \
+                            m2/gm2-gcc/rtegraph.o plugin/m2rte$(exeext).so $(m2.prev)
+	@$(call LINK_PROGRESS,$(INDEX.m2),start)
+	+$(LLINKER) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(GM2_C_OBJS) m2/gm2-compiler-boot/m2flex.o \
                             attribs.o \
                              $(GM2_LIBS_BOOT) $(MC_LIBS) m2/gm2-gcc/rtegraph.o \
                              $(BACKEND) $(LIBS) $(BACKENDLIBS)
+	@$(call LINK_PROGRESS,$(INDEX.m2),end)
 
 # Compiling object files from source files.
 

Reply via email to