Iain Sandoe <idsan...@googlemail.com> writes: > Hi Gaius, > > I’m finding it hard to figure out how the configuration is supposed to work > for cross compilers (and more so for Canadian/native crosses). > > Apologies if this is already answered in other review (but maybe some notes > would help in that case). > > questions in-line, thanks > Iain
Hi Iain, many thanks for the comments. The patch only addresses the empty directories issue. I take your point about Canadian cross compiler problems. I think there is confusion in my use of stage1, stage2, stage3 directory names which perhaps should be renamed cxxobj1, m2obj2, m2obj3. All objects in cxxobj1 are created by 'mc' and 'g++' and this would occur if the compiler is built native or in any cross configuration. The m2obj2 objects would be built from modula-2 sources using cxxobj1 and would be a developer/maintainer enabled option principally used for debugging. Finally m2obj3 is also used by developers to allow the compiler generations output to be compared (cxxobj1 vs m2obj2 vs m2obj3). This could coexist with the standard stage1, stage2, stage3 of gcc. The gcc stage check would only check cxxobj1 having been rebuilt by the relevant g++/gcc. I propose to rework the patch (renaming the directories) and ensure that Canadian cross works (currently it doesn't) - although it was tested for classic cross (build == host != target). regards, Gaius >> On 26 Dec 2022, at 14:46, Gaius Mulley via Gcc-patches >> <gcc-patches@gcc.gnu.org> wrote: >> >> >> Hello, >> >> Bootstrapped on amd64 GNU/Linux. Ok for trunk? >> >> regards, >> Gaius >> >> --- 8< --- >> >> PR-108142 Remove empty directories created in the build directory. >> >> This patch removes empty directories created in the build directory. >> Directories are only created if required and all modula-2 build output >> is created under m2. Add m2.stageprofile and m2.stagefeedback rules. >> >> gcc/m2/ChangeLog: >> >> * PR m2/108142 >> * Make-lang.in: Change build directory to m2. >> Change all rules to dynamically create subdirectories >> when required. >> (m2.stageprofile): New. >> (m2.stagefeedback): New. >> * Make-maintainer.in: Change build directory to m2. >> Change all rules to dynamically create subdirectories when >> required. >> * config-lang.in: Remove static creation of build directories. >> >> diff --git a/gcc/m2/Make-lang.in b/gcc/m2/Make-lang.in >> index a8bd7fe4d19..828eaad6285 100644 >> --- a/gcc/m2/Make-lang.in >> +++ b/gcc/m2/Make-lang.in >> @@ -27,7 +27,7 @@ GM2_CROSS_NAME = `echo gm2|sed >> '$(program_transform_cross_name)'` >> >> M2_MAINTAINER = no >> >> -GM2_1 = ./gm2 -B./stage1/m2 -g -fm2-g >> +GM2_1 = ./gm2 -B./m2/stage1 -g -fm2-g > > What does “stage1” mean in the case of a cross-compiler or a > —disable-bootstrap configure? stage1 (or the proposed newly named cxxobj1) is created when the first generation modula-2 compiler is built (using mc/g++). >> GM2_FOR_TARGET = $(STAGE_CC_WRAPPER) ./gm2 -B./ -B$(build_tooldir)/bin/ >> -L$(objdir)/../ld $(TFLAGS) >> >> @@ -61,7 +61,6 @@ m2.srcextra: m2/SYSTEM-pim.texi m2/SYSTEM-iso.texi >> m2/gm2-libs.texi m2/gm2-ebnf. >> -cp -p m2/SYSTEM-iso.texi $(srcdir)/m2 >> -cp -p m2/gm2-libs.texi $(srcdir)/m2 >> -cp -p m2/gm2-ebnf.texi $(srcdir)/m2 >> - find . -name '*.texi' -print >> else >> m2.srcextra: >> endif <snip> >> @@ -565,6 +518,7 @@ m2/gm2-gcc/m2configure.o: >> $(srcdir)/m2/gm2-gcc/m2configure.cc \ >> $(SYSTEM_H) $(GCC_H) $(CONFIG_H) \ >> m2/gm2config.h $(TARGET_H) $(PLUGIN_HEADERS) \ >> $(generated_files) $(C_TREE_H) insn-attr-common.h >> + -test -d m2/gm2-gcc || $(mkinstalldirs) m2/gm2-gcc >> $(COMPILER) $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ >> $(DRIVER_DEFINES) \ >> -DLIBSUBDIR=\"$(libsubdir)\" \ >> @@ -585,6 +539,7 @@ m2/m2pp.o : $(srcdir)/m2/m2pp.cc >> $(GCC_HEADER_DEPENDENCIES_FOR_M2) >> >> m2/gm2-gcc/rtegraph.o: $(srcdir)/m2/gm2-gcc/rtegraph.cc >> $(GCC_HEADER_DEPENDENCIES_FOR_M2) \ >> gt-m2-rtegraph.h >> + -test -d m2/gm2-gcc || $(mkinstalldirs) m2/gm2-gcc >> $(COMPILER) -c -g -I$(GM2GCC) $(ALL_COMPILERFLAGS) \ > > GM2GCC = -I$(srcdir)/m2 -Im2 -I$(srcdir)/m2/gm2-gcc -Im2/gm2-gcc ? allows g++ to pick up the mc translated definition modules in the build directory gcc/m2/gm2-gcc/G*.h. Maybe I've misunderstood the question? There is some redundancy when this macro is used within some rules (I'll reduce the paths), thanks for spotting it! > (and in two other places). > >> $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) >> >> @@ -593,6 +548,7 @@ c-family/m2pp.o : $(srcdir)/m2/m2pp.cc >> $(GCC_HEADER_DEPENDENCIES_FOR_M2) >> $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) >> <snip>