diff mbox series

Modula-2 into the GCC tree on master

Message ID 87eed0nn4u.fsf@j228-gm.comp.glam.ac.uk
State New
Headers show
Series Modula-2 into the GCC tree on master | expand

Commit Message

Gaius Mulley June 17, 2021, 10:26 p.m. UTC
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.

How to merge
============

1.  apply patches below to the master GCC tree.

2.  cd gcc-git-top

wget http://floppsie.comp.glam.ac.uk/download/c/gm2-front-end-20210617-tar.gz

    tar zxf gm2-front-end-20210617-tar.gz
    rm gm2-front-end-20210617-tar.gz
    # new directories gm2tools, libgm2, gcc/m2, gcc/testsuite/gm2 are created
    # and populated.  Documentation in gcc/doc and testsuite/lib contains some
    # Modula-2 dejagnu scripts.

3.  cd gcc-git-top
    autogen Makefile.def
    autoconf
    cd libgm2
    /bin/sh ./autogen.sh
    cd ../gm2tools
    /bin/sh ./autogen.sh

Thank you Richard for the extensive feedback from the last time the
patches were posted.  I've gone though your points and addressed them
(I think).

> It looks like libgm2 is built independently on whether m2 is enabled
> or not?  I'd like to see a while-listing of supported targets like
> done for example for libgomp via configure.tgt or for libgo (see
> toplevel configure).

I've added a test in libgm2/configure.ac to restict the building of
libgm2 - or to restrict it to building libm2min which is a near zero
runtime library.  It restricts on host and target and can easily be
changed.

> The driver changes have been posted and reviewed previously but I
> didn't see any real OK there but motivational questions - they never
> were posted together with the m2 driver portion (I guess that would
> be gcc/m2/gm2spec.c in the tarball).

yes gcc/m2/gm2spec.c.

> I've not seen reviews or postings (besides as tarball) of the
> frontend or the library (but I don't remember seeing extensive
> reviews of other languages frontends or runtime portions at the
> point of their inclusion - still the glueing to the middle-end
> should get the chance to be reviewed).

the glue code is in m2/gm2-gcc/*.[ch].  The filenames adopt a similar
naming scheme to other front ends: m2/gm2-gcc/m2decl.c for
declarations, m2/gm2-gcc/m2expr.c for expressions etc.  The exported
names are prefixed by the module name so that the code can be linked
against the Modula-2 version with an appropriate definition module
(for example m2/gm2-gcc/m2expr.def).

> I've tried to find my way through gcc/m2 but am quite lost in the
> number of subdirectories.

I've added a README in each directory giving an overview of the
contents.

> I do see in gm2-lang.c and elsewhere inclusion of system headers
> outside of system.h which is going to be a portability problem.

I've changed nearly all headers to use "config.h", "system.h" and
friends and modified the bootstrap tool to automatically generate
these gcc header includes.

> From the parse_file langhook we eventually dispatch to
> init_PerCompilationInit which looks like a Modula-2 scaffolding
> file?

yes indeed.

> Is the compiler written in Modula-2?  It's not clear what
> parts make up the interface to the GCC middle-end.

yes most of the compiler and libraries are written in Modula-2 there
is some interface code written in C/C++.  In particular, for the
compiler, the directory m2/gm2-gcc contains all the tree creation code.
m2/gm2-libs-ch is the small amount of C required to interface to the
host operating system.  The bootstrap tool (m2/mc) is written in
Modula-2 and within the tree there is a C translation of mc for
bootstrapping purposes (m2/mc-boot).  Given a small amount of time
this can easily be altered to C++ if desired.  mc will generate C++ or
C and when translating the gm2 sources it produces C++ equivalents.

> I'm missing a patch for gcc/doc/install.texi which should list
> requirements plus a patch to sourcebuild.texi listing the new
> toplevel dirs (at least).

all done now.  The documentation is now in gcc/doc/m2.texi and the
patches add information about m2 the two files (gcc/doc/sourcebuild.texi
and gcc/doc/install.texi).

> We don't usally ship "examples" in the GCC source tree,

ok - I've purged the examples and added some of these examples to the
regression testsuite instead.

> there's a gm2-tools directory which name suggests those are host
> tools which should usually reside in the toplevel.

I've now created a gm2tools directory in the top which will only be
configured if m2 is enabled.

> There's copies of gpl and gpl-3.0.texi files in m2/ but I think all
> .texi stuff (even language specific) should be in gcc/doc/ and not
> the lang specific subdirectory.

ok removed these.

> I've just tried following the merge instructions and a build on SUSE
> Leap 15.2 produces a toplevel m2/ and stage{1,2,3,4} directories
> (empty?!) which hints at some bootstrapping magic taking place?  In
> the end the build fails like the following in stage2

> [...]

> I've just done ./configure --enable-languages=m2; make -j24

now fixed apologies.

> I would suggest to not rush this in now during stage4 but instead
> take the opportunity of this "quiet" phase to prepare an integration
> branch with all the issues above sorted out which we can merge at
> the beginning of stage1 for GCC 12 (or later during stage4 if
> everyone is happy and/or backport for GCC 11.2 when it landed in
> trunk).

I'm guessing my priorities are:

   to keep polishing the code.
   fix reported bugs.
   backport to 11.x
   (happy to adjust these if necessary).

thereafter I've got some analyzer patches (which are not posted here)
but which are a whole load of fun and I would like to see these in the
tree at some sensible time.  Longer term I'd like to revisit the SET
type and get this to work with dwarf5/gdb and re-implement the large
set data type.  Other ideas can wait for the moment though.  But in
the meantime I hope this is useful - enjoy.

regards,
Gaius

[ these patches can also be found on:

  http://git.savannah.gnu.org/cgit/gm2.git/tree/gcc-versionno/
  and also in the tarball above at: gcc/m2/patches/gcc/trunk
]

They are also available at:

  http://floppsie.comp.glam.ac.uk/download/c/gcc-patches-trunk-20210617-tar.gz

just in case anything below gets mangled.


2021-06-17  Gaius Mulley   <gaius.mulley@southwales.ac.uk>

* Makefile.def (host_modules) includes gm2tools.
(target_modules): Includes libgm2.
(GM2_FOR_TARGET): Added.
(GM2FLAGS_FOR_TARGET): Added.
(dependencies): all-gm2tools on all-target-libgm2.
(dependencies): configure-target-libgm2 on all-target-libstdc++-v3.
(dependencies): all-target-libgm2 on all-target-libatomic.
(languages): m2 define gcc-check-target as check-m2,
define lib-check-target as check-target-libgm2 and
lib-check-target as check-gm2tools.
* Makefile.tpl: Assign GM2,
GM2_FOR_BUILD, GM2_FOR_TARGET and GM2FLAGS.
Pass variables to make.
* configure.ac (GM2_FOR_TARGET): Added.
Request build driver program gm2.
(libgm2) option added.
(GCC_TARGET_TOOL): define gm2 and how it is invoked.
(compare_exclusions) includes SYSTEM and M2Version.

gcc/

* doc/install.texi (m2): Add Modula-2 as a recognized front end
language.  (--disable-libgm2) Add entry.  (check-m2) Add reference
to run the Modula-2 regression tests.
* doc/sourcebuild.texi (gm2tools): Added top level directory additions.
(libgm2) Added top level directory entry.  (m2) Added reference for
a new language subdirectory.
* gcc/c-family/cppspec.c (lang_register_spec_functions): Added.
* gcc/c/gccspec.c (lang_register_spec_functions): Added.
* gcc/cp/g++spec.c (lang_register_spec_functions): Added.
* gcc/d/d-spec.cc (lang_register_spec_functions): Added.
* gcc/fortran/gfortranspec.c (lang_register_spec_functions): Added.
* gcc/gcc.c (allow_linker): Global variable to disable
linker by the front end.  (xputenv) available externally.
(xgetenv) New function.  (save_switch) available externally.
(fe_add_linker_option) New function.  (handle_OPT_B) New function.
(fe_add_infile) New function.  (fe_mark_compiled) New function.
(driver_handle_option) call handle_OPT_B.  (print_option) New
function.  (print_options) New function.  (dbg_options) New function.
(fe_add_spec_function) New function.  (lookup_spec_function)
checks front end registered functions.
(driver::set_up_specs):  call lang_register_spec_functions.
(maybe_run_linker): Check allow_linker before running the linker.
* gcc/gcc.h (fe_save_switch): Prototype.
(handle_OPT_B) Prototype.  (fe_add_infile) Prototype.
(fe_add_linker_option) Prototype.  (fe_add_spec_function) Prototype.
(xputenv) Prototype.  (xgetenv) Prototype.  (print_options) Prototype.
(print_option) Prototype.  (dbg_options) Prototype.
(lang_register_spec_functions) Prototype.
(allow_linker): Extern.
* gcc/go/gospec.c (lang_register_spec_functions): Added.

Patches
=======




regards,
Gaius

Comments

Matthias Klose June 18, 2021, 10:19 a.m. UTC | #1
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
Richard Biener June 18, 2021, 10:52 a.m. UTC | #2
On Thu, 17 Jun 2021, 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.
> 
> How to merge
> ============
> 
> 1.  apply patches below to the master GCC tree.
> 
> 2.  cd gcc-git-top
> 
> wget http://floppsie.comp.glam.ac.uk/download/c/gm2-front-end-20210617-tar.gz
> 
>     tar zxf gm2-front-end-20210617-tar.gz
>     rm gm2-front-end-20210617-tar.gz
>     # new directories gm2tools, libgm2, gcc/m2, gcc/testsuite/gm2 are created
>     # and populated.  Documentation in gcc/doc and testsuite/lib contains some
>     # Modula-2 dejagnu scripts.
> 
> 3.  cd gcc-git-top
>     autogen Makefile.def
>     autoconf
>     cd libgm2
>     /bin/sh ./autogen.sh
>     cd ../gm2tools
>     /bin/sh ./autogen.sh
> 
> Thank you Richard for the extensive feedback from the last time the
> patches were posted.  I've gone though your points and addressed them
> (I think).
> 
> > It looks like libgm2 is built independently on whether m2 is enabled
> > or not?  I'd like to see a while-listing of supported targets like
> > done for example for libgomp via configure.tgt or for libgo (see
> > toplevel configure).
> 
> I've added a test in libgm2/configure.ac to restict the building of
> libgm2 - or to restrict it to building libm2min which is a near zero
> runtime library.  It restricts on host and target and can easily be
> changed.
> 
> > The driver changes have been posted and reviewed previously but I
> > didn't see any real OK there but motivational questions - they never
> > were posted together with the m2 driver portion (I guess that would
> > be gcc/m2/gm2spec.c in the tarball).
> 
> yes gcc/m2/gm2spec.c.
> 
> > I've not seen reviews or postings (besides as tarball) of the
> > frontend or the library (but I don't remember seeing extensive
> > reviews of other languages frontends or runtime portions at the
> > point of their inclusion - still the glueing to the middle-end
> > should get the chance to be reviewed).
> 
> the glue code is in m2/gm2-gcc/*.[ch].  The filenames adopt a similar
> naming scheme to other front ends: m2/gm2-gcc/m2decl.c for
> declarations, m2/gm2-gcc/m2expr.c for expressions etc.  The exported
> names are prefixed by the module name so that the code can be linked
> against the Modula-2 version with an appropriate definition module
> (for example m2/gm2-gcc/m2expr.def).
> 
> > I've tried to find my way through gcc/m2 but am quite lost in the
> > number of subdirectories.
> 
> I've added a README in each directory giving an overview of the
> contents.
> 
> > I do see in gm2-lang.c and elsewhere inclusion of system headers
> > outside of system.h which is going to be a portability problem.
> 
> I've changed nearly all headers to use "config.h", "system.h" and
> friends and modified the bootstrap tool to automatically generate
> these gcc header includes.
> 
> > From the parse_file langhook we eventually dispatch to
> > init_PerCompilationInit which looks like a Modula-2 scaffolding
> > file?
> 
> yes indeed.
> 
> > Is the compiler written in Modula-2?  It's not clear what
> > parts make up the interface to the GCC middle-end.
> 
> yes most of the compiler and libraries are written in Modula-2 there
> is some interface code written in C/C++.  In particular, for the
> compiler, the directory m2/gm2-gcc contains all the tree creation code.
> m2/gm2-libs-ch is the small amount of C required to interface to the
> host operating system.  The bootstrap tool (m2/mc) is written in
> Modula-2 and within the tree there is a C translation of mc for
> bootstrapping purposes (m2/mc-boot).  Given a small amount of time
> this can easily be altered to C++ if desired.  mc will generate C++ or
> C and when translating the gm2 sources it produces C++ equivalents.
> 
> > I'm missing a patch for gcc/doc/install.texi which should list
> > requirements plus a patch to sourcebuild.texi listing the new
> > toplevel dirs (at least).
> 
> all done now.  The documentation is now in gcc/doc/m2.texi and the
> patches add information about m2 the two files (gcc/doc/sourcebuild.texi
> and gcc/doc/install.texi).
> 
> > We don't usally ship "examples" in the GCC source tree,
> 
> ok - I've purged the examples and added some of these examples to the
> regression testsuite instead.
> 
> > there's a gm2-tools directory which name suggests those are host
> > tools which should usually reside in the toplevel.
> 
> I've now created a gm2tools directory in the top which will only be
> configured if m2 is enabled.
> 
> > There's copies of gpl and gpl-3.0.texi files in m2/ but I think all
> > .texi stuff (even language specific) should be in gcc/doc/ and not
> > the lang specific subdirectory.
> 
> ok removed these.
> 
> > I've just tried following the merge instructions and a build on SUSE
> > Leap 15.2 produces a toplevel m2/ and stage{1,2,3,4} directories
> > (empty?!) which hints at some bootstrapping magic taking place?  In
> > the end the build fails like the following in stage2
> 
> > [...]
> 
> > I've just done ./configure --enable-languages=m2; make -j24
> 
> now fixed apologies.
> 
> > I would suggest to not rush this in now during stage4 but instead
> > take the opportunity of this "quiet" phase to prepare an integration
> > branch with all the issues above sorted out which we can merge at
> > the beginning of stage1 for GCC 12 (or later during stage4 if
> > everyone is happy and/or backport for GCC 11.2 when it landed in
> > trunk).

So as suggested above please create a public branch off trunk where you
do the integration and keep it rebased on trunk regularly.  It looks
like you do not have write access to the GCC repository, please
obtain that and make yourself familiar with the repository and
branch layout.

I see there are copyright disclaimers and assignments to the FSF
for you though for GCC I see specific changes rather than
boiler-plate "past and future changes".  Fortunately we now have
a DCO in place so I suggest to make sure to annotate commits
to areas you did not assign copyright with appropriate Signed-Off-By
lines - or maybe for simplicity apply that to all commits.

The SC may also have comments here.

Basically I'd like to see the merged state accessible on a branch.

Thanks,
Richard.

> I'm guessing my priorities are:
> 
>    to keep polishing the code.
>    fix reported bugs.
>    backport to 11.x
>    (happy to adjust these if necessary).
> 
> thereafter I've got some analyzer patches (which are not posted here)
> but which are a whole load of fun and I would like to see these in the
> tree at some sensible time.  Longer term I'd like to revisit the SET
> type and get this to work with dwarf5/gdb and re-implement the large
> set data type.  Other ideas can wait for the moment though.  But in
> the meantime I hope this is useful - enjoy.
> 
> regards,
> Gaius
> 
> [ these patches can also be found on:
> 
>   http://git.savannah.gnu.org/cgit/gm2.git/tree/gcc-versionno/
>   and also in the tarball above at: gcc/m2/patches/gcc/trunk
> ]
> 
> They are also available at:
> 
>   http://floppsie.comp.glam.ac.uk/download/c/gcc-patches-trunk-20210617-tar.gz
> 
> just in case anything below gets mangled.
> 
> 
> 2021-06-17  Gaius Mulley   <gaius.mulley@southwales.ac.uk>
> 
> * Makefile.def (host_modules) includes gm2tools.
> (target_modules): Includes libgm2.
> (GM2_FOR_TARGET): Added.
> (GM2FLAGS_FOR_TARGET): Added.
> (dependencies): all-gm2tools on all-target-libgm2.
> (dependencies): configure-target-libgm2 on all-target-libstdc++-v3.
> (dependencies): all-target-libgm2 on all-target-libatomic.
> (languages): m2 define gcc-check-target as check-m2,
> define lib-check-target as check-target-libgm2 and
> lib-check-target as check-gm2tools.
> * Makefile.tpl: Assign GM2,
> GM2_FOR_BUILD, GM2_FOR_TARGET and GM2FLAGS.
> Pass variables to make.
> * configure.ac (GM2_FOR_TARGET): Added.
> Request build driver program gm2.
> (libgm2) option added.
> (GCC_TARGET_TOOL): define gm2 and how it is invoked.
> (compare_exclusions) includes SYSTEM and M2Version.
> 
> gcc/
> 
> * doc/install.texi (m2): Add Modula-2 as a recognized front end
> language.  (--disable-libgm2) Add entry.  (check-m2) Add reference
> to run the Modula-2 regression tests.
> * doc/sourcebuild.texi (gm2tools): Added top level directory additions.
> (libgm2) Added top level directory entry.  (m2) Added reference for
> a new language subdirectory.
> * gcc/c-family/cppspec.c (lang_register_spec_functions): Added.
> * gcc/c/gccspec.c (lang_register_spec_functions): Added.
> * gcc/cp/g++spec.c (lang_register_spec_functions): Added.
> * gcc/d/d-spec.cc (lang_register_spec_functions): Added.
> * gcc/fortran/gfortranspec.c (lang_register_spec_functions): Added.
> * gcc/gcc.c (allow_linker): Global variable to disable
> linker by the front end.  (xputenv) available externally.
> (xgetenv) New function.  (save_switch) available externally.
> (fe_add_linker_option) New function.  (handle_OPT_B) New function.
> (fe_add_infile) New function.  (fe_mark_compiled) New function.
> (driver_handle_option) call handle_OPT_B.  (print_option) New
> function.  (print_options) New function.  (dbg_options) New function.
> (fe_add_spec_function) New function.  (lookup_spec_function)
> checks front end registered functions.
> (driver::set_up_specs):  call lang_register_spec_functions.
> (maybe_run_linker): Check allow_linker before running the linker.
> * gcc/gcc.h (fe_save_switch): Prototype.
> (handle_OPT_B) Prototype.  (fe_add_infile) Prototype.
> (fe_add_linker_option) Prototype.  (fe_add_spec_function) Prototype.
> (xputenv) Prototype.  (xgetenv) Prototype.  (print_options) Prototype.
> (print_option) Prototype.  (dbg_options) Prototype.
> (lang_register_spec_functions) Prototype.
> (allow_linker): Extern.
> * gcc/go/gospec.c (lang_register_spec_functions): Added.
> 
> Patches
> =======
> 
> --- gcc-git/configure	2021-06-10 11:58:16.842976709 +0100
> +++ gm2-floppsie/configure	2021-06-17 10:21:32.547445349 +0100
> @@ -612,6 +612,7 @@
>  DLLTOOL_FOR_TARGET
>  AS_FOR_TARGET
>  AR_FOR_TARGET
> +GM2_FOR_TARGET
>  GDC_FOR_TARGET
>  GOC_FOR_TARGET
>  GFORTRAN_FOR_TARGET
> @@ -756,6 +757,7 @@
>  docdir
>  oldincludedir
>  includedir
> +runstatedir
>  localstatedir
>  sharedstatedir
>  sysconfdir
> @@ -793,6 +795,7 @@
>  enable_libquadmath
>  enable_libquadmath_support
>  enable_libada
> +enable_libgm2
>  enable_libssp
>  enable_libstdcxx
>  enable_liboffloadmic
> @@ -871,6 +874,7 @@
>  GFORTRAN_FOR_TARGET
>  GOC_FOR_TARGET
>  GDC_FOR_TARGET
> +GM2_FOR_TARGET
>  AR_FOR_TARGET
>  AS_FOR_TARGET
>  DLLTOOL_FOR_TARGET
> @@ -923,6 +927,7 @@
>  sysconfdir='${prefix}/etc'
>  sharedstatedir='${prefix}/com'
>  localstatedir='${prefix}/var'
> +runstatedir='${localstatedir}/run'
>  includedir='${prefix}/include'
>  oldincludedir='/usr/include'
>  docdir='${datarootdir}/doc/${PACKAGE}'
> @@ -1175,6 +1180,15 @@
>    | -silent | --silent | --silen | --sile | --sil)
>      silent=yes ;;
>  
> +  -runstatedir | --runstatedir | --runstatedi | --runstated \
> +  | --runstate | --runstat | --runsta | --runst | --runs \
> +  | --run | --ru | --r)
> +    ac_prev=runstatedir ;;
> +  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
> +  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
> +  | --run=* | --ru=* | --r=*)
> +    runstatedir=$ac_optarg ;;
> +
>    -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
>      ac_prev=sbindir ;;
>    -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
> @@ -1312,7 +1326,7 @@
>  for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
>  		datadir sysconfdir sharedstatedir localstatedir includedir \
>  		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
> -		libdir localedir mandir
> +		libdir localedir mandir runstatedir
>  do
>    eval ac_val=\$$ac_var
>    # Remove trailing slashes.
> @@ -1472,6 +1486,7 @@
>    --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
>    --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
>    --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
> +  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
>    --libdir=DIR            object code libraries [EPREFIX/lib]
>    --includedir=DIR        C header files [PREFIX/include]
>    --oldincludedir=DIR     C header files for non-gcc [/usr/include]
> @@ -1530,6 +1545,7 @@
>    --disable-libquadmath-support
>                            disable libquadmath support for Fortran
>    --enable-libada         build libada directory
> +  --enable-libgm2         build libgm2 directory
>    --enable-libssp         build libssp directory
>    --disable-libstdcxx     do not build libstdc++-v3 directory
>    --enable-liboffloadmic=ARG
> @@ -1665,6 +1681,8 @@
>                GOC for the target
>    GDC_FOR_TARGET
>                GDC for the target
> +  GM2_FOR_TARGET
> +              GM2 for the target
>    AR_FOR_TARGET
>                AR for the target
>    AS_FOR_TARGET
> @@ -2801,7 +2819,7 @@
>  # binutils, gas and ld appear in that order because it makes sense to run
>  # "make check" in that particular order.
>  # If --enable-gold is used, "gold" may replace "ld".
> -host_tools="texinfo flex bison binutils gas ld fixincludes gcc cgen sid sim gdb gdbserver gprof etc expect dejagnu m4 utils guile fastjar gnattools libcc1 gotools c++tools"
> +host_tools="texinfo flex bison binutils gas ld fixincludes gcc cgen sid sim gdb gdbserver gprof etc expect dejagnu m4 utils guile fastjar gnattools libcc1 gm2tools gotools c++tools"
>  
>  # these libraries are built for the target environment, and are built after
>  # the host libraries and the host tools (which may be a cross compiler)
> @@ -2823,6 +2841,7 @@
>  		target-libffi \
>  		target-libobjc \
>  		target-libada \
> +		target-libgm2 \
>  		target-libgo \
>  		target-libphobos \
>  		target-zlib"
> @@ -3160,6 +3179,17 @@
>    noconfigdirs="$noconfigdirs gnattools"
>  fi
>  
> +# Check whether --enable-libgm2 was given.
> +if test "${enable_libgm2+set}" = set; then :
> +  enableval=$enable_libgm2; ENABLE_LIBGM2=$enableval
> +else
> +  ENABLE_LIBGM2=no
> +fi
> +
> +if test "${ENABLE_LIBGM2}" != "yes" ; then
> +  noconfigdirs="$noconfigdirs gm2tools"
> +fi
> +
>  # Check whether --enable-libssp was given.
>  if test "${enable_libssp+set}" = set; then :
>    enableval=$enable_libssp; ENABLE_LIBSSP=$enableval
> @@ -13414,6 +13444,167 @@
>  
>  
>  
> +if test -n "$GM2_FOR_TARGET"; then
> +  ac_cv_prog_GM2_FOR_TARGET=$GM2_FOR_TARGET
> +elif test -n "$ac_cv_prog_GM2_FOR_TARGET"; then
> +  GM2_FOR_TARGET=$ac_cv_prog_GM2_FOR_TARGET
> +fi
> +
> +if test -n "$ac_cv_prog_GM2_FOR_TARGET"; then
> +  for ncn_progname in gm2; do
> +    # Extract the first word of "${ncn_progname}", so it can be a program name with args.
> +set dummy ${ncn_progname}; ac_word=$2
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
> +$as_echo_n "checking for $ac_word... " >&6; }
> +if ${ac_cv_prog_GM2_FOR_TARGET+:} false; then :
> +  $as_echo_n "(cached) " >&6
> +else
> +  if test -n "$GM2_FOR_TARGET"; then
> +  ac_cv_prog_GM2_FOR_TARGET="$GM2_FOR_TARGET" # Let the user override the test.
> +else
> +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
> +for as_dir in $PATH
> +do
> +  IFS=$as_save_IFS
> +  test -z "$as_dir" && as_dir=.
> +    for ac_exec_ext in '' $ac_executable_extensions; do
> +  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
> +    ac_cv_prog_GM2_FOR_TARGET="${ncn_progname}"
> +    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
> +    break 2
> +  fi
> +done
> +  done
> +IFS=$as_save_IFS
> +
> +fi
> +fi
> +GM2_FOR_TARGET=$ac_cv_prog_GM2_FOR_TARGET
> +if test -n "$GM2_FOR_TARGET"; then
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GM2_FOR_TARGET" >&5
> +$as_echo "$GM2_FOR_TARGET" >&6; }
> +else
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
> +$as_echo "no" >&6; }
> +fi
> +
> +
> +  done
> +fi
> +
> +if test -z "$ac_cv_prog_GM2_FOR_TARGET" && test -n "$with_build_time_tools"; then
> +  for ncn_progname in gm2; do
> +    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ncn_progname} in $with_build_time_tools" >&5
> +$as_echo_n "checking for ${ncn_progname} in $with_build_time_tools... " >&6; }
> +    if test -x $with_build_time_tools/${ncn_progname}; then
> +      ac_cv_prog_GM2_FOR_TARGET=$with_build_time_tools/${ncn_progname}
> +      { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
> +$as_echo "yes" >&6; }
> +      break
> +    else
> +      { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
> +$as_echo "no" >&6; }
> +    fi
> +  done
> +fi
> +
> +if test -z "$ac_cv_prog_GM2_FOR_TARGET"; then
> +  for ncn_progname in gm2; do
> +    if test -n "$ncn_target_tool_prefix"; then
> +      # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args.
> +set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
> +$as_echo_n "checking for $ac_word... " >&6; }
> +if ${ac_cv_prog_GM2_FOR_TARGET+:} false; then :
> +  $as_echo_n "(cached) " >&6
> +else
> +  if test -n "$GM2_FOR_TARGET"; then
> +  ac_cv_prog_GM2_FOR_TARGET="$GM2_FOR_TARGET" # Let the user override the test.
> +else
> +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
> +for as_dir in $PATH
> +do
> +  IFS=$as_save_IFS
> +  test -z "$as_dir" && as_dir=.
> +    for ac_exec_ext in '' $ac_executable_extensions; do
> +  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
> +    ac_cv_prog_GM2_FOR_TARGET="${ncn_target_tool_prefix}${ncn_progname}"
> +    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
> +    break 2
> +  fi
> +done
> +  done
> +IFS=$as_save_IFS
> +
> +fi
> +fi
> +GM2_FOR_TARGET=$ac_cv_prog_GM2_FOR_TARGET
> +if test -n "$GM2_FOR_TARGET"; then
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GM2_FOR_TARGET" >&5
> +$as_echo "$GM2_FOR_TARGET" >&6; }
> +else
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
> +$as_echo "no" >&6; }
> +fi
> +
> +
> +    fi
> +    if test -z "$ac_cv_prog_GM2_FOR_TARGET" && test $build = $target ; then
> +      # Extract the first word of "${ncn_progname}", so it can be a program name with args.
> +set dummy ${ncn_progname}; ac_word=$2
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
> +$as_echo_n "checking for $ac_word... " >&6; }
> +if ${ac_cv_prog_GM2_FOR_TARGET+:} false; then :
> +  $as_echo_n "(cached) " >&6
> +else
> +  if test -n "$GM2_FOR_TARGET"; then
> +  ac_cv_prog_GM2_FOR_TARGET="$GM2_FOR_TARGET" # Let the user override the test.
> +else
> +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
> +for as_dir in $PATH
> +do
> +  IFS=$as_save_IFS
> +  test -z "$as_dir" && as_dir=.
> +    for ac_exec_ext in '' $ac_executable_extensions; do
> +  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
> +    ac_cv_prog_GM2_FOR_TARGET="${ncn_progname}"
> +    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
> +    break 2
> +  fi
> +done
> +  done
> +IFS=$as_save_IFS
> +
> +fi
> +fi
> +GM2_FOR_TARGET=$ac_cv_prog_GM2_FOR_TARGET
> +if test -n "$GM2_FOR_TARGET"; then
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GM2_FOR_TARGET" >&5
> +$as_echo "$GM2_FOR_TARGET" >&6; }
> +else
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
> +$as_echo "no" >&6; }
> +fi
> +
> +
> +    fi
> +    test -n "$ac_cv_prog_GM2_FOR_TARGET" && break
> +  done
> +fi
> +
> +if test -z "$ac_cv_prog_GM2_FOR_TARGET" ; then
> +  set dummy gm2
> +  if test $build = $target ; then
> +    GM2_FOR_TARGET="$2"
> +  else
> +    GM2_FOR_TARGET="${ncn_target_tool_prefix}$2"
> +  fi
> +else
> +  GM2_FOR_TARGET="$ac_cv_prog_GM2_FOR_TARGET"
> +fi
> +
> +
> +
>  cat > conftest.c << \EOF
>  #ifdef __GNUC__
>    gcc_yay;
> @@ -17085,6 +17276,51 @@
>    fi
>  fi
>  
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking where to find the target gm2" >&5
> +$as_echo_n "checking where to find the target gm2... " >&6; }
> +if test "x${build}" != "x${host}" ; then
> +  if expr "x$GM2_FOR_TARGET" : "x/" > /dev/null; then
> +    # We already found the complete path
> +    ac_dir=`dirname $GM2_FOR_TARGET`
> +    { $as_echo "$as_me:${as_lineno-$LINENO}: result: pre-installed in $ac_dir" >&5
> +$as_echo "pre-installed in $ac_dir" >&6; }
> +  else
> +    # Canadian cross, just use what we found
> +    { $as_echo "$as_me:${as_lineno-$LINENO}: result: pre-installed" >&5
> +$as_echo "pre-installed" >&6; }
> +  fi
> +else
> +  ok=yes
> +  case " ${configdirs} " in
> +    *" gcc "*) ;;
> +    *) ok=no ;;
> +  esac
> +  case ,${enable_languages}, in
> +    *,m2,*) ;;
> +    *) ok=no ;;
> +  esac
> +  if test $ok = yes; then
> +    # An in-tree tool is available and we can use it
> +    GM2_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/gm2 -B$$r/$(HOST_SUBDIR)/gcc/'
> +    { $as_echo "$as_me:${as_lineno-$LINENO}: result: just compiled" >&5
> +$as_echo "just compiled" >&6; }
> +  elif expr "x$GM2_FOR_TARGET" : "x/" > /dev/null; then
> +    # We already found the complete path
> +    ac_dir=`dirname $GM2_FOR_TARGET`
> +    { $as_echo "$as_me:${as_lineno-$LINENO}: result: pre-installed in $ac_dir" >&5
> +$as_echo "pre-installed in $ac_dir" >&6; }
> +  elif test "x$target" = "x$host"; then
> +    # We can use an host tool
> +    GM2_FOR_TARGET='$(GM2)'
> +    { $as_echo "$as_me:${as_lineno-$LINENO}: result: host tool" >&5
> +$as_echo "host tool" >&6; }
> +  else
> +    # We need a cross tool
> +    { $as_echo "$as_me:${as_lineno-$LINENO}: result: pre-installed" >&5
> +$as_echo "pre-installed" >&6; }
> +  fi
> +fi
> +
>  { $as_echo "$as_me:${as_lineno-$LINENO}: checking where to find the target ld" >&5
>  $as_echo_n "checking where to find the target ld... " >&6; }
>  if test "x${build}" != "x${host}" ; then
> @@ -17646,6 +17882,8 @@
>  # Specify what files to not compare during bootstrap.
>  
>  compare_exclusions="gcc/cc*-checksum\$(objext) | gcc/ada/*tools/*"
> +compare_exclusions="$compare_exclusions | gcc/m2/gm2-compiler-boot/M2Version*"
> +compare_exclusions="$compare_exclusions | gcc/m2/gm2-compiler-boot/SYSTEM*"
>  case "$target" in
>    hppa*64*-*-hpux*) ;;
>    hppa*-*-hpux*) compare_exclusions="$compare_exclusions | */libgcc/lib2funcs* | gcc/function-tests.o" ;;
> --- gcc-git/configure.ac	2021-06-10 11:58:16.842976709 +0100
> +++ gm2-floppsie/configure.ac	2021-06-17 10:20:53.191400495 +0100
> @@ -140,7 +140,7 @@
>  # binutils, gas and ld appear in that order because it makes sense to run
>  # "make check" in that particular order.
>  # If --enable-gold is used, "gold" may replace "ld".
> -host_tools="texinfo flex bison binutils gas ld fixincludes gcc cgen sid sim gdb gdbserver gprof etc expect dejagnu m4 utils guile fastjar gnattools libcc1 gotools c++tools"
> +host_tools="texinfo flex bison binutils gas ld fixincludes gcc cgen sid sim gdb gdbserver gprof etc expect dejagnu m4 utils guile fastjar gnattools libcc1 gm2tools gotools c++tools"
>  
>  # these libraries are built for the target environment, and are built after
>  # the host libraries and the host tools (which may be a cross compiler)
> @@ -162,6 +162,7 @@
>  		target-libffi \
>  		target-libobjc \
>  		target-libada \
> +		target-libgm2 \
>  		target-libgo \
>  		target-libphobos \
>  		target-zlib"
> @@ -459,6 +460,14 @@
>    noconfigdirs="$noconfigdirs gnattools"
>  fi
>  
> +AC_ARG_ENABLE(libgm2,
> +[AS_HELP_STRING([--enable-libgm2], [build libgm2 directory])],
> +ENABLE_LIBGM2=$enableval,
> +ENABLE_LIBGM2=no)
> +if test "${ENABLE_LIBGM2}" != "yes" ; then
> +  noconfigdirs="$noconfigdirs gm2tools"
> +fi
> +
>  AC_ARG_ENABLE(libssp,
>  [AS_HELP_STRING([--enable-libssp], [build libssp directory])],
>  ENABLE_LIBSSP=$enableval,
> @@ -3494,6 +3503,7 @@
>  NCN_STRICT_CHECK_TARGET_TOOLS(GFORTRAN_FOR_TARGET, gfortran)
>  NCN_STRICT_CHECK_TARGET_TOOLS(GOC_FOR_TARGET, gccgo)
>  NCN_STRICT_CHECK_TARGET_TOOLS(GDC_FOR_TARGET, gdc)
> +NCN_STRICT_CHECK_TARGET_TOOLS(GM2_FOR_TARGET, gm2)
>  
>  ACX_CHECK_INSTALLED_TARGET_TOOL(AR_FOR_TARGET, ar)
>  ACX_CHECK_INSTALLED_TARGET_TOOL(AS_FOR_TARGET, as)
> @@ -3530,6 +3540,8 @@
>  		[gcc/gccgo -B$$r/$(HOST_SUBDIR)/gcc/], go)
>  GCC_TARGET_TOOL(gdc, GDC_FOR_TARGET, GDC,
>  		[gcc/gdc -B$$r/$(HOST_SUBDIR)/gcc/], d)
> +GCC_TARGET_TOOL(gm2, GM2_FOR_TARGET, GM2,
> +		[gcc/gm2 -B$$r/$(HOST_SUBDIR)/gcc/], m2)
>  GCC_TARGET_TOOL(ld, LD_FOR_TARGET, LD, [ld/ld-new])
>  GCC_TARGET_TOOL(lipo, LIPO_FOR_TARGET, LIPO)
>  GCC_TARGET_TOOL(nm, NM_FOR_TARGET, NM, [binutils/nm-new])
> @@ -3656,6 +3668,8 @@
>  # Specify what files to not compare during bootstrap.
>  
>  compare_exclusions="gcc/cc*-checksum\$(objext) | gcc/ada/*tools/*"
> +compare_exclusions="$compare_exclusions | gcc/m2/gm2-compiler-boot/M2Version*"
> +compare_exclusions="$compare_exclusions | gcc/m2/gm2-compiler-boot/SYSTEM*"
>  case "$target" in
>    hppa*64*-*-hpux*) ;;
>    hppa*-*-hpux*) compare_exclusions="$compare_exclusions | */libgcc/lib2funcs* | gcc/function-tests.o" ;;
> --- gcc-git/gcc/c/gccspec.c	2021-06-10 11:58:17.710982159 +0100
> +++ gm2-floppsie/gcc/c/gccspec.c	2021-06-17 10:20:53.195400499 +0100
> @@ -105,3 +105,9 @@
>  
>  /* Number of extra output files that lang_specific_pre_link may generate.  */
>  int lang_specific_extra_outfiles = 0;  /* Not used for C.  */
> +
> +/* lang_register_spec_functions.  Not used for C.  */
> +void
> +lang_register_spec_functions (void)
> +{
> +}
> --- gcc-git/gcc/c-family/cppspec.c	2021-06-10 11:58:17.694982057 +0100
> +++ gm2-floppsie/gcc/c-family/cppspec.c	2021-06-17 10:20:53.195400499 +0100
> @@ -198,3 +198,9 @@
>  
>  /* Number of extra output files that lang_specific_pre_link may generate.  */
>  int lang_specific_extra_outfiles = 0;  /* Not used for cpp.  */
> +
> +/* lang_register_spec_functions.  Not used for cpp.  */
> +void
> +lang_register_spec_functions (void)
> +{
> +}
> --- gcc-git/gcc/cp/g++spec.c	2021-06-10 11:58:18.246985525 +0100
> +++ gm2-floppsie/gcc/cp/g++spec.c	2021-06-17 10:20:53.195400499 +0100
> @@ -434,3 +434,9 @@
>  
>  /* Number of extra output files that lang_specific_pre_link may generate.  */
>  int lang_specific_extra_outfiles = 0;  /* Not used for C++.  */
> +
> +/* lang_register_spec_functions.  Not used for C++.  */
> +void
> +lang_register_spec_functions (void)
> +{
> +}
> --- gcc-git/gcc/gcc.c	2021-06-10 11:58:18.494987083 +0100
> +++ gm2-floppsie/gcc/gcc.c	2021-06-17 10:20:53.199400503 +0100
> @@ -334,6 +334,10 @@
>  static const char *cross_compile = "0";
>  #endif
>  
> +/* The lang specs might wish to override the default linker.
> + */
> +int allow_linker = 1;
> +
>  /* Greatest exit code of sub-processes that has been encountered up to
>     now.  */
>  static int greatest_status = 1;
> @@ -362,7 +366,6 @@
>  static struct compiler *lookup_compiler (const char *, size_t, const char *);
>  static char *build_search_list (const struct path_prefix *, const char *,
>  				bool, bool);
> -static void xputenv (const char *);
>  static void putenv_from_prefixes (const struct path_prefix *, const char *,
>  				  bool);
>  static int access_check (const char *, int);
> @@ -1148,6 +1151,7 @@
>  /* We pass any -flto flags on to the linker, which is expected
>     to understand them.  In practice, this means it had better be collect2.  */
>  /* %{e*} includes -export-dynamic; see comment in common.opt.  */
> +
>  #ifndef LINK_COMMAND_SPEC
>  #define LINK_COMMAND_SPEC "\
>  %{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\
> @@ -1781,6 +1785,10 @@
>    { 0, 0 }
>  };
>  
> +/* front end registered spec functions */
> +static struct spec_function *lang_spec_functions = NULL;
> +static unsigned int lang_spec_functions_length = 0;
> +
>  static int processing_spec_function;
>  
>  /* Add appropriate libgcc specs to OBSTACK, taking into account
> @@ -2943,12 +2951,20 @@
>  
>  /* Add or change the value of an environment variable, outputting the
>     change to standard error if in verbose mode.  */
> -static void
> +void
>  xputenv (const char *string)
>  {
>    env.xput (string);
>  }
>  
> +/* Get the environment variable through the managed env.  */
> +
> +const char *
> +xgetenv (const char *key)
> +{
> +  return env.get (key);
> +}
> +
>  /* Build a list of search directories from PATHS.
>     PREFIX is a string to prepend to the list.
>     If CHECK_DIR_P is true we ensure the directory exists.
> @@ -3877,7 +3893,7 @@
>  /* Save an option OPT with N_ARGS arguments in array ARGS, marking it
>     as validated if VALIDATED and KNOWN if it is an internal switch.  */
>  
> -static void
> +void
>  save_switch (const char *opt, size_t n_args, const char *const *args,
>  	     bool validated, bool known)
>  {
> @@ -3922,6 +3938,66 @@
>    setenv ("SOURCE_DATE_EPOCH", source_date_epoch, 0);
>  }
>  
> +void
> +fe_add_linker_option (const char *option)
> +{
> +  add_linker_option (option, strlen (option));
> +}
> +
> +/* Handle the -B option by adding the prefix to exec, startfile and
> +   include search paths.  */
> +
> +void
> +handle_OPT_B (const char *arg)
> +{
> +  size_t len = strlen (arg);
> +
> +  /* Catch the case where the user has forgotten to append a
> +     directory separator to the path.  Note, they may be using
> +     -B to add an executable name prefix, eg "i386-elf-", in
> +     order to distinguish between multiple installations of
> +     GCC in the same directory.  Hence we must check to see
> +     if appending a directory separator actually makes a
> +     valid directory name.  */
> +  if (!IS_DIR_SEPARATOR (arg[len - 1])
> +      && is_directory (arg, false))
> +    {
> +      char *tmp = XNEWVEC (char, len + 2);
> +      strcpy (tmp, arg);
> +      tmp[len] = DIR_SEPARATOR;
> +      tmp[++len] = 0;
> +      arg = tmp;
> +    }
> +
> +  add_prefix (&exec_prefixes, arg, NULL,
> +	      PREFIX_PRIORITY_B_OPT, 0, 0);
> +  add_prefix (&startfile_prefixes, arg, NULL,
> +	      PREFIX_PRIORITY_B_OPT, 0, 0);
> +  add_prefix (&include_prefixes, arg, NULL,
> +	      PREFIX_PRIORITY_B_OPT, 0, 0);
> +}
> +
> +/* Save the infile.  */
> +
> +void
> +fe_add_infile (const char *infile, const char *lang)
> +{
> +  add_infile (infile, lang);
> +}
> +
> +/* Mark a file as compiled.  */
> +
> +void
> +fe_mark_compiled (const char *name)
> +{
> +  int max = n_infiles + lang_specific_extra_outfiles;
> +  int i;
> +
> +  for (i = 0; i < max; i++)
> +    if (filename_cmp (name, infiles[i].name) == 0)
> +      infiles[i].compiled = true;
> +}
> +
>  /* Handle an option DECODED that is unknown to the option-processing
>     machinery.  */
>  
> @@ -4423,33 +4499,7 @@
>        break;
>  
>      case OPT_B:
> -      {
> -	size_t len = strlen (arg);
> -
> -	/* Catch the case where the user has forgotten to append a
> -	   directory separator to the path.  Note, they may be using
> -	   -B to add an executable name prefix, eg "i386-elf-", in
> -	   order to distinguish between multiple installations of
> -	   GCC in the same directory.  Hence we must check to see
> -	   if appending a directory separator actually makes a
> -	   valid directory name.  */
> -	if (!IS_DIR_SEPARATOR (arg[len - 1])
> -	    && is_directory (arg, false))
> -	  {
> -	    char *tmp = XNEWVEC (char, len + 2);
> -	    strcpy (tmp, arg);
> -	    tmp[len] = DIR_SEPARATOR;
> -	    tmp[++len] = 0;
> -	    arg = tmp;
> -	  }
> -
> -	add_prefix (&exec_prefixes, arg, NULL,
> -		    PREFIX_PRIORITY_B_OPT, 0, 0);
> -	add_prefix (&startfile_prefixes, arg, NULL,
> -		    PREFIX_PRIORITY_B_OPT, 0, 0);
> -	add_prefix (&include_prefixes, arg, NULL,
> -		    PREFIX_PRIORITY_B_OPT, 0, 0);
> -      }
> +      handle_OPT_B (arg);
>        validated = true;
>        break;
>  
> @@ -4572,6 +4622,69 @@
>    return ret;
>  }
>  
> +/* print_option a debugging routine to display option i with a leading desc
> +   string.  */
> +
> +void
> +print_option (const char *desc, unsigned int i,
> +	      struct cl_decoded_option *in_decoded_options)
> +{
> +  printf (desc);
> +  printf (" [%d]", i);
> +  switch (in_decoded_options[i].opt_index)
> +    {
> +
> +    case N_OPTS:
> +      break;
> +    case OPT_SPECIAL_unknown:
> +      printf (" flag <unknown>");
> +      break;
> +    case OPT_SPECIAL_ignore:
> +      printf (" flag <ignore>");
> +      break;
> +    case OPT_SPECIAL_program_name:
> +      printf (" flag <program name>");
> +      break;
> +    case OPT_SPECIAL_input_file:
> +      printf (" flag <input file name>");
> +      break;
> +    default:
> +      printf (" flag [%s]",
> +              cl_options[in_decoded_options[i].opt_index].opt_text);
> +    }
> +
> +  if (in_decoded_options[i].arg == NULL)
> +    printf (" no arg");
> +  else
> +    printf (" arg [%s]", in_decoded_options[i].arg);
> +  printf (" orig text [%s]",
> +          in_decoded_options[i].orig_option_with_args_text);
> +  /* On some hosts value is declared as a long long int.  */
> +  printf (" value [%ld]", (long int)in_decoded_options[i].value);
> +  printf (" error [%d]\n", in_decoded_options[i].errors);
> +}
> +
> +/* print_options display all options with a leading string desc.  */
> +
> +void
> +print_options (const char *desc,
> +	       unsigned int in_decoded_options_count,
> +	       struct cl_decoded_option *in_decoded_options)
> +{
> +  for (unsigned int i = 0; i < in_decoded_options_count; i++)
> +    print_option (desc, i, in_decoded_options);
> +}
> +
> +/* dbg_options display all options.  */
> +
> +void
> +dbg_options (unsigned int in_decoded_options_count,
> +	     struct cl_decoded_option *in_decoded_options)
> +{
> +  print_options ("dbg_options", in_decoded_options_count,
> +		 in_decoded_options);
> +}
> +
>  /* Create the vector `switches' and its contents.
>     Store its length in `n_switches'.  */
>  
> @@ -6731,6 +6844,33 @@
>    return 0;
>  }
>  
> +/* Allow the front end to register a spec function.  */
> +
> +void fe_add_spec_function (const char *name, const char *(*func) (int, const char **))
> +{
> +  const struct spec_function *f = lookup_spec_function (name);
> +  struct spec_function *fl;
> +  unsigned int i;
> +
> +  if (f != NULL)
> +    fatal_error (input_location, "spec function (%s) already registered", name);
> +
> +  if (lang_spec_functions == NULL)
> +    lang_spec_functions_length = 1;
> +
> +  lang_spec_functions_length++;
> +  fl = (struct spec_function *) xmalloc (sizeof (const struct spec_function)*lang_spec_functions_length);
> +  for (i=0; i<lang_spec_functions_length-2; i++)
> +    fl[i] = lang_spec_functions[i];
> +  free (lang_spec_functions);
> +  lang_spec_functions = fl;
> +
> +  lang_spec_functions[lang_spec_functions_length-2].name = name;
> +  lang_spec_functions[lang_spec_functions_length-2].func = func;
> +  lang_spec_functions[lang_spec_functions_length-1].name = NULL;
> +  lang_spec_functions[lang_spec_functions_length-1].func = NULL;
> +}
> +
>  /* Look up a spec function.  */
>  
>  static const struct spec_function *
> @@ -6742,6 +6882,11 @@
>      if (strcmp (sf->name, name) == 0)
>        return sf;
>  
> +  if (lang_spec_functions != NULL)
> +    for (sf = lang_spec_functions; sf->name != NULL; sf++)
> +      if (strcmp (sf->name, name) == 0)
> +	return sf;
> +
>    return NULL;
>  }
>  
> @@ -8228,6 +8373,8 @@
>  			   accel_dir_suffix, dir_separator_str, NULL);
>    just_machine_suffix = concat (spec_machine, dir_separator_str, NULL);
>  
> +  lang_register_spec_functions ();
> +
>    specs_file = find_a_file (&startfile_prefixes, "specs", R_OK, true);
>    /* Read the specs file unless it is a default one.  */
>    if (specs_file != 0 && strcmp (specs_file, "specs"))
> @@ -8962,7 +9109,8 @@
>  
>    /* Run ld to link all the compiler output files.  */
>  
> -  if (num_linker_inputs > 0 && !seen_error () && print_subprocess_help < 2)
> +  if (num_linker_inputs > 0 && !seen_error () && print_subprocess_help < 2
> +      && allow_linker)
>      {
>        int tmp = execution_count;
>  
> @@ -9031,7 +9179,7 @@
>    /* If options said don't run linker,
>       complain about input files to be given to the linker.  */
>  
> -  if (! linker_was_run && !seen_error ())
> +  if (! linker_was_run && !seen_error () && allow_linker)
>      for (i = 0; (int) i < n_infiles; i++)
>        if (explicit_link_files[i]
>  	  && !(infiles[i].language && infiles[i].language[0] == '*'))
> --- gcc-git/gcc/gcc.h	2021-06-10 11:58:18.494987083 +0100
> +++ gm2-floppsie/gcc/gcc.h	2021-06-17 10:20:53.199400503 +0100
> @@ -73,9 +73,28 @@
>  extern int do_spec (const char *);
>  extern void record_temp_file (const char *, int, int);
>  extern void set_input (const char *);
> +extern void save_switch (const char *opt, size_t n_args,
> +			 const char *const *args,
> +			 bool validated, bool known);
> +extern void handle_OPT_B (const char *arg);
> +extern void fe_add_infile (const char *infile, const char *lang);
> +extern void fe_add_linker_option (const char *option);
> +extern void fe_add_spec_function (const char *name, const char *(*func) (int, const char **));
> +extern void xputenv (const char *value);
> +extern const char *xgetenv (const char *key);
> +extern void print_options (const char *desc,
> +			   unsigned int in_decoded_options_count,
> +			   struct cl_decoded_option *in_decoded_options);
> +extern void print_option (const char *desc, unsigned int i,
> +			  struct cl_decoded_option *in_decoded_options);
> +extern void dbg_options (unsigned int in_decoded_options_count,
> +			 struct cl_decoded_option *in_decoded_options);
> +
>  
>  /* Spec files linked with gcc.c must provide definitions for these.  */
>  
> +extern void lang_register_spec_functions (void);
> +
>  /* Called before processing to change/add/remove arguments.  */
>  extern void lang_specific_driver (struct cl_decoded_option **,
>  				  unsigned int *, int *);
> @@ -97,4 +116,8 @@
>  					      void *user_data),
>  				   void *user_data);
>  
> +/* Default setting is true, but can be overridden by the language
> +   front end to prohibit the linker from being invoked.  */
> +extern int allow_linker;
> +
>  #endif /* ! GCC_GCC_H */
> --- gcc-git/Makefile.def	2021-06-10 11:58:16.806976484 +0100
> +++ gm2-floppsie/Makefile.def	2021-06-17 10:20:53.203400506 +0100
> @@ -140,6 +140,7 @@
>  		extra_configure_flags='--enable-shared @extra_linker_plugin_flags@ @extra_linker_plugin_configure_flags@';
>  		extra_make_flags='@extra_linker_plugin_flags@'; };
>  host_modules= { module= libcc1; extra_configure_flags=--enable-shared; };
> +host_modules= { module= gm2tools; };
>  host_modules= { module= gotools; };
>  host_modules= { module= libctf; bootstrap=true; };
>  
> @@ -179,6 +180,7 @@
>  target_modules = { module= zlib; };
>  target_modules = { module= rda; };
>  target_modules = { module= libada; };
> +target_modules = { module= libgm2; lib_path=.libs; };
>  target_modules = { module= libgomp; bootstrap= true; lib_path=.libs; };
>  target_modules = { module= libitm; lib_path=.libs; };
>  target_modules = { module= libatomic; lib_path=.libs; };
> @@ -297,6 +299,8 @@
>  flags_to_pass = { flag= GOCFLAGS_FOR_TARGET ; };
>  flags_to_pass = { flag= GDC_FOR_TARGET ; };
>  flags_to_pass = { flag= GDCFLAGS_FOR_TARGET ; };
> +flags_to_pass = { flag= GM2_FOR_TARGET ; };
> +flags_to_pass = { flag= GM2FLAGS_FOR_TARGET ; };
>  flags_to_pass = { flag= LD_FOR_TARGET ; };
>  flags_to_pass = { flag= LIPO_FOR_TARGET ; };
>  flags_to_pass = { flag= LDFLAGS_FOR_TARGET ; };
> @@ -393,6 +397,8 @@
>  // we want version.o from gcc, and implicitly depend on libcody
>  dependencies = { module=all-c++tools; on=all-gcc; };
>  dependencies = { module=all-gotools; on=all-target-libgo; };
> +dependencies = { module=all-gm2tools; on=all-target-libgm2; };
> +dependencies = { module=all-gm2tools; on=all-target-libstdc++-v3; };
>  
>  dependencies = { module=all-utils; on=all-libiberty; };
>  
> @@ -593,6 +599,8 @@
>  dependencies = { module=all-target-libgo; on=all-target-libbacktrace; };
>  dependencies = { module=all-target-libgo; on=all-target-libffi; };
>  dependencies = { module=all-target-libgo; on=all-target-libatomic; };
> +dependencies = { module=configure-target-libgm2; on=all-target-libstdc++-v3; };
> +dependencies = { module=all-target-libgm2; on=all-target-libatomic; };
>  dependencies = { module=configure-target-libphobos; on=configure-target-libbacktrace; };
>  dependencies = { module=configure-target-libphobos; on=configure-target-zlib; };
>  dependencies = { module=all-target-libphobos; on=all-target-libbacktrace; };
> @@ -651,6 +659,9 @@
>  languages = { language=go;	gcc-check-target=check-go;
>  				lib-check-target=check-target-libgo;
>  				lib-check-target=check-gotools; };
> +languages = { language=m2;	gcc-check-target=check-m2; 
> +				lib-check-target=check-target-libgm2;
> +				lib-check-target=check-gm2tools; };
>  languages = { language=d;	gcc-check-target=check-d;
>  				lib-check-target=check-target-libphobos; };
>  
> --- gcc-git/Makefile.in	2021-06-10 11:58:16.818976558 +0100
> +++ gm2-floppsie/Makefile.in	2021-06-17 10:21:30.000000000 +0100
> @@ -158,6 +158,7 @@
>  	GOCFLAGS="$(GOCFLAGS_FOR_BUILD)"; export GOCFLAGS; \
>  	GDC="$(GDC_FOR_BUILD)"; export GDC; \
>  	GDCFLAGS="$(GDCFLAGS_FOR_BUILD)"; export GDCFLAGS; \
> +	GM2="$(GM2_FOR_BUILD)"; export GM2; \
>  	DLLTOOL="$(DLLTOOL_FOR_BUILD)"; export DLLTOOL; \
>  	LD="$(LD_FOR_BUILD)"; export LD; \
>  	LDFLAGS="$(LDFLAGS_FOR_BUILD)"; export LDFLAGS; \
> @@ -195,6 +196,7 @@
>  	GFORTRAN="$(GFORTRAN)"; export GFORTRAN; \
>  	GOC="$(GOC)"; export GOC; \
>  	GDC="$(GDC)"; export GDC; \
> +	GM2="$(GM2)"; export GM2; \
>  	AR="$(AR)"; export AR; \
>  	AS="$(AS)"; export AS; \
>  	CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \
> @@ -293,6 +295,7 @@
>  	GFORTRAN="$(GFORTRAN_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GFORTRAN; \
>  	GOC="$(GOC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GOC; \
>  	GDC="$(GDC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GDC; \
> +	GM2="$(GM2_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GM2; \
>  	DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \
>  	LD="$(COMPILER_LD_FOR_TARGET)"; export LD; \
>  	LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \
> @@ -359,6 +362,7 @@
>  GFORTRAN_FOR_BUILD = @GFORTRAN_FOR_BUILD@
>  GOC_FOR_BUILD = @GOC_FOR_BUILD@
>  GDC_FOR_BUILD = @GDC_FOR_BUILD@
> +GM2_FOR_BUILD = @GM2_FOR_BUILD@
>  LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@
>  LD_FOR_BUILD = @LD_FOR_BUILD@
>  NM_FOR_BUILD = @NM_FOR_BUILD@
> @@ -428,6 +432,7 @@
>  LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
>  GOCFLAGS = $(CFLAGS)
>  GDCFLAGS = $(CFLAGS)
> +GM2FLAGS = $(CFLAGS)
>  
>  CREATE_GCOV = create_gcov
>  
> @@ -595,6 +600,7 @@
>  GFORTRAN_FOR_TARGET=$(STAGE_CC_WRAPPER) @GFORTRAN_FOR_TARGET@
>  GOC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GOC_FOR_TARGET@
>  GDC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GDC_FOR_TARGET@
> +GM2_FOR_TARGET=$(STAGE_CC_WRAPPER) @GM2_FOR_TARGET@
>  DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@
>  LD_FOR_TARGET=@LD_FOR_TARGET@
>  
> @@ -619,6 +625,7 @@
>  LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
>  LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
>  LDFLAGS_FOR_TARGET = @LDFLAGS_FOR_TARGET@
> +GM2FLAGS_FOR_TARGET = -O2 -g
>  GOCFLAGS_FOR_TARGET = -O2 -g
>  GDCFLAGS_FOR_TARGET = -O2 -g
>  
> @@ -645,7 +652,7 @@
>  
>  # This is the list of directories that may be needed in RPATH_ENVVAR
>  # so that programs built for the target machine work.
> -TARGET_LIB_PATH = $(TARGET_LIB_PATH_libstdc++-v3)$(TARGET_LIB_PATH_libsanitizer)$(TARGET_LIB_PATH_libvtv)$(TARGET_LIB_PATH_liboffloadmic)$(TARGET_LIB_PATH_libssp)$(TARGET_LIB_PATH_libphobos)$(TARGET_LIB_PATH_libgomp)$(TARGET_LIB_PATH_libitm)$(TARGET_LIB_PATH_libatomic)$(HOST_LIB_PATH_gcc)
> +TARGET_LIB_PATH = $(TARGET_LIB_PATH_libstdc++-v3)$(TARGET_LIB_PATH_libsanitizer)$(TARGET_LIB_PATH_libvtv)$(TARGET_LIB_PATH_liboffloadmic)$(TARGET_LIB_PATH_libssp)$(TARGET_LIB_PATH_libphobos)$(TARGET_LIB_PATH_libgm2)$(TARGET_LIB_PATH_libgomp)$(TARGET_LIB_PATH_libitm)$(TARGET_LIB_PATH_libatomic)$(HOST_LIB_PATH_gcc)
>  
>  @if target-libstdc++-v3
>  TARGET_LIB_PATH_libstdc++-v3 = $$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs:
> @@ -671,6 +678,10 @@
>  TARGET_LIB_PATH_libphobos = $$r/$(TARGET_SUBDIR)/libphobos/src/.libs:
>  @endif target-libphobos
>  
> +@if target-libgm2
> +TARGET_LIB_PATH_libgm2 = $$r/$(TARGET_SUBDIR)/libgm2/.libs:
> +@endif target-libgm2
> +
>  @if target-libgomp
>  TARGET_LIB_PATH_libgomp = $$r/$(TARGET_SUBDIR)/libgomp/.libs:
>  @endif target-libgomp
> @@ -820,6 +831,8 @@
>  	"GOCFLAGS_FOR_TARGET=$(GOCFLAGS_FOR_TARGET)" \
>  	"GDC_FOR_TARGET=$(GDC_FOR_TARGET)" \
>  	"GDCFLAGS_FOR_TARGET=$(GDCFLAGS_FOR_TARGET)" \
> +	"GM2_FOR_TARGET=$(GM2_FOR_TARGET)" \
> +	"GM2FLAGS_FOR_TARGET=$(GM2FLAGS_FOR_TARGET)" \
>  	"LD_FOR_TARGET=$(LD_FOR_TARGET)" \
>  	"LIPO_FOR_TARGET=$(LIPO_FOR_TARGET)" \
>  	"LDFLAGS_FOR_TARGET=$(LDFLAGS_FOR_TARGET)" \
> @@ -892,6 +905,7 @@
>  	'GFORTRAN=$(GFORTRAN)' \
>  	'GOC=$(GOC)' \
>  	'GDC=$(GDC)' \
> +	'GM2=$(GM2)' \
>  	'LD=$(LD)' \
>  	'LIPO=$(LIPO)' \
>  	'NM=$(NM)' \
> @@ -918,6 +932,7 @@
>  	CC="$${CC}" CC_FOR_BUILD="$${CC_FOR_BUILD}" \
>  	CXX="$${CXX}" CXX_FOR_BUILD="$${CXX_FOR_BUILD}" \
>  	GDC="$${GDC}" GDC_FOR_BUILD="$${GDC_FOR_BUILD}" \
> +	GM2="$${GM2}" GM2_FOR_BUILD="$${GM2_FOR_BUILD}" \
>  	GNATBIND="$${GNATBIND}" \
>  	LDFLAGS="$${LDFLAGS}" \
>  	HOST_LIBS="$${HOST_LIBS}" \
> @@ -952,6 +967,8 @@
>  	'GOCFLAGS=$$(GOCFLAGS_FOR_TARGET)' \
>  	'GDC=$$(GDC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
>  	'GDCFLAGS=$$(GDCFLAGS_FOR_TARGET)' \
> +	'GM2=$$(GM2_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
> +	'GM2FLAGS=$$(GM2FLAGS_FOR_TARGET)' \
>  	'LD=$(COMPILER_LD_FOR_TARGET)' \
>  	'LDFLAGS=$$(LDFLAGS_FOR_TARGET)' \
>  	'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET)' \
> @@ -978,6 +995,7 @@
>  # cross-building scheme.
>  EXTRA_GCC_FLAGS = \
>  	"GCC_FOR_TARGET=$(GCC_FOR_TARGET)" \
> +	"GM2_FOR_TARGET=$(GM2_FOR_TARGET)" \
>  	"`echo 'STMP_FIXPROTO=$(STMP_FIXPROTO)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
>  	"`echo 'LIMITS_H_TEST=$(LIMITS_H_TEST)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
>  
> @@ -1042,6 +1060,7 @@
>      maybe-configure-gnattools \
>      maybe-configure-lto-plugin \
>      maybe-configure-libcc1 \
> +    maybe-configure-gm2tools \
>      maybe-configure-gotools \
>      maybe-configure-libctf
>  .PHONY: configure-target
> @@ -1066,6 +1085,7 @@
>      maybe-configure-target-zlib \
>      maybe-configure-target-rda \
>      maybe-configure-target-libada \
> +    maybe-configure-target-libgm2 \
>      maybe-configure-target-libgomp \
>      maybe-configure-target-libitm \
>      maybe-configure-target-libatomic
> @@ -1203,6 +1223,7 @@
>  all-host: maybe-all-lto-plugin
>  @endif lto-plugin-no-bootstrap
>  all-host: maybe-all-libcc1
> +all-host: maybe-all-gm2tools
>  all-host: maybe-all-gotools
>  @if libctf-no-bootstrap
>  all-host: maybe-all-libctf
> @@ -1238,6 +1259,7 @@
>  all-target: maybe-all-target-zlib
>  all-target: maybe-all-target-rda
>  all-target: maybe-all-target-libada
> +all-target: maybe-all-target-libgm2
>  @if target-libgomp-no-bootstrap
>  all-target: maybe-all-target-libgomp
>  @endif target-libgomp-no-bootstrap
> @@ -1310,6 +1332,7 @@
>  info-host: maybe-info-gnattools
>  info-host: maybe-info-lto-plugin
>  info-host: maybe-info-libcc1
> +info-host: maybe-info-gm2tools
>  info-host: maybe-info-gotools
>  info-host: maybe-info-libctf
>  
> @@ -1335,6 +1358,7 @@
>  info-target: maybe-info-target-zlib
>  info-target: maybe-info-target-rda
>  info-target: maybe-info-target-libada
> +info-target: maybe-info-target-libgm2
>  info-target: maybe-info-target-libgomp
>  info-target: maybe-info-target-libitm
>  info-target: maybe-info-target-libatomic
> @@ -1400,6 +1424,7 @@
>  dvi-host: maybe-dvi-gnattools
>  dvi-host: maybe-dvi-lto-plugin
>  dvi-host: maybe-dvi-libcc1
> +dvi-host: maybe-dvi-gm2tools
>  dvi-host: maybe-dvi-gotools
>  dvi-host: maybe-dvi-libctf
>  
> @@ -1425,6 +1450,7 @@
>  dvi-target: maybe-dvi-target-zlib
>  dvi-target: maybe-dvi-target-rda
>  dvi-target: maybe-dvi-target-libada
> +dvi-target: maybe-dvi-target-libgm2
>  dvi-target: maybe-dvi-target-libgomp
>  dvi-target: maybe-dvi-target-libitm
>  dvi-target: maybe-dvi-target-libatomic
> @@ -1490,6 +1516,7 @@
>  pdf-host: maybe-pdf-gnattools
>  pdf-host: maybe-pdf-lto-plugin
>  pdf-host: maybe-pdf-libcc1
> +pdf-host: maybe-pdf-gm2tools
>  pdf-host: maybe-pdf-gotools
>  pdf-host: maybe-pdf-libctf
>  
> @@ -1515,6 +1542,7 @@
>  pdf-target: maybe-pdf-target-zlib
>  pdf-target: maybe-pdf-target-rda
>  pdf-target: maybe-pdf-target-libada
> +pdf-target: maybe-pdf-target-libgm2
>  pdf-target: maybe-pdf-target-libgomp
>  pdf-target: maybe-pdf-target-libitm
>  pdf-target: maybe-pdf-target-libatomic
> @@ -1580,6 +1608,7 @@
>  html-host: maybe-html-gnattools
>  html-host: maybe-html-lto-plugin
>  html-host: maybe-html-libcc1
> +html-host: maybe-html-gm2tools
>  html-host: maybe-html-gotools
>  html-host: maybe-html-libctf
>  
> @@ -1605,6 +1634,7 @@
>  html-target: maybe-html-target-zlib
>  html-target: maybe-html-target-rda
>  html-target: maybe-html-target-libada
> +html-target: maybe-html-target-libgm2
>  html-target: maybe-html-target-libgomp
>  html-target: maybe-html-target-libitm
>  html-target: maybe-html-target-libatomic
> @@ -1670,6 +1700,7 @@
>  TAGS-host: maybe-TAGS-gnattools
>  TAGS-host: maybe-TAGS-lto-plugin
>  TAGS-host: maybe-TAGS-libcc1
> +TAGS-host: maybe-TAGS-gm2tools
>  TAGS-host: maybe-TAGS-gotools
>  TAGS-host: maybe-TAGS-libctf
>  
> @@ -1695,6 +1726,7 @@
>  TAGS-target: maybe-TAGS-target-zlib
>  TAGS-target: maybe-TAGS-target-rda
>  TAGS-target: maybe-TAGS-target-libada
> +TAGS-target: maybe-TAGS-target-libgm2
>  TAGS-target: maybe-TAGS-target-libgomp
>  TAGS-target: maybe-TAGS-target-libitm
>  TAGS-target: maybe-TAGS-target-libatomic
> @@ -1760,6 +1792,7 @@
>  install-info-host: maybe-install-info-gnattools
>  install-info-host: maybe-install-info-lto-plugin
>  install-info-host: maybe-install-info-libcc1
> +install-info-host: maybe-install-info-gm2tools
>  install-info-host: maybe-install-info-gotools
>  install-info-host: maybe-install-info-libctf
>  
> @@ -1785,6 +1818,7 @@
>  install-info-target: maybe-install-info-target-zlib
>  install-info-target: maybe-install-info-target-rda
>  install-info-target: maybe-install-info-target-libada
> +install-info-target: maybe-install-info-target-libgm2
>  install-info-target: maybe-install-info-target-libgomp
>  install-info-target: maybe-install-info-target-libitm
>  install-info-target: maybe-install-info-target-libatomic
> @@ -1850,6 +1884,7 @@
>  install-pdf-host: maybe-install-pdf-gnattools
>  install-pdf-host: maybe-install-pdf-lto-plugin
>  install-pdf-host: maybe-install-pdf-libcc1
> +install-pdf-host: maybe-install-pdf-gm2tools
>  install-pdf-host: maybe-install-pdf-gotools
>  install-pdf-host: maybe-install-pdf-libctf
>  
> @@ -1875,6 +1910,7 @@
>  install-pdf-target: maybe-install-pdf-target-zlib
>  install-pdf-target: maybe-install-pdf-target-rda
>  install-pdf-target: maybe-install-pdf-target-libada
> +install-pdf-target: maybe-install-pdf-target-libgm2
>  install-pdf-target: maybe-install-pdf-target-libgomp
>  install-pdf-target: maybe-install-pdf-target-libitm
>  install-pdf-target: maybe-install-pdf-target-libatomic
> @@ -1940,6 +1976,7 @@
>  install-html-host: maybe-install-html-gnattools
>  install-html-host: maybe-install-html-lto-plugin
>  install-html-host: maybe-install-html-libcc1
> +install-html-host: maybe-install-html-gm2tools
>  install-html-host: maybe-install-html-gotools
>  install-html-host: maybe-install-html-libctf
>  
> @@ -1965,6 +2002,7 @@
>  install-html-target: maybe-install-html-target-zlib
>  install-html-target: maybe-install-html-target-rda
>  install-html-target: maybe-install-html-target-libada
> +install-html-target: maybe-install-html-target-libgm2
>  install-html-target: maybe-install-html-target-libgomp
>  install-html-target: maybe-install-html-target-libitm
>  install-html-target: maybe-install-html-target-libatomic
> @@ -2030,6 +2068,7 @@
>  installcheck-host: maybe-installcheck-gnattools
>  installcheck-host: maybe-installcheck-lto-plugin
>  installcheck-host: maybe-installcheck-libcc1
> +installcheck-host: maybe-installcheck-gm2tools
>  installcheck-host: maybe-installcheck-gotools
>  installcheck-host: maybe-installcheck-libctf
>  
> @@ -2055,6 +2094,7 @@
>  installcheck-target: maybe-installcheck-target-zlib
>  installcheck-target: maybe-installcheck-target-rda
>  installcheck-target: maybe-installcheck-target-libada
> +installcheck-target: maybe-installcheck-target-libgm2
>  installcheck-target: maybe-installcheck-target-libgomp
>  installcheck-target: maybe-installcheck-target-libitm
>  installcheck-target: maybe-installcheck-target-libatomic
> @@ -2120,6 +2160,7 @@
>  mostlyclean-host: maybe-mostlyclean-gnattools
>  mostlyclean-host: maybe-mostlyclean-lto-plugin
>  mostlyclean-host: maybe-mostlyclean-libcc1
> +mostlyclean-host: maybe-mostlyclean-gm2tools
>  mostlyclean-host: maybe-mostlyclean-gotools
>  mostlyclean-host: maybe-mostlyclean-libctf
>  
> @@ -2145,6 +2186,7 @@
>  mostlyclean-target: maybe-mostlyclean-target-zlib
>  mostlyclean-target: maybe-mostlyclean-target-rda
>  mostlyclean-target: maybe-mostlyclean-target-libada
> +mostlyclean-target: maybe-mostlyclean-target-libgm2
>  mostlyclean-target: maybe-mostlyclean-target-libgomp
>  mostlyclean-target: maybe-mostlyclean-target-libitm
>  mostlyclean-target: maybe-mostlyclean-target-libatomic
> @@ -2210,6 +2252,7 @@
>  clean-host: maybe-clean-gnattools
>  clean-host: maybe-clean-lto-plugin
>  clean-host: maybe-clean-libcc1
> +clean-host: maybe-clean-gm2tools
>  clean-host: maybe-clean-gotools
>  clean-host: maybe-clean-libctf
>  
> @@ -2235,6 +2278,7 @@
>  clean-target: maybe-clean-target-zlib
>  clean-target: maybe-clean-target-rda
>  clean-target: maybe-clean-target-libada
> +clean-target: maybe-clean-target-libgm2
>  clean-target: maybe-clean-target-libgomp
>  clean-target: maybe-clean-target-libitm
>  clean-target: maybe-clean-target-libatomic
> @@ -2300,6 +2344,7 @@
>  distclean-host: maybe-distclean-gnattools
>  distclean-host: maybe-distclean-lto-plugin
>  distclean-host: maybe-distclean-libcc1
> +distclean-host: maybe-distclean-gm2tools
>  distclean-host: maybe-distclean-gotools
>  distclean-host: maybe-distclean-libctf
>  
> @@ -2325,6 +2370,7 @@
>  distclean-target: maybe-distclean-target-zlib
>  distclean-target: maybe-distclean-target-rda
>  distclean-target: maybe-distclean-target-libada
> +distclean-target: maybe-distclean-target-libgm2
>  distclean-target: maybe-distclean-target-libgomp
>  distclean-target: maybe-distclean-target-libitm
>  distclean-target: maybe-distclean-target-libatomic
> @@ -2390,6 +2436,7 @@
>  maintainer-clean-host: maybe-maintainer-clean-gnattools
>  maintainer-clean-host: maybe-maintainer-clean-lto-plugin
>  maintainer-clean-host: maybe-maintainer-clean-libcc1
> +maintainer-clean-host: maybe-maintainer-clean-gm2tools
>  maintainer-clean-host: maybe-maintainer-clean-gotools
>  maintainer-clean-host: maybe-maintainer-clean-libctf
>  
> @@ -2415,6 +2462,7 @@
>  maintainer-clean-target: maybe-maintainer-clean-target-zlib
>  maintainer-clean-target: maybe-maintainer-clean-target-rda
>  maintainer-clean-target: maybe-maintainer-clean-target-libada
> +maintainer-clean-target: maybe-maintainer-clean-target-libgm2
>  maintainer-clean-target: maybe-maintainer-clean-target-libgomp
>  maintainer-clean-target: maybe-maintainer-clean-target-libitm
>  maintainer-clean-target: maybe-maintainer-clean-target-libatomic
> @@ -2463,7 +2511,7 @@
>  	-rm -f texinfo/doc/Makefile texinfo/po/POTFILES
>  	-rmdir texinfo/doc texinfo/info texinfo/intl texinfo/lib 2>/dev/null
>  	-rmdir texinfo/makeinfo texinfo/po texinfo/util 2>/dev/null
> -	-rmdir c++tools fastjar gcc gnattools gotools 2>/dev/null
> +	-rmdir c++tools fastjar gcc gnattools gm2tools gotools 2>/dev/null
>  	-rmdir libcc1 libiberty texinfo zlib 2>/dev/null
>  	-find . -name config.cache -exec rm -f {} \; \; 2>/dev/null
>  
> @@ -2536,6 +2584,7 @@
>      maybe-check-gnattools \
>      maybe-check-lto-plugin \
>      maybe-check-libcc1 \
> +    maybe-check-gm2tools \
>      maybe-check-gotools \
>      maybe-check-libctf
>  
> @@ -2561,6 +2610,7 @@
>      maybe-check-target-zlib \
>      maybe-check-target-rda \
>      maybe-check-target-libada \
> +    maybe-check-target-libgm2 \
>      maybe-check-target-libgomp \
>      maybe-check-target-libitm \
>      maybe-check-target-libatomic
> @@ -2673,6 +2723,7 @@
>      maybe-install-gnattools \
>      maybe-install-lto-plugin \
>      maybe-install-libcc1 \
> +    maybe-install-gm2tools \
>      maybe-install-gotools \
>      maybe-install-libctf
>  
> @@ -2728,6 +2779,7 @@
>      maybe-install-gnattools \
>      maybe-install-lto-plugin \
>      maybe-install-libcc1 \
> +    maybe-install-gm2tools \
>      maybe-install-gotools \
>      maybe-install-libctf
>  
> @@ -2753,6 +2805,7 @@
>      maybe-install-target-zlib \
>      maybe-install-target-rda \
>      maybe-install-target-libada \
> +    maybe-install-target-libgm2 \
>      maybe-install-target-libgomp \
>      maybe-install-target-libitm \
>      maybe-install-target-libatomic
> @@ -2838,6 +2891,7 @@
>      maybe-install-strip-gnattools \
>      maybe-install-strip-lto-plugin \
>      maybe-install-strip-libcc1 \
> +    maybe-install-strip-gm2tools \
>      maybe-install-strip-gotools \
>      maybe-install-strip-libctf
>  
> @@ -2863,6 +2917,7 @@
>      maybe-install-strip-target-zlib \
>      maybe-install-strip-target-rda \
>      maybe-install-strip-target-libada \
> +    maybe-install-strip-target-libgm2 \
>      maybe-install-strip-target-libgomp \
>      maybe-install-strip-target-libitm \
>      maybe-install-strip-target-libatomic
> @@ -40541,6 +40596,447 @@
>  
>  
>  
> +.PHONY: configure-gm2tools maybe-configure-gm2tools
> +maybe-configure-gm2tools:
> +@if gcc-bootstrap
> +configure-gm2tools: stage_current
> +@endif gcc-bootstrap
> +@if gm2tools
> +maybe-configure-gm2tools: configure-gm2tools
> +configure-gm2tools: 
> +	@: $(MAKE); $(unstage)
> +	@r=`${PWD_COMMAND}`; export r; \
> +	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
> +	test ! -f $(HOST_SUBDIR)/gm2tools/Makefile || exit 0; \
> +	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gm2tools; \
> +	$(HOST_EXPORTS)  \
> +	echo Configuring in $(HOST_SUBDIR)/gm2tools; \
> +	cd "$(HOST_SUBDIR)/gm2tools" || exit 1; \
> +	case $(srcdir) in \
> +	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
> +	  *) topdir=`echo $(HOST_SUBDIR)/gm2tools/ | \
> +		sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
> +	esac; \
> +	module_srcdir=gm2tools; \
> +	$(SHELL) \
> +	  $$s/$$module_srcdir/configure \
> +	  --srcdir=$${topdir}/$$module_srcdir \
> +	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
> +	  --target=${target_alias}  \
> +	  || exit 1
> +@endif gm2tools
> +
> +
> +
> +
> +
> +.PHONY: all-gm2tools maybe-all-gm2tools
> +maybe-all-gm2tools:
> +@if gcc-bootstrap
> +all-gm2tools: stage_current
> +@endif gcc-bootstrap
> +@if gm2tools
> +TARGET-gm2tools=all
> +maybe-all-gm2tools: all-gm2tools
> +all-gm2tools: configure-gm2tools
> +	@: $(MAKE); $(unstage)
> +	@r=`${PWD_COMMAND}`; export r; \
> +	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
> +	$(HOST_EXPORTS)  \
> +	(cd $(HOST_SUBDIR)/gm2tools && \
> +	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS)  \
> +		$(TARGET-gm2tools))
> +@endif gm2tools
> +
> +
> +
> +
> +.PHONY: check-gm2tools maybe-check-gm2tools
> +maybe-check-gm2tools:
> +@if gm2tools
> +maybe-check-gm2tools: check-gm2tools
> +
> +check-gm2tools:
> +	@: $(MAKE); $(unstage)
> +	@r=`${PWD_COMMAND}`; export r; \
> +	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
> +	$(HOST_EXPORTS)  \
> +	(cd $(HOST_SUBDIR)/gm2tools && \
> +	  $(MAKE) $(FLAGS_TO_PASS)  check)
> +
> +@endif gm2tools
> +
> +.PHONY: install-gm2tools maybe-install-gm2tools
> +maybe-install-gm2tools:
> +@if gm2tools
> +maybe-install-gm2tools: install-gm2tools
> +
> +install-gm2tools: installdirs
> +	@: $(MAKE); $(unstage)
> +	@r=`${PWD_COMMAND}`; export r; \
> +	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
> +	$(HOST_EXPORTS) \
> +	(cd $(HOST_SUBDIR)/gm2tools && \
> +	  $(MAKE) $(FLAGS_TO_PASS)  install)
> +
> +@endif gm2tools
> +
> +.PHONY: install-strip-gm2tools maybe-install-strip-gm2tools
> +maybe-install-strip-gm2tools:
> +@if gm2tools
> +maybe-install-strip-gm2tools: install-strip-gm2tools
> +
> +install-strip-gm2tools: installdirs
> +	@: $(MAKE); $(unstage)
> +	@r=`${PWD_COMMAND}`; export r; \
> +	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
> +	$(HOST_EXPORTS) \
> +	(cd $(HOST_SUBDIR)/gm2tools && \
> +	  $(MAKE) $(FLAGS_TO_PASS)  install-strip)
> +
> +@endif gm2tools
> +
> +# Other targets (info, dvi, pdf, etc.)
> +
> +.PHONY: maybe-info-gm2tools info-gm2tools
> +maybe-info-gm2tools:
> +@if gm2tools
> +maybe-info-gm2tools: info-gm2tools
> +
> +info-gm2tools: \
> +    configure-gm2tools 
> +	@: $(MAKE); $(unstage)
> +	@[ -f ./gm2tools/Makefile ] || exit 0; \
> +	r=`${PWD_COMMAND}`; export r; \
> +	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
> +	$(HOST_EXPORTS) \
> +	for flag in $(EXTRA_HOST_FLAGS) ; do \
> +	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
> +	done; \
> +	echo "Doing info in gm2tools"; \
> +	(cd $(HOST_SUBDIR)/gm2tools && \
> +	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
> +	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
> +	          "RANLIB=$${RANLIB}" \
> +	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
> +	          info) \
> +	  || exit 1
> +
> +@endif gm2tools
> +
> +.PHONY: maybe-dvi-gm2tools dvi-gm2tools
> +maybe-dvi-gm2tools:
> +@if gm2tools
> +maybe-dvi-gm2tools: dvi-gm2tools
> +
> +dvi-gm2tools: \
> +    configure-gm2tools 
> +	@: $(MAKE); $(unstage)
> +	@[ -f ./gm2tools/Makefile ] || exit 0; \
> +	r=`${PWD_COMMAND}`; export r; \
> +	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
> +	$(HOST_EXPORTS) \
> +	for flag in $(EXTRA_HOST_FLAGS) ; do \
> +	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
> +	done; \
> +	echo "Doing dvi in gm2tools"; \
> +	(cd $(HOST_SUBDIR)/gm2tools && \
> +	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
> +	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
> +	          "RANLIB=$${RANLIB}" \
> +	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
> +	          dvi) \
> +	  || exit 1
> +
> +@endif gm2tools
> +
> +.PHONY: maybe-pdf-gm2tools pdf-gm2tools
> +maybe-pdf-gm2tools:
> +@if gm2tools
> +maybe-pdf-gm2tools: pdf-gm2tools
> +
> +pdf-gm2tools: \
> +    configure-gm2tools 
> +	@: $(MAKE); $(unstage)
> +	@[ -f ./gm2tools/Makefile ] || exit 0; \
> +	r=`${PWD_COMMAND}`; export r; \
> +	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
> +	$(HOST_EXPORTS) \
> +	for flag in $(EXTRA_HOST_FLAGS) ; do \
> +	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
> +	done; \
> +	echo "Doing pdf in gm2tools"; \
> +	(cd $(HOST_SUBDIR)/gm2tools && \
> +	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
> +	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
> +	          "RANLIB=$${RANLIB}" \
> +	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
> +	          pdf) \
> +	  || exit 1
> +
> +@endif gm2tools
> +
> +.PHONY: maybe-html-gm2tools html-gm2tools
> +maybe-html-gm2tools:
> +@if gm2tools
> +maybe-html-gm2tools: html-gm2tools
> +
> +html-gm2tools: \
> +    configure-gm2tools 
> +	@: $(MAKE); $(unstage)
> +	@[ -f ./gm2tools/Makefile ] || exit 0; \
> +	r=`${PWD_COMMAND}`; export r; \
> +	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
> +	$(HOST_EXPORTS) \
> +	for flag in $(EXTRA_HOST_FLAGS) ; do \
> +	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
> +	done; \
> +	echo "Doing html in gm2tools"; \
> +	(cd $(HOST_SUBDIR)/gm2tools && \
> +	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
> +	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
> +	          "RANLIB=$${RANLIB}" \
> +	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
> +	          html) \
> +	  || exit 1
> +
> +@endif gm2tools
> +
> +.PHONY: maybe-TAGS-gm2tools TAGS-gm2tools
> +maybe-TAGS-gm2tools:
> +@if gm2tools
> +maybe-TAGS-gm2tools: TAGS-gm2tools
> +
> +TAGS-gm2tools: \
> +    configure-gm2tools 
> +	@: $(MAKE); $(unstage)
> +	@[ -f ./gm2tools/Makefile ] || exit 0; \
> +	r=`${PWD_COMMAND}`; export r; \
> +	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
> +	$(HOST_EXPORTS) \
> +	for flag in $(EXTRA_HOST_FLAGS) ; do \
> +	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
> +	done; \
> +	echo "Doing TAGS in gm2tools"; \
> +	(cd $(HOST_SUBDIR)/gm2tools && \
> +	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
> +	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
> +	          "RANLIB=$${RANLIB}" \
> +	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
> +	          TAGS) \
> +	  || exit 1
> +
> +@endif gm2tools
> +
> +.PHONY: maybe-install-info-gm2tools install-info-gm2tools
> +maybe-install-info-gm2tools:
> +@if gm2tools
> +maybe-install-info-gm2tools: install-info-gm2tools
> +
> +install-info-gm2tools: \
> +    configure-gm2tools \
> +    info-gm2tools 
> +	@: $(MAKE); $(unstage)
> +	@[ -f ./gm2tools/Makefile ] || exit 0; \
> +	r=`${PWD_COMMAND}`; export r; \
> +	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
> +	$(HOST_EXPORTS) \
> +	for flag in $(EXTRA_HOST_FLAGS) ; do \
> +	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
> +	done; \
> +	echo "Doing install-info in gm2tools"; \
> +	(cd $(HOST_SUBDIR)/gm2tools && \
> +	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
> +	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
> +	          "RANLIB=$${RANLIB}" \
> +	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
> +	          install-info) \
> +	  || exit 1
> +
> +@endif gm2tools
> +
> +.PHONY: maybe-install-pdf-gm2tools install-pdf-gm2tools
> +maybe-install-pdf-gm2tools:
> +@if gm2tools
> +maybe-install-pdf-gm2tools: install-pdf-gm2tools
> +
> +install-pdf-gm2tools: \
> +    configure-gm2tools \
> +    pdf-gm2tools 
> +	@: $(MAKE); $(unstage)
> +	@[ -f ./gm2tools/Makefile ] || exit 0; \
> +	r=`${PWD_COMMAND}`; export r; \
> +	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
> +	$(HOST_EXPORTS) \
> +	for flag in $(EXTRA_HOST_FLAGS) ; do \
> +	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
> +	done; \
> +	echo "Doing install-pdf in gm2tools"; \
> +	(cd $(HOST_SUBDIR)/gm2tools && \
> +	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
> +	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
> +	          "RANLIB=$${RANLIB}" \
> +	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
> +	          install-pdf) \
> +	  || exit 1
> +
> +@endif gm2tools
> +
> +.PHONY: maybe-install-html-gm2tools install-html-gm2tools
> +maybe-install-html-gm2tools:
> +@if gm2tools
> +maybe-install-html-gm2tools: install-html-gm2tools
> +
> +install-html-gm2tools: \
> +    configure-gm2tools \
> +    html-gm2tools 
> +	@: $(MAKE); $(unstage)
> +	@[ -f ./gm2tools/Makefile ] || exit 0; \
> +	r=`${PWD_COMMAND}`; export r; \
> +	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
> +	$(HOST_EXPORTS) \
> +	for flag in $(EXTRA_HOST_FLAGS) ; do \
> +	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
> +	done; \
> +	echo "Doing install-html in gm2tools"; \
> +	(cd $(HOST_SUBDIR)/gm2tools && \
> +	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
> +	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
> +	          "RANLIB=$${RANLIB}" \
> +	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
> +	          install-html) \
> +	  || exit 1
> +
> +@endif gm2tools
> +
> +.PHONY: maybe-installcheck-gm2tools installcheck-gm2tools
> +maybe-installcheck-gm2tools:
> +@if gm2tools
> +maybe-installcheck-gm2tools: installcheck-gm2tools
> +
> +installcheck-gm2tools: \
> +    configure-gm2tools 
> +	@: $(MAKE); $(unstage)
> +	@[ -f ./gm2tools/Makefile ] || exit 0; \
> +	r=`${PWD_COMMAND}`; export r; \
> +	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
> +	$(HOST_EXPORTS) \
> +	for flag in $(EXTRA_HOST_FLAGS) ; do \
> +	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
> +	done; \
> +	echo "Doing installcheck in gm2tools"; \
> +	(cd $(HOST_SUBDIR)/gm2tools && \
> +	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
> +	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
> +	          "RANLIB=$${RANLIB}" \
> +	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
> +	          installcheck) \
> +	  || exit 1
> +
> +@endif gm2tools
> +
> +.PHONY: maybe-mostlyclean-gm2tools mostlyclean-gm2tools
> +maybe-mostlyclean-gm2tools:
> +@if gm2tools
> +maybe-mostlyclean-gm2tools: mostlyclean-gm2tools
> +
> +mostlyclean-gm2tools: 
> +	@: $(MAKE); $(unstage)
> +	@[ -f ./gm2tools/Makefile ] || exit 0; \
> +	r=`${PWD_COMMAND}`; export r; \
> +	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
> +	$(HOST_EXPORTS) \
> +	for flag in $(EXTRA_HOST_FLAGS) ; do \
> +	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
> +	done; \
> +	echo "Doing mostlyclean in gm2tools"; \
> +	(cd $(HOST_SUBDIR)/gm2tools && \
> +	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
> +	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
> +	          "RANLIB=$${RANLIB}" \
> +	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
> +	          mostlyclean) \
> +	  || exit 1
> +
> +@endif gm2tools
> +
> +.PHONY: maybe-clean-gm2tools clean-gm2tools
> +maybe-clean-gm2tools:
> +@if gm2tools
> +maybe-clean-gm2tools: clean-gm2tools
> +
> +clean-gm2tools: 
> +	@: $(MAKE); $(unstage)
> +	@[ -f ./gm2tools/Makefile ] || exit 0; \
> +	r=`${PWD_COMMAND}`; export r; \
> +	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
> +	$(HOST_EXPORTS) \
> +	for flag in $(EXTRA_HOST_FLAGS) ; do \
> +	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
> +	done; \
> +	echo "Doing clean in gm2tools"; \
> +	(cd $(HOST_SUBDIR)/gm2tools && \
> +	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
> +	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
> +	          "RANLIB=$${RANLIB}" \
> +	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
> +	          clean) \
> +	  || exit 1
> +
> +@endif gm2tools
> +
> +.PHONY: maybe-distclean-gm2tools distclean-gm2tools
> +maybe-distclean-gm2tools:
> +@if gm2tools
> +maybe-distclean-gm2tools: distclean-gm2tools
> +
> +distclean-gm2tools: 
> +	@: $(MAKE); $(unstage)
> +	@[ -f ./gm2tools/Makefile ] || exit 0; \
> +	r=`${PWD_COMMAND}`; export r; \
> +	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
> +	$(HOST_EXPORTS) \
> +	for flag in $(EXTRA_HOST_FLAGS) ; do \
> +	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
> +	done; \
> +	echo "Doing distclean in gm2tools"; \
> +	(cd $(HOST_SUBDIR)/gm2tools && \
> +	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
> +	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
> +	          "RANLIB=$${RANLIB}" \
> +	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
> +	          distclean) \
> +	  || exit 1
> +
> +@endif gm2tools
> +
> +.PHONY: maybe-maintainer-clean-gm2tools maintainer-clean-gm2tools
> +maybe-maintainer-clean-gm2tools:
> +@if gm2tools
> +maybe-maintainer-clean-gm2tools: maintainer-clean-gm2tools
> +
> +maintainer-clean-gm2tools: 
> +	@: $(MAKE); $(unstage)
> +	@[ -f ./gm2tools/Makefile ] || exit 0; \
> +	r=`${PWD_COMMAND}`; export r; \
> +	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
> +	$(HOST_EXPORTS) \
> +	for flag in $(EXTRA_HOST_FLAGS) ; do \
> +	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
> +	done; \
> +	echo "Doing maintainer-clean in gm2tools"; \
> +	(cd $(HOST_SUBDIR)/gm2tools && \
> +	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
> +	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
> +	          "RANLIB=$${RANLIB}" \
> +	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
> +	          maintainer-clean) \
> +	  || exit 1
> +
> +@endif gm2tools
> +
> +
> +
>  .PHONY: configure-gotools maybe-configure-gotools
>  maybe-configure-gotools:
>  @if gcc-bootstrap
> @@ -54318,6 +54814,464 @@
>  
>  
>  
> +.PHONY: configure-target-libgm2 maybe-configure-target-libgm2
> +maybe-configure-target-libgm2:
> +@if gcc-bootstrap
> +configure-target-libgm2: stage_current
> +@endif gcc-bootstrap
> +@if target-libgm2
> +maybe-configure-target-libgm2: configure-target-libgm2
> +configure-target-libgm2: 
> +	@: $(MAKE); $(unstage)
> +	@r=`${PWD_COMMAND}`; export r; \
> +	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
> +	echo "Checking multilib configuration for libgm2..."; \
> +	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libgm2; \
> +	$(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/libgm2/multilib.tmp 2> /dev/null; \
> +	if test -r $(TARGET_SUBDIR)/libgm2/multilib.out; then \
> +	  if cmp -s $(TARGET_SUBDIR)/libgm2/multilib.tmp $(TARGET_SUBDIR)/libgm2/multilib.out; then \
> +	    rm -f $(TARGET_SUBDIR)/libgm2/multilib.tmp; \
> +	  else \
> +	    rm -f $(TARGET_SUBDIR)/libgm2/Makefile; \
> +	    mv $(TARGET_SUBDIR)/libgm2/multilib.tmp $(TARGET_SUBDIR)/libgm2/multilib.out; \
> +	  fi; \
> +	else \
> +	  mv $(TARGET_SUBDIR)/libgm2/multilib.tmp $(TARGET_SUBDIR)/libgm2/multilib.out; \
> +	fi; \
> +	test ! -f $(TARGET_SUBDIR)/libgm2/Makefile || exit 0; \
> +	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libgm2; \
> +	$(NORMAL_TARGET_EXPORTS)  \
> +	echo Configuring in $(TARGET_SUBDIR)/libgm2; \
> +	cd "$(TARGET_SUBDIR)/libgm2" || exit 1; \
> +	case $(srcdir) in \
> +	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
> +	  *) topdir=`echo $(TARGET_SUBDIR)/libgm2/ | \
> +		sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
> +	esac; \
> +	module_srcdir=libgm2; \
> +	rm -f no-such-file || : ; \
> +	CONFIG_SITE=no-such-file $(SHELL) \
> +	  $$s/$$module_srcdir/configure \
> +	  --srcdir=$${topdir}/$$module_srcdir \
> +	  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
> +	  --target=${target_alias}  \
> +	  || exit 1
> +@endif target-libgm2
> +
> +
> +
> +
> +
> +.PHONY: all-target-libgm2 maybe-all-target-libgm2
> +maybe-all-target-libgm2:
> +@if gcc-bootstrap
> +all-target-libgm2: stage_current
> +@endif gcc-bootstrap
> +@if target-libgm2
> +TARGET-target-libgm2=all
> +maybe-all-target-libgm2: all-target-libgm2
> +all-target-libgm2: configure-target-libgm2
> +	@: $(MAKE); $(unstage)
> +	@r=`${PWD_COMMAND}`; export r; \
> +	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
> +	$(NORMAL_TARGET_EXPORTS)  \
> +	(cd $(TARGET_SUBDIR)/libgm2 && \
> +	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)   \
> +		$(TARGET-target-libgm2))
> +@endif target-libgm2
> +
> +
> +
> +
> +
> +.PHONY: check-target-libgm2 maybe-check-target-libgm2
> +maybe-check-target-libgm2:
> +@if target-libgm2
> +maybe-check-target-libgm2: check-target-libgm2
> +
> +check-target-libgm2:
> +	@: $(MAKE); $(unstage)
> +	@r=`${PWD_COMMAND}`; export r; \
> +	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
> +	$(NORMAL_TARGET_EXPORTS) \
> +	(cd $(TARGET_SUBDIR)/libgm2 && \
> +	  $(MAKE) $(TARGET_FLAGS_TO_PASS)   check)
> +
> +@endif target-libgm2
> +
> +.PHONY: install-target-libgm2 maybe-install-target-libgm2
> +maybe-install-target-libgm2:
> +@if target-libgm2
> +maybe-install-target-libgm2: install-target-libgm2
> +
> +install-target-libgm2: installdirs
> +	@: $(MAKE); $(unstage)
> +	@r=`${PWD_COMMAND}`; export r; \
> +	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
> +	$(NORMAL_TARGET_EXPORTS) \
> +	(cd $(TARGET_SUBDIR)/libgm2 && \
> +	  $(MAKE) $(TARGET_FLAGS_TO_PASS)  install)
> +
> +@endif target-libgm2
> +
> +.PHONY: install-strip-target-libgm2 maybe-install-strip-target-libgm2
> +maybe-install-strip-target-libgm2:
> +@if target-libgm2
> +maybe-install-strip-target-libgm2: install-strip-target-libgm2
> +
> +install-strip-target-libgm2: installdirs
> +	@: $(MAKE); $(unstage)
> +	@r=`${PWD_COMMAND}`; export r; \
> +	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
> +	$(NORMAL_TARGET_EXPORTS) \
> +	(cd $(TARGET_SUBDIR)/libgm2 && \
> +	  $(MAKE) $(TARGET_FLAGS_TO_PASS)  install-strip)
> +
> +@endif target-libgm2
> +
> +# Other targets (info, dvi, pdf, etc.)
> +
> +.PHONY: maybe-info-target-libgm2 info-target-libgm2
> +maybe-info-target-libgm2:
> +@if target-libgm2
> +maybe-info-target-libgm2: info-target-libgm2
> +
> +info-target-libgm2: \
> +    configure-target-libgm2 
> +	@: $(MAKE); $(unstage)
> +	@[ -f $(TARGET_SUBDIR)/libgm2/Makefile ] || exit 0; \
> +	r=`${PWD_COMMAND}`; export r; \
> +	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
> +	$(NORMAL_TARGET_EXPORTS) \
> +	echo "Doing info in $(TARGET_SUBDIR)/libgm2"; \
> +	for flag in $(EXTRA_TARGET_FLAGS); do \
> +	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
> +	done; \
> +	(cd $(TARGET_SUBDIR)/libgm2 && \
> +	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
> +	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
> +	          "RANLIB=$${RANLIB}" \
> +	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
> +	           info) \
> +	  || exit 1
> +
> +@endif target-libgm2
> +
> +.PHONY: maybe-dvi-target-libgm2 dvi-target-libgm2
> +maybe-dvi-target-libgm2:
> +@if target-libgm2
> +maybe-dvi-target-libgm2: dvi-target-libgm2
> +
> +dvi-target-libgm2: \
> +    configure-target-libgm2 
> +	@: $(MAKE); $(unstage)
> +	@[ -f $(TARGET_SUBDIR)/libgm2/Makefile ] || exit 0; \
> +	r=`${PWD_COMMAND}`; export r; \
> +	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
> +	$(NORMAL_TARGET_EXPORTS) \
> +	echo "Doing dvi in $(TARGET_SUBDIR)/libgm2"; \
> +	for flag in $(EXTRA_TARGET_FLAGS); do \
> +	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
> +	done; \
> +	(cd $(TARGET_SUBDIR)/libgm2 && \
> +	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
> +	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
> +	          "RANLIB=$${RANLIB}" \
> +	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
> +	           dvi) \
> +	  || exit 1
> +
> +@endif target-libgm2
> +
> +.PHONY: maybe-pdf-target-libgm2 pdf-target-libgm2
> +maybe-pdf-target-libgm2:
> +@if target-libgm2
> +maybe-pdf-target-libgm2: pdf-target-libgm2
> +
> +pdf-target-libgm2: \
> +    configure-target-libgm2 
> +	@: $(MAKE); $(unstage)
> +	@[ -f $(TARGET_SUBDIR)/libgm2/Makefile ] || exit 0; \
> +	r=`${PWD_COMMAND}`; export r; \
> +	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
> +	$(NORMAL_TARGET_EXPORTS) \
> +	echo "Doing pdf in $(TARGET_SUBDIR)/libgm2"; \
> +	for flag in $(EXTRA_TARGET_FLAGS); do \
> +	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
> +	done; \
> +	(cd $(TARGET_SUBDIR)/libgm2 && \
> +	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
> +	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
> +	          "RANLIB=$${RANLIB}" \
> +	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
> +	           pdf) \
> +	  || exit 1
> +
> +@endif target-libgm2
> +
> +.PHONY: maybe-html-target-libgm2 html-target-libgm2
> +maybe-html-target-libgm2:
> +@if target-libgm2
> +maybe-html-target-libgm2: html-target-libgm2
> +
> +html-target-libgm2: \
> +    configure-target-libgm2 
> +	@: $(MAKE); $(unstage)
> +	@[ -f $(TARGET_SUBDIR)/libgm2/Makefile ] || exit 0; \
> +	r=`${PWD_COMMAND}`; export r; \
> +	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
> +	$(NORMAL_TARGET_EXPORTS) \
> +	echo "Doing html in $(TARGET_SUBDIR)/libgm2"; \
> +	for flag in $(EXTRA_TARGET_FLAGS); do \
> +	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
> +	done; \
> +	(cd $(TARGET_SUBDIR)/libgm2 && \
> +	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
> +	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
> +	          "RANLIB=$${RANLIB}" \
> +	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
> +	           html) \
> +	  || exit 1
> +
> +@endif target-libgm2
> +
> +.PHONY: maybe-TAGS-target-libgm2 TAGS-target-libgm2
> +maybe-TAGS-target-libgm2:
> +@if target-libgm2
> +maybe-TAGS-target-libgm2: TAGS-target-libgm2
> +
> +TAGS-target-libgm2: \
> +    configure-target-libgm2 
> +	@: $(MAKE); $(unstage)
> +	@[ -f $(TARGET_SUBDIR)/libgm2/Makefile ] || exit 0; \
> +	r=`${PWD_COMMAND}`; export r; \
> +	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
> +	$(NORMAL_TARGET_EXPORTS) \
> +	echo "Doing TAGS in $(TARGET_SUBDIR)/libgm2"; \
> +	for flag in $(EXTRA_TARGET_FLAGS); do \
> +	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
> +	done; \
> +	(cd $(TARGET_SUBDIR)/libgm2 && \
> +	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
> +	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
> +	          "RANLIB=$${RANLIB}" \
> +	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
> +	           TAGS) \
> +	  || exit 1
> +
> +@endif target-libgm2
> +
> +.PHONY: maybe-install-info-target-libgm2 install-info-target-libgm2
> +maybe-install-info-target-libgm2:
> +@if target-libgm2
> +maybe-install-info-target-libgm2: install-info-target-libgm2
> +
> +install-info-target-libgm2: \
> +    configure-target-libgm2 \
> +    info-target-libgm2 
> +	@: $(MAKE); $(unstage)
> +	@[ -f $(TARGET_SUBDIR)/libgm2/Makefile ] || exit 0; \
> +	r=`${PWD_COMMAND}`; export r; \
> +	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
> +	$(NORMAL_TARGET_EXPORTS) \
> +	echo "Doing install-info in $(TARGET_SUBDIR)/libgm2"; \
> +	for flag in $(EXTRA_TARGET_FLAGS); do \
> +	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
> +	done; \
> +	(cd $(TARGET_SUBDIR)/libgm2 && \
> +	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
> +	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
> +	          "RANLIB=$${RANLIB}" \
> +	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
> +	           install-info) \
> +	  || exit 1
> +
> +@endif target-libgm2
> +
> +.PHONY: maybe-install-pdf-target-libgm2 install-pdf-target-libgm2
> +maybe-install-pdf-target-libgm2:
> +@if target-libgm2
> +maybe-install-pdf-target-libgm2: install-pdf-target-libgm2
> +
> +install-pdf-target-libgm2: \
> +    configure-target-libgm2 \
> +    pdf-target-libgm2 
> +	@: $(MAKE); $(unstage)
> +	@[ -f $(TARGET_SUBDIR)/libgm2/Makefile ] || exit 0; \
> +	r=`${PWD_COMMAND}`; export r; \
> +	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
> +	$(NORMAL_TARGET_EXPORTS) \
> +	echo "Doing install-pdf in $(TARGET_SUBDIR)/libgm2"; \
> +	for flag in $(EXTRA_TARGET_FLAGS); do \
> +	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
> +	done; \
> +	(cd $(TARGET_SUBDIR)/libgm2 && \
> +	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
> +	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
> +	          "RANLIB=$${RANLIB}" \
> +	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
> +	           install-pdf) \
> +	  || exit 1
> +
> +@endif target-libgm2
> +
> +.PHONY: maybe-install-html-target-libgm2 install-html-target-libgm2
> +maybe-install-html-target-libgm2:
> +@if target-libgm2
> +maybe-install-html-target-libgm2: install-html-target-libgm2
> +
> +install-html-target-libgm2: \
> +    configure-target-libgm2 \
> +    html-target-libgm2 
> +	@: $(MAKE); $(unstage)
> +	@[ -f $(TARGET_SUBDIR)/libgm2/Makefile ] || exit 0; \
> +	r=`${PWD_COMMAND}`; export r; \
> +	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
> +	$(NORMAL_TARGET_EXPORTS) \
> +	echo "Doing install-html in $(TARGET_SUBDIR)/libgm2"; \
> +	for flag in $(EXTRA_TARGET_FLAGS); do \
> +	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
> +	done; \
> +	(cd $(TARGET_SUBDIR)/libgm2 && \
> +	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
> +	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
> +	          "RANLIB=$${RANLIB}" \
> +	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
> +	           install-html) \
> +	  || exit 1
> +
> +@endif target-libgm2
> +
> +.PHONY: maybe-installcheck-target-libgm2 installcheck-target-libgm2
> +maybe-installcheck-target-libgm2:
> +@if target-libgm2
> +maybe-installcheck-target-libgm2: installcheck-target-libgm2
> +
> +installcheck-target-libgm2: \
> +    configure-target-libgm2 
> +	@: $(MAKE); $(unstage)
> +	@[ -f $(TARGET_SUBDIR)/libgm2/Makefile ] || exit 0; \
> +	r=`${PWD_COMMAND}`; export r; \
> +	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
> +	$(NORMAL_TARGET_EXPORTS) \
> +	echo "Doing installcheck in $(TARGET_SUBDIR)/libgm2"; \
> +	for flag in $(EXTRA_TARGET_FLAGS); do \
> +	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
> +	done; \
> +	(cd $(TARGET_SUBDIR)/libgm2 && \
> +	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
> +	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
> +	          "RANLIB=$${RANLIB}" \
> +	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
> +	           installcheck) \
> +	  || exit 1
> +
> +@endif target-libgm2
> +
> +.PHONY: maybe-mostlyclean-target-libgm2 mostlyclean-target-libgm2
> +maybe-mostlyclean-target-libgm2:
> +@if target-libgm2
> +maybe-mostlyclean-target-libgm2: mostlyclean-target-libgm2
> +
> +mostlyclean-target-libgm2: 
> +	@: $(MAKE); $(unstage)
> +	@[ -f $(TARGET_SUBDIR)/libgm2/Makefile ] || exit 0; \
> +	r=`${PWD_COMMAND}`; export r; \
> +	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
> +	$(NORMAL_TARGET_EXPORTS) \
> +	echo "Doing mostlyclean in $(TARGET_SUBDIR)/libgm2"; \
> +	for flag in $(EXTRA_TARGET_FLAGS); do \
> +	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
> +	done; \
> +	(cd $(TARGET_SUBDIR)/libgm2 && \
> +	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
> +	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
> +	          "RANLIB=$${RANLIB}" \
> +	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
> +	           mostlyclean) \
> +	  || exit 1
> +
> +@endif target-libgm2
> +
> +.PHONY: maybe-clean-target-libgm2 clean-target-libgm2
> +maybe-clean-target-libgm2:
> +@if target-libgm2
> +maybe-clean-target-libgm2: clean-target-libgm2
> +
> +clean-target-libgm2: 
> +	@: $(MAKE); $(unstage)
> +	@[ -f $(TARGET_SUBDIR)/libgm2/Makefile ] || exit 0; \
> +	r=`${PWD_COMMAND}`; export r; \
> +	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
> +	$(NORMAL_TARGET_EXPORTS) \
> +	echo "Doing clean in $(TARGET_SUBDIR)/libgm2"; \
> +	for flag in $(EXTRA_TARGET_FLAGS); do \
> +	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
> +	done; \
> +	(cd $(TARGET_SUBDIR)/libgm2 && \
> +	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
> +	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
> +	          "RANLIB=$${RANLIB}" \
> +	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
> +	           clean) \
> +	  || exit 1
> +
> +@endif target-libgm2
> +
> +.PHONY: maybe-distclean-target-libgm2 distclean-target-libgm2
> +maybe-distclean-target-libgm2:
> +@if target-libgm2
> +maybe-distclean-target-libgm2: distclean-target-libgm2
> +
> +distclean-target-libgm2: 
> +	@: $(MAKE); $(unstage)
> +	@[ -f $(TARGET_SUBDIR)/libgm2/Makefile ] || exit 0; \
> +	r=`${PWD_COMMAND}`; export r; \
> +	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
> +	$(NORMAL_TARGET_EXPORTS) \
> +	echo "Doing distclean in $(TARGET_SUBDIR)/libgm2"; \
> +	for flag in $(EXTRA_TARGET_FLAGS); do \
> +	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
> +	done; \
> +	(cd $(TARGET_SUBDIR)/libgm2 && \
> +	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
> +	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
> +	          "RANLIB=$${RANLIB}" \
> +	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
> +	           distclean) \
> +	  || exit 1
> +
> +@endif target-libgm2
> +
> +.PHONY: maybe-maintainer-clean-target-libgm2 maintainer-clean-target-libgm2
> +maybe-maintainer-clean-target-libgm2:
> +@if target-libgm2
> +maybe-maintainer-clean-target-libgm2: maintainer-clean-target-libgm2
> +
> +maintainer-clean-target-libgm2: 
> +	@: $(MAKE); $(unstage)
> +	@[ -f $(TARGET_SUBDIR)/libgm2/Makefile ] || exit 0; \
> +	r=`${PWD_COMMAND}`; export r; \
> +	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
> +	$(NORMAL_TARGET_EXPORTS) \
> +	echo "Doing maintainer-clean in $(TARGET_SUBDIR)/libgm2"; \
> +	for flag in $(EXTRA_TARGET_FLAGS); do \
> +	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
> +	done; \
> +	(cd $(TARGET_SUBDIR)/libgm2 && \
> +	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
> +	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
> +	          "RANLIB=$${RANLIB}" \
> +	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
> +	           maintainer-clean) \
> +	  || exit 1
> +
> +@endif target-libgm2
> +
> +
> +
> +
> +
>  .PHONY: configure-target-libgomp maybe-configure-target-libgomp
>  maybe-configure-target-libgomp:
>  @if gcc-bootstrap
> @@ -56569,6 +57523,14 @@
>  	(cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) check-go);
>  check-go: check-gcc-go check-target-libgo check-gotools
>  
> +.PHONY: check-gcc-m2 check-m2
> +check-gcc-m2:
> +	r=`${PWD_COMMAND}`; export r; \
> +	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
> +	$(HOST_EXPORTS) \
> +	(cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) check-m2);
> +check-m2: check-gcc-m2 check-target-libgm2 check-gm2tools
> +
>  .PHONY: check-gcc-d check-d
>  check-gcc-d:
>  	r=`${PWD_COMMAND}`; export r; \
> @@ -59988,6 +60950,7 @@
>  configure-target-zlib: stage_last
>  configure-target-rda: stage_last
>  configure-target-libada: stage_last
> +configure-target-libgm2: stage_last
>  configure-stage1-target-libgomp: maybe-all-stage1-gcc
>  configure-stage2-target-libgomp: maybe-all-stage2-gcc
>  configure-stage3-target-libgomp: maybe-all-stage3-gcc
> @@ -60022,6 +60985,7 @@
>  configure-target-zlib: maybe-all-gcc
>  configure-target-rda: maybe-all-gcc
>  configure-target-libada: maybe-all-gcc
> +configure-target-libgm2: maybe-all-gcc
>  configure-target-libgomp: maybe-all-gcc
>  configure-target-libitm: maybe-all-gcc
>  configure-target-libatomic: maybe-all-gcc
> @@ -60509,6 +61473,7 @@
>  all-stageautoprofile-lto-plugin: maybe-all-stageautoprofile-libiberty-linker-plugin
>  all-stageautofeedback-lto-plugin: maybe-all-stageautofeedback-libiberty-linker-plugin
>  all-gotools: maybe-all-target-libgo
> +all-gm2tools: maybe-all-target-libgm2
>  configure-intl: maybe-all-libiconv
>  configure-stage1-intl: maybe-all-stage1-libiconv
>  configure-stage2-intl: maybe-all-stage2-libiconv
> @@ -61129,6 +62094,7 @@
>  all-target-libgo: maybe-all-target-libbacktrace
>  all-target-libgo: maybe-all-target-libffi
>  all-target-libgo: maybe-all-target-libatomic
> +all-target-libgm2: maybe-all-target-libatomic
>  configure-target-libphobos: maybe-configure-target-libbacktrace
>  configure-target-libphobos: maybe-configure-target-zlib
>  all-target-libphobos: maybe-all-target-libbacktrace
> @@ -61197,6 +62163,7 @@
>  configure-gnattools: stage_last
>  configure-libcc1: stage_last
>  configure-c++tools: stage_last
> +configure-gm2tools: stage_last
>  configure-utils: stage_last
>  configure-gdb: stage_last
>  configure-gdbserver: stage_last
> @@ -61215,6 +62182,7 @@
>  configure-libcc1: maybe-configure-gcc
>  all-libcc1: maybe-all-gcc
>  all-c++tools: maybe-all-gcc
> +all-gm2tools: maybe-all-target-libstdc++-v3
>  all-utils: maybe-all-libiberty
>  configure-gdb: maybe-all-intl
>  configure-gdb: maybe-all-bfd
> @@ -61247,6 +62215,7 @@
>  all-flex: maybe-all-intl
>  all-m4: maybe-all-intl
>  configure-target-libgo: maybe-all-target-libstdc++-v3
> +configure-target-libgm2: maybe-all-target-libstdc++-v3
>  configure-target-liboffloadmic: maybe-configure-target-libgomp
>  all-target-liboffloadmic: maybe-all-target-libgomp
>  configure-target-newlib: maybe-all-binutils
> @@ -61317,6 +62286,7 @@
>  configure-target-zlib: maybe-all-target-libgcc
>  configure-target-rda: maybe-all-target-libgcc
>  configure-target-libada: maybe-all-target-libgcc
> +configure-target-libgm2: maybe-all-target-libgcc
>  configure-target-libgomp: maybe-all-target-libgcc
>  configure-target-libitm: maybe-all-target-libgcc
>  configure-target-libatomic: maybe-all-target-libgcc
> @@ -61362,6 +62332,8 @@
>  
>  configure-target-libada: maybe-all-target-newlib maybe-all-target-libgloss
>  
> +configure-target-libgm2: maybe-all-target-newlib maybe-all-target-libgloss
> +
>  configure-target-libgomp: maybe-all-target-newlib maybe-all-target-libgloss
>  
>  configure-target-libitm: maybe-all-target-newlib maybe-all-target-libgloss
> --- gcc-git/Makefile.tpl	2021-06-10 11:58:16.822976584 +0100
> +++ gm2-floppsie/Makefile.tpl	2021-06-17 10:20:53.215400517 +0100
> @@ -161,6 +161,7 @@
>  	GOCFLAGS="$(GOCFLAGS_FOR_BUILD)"; export GOCFLAGS; \
>  	GDC="$(GDC_FOR_BUILD)"; export GDC; \
>  	GDCFLAGS="$(GDCFLAGS_FOR_BUILD)"; export GDCFLAGS; \
> +	GM2="$(GM2_FOR_BUILD)"; export GM2; \
>  	DLLTOOL="$(DLLTOOL_FOR_BUILD)"; export DLLTOOL; \
>  	LD="$(LD_FOR_BUILD)"; export LD; \
>  	LDFLAGS="$(LDFLAGS_FOR_BUILD)"; export LDFLAGS; \
> @@ -198,6 +199,7 @@
>  	GFORTRAN="$(GFORTRAN)"; export GFORTRAN; \
>  	GOC="$(GOC)"; export GOC; \
>  	GDC="$(GDC)"; export GDC; \
> +	GM2="$(GM2)"; export GM2; \
>  	AR="$(AR)"; export AR; \
>  	AS="$(AS)"; export AS; \
>  	CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \
> @@ -296,6 +298,7 @@
>  	GFORTRAN="$(GFORTRAN_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GFORTRAN; \
>  	GOC="$(GOC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GOC; \
>  	GDC="$(GDC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GDC; \
> +	GM2="$(GM2_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GM2; \
>  	DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \
>  	LD="$(COMPILER_LD_FOR_TARGET)"; export LD; \
>  	LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \
> @@ -362,6 +365,7 @@
>  GFORTRAN_FOR_BUILD = @GFORTRAN_FOR_BUILD@
>  GOC_FOR_BUILD = @GOC_FOR_BUILD@
>  GDC_FOR_BUILD = @GDC_FOR_BUILD@
> +GM2_FOR_BUILD = @GM2_FOR_BUILD@
>  LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@
>  LD_FOR_BUILD = @LD_FOR_BUILD@
>  NM_FOR_BUILD = @NM_FOR_BUILD@
> @@ -431,6 +435,7 @@
>  LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
>  GOCFLAGS = $(CFLAGS)
>  GDCFLAGS = $(CFLAGS)
> +GM2FLAGS = $(CFLAGS)
>  
>  CREATE_GCOV = create_gcov
>  
> @@ -518,6 +523,7 @@
>  GFORTRAN_FOR_TARGET=$(STAGE_CC_WRAPPER) @GFORTRAN_FOR_TARGET@
>  GOC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GOC_FOR_TARGET@
>  GDC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GDC_FOR_TARGET@
> +GM2_FOR_TARGET=$(STAGE_CC_WRAPPER) @GM2_FOR_TARGET@
>  DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@
>  LD_FOR_TARGET=@LD_FOR_TARGET@
>  
> @@ -542,6 +548,7 @@
>  LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
>  LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
>  LDFLAGS_FOR_TARGET = @LDFLAGS_FOR_TARGET@
> +GM2FLAGS_FOR_TARGET = -O2 -g
>  GOCFLAGS_FOR_TARGET = -O2 -g
>  GDCFLAGS_FOR_TARGET = -O2 -g
>  
> @@ -647,6 +654,7 @@
>  	'GFORTRAN=$(GFORTRAN)' \
>  	'GOC=$(GOC)' \
>  	'GDC=$(GDC)' \
> +	'GM2=$(GM2)' \
>  	'LD=$(LD)' \
>  	'LIPO=$(LIPO)' \
>  	'NM=$(NM)' \
> @@ -673,6 +681,7 @@
>  	CC="$${CC}" CC_FOR_BUILD="$${CC_FOR_BUILD}" \
>  	CXX="$${CXX}" CXX_FOR_BUILD="$${CXX_FOR_BUILD}" \
>  	GDC="$${GDC}" GDC_FOR_BUILD="$${GDC_FOR_BUILD}" \
> +	GM2="$${GM2}" GM2_FOR_BUILD="$${GM2_FOR_BUILD}" \
>  	GNATBIND="$${GNATBIND}" \
>  	LDFLAGS="$${LDFLAGS}" \
>  	HOST_LIBS="$${HOST_LIBS}" \
> @@ -707,6 +716,8 @@
>  	'GOCFLAGS=$$(GOCFLAGS_FOR_TARGET)' \
>  	'GDC=$$(GDC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
>  	'GDCFLAGS=$$(GDCFLAGS_FOR_TARGET)' \
> +	'GM2=$$(GM2_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
> +	'GM2FLAGS=$$(GM2FLAGS_FOR_TARGET)' \
>  	'LD=$(COMPILER_LD_FOR_TARGET)' \
>  	'LDFLAGS=$$(LDFLAGS_FOR_TARGET)' \
>  	'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET)' \
> @@ -733,6 +744,7 @@
>  # cross-building scheme.
>  EXTRA_GCC_FLAGS = \
>  	"GCC_FOR_TARGET=$(GCC_FOR_TARGET)" \
> +	"GM2_FOR_TARGET=$(GM2_FOR_TARGET)" \
>  	"`echo 'STMP_FIXPROTO=$(STMP_FIXPROTO)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
>  	"`echo 'LIMITS_H_TEST=$(LIMITS_H_TEST)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
>  
> @@ -864,7 +876,7 @@
>  	-rm -f texinfo/doc/Makefile texinfo/po/POTFILES
>  	-rmdir texinfo/doc texinfo/info texinfo/intl texinfo/lib 2>/dev/null
>  	-rmdir texinfo/makeinfo texinfo/po texinfo/util 2>/dev/null
> -	-rmdir c++tools fastjar gcc gnattools gotools 2>/dev/null
> +	-rmdir c++tools fastjar gcc gnattools gm2tools gotools 2>/dev/null
>  	-rmdir libcc1 libiberty texinfo zlib 2>/dev/null
>  	-find . -name config.cache -exec rm -f {} \; \; 2>/dev/null
>  
> --- gcc-git/gcc/go/gospec.c	2021-06-10 11:58:18.558987486 +0100
> +++ gm2-floppsie/gcc/go/gospec.c	2021-06-17 10:20:53.219400521 +0100
> @@ -464,3 +464,9 @@
>  
>  /* Number of extra output files that lang_specific_pre_link may generate.  */
>  int lang_specific_extra_outfiles = 0;  /* Not used for Go.  */
> +
> +/* lang_register_spec_functions.  Not used for Go.  */
> +void
> +lang_register_spec_functions (void)
> +{
> +}
> --- gcc-git/gcc/fortran/gfortranspec.c	2021-06-10 11:58:18.450986807 +0100
> +++ gm2-floppsie/gcc/fortran/gfortranspec.c	2021-06-17 10:20:53.219400521 +0100
> @@ -447,4 +447,12 @@
>  }
>  
>  /* Number of extra output files that lang_specific_pre_link may generate.  */
> -int lang_specific_extra_outfiles = 0;	/* Not used for F77.  */
> +int lang_specific_extra_outfiles = 0;	/* Not used for Fortran.  */
> +
> +/* lang_register_spec_functions register the Fortran associated spec
> +   functions.  */
> +
> +void
> +lang_register_spec_functions (void)
> +{
> +}
> --- gcc-git/gcc/d/d-spec.cc	2021-06-10 11:58:18.298985852 +0100
> +++ gm2-floppsie/gcc/d/d-spec.cc	2021-06-17 10:20:53.219400521 +0100
> @@ -490,3 +490,10 @@
>  
>  int lang_specific_extra_outfiles = 0;  /* Not used for D.  */
>  
> +/* lang_register_spec_functions register the D associated spec
> +   functions.  Not used for D.  */
> +
> +void
> +lang_register_spec_functions (void)
> +{
> +}
> --- gcc-git/gcc/jit/jit-spec.c	2021-06-10 11:58:18.618987863 +0100
> +++ gm2-floppsie/gcc/jit/jit-spec.c	2021-06-17 10:20:53.219400521 +0100
> @@ -39,3 +39,9 @@
>  
>  /* Number of extra output files that lang_specific_pre_link may generate.  */
>  int lang_specific_extra_outfiles = 0;  /* Not used for jit.  */
> +
> +/* lang_register_spec_functions.  Not used for jit.  */
> +void
> +lang_register_spec_functions (void)
> +{
> +}
> --- gcc-git/gcc/hwint.h	2021-06-10 11:58:18.570987562 +0100
> +++ gm2-floppsie/gcc/hwint.h	2021-06-17 10:20:53.223400525 +0100
> @@ -257,11 +257,14 @@
>    (HOST_WIDE_INT_1U << (HOST_BITS_PER_WIDE_INT - 1))
>  #define HOST_WIDE_INT_MAX (~(HOST_WIDE_INT_MIN))
>  
> +#ifndef __cplusplus
>  extern HOST_WIDE_INT abs_hwi (HOST_WIDE_INT);
>  extern unsigned HOST_WIDE_INT absu_hwi (HOST_WIDE_INT);
> -extern HOST_WIDE_INT gcd (HOST_WIDE_INT, HOST_WIDE_INT);
>  extern HOST_WIDE_INT pos_mul_hwi (HOST_WIDE_INT, HOST_WIDE_INT);
>  extern HOST_WIDE_INT mul_hwi (HOST_WIDE_INT, HOST_WIDE_INT);
> +#endif  /* !cplusplus.  */
> +
> +extern HOST_WIDE_INT gcd (HOST_WIDE_INT, HOST_WIDE_INT);
>  extern HOST_WIDE_INT least_common_multiple (HOST_WIDE_INT, HOST_WIDE_INT);
>  
>  /* Like ctz_hwi, except 0 when x == 0.  */
> @@ -316,6 +319,7 @@
>      }
>  }
>  
> +#ifdef __cplusplus
>  /* Compute the absolute value of X.  */
>  
>  inline HOST_WIDE_INT
> @@ -374,5 +378,6 @@
>    return result;
>  #endif
>  }
> +#endif /* ! __cplusplus */
>  
>  #endif /* ! GCC_HWINT_H */
> --- gcc-git/gcc/doc/install.texi	2021-06-10 11:58:18.366986279 +0100
> +++ gm2-floppsie/gcc/doc/install.texi	2021-06-17 17:22:04.645530103 +0100
> @@ -1777,18 +1777,19 @@
>  @smallexample
>  grep ^language= */config-lang.in
>  @end smallexample
> -Currently, you can use any of the following:
> -@code{all}, @code{default}, @code{ada}, @code{c}, @code{c++}, @code{d},
> -@code{fortran}, @code{go}, @code{jit}, @code{lto}, @code{objc}, @code{obj-c++}.
> -Building the Ada compiler has special requirements, see below.
> -If you do not pass this flag, or specify the option @code{default}, then the
> -default languages available in the @file{gcc} sub-tree will be configured.
> -Ada, D, Go, Jit, and Objective-C++ are not default languages.  LTO is not a
> -default language, but is built by default because @option{--enable-lto} is
> -enabled by default.  The other languages are default languages.  If
> -@code{all} is specified, then all available languages are built.  An
> -exception is @code{jit} language, which requires
> -@option{--enable-host-shared} to be included with @code{all}.
> +Currently, you can use any of the following: @code{all},
> +@code{default}, @code{ada}, @code{c}, @code{c++}, @code{d},
> +@code{fortran}, @code{go}, @code{jit}, @code{lto}, @code{m2},
> +@code{objc}, @code{obj-c++}.  Building the Ada compiler has special
> +requirements, see below.  If you do not pass this flag, or specify the
> +option @code{default}, then the default languages available in the
> +@file{gcc} sub-tree will be configured.  Ada, D, Go, Jit,
> +Objective-C++ and Modula-2 are not default languages.  LTO is not a
> +default language, but is built by default because
> +@option{--enable-lto} is enabled by default.  The other languages are
> +default languages.  If @code{all} is specified, then all available
> +languages are built.  An exception is @code{jit} language, which
> +requires @option{--enable-host-shared} to be included with @code{all}.
>  
>  @item --enable-stage1-languages=@var{lang1},@var{lang2},@dots{}
>  Specify that a particular subset of compilers and their runtime
> @@ -1811,6 +1812,10 @@
>  previous Ada build procedures, when it was required to explicitly
>  do a @samp{make -C gcc gnatlib_and_tools}.
>  
> +@item --disable-libgm2
> +Specify that the run-time libraries and tools used by Modula-2 should not
> +be built.  This can be useful for debugging.
> +
>  @item --disable-libsanitizer
>  Specify that the run-time libraries for the various sanitizers should
>  not be built.
> @@ -3070,10 +3075,10 @@
>  In order to run sets of tests selectively, there are targets
>  @samp{make check-gcc} and language specific @samp{make check-c},
>  @samp{make check-c++}, @samp{make check-d} @samp{make check-fortran},
> -@samp{make check-ada}, @samp{make check-objc}, @samp{make check-obj-c++},
> -@samp{make check-lto}
> -in the @file{gcc} subdirectory of the object directory.  You can also
> -just run @samp{make check} in a subdirectory of the object directory.
> +@samp{make check-ada}, @samp{make check-m2}, @samp{make check-objc},
> +@samp{make check-obj-c++}, @samp{make check-lto} in the @file{gcc}
> +subdirectory of the object directory.  You can also just run
> +@samp{make check} in a subdirectory of the object directory.
>  
>  
>  A more selective way to just run all @command{gcc} execute tests in the
> --- gcc-git/gcc/doc/sourcebuild.texi	2021-06-10 11:58:18.382986380 +0100
> +++ gm2-floppsie/gcc/doc/sourcebuild.texi	2021-06-17 10:20:53.227400528 +0100
> @@ -52,6 +52,9 @@
>  language front ends, and testsuites.  @xref{gcc Directory, , The
>  @file{gcc} Subdirectory}, for details.
>  
> +@item gm2tools
> +Support tools for Modula-2.
> +
>  @item gnattools
>  Support tools for GNAT.
>  
> @@ -84,6 +87,9 @@
>  @item libgfortran
>  The Fortran runtime library.
>  
> +@item libgm2
> +The Modula-2 runtime library.
> +
>  @item libgo
>  The Go runtime library.  The bulk of this library is mirrored from the
>  @uref{https://github.com/@/golang/go, master Go repository}.
> @@ -163,13 +169,12 @@
>  @item @var{language}
>  Subdirectories for various languages.  Directories containing a file
>  @file{config-lang.in} are language subdirectories.  The contents of
> -the subdirectories @file{c} (for C), @file{cp} (for C++),
> -@file{objc} (for Objective-C), @file{objcp} (for Objective-C++),
> -and @file{lto} (for LTO) are documented in this
> -manual (@pxref{Passes, , Passes and Files of the Compiler});
> -those for other languages are not.  @xref{Front End, ,
> -Anatomy of a Language Front End}, for details of the files in these
> -directories.
> +the subdirectories @file{c} (for C), @file{cp} (for C++), @file{m2}
> +(for Modula-2), @file{objc} (for Objective-C), @file{objcp} (for
> +Objective-C++), and @file{lto} (for LTO) are documented in this manual
> +(@pxref{Passes, , Passes and Files of the Compiler}); those for other
> +languages are not.  @xref{Front End, , Anatomy of a Language Front
> +End}, for details of the files in these directories.
>  
>  @item common
>  Source files shared between the compiler drivers (such as
> 
> 
> 
> regards,
> Gaius
>
Segher Boessenkool June 18, 2021, 12:32 p.m. UTC | #3
Hi Gaius,

On Thu, Jun 17, 2021 at 11:26:41PM +0100, Gaius Mulley via Gcc-patches wrote:
> here are a set of patches which merge the gm2 front end into the
> GCC tree.

I have looked through the patches in this email, and they all look good
too me.  (There are a few warnings about whitespace from "git am", I
haven't looked if those are from your code, or auto-generated).

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

I am building it on powerpc64-linux (-m32,-m64) and poweerpc64le-linux
currently.  (All CentOS 7 fwiw).

It does not want to build gm2tools, haven't investigated that yet
either.

Will report results later.  Thanks for your persistence!


Segher
Segher Boessenkool June 18, 2021, 12:50 p.m. UTC | #4
On Fri, Jun 18, 2021 at 12:52:41PM +0200, Richard Biener wrote:
> So as suggested above please create a public branch off trunk where you
> do the integration and keep it rebased on trunk regularly.  It looks
> like you do not have write access to the GCC repository, please
> obtain that and make yourself familiar with the repository and
> branch layout.

I've pushed a branch with the patches in the first post in this thread
to users/segher/heads/gm2 .  Maybe it can help; I'll delete it to reduce
confusion when something more official shows up :-)

> I see there are copyright disclaimers and assignments to the FSF
> for you though for GCC I see specific changes rather than
> boiler-plate "past and future changes".  Fortunately we now have
> a DCO in place so I suggest to make sure to annotate commits
> to areas you did not assign copyright with appropriate Signed-Off-By
> lines - or maybe for simplicity apply that to all commits.

It is spelled Signed-off-by: (one capital only).


Segher
Gaius Mulley June 18, 2021, 3:10 p.m. UTC | #5
Richard Biener <rguenther@suse.de> writes:

>> > I would suggest to not rush this in now during stage4 but instead
>> > take the opportunity of this "quiet" phase to prepare an integration
>> > branch with all the issues above sorted out which we can merge at
>> > the beginning of stage1 for GCC 12 (or later during stage4 if
>> > everyone is happy and/or backport for GCC 11.2 when it landed in
>> > trunk).
>
> So as suggested above please create a public branch off trunk where you
> do the integration and keep it rebased on trunk regularly.  It looks
> like you do not have write access to the GCC repository, please
> obtain that and make yourself familiar with the repository and
> branch layout.

ok thanks - will do.  Incidentally there is a nightly rebase
automatically performed on

    git clone http://floppsie.comp.glam.ac.uk/gm2 combined-repro-gcc

with a number of branches.  git checkout remotes/origin/gm2-master
obtains gcc 12, it runs about 24 hours behind gcc and the gm2 repro.

I'll create a public branch on gcc.gnu.org and keep it up to date.

> I see there are copyright disclaimers and assignments to the FSF
> for you though for GCC I see specific changes rather than
> boiler-plate "past and future changes".  Fortunately we now have
> a DCO in place so I suggest to make sure to annotate commits
> to areas you did not assign copyright with appropriate Signed-Off-By
> lines - or maybe for simplicity apply that to all commits.

good idea - as you say fortunate the DCO came along - impeccable timing
:-).  I will use a DCO on all commits to be safe,

> The SC may also have comments here.
>
> Basically I'd like to see the merged state accessible on a branch.
>
> Thanks,
> Richard.


regards,
Gaius
Gaius Mulley June 18, 2021, 9 p.m. UTC | #6
Segher Boessenkool <segher@kernel.crashing.org> writes:

> Hi Gaius,
>
> On Thu, Jun 17, 2021 at 11:26:41PM +0100, Gaius Mulley via Gcc-patches wrote:
>> here are a set of patches which merge the gm2 front end into the
>> GCC tree.
>
> I have looked through the patches in this email, and they all look good
> too me.  (There are a few warnings about whitespace from "git am", I
> haven't looked if those are from your code, or auto-generated).

ah thanks - yes I'll try and avoid generating whitespace diff hunks

>> 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.
>
> I am building it on powerpc64-linux (-m32,-m64) and poweerpc64le-linux
> currently.  (All CentOS 7 fwiw).

excellent the more varieties the better - I'm eagerly awaiting a risc-v
motherboard which might also be interesting

> It does not want to build gm2tools, haven't investigated that yet
> either.
>
> Will report results later.  Thanks for your persistence!

many thanks for trying it and your patience,


regards,
Gaius
Gaius Mulley June 18, 2021, 9:14 p.m. UTC | #7
Matthias Klose <doko@ubuntu.com> writes:

>
> 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

Hi Matthias,

thanks for the patch - I will re-examine the install - there is
definitely something odd going on.  On one of my machines it always
wants to rebuild gcc/m2/gm2-lang.o and falls over and on another (same
release - same gcc version 6.3.0 20170516 - debian stretch) it succeeds.

Thanks for the tips on --enable-link-serialization=N,


regards,
Gaius
Gaius Mulley June 19, 2021, 7:53 a.m. UTC | #8
Matthias Klose <doko@ubuntu.com> writes:

> 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

many thanks for the patch - committed.  I've also fixed the make install
bug (causing the re-bootstrap mentioned above),




regards,
Gaius
Matthias Klose June 19, 2021, 10:32 a.m. UTC | #9
On 6/19/21 9:53 AM, Gaius Mulley wrote:
> Matthias Klose <doko@ubuntu.com> writes:
> 
>> 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
> 
> many thanks for the patch - committed.  I've also fixed the make install
> bug (causing the re-bootstrap mentioned above),

the build now fails already in stage1 with

[...]
gm2.a m2/mc-boot-ch/Glibc.o m2/mc-boot-ch/Gmcrts.o libcommon.a
../libcpp/libcpp.a   ../libbacktrace/.libs/libbacktrace.a
../libiberty/libiberty.a ../libdecnumber/libdecnumber.a  -lm
/usr/bin/x86_64-linux-gnu-ld: cannot find libcommon.a: No such file or directory
collect2: error: ld returned 1 exit status

Matthias
Segher Boessenkool June 19, 2021, 2:09 p.m. UTC | #10
Hi!

On Fri, Jun 18, 2021 at 10:00:40PM +0100, Gaius Mulley wrote:
> Segher Boessenkool <segher@kernel.crashing.org> writes:
> > On Thu, Jun 17, 2021 at 11:26:41PM +0100, Gaius Mulley via Gcc-patches wrote:
> >> 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.
> >
> > I am building it on powerpc64-linux (-m32,-m64) and poweerpc64le-linux
> > currently.  (All CentOS 7 fwiw).
> 
> excellent the more varieties the better - I'm eagerly awaiting a risc-v
> motherboard which might also be interesting

I needed a few fixes to get it to build, they are in my branch
(<https://gcc.gnu.org/git/?p=gcc.git;a=shortlog;h=users/segher/heads/gm2>).

The files gm2-libs/getopt.def and gm2-libs/GetOpt.def have filenames
that differ case only, this is censored by the scripts that we run on
the Git server.  I renamed the former to cgetopt.def for now, but of
course more changes are needed for this to work at all.

> > It does not want to build gm2tools, haven't investigated that yet
> > either.

Not yet :-)

> > Will report results later.

powerpc64-linux now is building, and is running the tetsuite.  My
powerpc64le-linux build used --enable-languages=all, but Ada fails to
build, so I'll redo that without Ada.

Gaius, could you look through the two patches I did to get the build to
work, see if those are correct or if something better needs to be done?

<https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=28cec96b06d0f35c387cfa4c73e5ea0c9b9a7e47>
$(subdir) is an absolute path for me, so ../$(subdir) cannot work.

<https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=91473b9caf6753f28be22c0a8f7d39b57a48172a>
Maybe your texinfo is less picky than mine, I use an older one (5.1)?


Segher
Segher Boessenkool June 19, 2021, 4:06 p.m. UTC | #11
On Sat, Jun 19, 2021 at 09:09:05AM -0500, Segher Boessenkool wrote:
> powerpc64-linux now is building, and is running the tetsuite.  My
> powerpc64le-linux build used --enable-languages=all, but Ada fails to
> build, so I'll redo that without Ada.

For powerpc64le-linux I get

                === gm2 tests ===


Running target unix
FAIL: gm2/pim/fail/TestLong4.mod,  -g  
FAIL: gm2/pim/fail/TestLong4.mod,  -O  
FAIL: gm2/pim/fail/TestLong4.mod,  -O -g  
FAIL: gm2/pim/fail/TestLong4.mod,  -Os  
FAIL: gm2/pim/fail/TestLong4.mod,  -O3 -fomit-frame-pointer  
FAIL: gm2/pim/fail/TestLong4.mod,  -O3 -fomit-frame-pointer -finline-functions  
FAIL: gm2/pimlib/logitech/run/pass/realconv.mod execution,  -g 
FAIL: gm2/pimlib/logitech/run/pass/realconv.mod execution,  -O 
FAIL: gm2/pimlib/logitech/run/pass/realconv.mod execution,  -O -g 
FAIL: gm2/pimlib/logitech/run/pass/realconv.mod execution,  -Os 
FAIL: gm2/pimlib/logitech/run/pass/realconv.mod execution,  -O3 -fomit-frame-pointer 
FAIL: gm2/pimlib/logitech/run/pass/realconv.mod execution,  -O3 -fomit-frame-pointer -finline-functions 

                === gm2 Summary ===

# of expected passes            11610
# of unexpected failures        12

So that is excellent, only two failing tests :-)

For BE there is more:

A whole bunch of testcases fail to build (both 32-bit and 64-bit).  I
don't know yet.

The realconv.mod testcase fails at all optimisation levels (also -O0).

setarith*.mod and setrotate*.mod and setshift*.mod and simple*.mod fail
to build.  Also cardrange*.mod and intrange*.mod and multint*.mod and
realrange*.mod and subrange.mod and cardrange.mod and forcheck.mod.
And the extended-opaque tests.  And more :-)

<built-in>: error: the file containing the definition module <E2><80><98>M2RTS
<E2><80><99> cannot be found
compiler exited with status 1
output is:
<built-in>: error: the file containing the definition module <E2><80><98>M2RTS
<E2><80><99> cannot be found

(That is UTF-8 quotation marks, and I do not use an UTF-8 locale there
btw.  That is just a cosmetic problem of course.)

Does this have to do with gm2tools?


Segher
Gaius Mulley June 20, 2021, 11:57 a.m. UTC | #12
Segher Boessenkool <segher@kernel.crashing.org> writes:

> Hi!
>
> On Fri, Jun 18, 2021 at 10:00:40PM +0100, Gaius Mulley wrote:
>> Segher Boessenkool <segher@kernel.crashing.org> writes:
>> > On Thu, Jun 17, 2021 at 11:26:41PM +0100, Gaius Mulley via Gcc-patches wrote:
>> >> 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.
>> >
>> > I am building it on powerpc64-linux (-m32,-m64) and poweerpc64le-linux
>> > currently.  (All CentOS 7 fwiw).
>>
>> excellent the more varieties the better - I'm eagerly awaiting a risc-v
>> motherboard which might also be interesting
>
> I needed a few fixes to get it to build, they are in my branch
> (https://gcc.gnu.org/git/?p=gcc.git;a=shortlog;h=users/segher/heads/gm2)
>
> The files gm2-libs/getopt.def and gm2-libs/GetOpt.def have filenames
> that differ case only, this is censored by the scripts that we run on
> the Git server.  I renamed the former to cgetopt.def for now, but of
> course more changes are needed for this to work at all.

Hi Segher,

ah yes thanks for spotting this - I recall I had a similar issue with
SYSTEM.def will change to getopt.def to cgetopt.def.

>> > It does not want to build gm2tools, haven't investigated that yet
>> > either.
>
> Not yet :-)
>
>> > Will report results later.
>
> powerpc64-linux now is building, and is running the tetsuite.  My
> powerpc64le-linux build used --enable-languages=all, but Ada fails to
> build, so I'll redo that without Ada.
>
> Gaius, could you look through the two patches I did to get the build to
> work, see if those are correct or if something better needs to be done?
>
> <https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=28cec96b06d0f35c387cfa4c73e5ea0c9b9a7e47>
> $(subdir) is an absolute path for me, so ../$(subdir) cannot work.

this looks sensible - I'll also test and apply this on a few machines.

> <https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=91473b9caf6753f28be22c0a8f7d39b57a48172a>
> Maybe your texinfo is less picky than mine, I use an older one (5.1)?

(Debian buster texinfo is on 6.5.0 and Debian stretch is on 6.3.0).  But
the up node was inconsistent :-), again thanks for these up node fixes.

I will rebuild on aarch64 (Debian stretch), x86_64 Debian stretch and
x86_64 Debian buster and make source changes for cgetopt.def etc.


regards,
Gaius
Gaius Mulley June 21, 2021, 11:20 a.m. UTC | #13
Segher Boessenkool <segher@kernel.crashing.org> writes:

> Gaius, could you look through the two patches I did to get the build to
> work, see if those are correct or if something better needs to be done?
>
> <https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=28cec96b06d0f35c387cfa4c73e5ea0c9b9a7e47>
> $(subdir) is an absolute path for me, so ../$(subdir) cannot work.

Hi Segher,

ah after more testing the patch will fail on a relative srcdir and the
configure has to be run in the m2 or m2/gm2-libs build directories.
I've pushed some changes onto the gm2 repro at savannah to fix this
which are included below.  Also included are the renaming changes to
getopt you suggested

regards,
Gaius


diff --git a/gcc-versionno/gcc/m2/ChangeLog b/gcc-versionno/gcc/m2/ChangeLog
index eeac1930..e523f307 100644
--- a/gcc-versionno/gcc/m2/ChangeLog
+++ b/gcc-versionno/gcc/m2/ChangeLog
@@ -1,4 +1,23 @@
-2021-06-19      Matthias Klose <doko@ubuntu.com>
+2021-06-21       Gaius Mulley <gaius.mulley@southwales.ac.uk>
+
+	* tools-src/calcpath:  (New file).
+	* Make-lang.in:  (m2/gm2-libs/gm2-libs-host.h) use calcpath
+	to determine the srcdir of the new subdirectory.
+	(m2/gm2config.h) use calcpath
+	to determine the srcdir of the new subdirectory.
+	Fixes an error and based on a patch reported by Segher Boessenkool
+	<segher@kernel.crashing.org>.
+	* Make-lang.in:  (m2/gm2-libs/gm2-libs-host.h) Restore tabs.
+	* Make-lang.in:  (m2/gm2config.h) Restore tabs.
+	* Make-lang.in:  Replaced getopt.c by cgetopt.c.
+	* gm2-libs/getopt.def:  Renamed gm2-libs/cgetopt.def.
+	* gm2-libs-ch/getopt.c:  Renamed gm2-libs-ch/cgetopt.c.
+	Replaced getopt_ by cgetopt_.
+	Fixes an error reported by Segher Boessenkool
+	<segher@kernel.crashing.org>.
+	* tools-src/calcpath:  (Corrected header comment).
+
+2021-06-19       Matthias Klose <doko@ubuntu.com>
 
 	* Make-lang.in:  introduce parallel linking.
 	* Make-lang.in (m2.serial): New target.
diff --git a/gcc-versionno/gcc/m2/Make-lang.in b/gcc-versionno/gcc/m2/Make-lang.in
index 58e5312e..298da26f 100644
--- a/gcc-versionno/gcc/m2/Make-lang.in
+++ b/gcc-versionno/gcc/m2/Make-lang.in
@@ -1179,9 +1179,11 @@ m2/gm2-libs-iso/%.o: $(srcdir)/m2/gm2-libs-iso/%.mod
 
 m2/gm2-libs/gm2-libs-host.h:
 	echo "Configuring to build libraries using native compiler" ; \
+        NEW_SRCDIR=`${srcdir}/m2/tools-src/calcpath ../../ ${srcdir} m2/gm2-libs` ; \
+        export NEW_SRCDIR ; \
         cd m2/gm2-libs ; \
-        $(SHELL) -c '../../$(srcdir)/m2/gm2-libs/config-host \
-               --srcdir=../../$(srcdir)/m2/gm2-libs \
+        $(SHELL) -c '$${NEW_SRCDIR}/config-host \
+               --srcdir=$${NEW_SRCDIR} \
                --target=$(target) \
                --program-suffix=$(exeext)'
 
@@ -1189,15 +1191,21 @@ m2/gm2-libs/gm2-libs-host.h:
 # cross compiler and the ../Makefile.in above appends this to INTERNAL_CFLAGS.
 
 m2/gm2config.h:
+	NEW_SRCDIR=`${srcdir}/m2/tools-src/calcpath ../ ${srcdir} m2` ; \
+        export NEW_SRCDIR ; \
 	cd m2 ; \
 	if echo $(INTERNAL_CFLAGS) | grep \\-DCROSS_DIRECTORY_STRUCTURE; then \
-            AR=`echo $(AR_FOR_TARGET) | sed -e "s/^ //"` ; \
+            AR=$(echo $(AR_FOR_TARGET) | sed -e "s/^ //") ; \
             export AR ; \
-            RANLIB=`echo $(RANLIB_FOR_TARGET) | sed -e "s/^ //"` ; \
+            RANLIB=$(echo $(RANLIB_FOR_TARGET) | sed -e "s/^ //") ; \
             export RANLIB ; \
-            $(SHELL) -c '../$(srcdir)/m2/configure --srcdir=../$(srcdir)/m2 --target=$(target) --program-suffix=$(exeext) --includedir=$(SYSTEM_HEADER_DIR) --libdir=$(libdir) --libexecdir=$(libexecdir)' ; \
+            $(SHELL) -c '$${NEW_SRCDIR}/configure --srcdir=$${NEW_SRCDIR} \
+                --target=$(target) --program-suffix=$(exeext) \
+                --includedir=$(SYSTEM_HEADER_DIR) --libdir=$(libdir) \
+                --libexecdir=$(libexecdir)' ; \
         else \
-            $(SHELL) -c '../$(srcdir)/m2/configure --srcdir=../$(srcdir)/m2 --target=$(target) --program-suffix=$(exeext)' ; \
+            $(SHELL) -c '$${NEW_SRCDIR}/configure --srcdir=$(NEW_SRCDIR) \
+                --target=$(target) --program-suffix=$(exeext)' ; \
         fi
 
 $(objdir)/m2/gm2-libs-min/SYSTEM.def: $(GM2_PROG_DEP)
diff --git a/gcc-versionno/gcc/m2/gm2-libs-ch/getopt.c b/gcc-versionno/gcc/m2/gm2-libs-ch/cgetopt.c
similarity index 67%
rename from gcc-versionno/gcc/m2/gm2-libs-ch/getopt.c
rename to gcc-versionno/gcc/m2/gm2-libs-ch/cgetopt.c
index 1f483a72..205c0487 100644
--- a/gcc-versionno/gcc/m2/gm2-libs-ch/getopt.c
+++ b/gcc-versionno/gcc/m2/gm2-libs-ch/cgetopt.c
@@ -28,21 +28,21 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #include "system.h"
 #include "ansi-decl.h"
 
-char *getopt_optarg;
-int getopt_optind;
-int getopt_opterr;
-int getopt_optopt;
+char *cgetopt_optarg;
+int cgetopt_optind;
+int cgetopt_opterr;
+int cgetopt_optopt;
 
 
 char
-getopt_getopt (int argc, char *argv[], char *optstring)
+cgetopt_getopt (int argc, char *argv[], char *optstring)
 {
   char r = getopt (argc, argv, optstring);
 
-  getopt_optarg = optarg;
-  getopt_optind = optind;
-  getopt_opterr = opterr;
-  getopt_optopt = optopt;
+  cgetopt_optarg = optarg;
+  cgetopt_optind = optind;
+  cgetopt_opterr = opterr;
+  cgetopt_optopt = optopt;
 
   if (r == (char)-1)
     return (char)0;
@@ -51,47 +51,47 @@ getopt_getopt (int argc, char *argv[], char *optstring)
 
 
 int
-getopt_getopt_long (int argc, char *argv[], char *optstring, const struct option *longopts,
+cgetopt_cgetopt_long (int argc, char *argv[], char *optstring, const struct option *longopts,
                     int *longindex)
 {
-  int r = getopt_long (argc, argv, optstring, longopts, longindex);
+  int r = cgetopt_long (argc, argv, optstring, longopts, longindex);
 
-  getopt_optarg = optarg;
-  getopt_optind = optind;
-  getopt_opterr = opterr;
-  getopt_optopt = optopt;
+  cgetopt_optarg = optarg;
+  cgetopt_optind = optind;
+  cgetopt_opterr = opterr;
+  cgetopt_optopt = optopt;
 
   return r;
 }
 
 
 int
-getopt_getopt_long_only (int argc, char *argv[], char *optstring,
+cgetopt_cgetopt_long_only (int argc, char *argv[], char *optstring,
                          const struct option *longopts, int *longindex)
 {
-  int r = getopt_long_only (argc, argv, optstring, longopts, longindex);
+  int r = cgetopt_long_only (argc, argv, optstring, longopts, longindex);
 
-  getopt_optarg = optarg;
-  getopt_optind = optind;
-  getopt_opterr = opterr;
-  getopt_optopt = optopt;
+  cgetopt_optarg = optarg;
+  cgetopt_optind = optind;
+  cgetopt_opterr = opterr;
+  cgetopt_optopt = optopt;
 
   return r;
 }
 
 
-typedef struct getopt_Options_s {
+typedef struct cgetopt_Options_s {
   struct option *cinfo;
   unsigned int high;
-} getopt_Options;
+} cgetopt_Options;
 
 
 /* InitOptions a constructor for Options.  */
 
-getopt_Options *
-getopt_InitOptions (void)
+cgetopt_Options *
+cgetopt_InitOptions (void)
 {
-  getopt_Options *o = (getopt_Options *) malloc (sizeof (getopt_Options));
+  cgetopt_Options *o = (cgetopt_Options *) malloc (sizeof (cgetopt_Options));
   o->cinfo = (struct option *) malloc (sizeof (struct option));
   o->high = 0;
   return o;
@@ -101,8 +101,8 @@ getopt_InitOptions (void)
 /* KillOptions a deconstructor for Options.  Returns NULL after freeing
    up all allocated memory associated with o.  */
 
-getopt_Options *
-getopt_KillOptions (getopt_Options *o)
+cgetopt_Options *
+cgetopt_KillOptions (cgetopt_Options *o)
 {
   free (o->cinfo);
   free (o);
@@ -113,7 +113,7 @@ getopt_KillOptions (getopt_Options *o)
 /* SetOption set option[index] with {name, has_arg, flag, val}.  */
 
 void
-getopt_SetOption (getopt_Options *o, unsigned int index,
+cgetopt_SetOption (cgetopt_Options *o, unsigned int index,
 		  char *name, unsigned int has_arg,
 		  int *flag, int val)
 {
@@ -133,7 +133,7 @@ getopt_SetOption (getopt_Options *o, unsigned int index,
    long options.  */
 
 struct option *
-getopt_GetLongOptionArray (getopt_Options *o)
+cgetopt_GetLongOptionArray (cgetopt_Options *o)
 {
   return o->cinfo;
 }
@@ -142,12 +142,12 @@ getopt_GetLongOptionArray (getopt_Options *o)
 /* GNU Modula-2 linking fodder.  */
 
 void
-_M2_getopt_init (void)
+_M2_cgetopt_init (void)
 {
 }
 
 
 void
-_M2_getopt_finish (void)
+_M2_cgetopt_finish (void)
 {
 }
diff --git a/gcc-versionno/gcc/m2/gm2-libs/getopt.def b/gcc-versionno/gcc/m2/gm2-libs/cgetopt.def
similarity index 98%
rename from gcc-versionno/gcc/m2/gm2-libs/getopt.def
rename to gcc-versionno/gcc/m2/gm2-libs/cgetopt.def
index c280958d..90ea8886 100644
--- a/gcc-versionno/gcc/m2/gm2-libs/getopt.def
+++ b/gcc-versionno/gcc/m2/gm2-libs/cgetopt.def
@@ -24,7 +24,7 @@ a copy of the GCC Runtime Library Exception along with this program;
 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 <http://www.gnu.org/licenses/>.  *)
 
-DEFINITION MODULE getopt ;
+DEFINITION MODULE cgetopt ;
 
 FROM SYSTEM IMPORT ADDRESS ;
 
@@ -104,4 +104,4 @@ PROCEDURE SetOption (o: Options; index: CARDINAL;
 PROCEDURE GetLongOptionArray (o: Options) : ADDRESS ;
 
 
-END getopt.
+END cgetopt.
diff --git a/gcc-versionno/gcc/m2/tools-src/calcpath b/gcc-versionno/gcc/m2/tools-src/calcpath
new file mode 100755
index 00000000..6123d4ca
--- /dev/null
+++ b/gcc-versionno/gcc/m2/tools-src/calcpath
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+# calcpath return a path which is $1/$2/$3 when $2 is relative and $2/$3 if absolute.
+
+# Copyright (C) 2021 Free Software Foundation, Inc.
+# Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
+#
+# This file is part of GNU Modula-2.
+#
+# GNU Modula-2 is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 3, or (at your option) any later
+# version.
+#
+# GNU Modula-2 is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with gm2; see the file COPYING.  If not, write to the Free Software
+# Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *)
+
+
+Usage () {
+   echo "Usage: calcpath pathcomponent1 pathcomponent2 subdir"
+   echo -n "  if pathcomponent1 is relative then pathcomponent1/pathcomponet2/subdir is"
+   echo " returned"
+   echo "  otherwise pathcomponet2/subdir is returned"
+   echo "  the path is checked for legality in subdir."
+}
+
+
+if [ $# -eq 3 ]; then
+   if [ "$(echo $2 | cut -b 1)" = "." ] ; then
+       # relative path
+       the_path=$1/$2/$3
+   else
+       the_path=$2/$3
+   fi
+   cd $3
+   if realpath -e ${the_path} > /dev/null ; then
+       echo ${the_path}
+   else
+       echo "calcpath: error ${the_path} is not a valid path in subdirectory $3"
+       exit 1
+   fi
+else
+   Usage
+   exit 1
+fi


regards,
Gaius
Gaius Mulley June 21, 2021, 10:36 p.m. UTC | #14
Segher Boessenkool <segher@kernel.crashing.org> writes:

> On Sat, Jun 19, 2021 at 09:09:05AM -0500, Segher Boessenkool wrote:
>> powerpc64-linux now is building, and is running the tetsuite.  My
>> powerpc64le-linux build used --enable-languages=all, but Ada fails to
>> build, so I'll redo that without Ada.
>
> For powerpc64le-linux I get
>
>                 === gm2 tests ===
>
>
> Running target unix
> FAIL: gm2/pim/fail/TestLong4.mod,  -g
> FAIL: gm2/pim/fail/TestLong4.mod,  -O
> FAIL: gm2/pim/fail/TestLong4.mod,  -O -g
> FAIL: gm2/pim/fail/TestLong4.mod,  -Os
> FAIL: gm2/pim/fail/TestLong4.mod,  -O3 -fomit-frame-pointer
> FAIL: gm2/pim/fail/TestLong4.mod,  -O3 -fomit-frame-pointer -finline-functions
> FAIL: gm2/pimlib/logitech/run/pass/realconv.mod execution,  -g
> FAIL: gm2/pimlib/logitech/run/pass/realconv.mod execution,  -O
> FAIL: gm2/pimlib/logitech/run/pass/realconv.mod execution,  -O -g
> FAIL: gm2/pimlib/logitech/run/pass/realconv.mod execution,  -Os
> FAIL: gm2/pimlib/logitech/run/pass/realconv.mod execution,  -O3 -fomit-frame-pointer
> FAIL: gm2/pimlib/logitech/run/pass/realconv.mod execution,  -O3 -fomit-frame-pointer -finline-functions
>
>                 === gm2 Summary ===
>
> # of expected passes            11610
> # of unexpected failures        12
>
> So that is excellent, only two failing tests :-)

yes indeed - I see TestLong4.mod fail on some of my x86_64 test
machines.

> For BE there is more:
>
> A whole bunch of testcases fail to build (both 32-bit and 64-bit).  I
> don't know yet.
>
> The realconv.mod testcase fails at all optimisation levels (also -O0).
>
> setarith*.mod and setrotate*.mod and setshift*.mod and simple*.mod fail
> to build.  Also cardrange*.mod and intrange*.mod and multint*.mod and
> realrange*.mod and subrange.mod and cardrange.mod and forcheck.mod.
> And the extended-opaque tests.  And more :-)
>
> <built-in>: error: the file containing the definition module <E2><80><98>M2RTS
> <E2><80><99> cannot be found
> compiler exited with status 1
> output is:
> <built-in>: error: the file containing the definition module <E2><80><98>M2RTS
> <E2><80><99> cannot be found

ah yes, it would be good to make it autoconf locale utf-8

> (That is UTF-8 quotation marks, and I do not use an UTF-8 locale there
> btw.  That is just a cosmetic problem of course.)
>
> Does this have to do with gm2tools?

Ah just examined simple2.mod and yes absolutely [to the set test
failures] - gm2tools uses word sized set types to implement the first
and follow set recursive descent parsers.  simple2.mod is performing bit
exclusion on a word sized set and failing :-) - which is good news as
this should be easy to debug.  Thanks for testing!




regards,
Gaius
Jakub Jelinek June 21, 2021, 10:41 p.m. UTC | #15
On Mon, Jun 21, 2021 at 11:36:48PM +0100, Gaius Mulley via Gcc-patches wrote:
> > <built-in>: error: the file containing the definition module <E2><80><98>M2RTS
> > <E2><80><99> cannot be found
> > compiler exited with status 1
> > output is:
> > <built-in>: error: the file containing the definition module <E2><80><98>M2RTS
> > <E2><80><99> cannot be found
> 
> ah yes, it would be good to make it autoconf locale utf-8

No, whether gcc is configured on an UTF-8 capable terminal or using UTF-8
locale doesn't imply whether it will actually be used in such a terminal
later on.
See e.g. gcc/intl.c (gcc_init_libintl) how it decides whether to use UTF-8
or normal quotes.

	Jakub
Gaius Mulley June 22, 2021, 10:29 p.m. UTC | #16
Jakub Jelinek <jakub@redhat.com> writes:

>
> On Mon, Jun 21, 2021 at 11:36:48PM +0100, Gaius Mulley via Gcc-patches wrote:
>> > <built-in>: error: the file containing the definition module <E2><80><98>M2RTS
>> > <E2><80><99> cannot be found
>> > compiler exited with status 1
>> > output is:
>> > <built-in>: error: the file containing the definition module <E2><80><98>M2RTS
>> > <E2><80><99> cannot be found
>>
>> ah yes, it would be good to make it autoconf locale utf-8
>
> No, whether gcc is configured on an UTF-8 capable terminal or using UTF-8
> locale doesn't imply whether it will actually be used in such a terminal
> later on.
> See e.g. gcc/intl.c (gcc_init_libintl) how it decides whether to use UTF-8
> or normal quotes.

thank you for the steer - and to avoid a mistake of confusing host and
build.  I've generated a small patch which works using gcc/intl.c
open_quote/close_quote.  Hopefully it improves the aesthetics on host
machines.

diff --git a/gcc-versionno/gcc/m2/ChangeLog b/gcc-versionno/gcc/m2/ChangeLog
index 25cee8ed..86a95270 100644
--- a/gcc-versionno/gcc/m2/ChangeLog
+++ b/gcc-versionno/gcc/m2/ChangeLog
@@ -1,3 +1,16 @@
+2021-06-22       Gaius Mulley <gaius.mulley@southwales.ac.uk>
+
+	* m2/gm2-compiler/M2ColorString.mod:  import open_quote and
+	close_quote from m2color.
+	* m2/gm2-gcc/m2color.c:  (open_quote) New function implemented.
+	(close_quote) New function implemented, both functions import
+	open and close quotes from gcc/intl.c to pick up whether the
+	host has utf-8 capability.
+	* m2/gm2-gcc/m2color.def:  (open_quote) New function defined.
+	(close_quote) New function defined.
+	* m2/gm2-gcc/m2color.h:  (open_quote) and (close_quote) provide C
+	prototypes for external	functions.
+
 2021-06-21       Gaius Mulley <gaius.mulley@southwales.ac.uk>
 
 	* tools-src/calcpath:  (New file).
diff --git a/gcc-versionno/gcc/m2/gm2-compiler/M2ColorString.mod b/gcc-versionno/gcc/m2/gm2-compiler/M2ColorString.mod
index cecee131..f32ef88c 100644
--- a/gcc-versionno/gcc/m2/gm2-compiler/M2ColorString.mod
+++ b/gcc-versionno/gcc/m2/gm2-compiler/M2ColorString.mod
@@ -21,7 +21,7 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 
 IMPLEMENTATION MODULE M2ColorString ;
 
-FROM m2color IMPORT colorize_start, colorize_stop ;
+FROM m2color IMPORT colorize_start, colorize_stop, open_quote, close_quote ;
 FROM DynamicStrings IMPORT InitString, InitStringCharStar,
                            ConCat, ConCatChar, Mark, string, KillString,
                            Dup, char, Length, Mult ;
@@ -70,7 +70,7 @@ END append ;
 
 PROCEDURE quoteOpen (s: String) : String ;
 BEGIN
-   RETURN ConCat (append (s, "quote"), Mark (InitString ("‘")))
+   RETURN ConCat (append (s, "quote"), Mark (InitStringCharStar (open_quote ())))
 END quoteOpen ;
 
 
@@ -82,7 +82,7 @@ PROCEDURE quoteClose (s: String) : String ;
 BEGIN
    s := endColor (s) ;
    s := append (s, "quote") ;
-   s := ConCat (s, Mark (InitString ("’"))) ;
+   s := ConCat (s, Mark (InitStringCharStar (close_quote ()))) ;
    s := endColor (s) ;
    RETURN s
 END quoteClose ;
diff --git a/gcc-versionno/gcc/m2/gm2-gcc/m2color.c b/gcc-versionno/gcc/m2/gm2-gcc/m2color.c
index ec58a4b7..72299e34 100644
--- a/gcc-versionno/gcc/m2/gm2-gcc/m2color.c
+++ b/gcc-versionno/gcc/m2/gm2-gcc/m2color.c
@@ -38,6 +38,18 @@ const char *m2color_colorize_stop (bool show_color)
 }
 
 
+const char *m2color_open_quote (void)
+{
+  return open_quote;
+}
+
+
+const char *m2color_close_quote (void)
+{
+  return close_quote;
+}
+
+
 void _M2_m2color_init ()
 {
 }
diff --git a/gcc-versionno/gcc/m2/gm2-gcc/m2color.def b/gcc-versionno/gcc/m2/gm2-gcc/m2color.def
index 6fa48d2a..a6e96e21 100644
--- a/gcc-versionno/gcc/m2/gm2-gcc/m2color.def
+++ b/gcc-versionno/gcc/m2/gm2-gcc/m2color.def
@@ -39,4 +39,16 @@ PROCEDURE colorize_start (show_color: BOOLEAN;
 PROCEDURE colorize_stop (show_color: BOOLEAN) : ADDRESS ;
 
 
+(* open_quote - return a C string containing the open quote character which
+   might be a UTF-8 character if on a UTF-8 supporting host.  *)
+
+PROCEDURE open_quote () : ADDRESS ;
+
+
+(* close_quote - return a C string containing the close quote character which
+   might be a UTF-8 character if on a UTF-8 supporting host.  *)
+
+PROCEDURE close_quote () : ADDRESS ;
+
+
 END m2color.
diff --git a/gcc-versionno/gcc/m2/gm2-gcc/m2color.h b/gcc-versionno/gcc/m2/gm2-gcc/m2color.h
index 08ef9e72..1b9be66b 100644
--- a/gcc-versionno/gcc/m2/gm2-gcc/m2color.h
+++ b/gcc-versionno/gcc/m2/gm2-gcc/m2color.h
@@ -37,9 +37,11 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 
 
 EXTERN const char *m2color_colorize_start (bool show_color, char *name, unsigned int name_len);
-
 EXTERN const char *m2color_colorize_stop (bool show_color);
 
+EXTERN const char *m2color_open_quote (void);
+EXTERN const char *m2color_close_quote (void);
+
 EXTERN void _M2_m2color_init ();
 EXTERN void _M2_m2color_finish ();


regards,
Gaius
Segher Boessenkool June 23, 2021, 4:34 p.m. UTC | #17
On Tue, Jun 22, 2021 at 12:41:27AM +0200, Jakub Jelinek wrote:
> On Mon, Jun 21, 2021 at 11:36:48PM +0100, Gaius Mulley via Gcc-patches wrote:
> > > <built-in>: error: the file containing the definition module <E2><80><98>M2RTS
> > > <E2><80><99> cannot be found
> > > compiler exited with status 1
> > > output is:
> > > <built-in>: error: the file containing the definition module <E2><80><98>M2RTS
> > > <E2><80><99> cannot be found
> > 
> > ah yes, it would be good to make it autoconf locale utf-8
> 
> No, whether gcc is configured on an UTF-8 capable terminal or using UTF-8
> locale doesn't imply whether it will actually be used in such a terminal
> later on.
> See e.g. gcc/intl.c (gcc_init_libintl) how it decides whether to use UTF-8
> or normal quotes.

Right, and I build and regcheck GCC with LANG=C (and no LC_*) so I
should never see anything translated at all, and nothing should generate
UTF-8 for me.


Segher
diff mbox series

Patch

--- gcc-git/configure	2021-06-10 11:58:16.842976709 +0100
+++ gm2-floppsie/configure	2021-06-17 10:21:32.547445349 +0100
@@ -612,6 +612,7 @@ 
 DLLTOOL_FOR_TARGET
 AS_FOR_TARGET
 AR_FOR_TARGET
+GM2_FOR_TARGET
 GDC_FOR_TARGET
 GOC_FOR_TARGET
 GFORTRAN_FOR_TARGET
@@ -756,6 +757,7 @@ 
 docdir
 oldincludedir
 includedir
+runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -793,6 +795,7 @@ 
 enable_libquadmath
 enable_libquadmath_support
 enable_libada
+enable_libgm2
 enable_libssp
 enable_libstdcxx
 enable_liboffloadmic
@@ -871,6 +874,7 @@ 
 GFORTRAN_FOR_TARGET
 GOC_FOR_TARGET
 GDC_FOR_TARGET
+GM2_FOR_TARGET
 AR_FOR_TARGET
 AS_FOR_TARGET
 DLLTOOL_FOR_TARGET
@@ -923,6 +927,7 @@ 
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE}'
@@ -1175,6 +1180,15 @@ 
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
 
+  -runstatedir | --runstatedir | --runstatedi | --runstated \
+  | --runstate | --runstat | --runsta | --runst | --runs \
+  | --run | --ru | --r)
+    ac_prev=runstatedir ;;
+  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+  | --run=* | --ru=* | --r=*)
+    runstatedir=$ac_optarg ;;
+
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1312,7 +1326,7 @@ 
 for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
 		datadir sysconfdir sharedstatedir localstatedir includedir \
 		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-		libdir localedir mandir
+		libdir localedir mandir runstatedir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1472,6 +1486,7 @@ 
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
@@ -1530,6 +1545,7 @@ 
   --disable-libquadmath-support
                           disable libquadmath support for Fortran
   --enable-libada         build libada directory
+  --enable-libgm2         build libgm2 directory
   --enable-libssp         build libssp directory
   --disable-libstdcxx     do not build libstdc++-v3 directory
   --enable-liboffloadmic=ARG
@@ -1665,6 +1681,8 @@ 
               GOC for the target
   GDC_FOR_TARGET
               GDC for the target
+  GM2_FOR_TARGET
+              GM2 for the target
   AR_FOR_TARGET
               AR for the target
   AS_FOR_TARGET
@@ -2801,7 +2819,7 @@ 
 # binutils, gas and ld appear in that order because it makes sense to run
 # "make check" in that particular order.
 # If --enable-gold is used, "gold" may replace "ld".
-host_tools="texinfo flex bison binutils gas ld fixincludes gcc cgen sid sim gdb gdbserver gprof etc expect dejagnu m4 utils guile fastjar gnattools libcc1 gotools c++tools"
+host_tools="texinfo flex bison binutils gas ld fixincludes gcc cgen sid sim gdb gdbserver gprof etc expect dejagnu m4 utils guile fastjar gnattools libcc1 gm2tools gotools c++tools"
 
 # these libraries are built for the target environment, and are built after
 # the host libraries and the host tools (which may be a cross compiler)
@@ -2823,6 +2841,7 @@ 
 		target-libffi \
 		target-libobjc \
 		target-libada \
+		target-libgm2 \
 		target-libgo \
 		target-libphobos \
 		target-zlib"
@@ -3160,6 +3179,17 @@ 
   noconfigdirs="$noconfigdirs gnattools"
 fi
 
+# Check whether --enable-libgm2 was given.
+if test "${enable_libgm2+set}" = set; then :
+  enableval=$enable_libgm2; ENABLE_LIBGM2=$enableval
+else
+  ENABLE_LIBGM2=no
+fi
+
+if test "${ENABLE_LIBGM2}" != "yes" ; then
+  noconfigdirs="$noconfigdirs gm2tools"
+fi
+
 # Check whether --enable-libssp was given.
 if test "${enable_libssp+set}" = set; then :
   enableval=$enable_libssp; ENABLE_LIBSSP=$enableval
@@ -13414,6 +13444,167 @@ 
 
 
 
+if test -n "$GM2_FOR_TARGET"; then
+  ac_cv_prog_GM2_FOR_TARGET=$GM2_FOR_TARGET
+elif test -n "$ac_cv_prog_GM2_FOR_TARGET"; then
+  GM2_FOR_TARGET=$ac_cv_prog_GM2_FOR_TARGET
+fi
+
+if test -n "$ac_cv_prog_GM2_FOR_TARGET"; then
+  for ncn_progname in gm2; do
+    # Extract the first word of "${ncn_progname}", so it can be a program name with args.
+set dummy ${ncn_progname}; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_GM2_FOR_TARGET+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$GM2_FOR_TARGET"; then
+  ac_cv_prog_GM2_FOR_TARGET="$GM2_FOR_TARGET" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_GM2_FOR_TARGET="${ncn_progname}"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+GM2_FOR_TARGET=$ac_cv_prog_GM2_FOR_TARGET
+if test -n "$GM2_FOR_TARGET"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GM2_FOR_TARGET" >&5
+$as_echo "$GM2_FOR_TARGET" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  done
+fi
+
+if test -z "$ac_cv_prog_GM2_FOR_TARGET" && test -n "$with_build_time_tools"; then
+  for ncn_progname in gm2; do
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ncn_progname} in $with_build_time_tools" >&5
+$as_echo_n "checking for ${ncn_progname} in $with_build_time_tools... " >&6; }
+    if test -x $with_build_time_tools/${ncn_progname}; then
+      ac_cv_prog_GM2_FOR_TARGET=$with_build_time_tools/${ncn_progname}
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+      break
+    else
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+    fi
+  done
+fi
+
+if test -z "$ac_cv_prog_GM2_FOR_TARGET"; then
+  for ncn_progname in gm2; do
+    if test -n "$ncn_target_tool_prefix"; then
+      # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args.
+set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_GM2_FOR_TARGET+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$GM2_FOR_TARGET"; then
+  ac_cv_prog_GM2_FOR_TARGET="$GM2_FOR_TARGET" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_GM2_FOR_TARGET="${ncn_target_tool_prefix}${ncn_progname}"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+GM2_FOR_TARGET=$ac_cv_prog_GM2_FOR_TARGET
+if test -n "$GM2_FOR_TARGET"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GM2_FOR_TARGET" >&5
+$as_echo "$GM2_FOR_TARGET" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+    fi
+    if test -z "$ac_cv_prog_GM2_FOR_TARGET" && test $build = $target ; then
+      # Extract the first word of "${ncn_progname}", so it can be a program name with args.
+set dummy ${ncn_progname}; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_GM2_FOR_TARGET+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$GM2_FOR_TARGET"; then
+  ac_cv_prog_GM2_FOR_TARGET="$GM2_FOR_TARGET" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_GM2_FOR_TARGET="${ncn_progname}"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+GM2_FOR_TARGET=$ac_cv_prog_GM2_FOR_TARGET
+if test -n "$GM2_FOR_TARGET"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GM2_FOR_TARGET" >&5
+$as_echo "$GM2_FOR_TARGET" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+    fi
+    test -n "$ac_cv_prog_GM2_FOR_TARGET" && break
+  done
+fi
+
+if test -z "$ac_cv_prog_GM2_FOR_TARGET" ; then
+  set dummy gm2
+  if test $build = $target ; then
+    GM2_FOR_TARGET="$2"
+  else
+    GM2_FOR_TARGET="${ncn_target_tool_prefix}$2"
+  fi
+else
+  GM2_FOR_TARGET="$ac_cv_prog_GM2_FOR_TARGET"
+fi
+
+
+
 cat > conftest.c << \EOF
 #ifdef __GNUC__
   gcc_yay;
@@ -17085,6 +17276,51 @@ 
   fi
 fi
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking where to find the target gm2" >&5
+$as_echo_n "checking where to find the target gm2... " >&6; }
+if test "x${build}" != "x${host}" ; then
+  if expr "x$GM2_FOR_TARGET" : "x/" > /dev/null; then
+    # We already found the complete path
+    ac_dir=`dirname $GM2_FOR_TARGET`
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: pre-installed in $ac_dir" >&5
+$as_echo "pre-installed in $ac_dir" >&6; }
+  else
+    # Canadian cross, just use what we found
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: pre-installed" >&5
+$as_echo "pre-installed" >&6; }
+  fi
+else
+  ok=yes
+  case " ${configdirs} " in
+    *" gcc "*) ;;
+    *) ok=no ;;
+  esac
+  case ,${enable_languages}, in
+    *,m2,*) ;;
+    *) ok=no ;;
+  esac
+  if test $ok = yes; then
+    # An in-tree tool is available and we can use it
+    GM2_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/gm2 -B$$r/$(HOST_SUBDIR)/gcc/'
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: just compiled" >&5
+$as_echo "just compiled" >&6; }
+  elif expr "x$GM2_FOR_TARGET" : "x/" > /dev/null; then
+    # We already found the complete path
+    ac_dir=`dirname $GM2_FOR_TARGET`
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: pre-installed in $ac_dir" >&5
+$as_echo "pre-installed in $ac_dir" >&6; }
+  elif test "x$target" = "x$host"; then
+    # We can use an host tool
+    GM2_FOR_TARGET='$(GM2)'
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: host tool" >&5
+$as_echo "host tool" >&6; }
+  else
+    # We need a cross tool
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: pre-installed" >&5
+$as_echo "pre-installed" >&6; }
+  fi
+fi
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking where to find the target ld" >&5
 $as_echo_n "checking where to find the target ld... " >&6; }
 if test "x${build}" != "x${host}" ; then
@@ -17646,6 +17882,8 @@ 
 # Specify what files to not compare during bootstrap.
 
 compare_exclusions="gcc/cc*-checksum\$(objext) | gcc/ada/*tools/*"
+compare_exclusions="$compare_exclusions | gcc/m2/gm2-compiler-boot/M2Version*"
+compare_exclusions="$compare_exclusions | gcc/m2/gm2-compiler-boot/SYSTEM*"
 case "$target" in
   hppa*64*-*-hpux*) ;;
   hppa*-*-hpux*) compare_exclusions="$compare_exclusions | */libgcc/lib2funcs* | gcc/function-tests.o" ;;
--- gcc-git/configure.ac	2021-06-10 11:58:16.842976709 +0100
+++ gm2-floppsie/configure.ac	2021-06-17 10:20:53.191400495 +0100
@@ -140,7 +140,7 @@ 
 # binutils, gas and ld appear in that order because it makes sense to run
 # "make check" in that particular order.
 # If --enable-gold is used, "gold" may replace "ld".
-host_tools="texinfo flex bison binutils gas ld fixincludes gcc cgen sid sim gdb gdbserver gprof etc expect dejagnu m4 utils guile fastjar gnattools libcc1 gotools c++tools"
+host_tools="texinfo flex bison binutils gas ld fixincludes gcc cgen sid sim gdb gdbserver gprof etc expect dejagnu m4 utils guile fastjar gnattools libcc1 gm2tools gotools c++tools"
 
 # these libraries are built for the target environment, and are built after
 # the host libraries and the host tools (which may be a cross compiler)
@@ -162,6 +162,7 @@ 
 		target-libffi \
 		target-libobjc \
 		target-libada \
+		target-libgm2 \
 		target-libgo \
 		target-libphobos \
 		target-zlib"
@@ -459,6 +460,14 @@ 
   noconfigdirs="$noconfigdirs gnattools"
 fi
 
+AC_ARG_ENABLE(libgm2,
+[AS_HELP_STRING([--enable-libgm2], [build libgm2 directory])],
+ENABLE_LIBGM2=$enableval,
+ENABLE_LIBGM2=no)
+if test "${ENABLE_LIBGM2}" != "yes" ; then
+  noconfigdirs="$noconfigdirs gm2tools"
+fi
+
 AC_ARG_ENABLE(libssp,
 [AS_HELP_STRING([--enable-libssp], [build libssp directory])],
 ENABLE_LIBSSP=$enableval,
@@ -3494,6 +3503,7 @@ 
 NCN_STRICT_CHECK_TARGET_TOOLS(GFORTRAN_FOR_TARGET, gfortran)
 NCN_STRICT_CHECK_TARGET_TOOLS(GOC_FOR_TARGET, gccgo)
 NCN_STRICT_CHECK_TARGET_TOOLS(GDC_FOR_TARGET, gdc)
+NCN_STRICT_CHECK_TARGET_TOOLS(GM2_FOR_TARGET, gm2)
 
 ACX_CHECK_INSTALLED_TARGET_TOOL(AR_FOR_TARGET, ar)
 ACX_CHECK_INSTALLED_TARGET_TOOL(AS_FOR_TARGET, as)
@@ -3530,6 +3540,8 @@ 
 		[gcc/gccgo -B$$r/$(HOST_SUBDIR)/gcc/], go)
 GCC_TARGET_TOOL(gdc, GDC_FOR_TARGET, GDC,
 		[gcc/gdc -B$$r/$(HOST_SUBDIR)/gcc/], d)
+GCC_TARGET_TOOL(gm2, GM2_FOR_TARGET, GM2,
+		[gcc/gm2 -B$$r/$(HOST_SUBDIR)/gcc/], m2)
 GCC_TARGET_TOOL(ld, LD_FOR_TARGET, LD, [ld/ld-new])
 GCC_TARGET_TOOL(lipo, LIPO_FOR_TARGET, LIPO)
 GCC_TARGET_TOOL(nm, NM_FOR_TARGET, NM, [binutils/nm-new])
@@ -3656,6 +3668,8 @@ 
 # Specify what files to not compare during bootstrap.
 
 compare_exclusions="gcc/cc*-checksum\$(objext) | gcc/ada/*tools/*"
+compare_exclusions="$compare_exclusions | gcc/m2/gm2-compiler-boot/M2Version*"
+compare_exclusions="$compare_exclusions | gcc/m2/gm2-compiler-boot/SYSTEM*"
 case "$target" in
   hppa*64*-*-hpux*) ;;
   hppa*-*-hpux*) compare_exclusions="$compare_exclusions | */libgcc/lib2funcs* | gcc/function-tests.o" ;;
--- gcc-git/gcc/c/gccspec.c	2021-06-10 11:58:17.710982159 +0100
+++ gm2-floppsie/gcc/c/gccspec.c	2021-06-17 10:20:53.195400499 +0100
@@ -105,3 +105,9 @@ 
 
 /* Number of extra output files that lang_specific_pre_link may generate.  */
 int lang_specific_extra_outfiles = 0;  /* Not used for C.  */
+
+/* lang_register_spec_functions.  Not used for C.  */
+void
+lang_register_spec_functions (void)
+{
+}
--- gcc-git/gcc/c-family/cppspec.c	2021-06-10 11:58:17.694982057 +0100
+++ gm2-floppsie/gcc/c-family/cppspec.c	2021-06-17 10:20:53.195400499 +0100
@@ -198,3 +198,9 @@ 
 
 /* Number of extra output files that lang_specific_pre_link may generate.  */
 int lang_specific_extra_outfiles = 0;  /* Not used for cpp.  */
+
+/* lang_register_spec_functions.  Not used for cpp.  */
+void
+lang_register_spec_functions (void)
+{
+}
--- gcc-git/gcc/cp/g++spec.c	2021-06-10 11:58:18.246985525 +0100
+++ gm2-floppsie/gcc/cp/g++spec.c	2021-06-17 10:20:53.195400499 +0100
@@ -434,3 +434,9 @@ 
 
 /* Number of extra output files that lang_specific_pre_link may generate.  */
 int lang_specific_extra_outfiles = 0;  /* Not used for C++.  */
+
+/* lang_register_spec_functions.  Not used for C++.  */
+void
+lang_register_spec_functions (void)
+{
+}
--- gcc-git/gcc/gcc.c	2021-06-10 11:58:18.494987083 +0100
+++ gm2-floppsie/gcc/gcc.c	2021-06-17 10:20:53.199400503 +0100
@@ -334,6 +334,10 @@ 
 static const char *cross_compile = "0";
 #endif
 
+/* The lang specs might wish to override the default linker.
+ */
+int allow_linker = 1;
+
 /* Greatest exit code of sub-processes that has been encountered up to
    now.  */
 static int greatest_status = 1;
@@ -362,7 +366,6 @@ 
 static struct compiler *lookup_compiler (const char *, size_t, const char *);
 static char *build_search_list (const struct path_prefix *, const char *,
 				bool, bool);
-static void xputenv (const char *);
 static void putenv_from_prefixes (const struct path_prefix *, const char *,
 				  bool);
 static int access_check (const char *, int);
@@ -1148,6 +1151,7 @@ 
 /* We pass any -flto flags on to the linker, which is expected
    to understand them.  In practice, this means it had better be collect2.  */
 /* %{e*} includes -export-dynamic; see comment in common.opt.  */
+
 #ifndef LINK_COMMAND_SPEC
 #define LINK_COMMAND_SPEC "\
 %{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\
@@ -1781,6 +1785,10 @@ 
   { 0, 0 }
 };
 
+/* front end registered spec functions */
+static struct spec_function *lang_spec_functions = NULL;
+static unsigned int lang_spec_functions_length = 0;
+
 static int processing_spec_function;
 
 /* Add appropriate libgcc specs to OBSTACK, taking into account
@@ -2943,12 +2951,20 @@ 
 
 /* Add or change the value of an environment variable, outputting the
    change to standard error if in verbose mode.  */
-static void
+void
 xputenv (const char *string)
 {
   env.xput (string);
 }
 
+/* Get the environment variable through the managed env.  */
+
+const char *
+xgetenv (const char *key)
+{
+  return env.get (key);
+}
+
 /* Build a list of search directories from PATHS.
    PREFIX is a string to prepend to the list.
    If CHECK_DIR_P is true we ensure the directory exists.
@@ -3877,7 +3893,7 @@ 
 /* Save an option OPT with N_ARGS arguments in array ARGS, marking it
    as validated if VALIDATED and KNOWN if it is an internal switch.  */
 
-static void
+void
 save_switch (const char *opt, size_t n_args, const char *const *args,
 	     bool validated, bool known)
 {
@@ -3922,6 +3938,66 @@ 
   setenv ("SOURCE_DATE_EPOCH", source_date_epoch, 0);
 }
 
+void
+fe_add_linker_option (const char *option)
+{
+  add_linker_option (option, strlen (option));
+}
+
+/* Handle the -B option by adding the prefix to exec, startfile and
+   include search paths.  */
+
+void
+handle_OPT_B (const char *arg)
+{
+  size_t len = strlen (arg);
+
+  /* Catch the case where the user has forgotten to append a
+     directory separator to the path.  Note, they may be using
+     -B to add an executable name prefix, eg "i386-elf-", in
+     order to distinguish between multiple installations of
+     GCC in the same directory.  Hence we must check to see
+     if appending a directory separator actually makes a
+     valid directory name.  */
+  if (!IS_DIR_SEPARATOR (arg[len - 1])
+      && is_directory (arg, false))
+    {
+      char *tmp = XNEWVEC (char, len + 2);
+      strcpy (tmp, arg);
+      tmp[len] = DIR_SEPARATOR;
+      tmp[++len] = 0;
+      arg = tmp;
+    }
+
+  add_prefix (&exec_prefixes, arg, NULL,
+	      PREFIX_PRIORITY_B_OPT, 0, 0);
+  add_prefix (&startfile_prefixes, arg, NULL,
+	      PREFIX_PRIORITY_B_OPT, 0, 0);
+  add_prefix (&include_prefixes, arg, NULL,
+	      PREFIX_PRIORITY_B_OPT, 0, 0);
+}
+
+/* Save the infile.  */
+
+void
+fe_add_infile (const char *infile, const char *lang)
+{
+  add_infile (infile, lang);
+}
+
+/* Mark a file as compiled.  */
+
+void
+fe_mark_compiled (const char *name)
+{
+  int max = n_infiles + lang_specific_extra_outfiles;
+  int i;
+
+  for (i = 0; i < max; i++)
+    if (filename_cmp (name, infiles[i].name) == 0)
+      infiles[i].compiled = true;
+}
+
 /* Handle an option DECODED that is unknown to the option-processing
    machinery.  */
 
@@ -4423,33 +4499,7 @@ 
       break;
 
     case OPT_B:
-      {
-	size_t len = strlen (arg);
-
-	/* Catch the case where the user has forgotten to append a
-	   directory separator to the path.  Note, they may be using
-	   -B to add an executable name prefix, eg "i386-elf-", in
-	   order to distinguish between multiple installations of
-	   GCC in the same directory.  Hence we must check to see
-	   if appending a directory separator actually makes a
-	   valid directory name.  */
-	if (!IS_DIR_SEPARATOR (arg[len - 1])
-	    && is_directory (arg, false))
-	  {
-	    char *tmp = XNEWVEC (char, len + 2);
-	    strcpy (tmp, arg);
-	    tmp[len] = DIR_SEPARATOR;
-	    tmp[++len] = 0;
-	    arg = tmp;
-	  }
-
-	add_prefix (&exec_prefixes, arg, NULL,
-		    PREFIX_PRIORITY_B_OPT, 0, 0);
-	add_prefix (&startfile_prefixes, arg, NULL,
-		    PREFIX_PRIORITY_B_OPT, 0, 0);
-	add_prefix (&include_prefixes, arg, NULL,
-		    PREFIX_PRIORITY_B_OPT, 0, 0);
-      }
+      handle_OPT_B (arg);
       validated = true;
       break;
 
@@ -4572,6 +4622,69 @@ 
   return ret;
 }
 
+/* print_option a debugging routine to display option i with a leading desc
+   string.  */
+
+void
+print_option (const char *desc, unsigned int i,
+	      struct cl_decoded_option *in_decoded_options)
+{
+  printf (desc);
+  printf (" [%d]", i);
+  switch (in_decoded_options[i].opt_index)
+    {
+
+    case N_OPTS:
+      break;
+    case OPT_SPECIAL_unknown:
+      printf (" flag <unknown>");
+      break;
+    case OPT_SPECIAL_ignore:
+      printf (" flag <ignore>");
+      break;
+    case OPT_SPECIAL_program_name:
+      printf (" flag <program name>");
+      break;
+    case OPT_SPECIAL_input_file:
+      printf (" flag <input file name>");
+      break;
+    default:
+      printf (" flag [%s]",
+              cl_options[in_decoded_options[i].opt_index].opt_text);
+    }
+
+  if (in_decoded_options[i].arg == NULL)
+    printf (" no arg");
+  else
+    printf (" arg [%s]", in_decoded_options[i].arg);
+  printf (" orig text [%s]",
+          in_decoded_options[i].orig_option_with_args_text);
+  /* On some hosts value is declared as a long long int.  */
+  printf (" value [%ld]", (long int)in_decoded_options[i].value);
+  printf (" error [%d]\n", in_decoded_options[i].errors);
+}
+
+/* print_options display all options with a leading string desc.  */
+
+void
+print_options (const char *desc,
+	       unsigned int in_decoded_options_count,
+	       struct cl_decoded_option *in_decoded_options)
+{
+  for (unsigned int i = 0; i < in_decoded_options_count; i++)
+    print_option (desc, i, in_decoded_options);
+}
+
+/* dbg_options display all options.  */
+
+void
+dbg_options (unsigned int in_decoded_options_count,
+	     struct cl_decoded_option *in_decoded_options)
+{
+  print_options ("dbg_options", in_decoded_options_count,
+		 in_decoded_options);
+}
+
 /* Create the vector `switches' and its contents.
    Store its length in `n_switches'.  */
 
@@ -6731,6 +6844,33 @@ 
   return 0;
 }
 
+/* Allow the front end to register a spec function.  */
+
+void fe_add_spec_function (const char *name, const char *(*func) (int, const char **))
+{
+  const struct spec_function *f = lookup_spec_function (name);
+  struct spec_function *fl;
+  unsigned int i;
+
+  if (f != NULL)
+    fatal_error (input_location, "spec function (%s) already registered", name);
+
+  if (lang_spec_functions == NULL)
+    lang_spec_functions_length = 1;
+
+  lang_spec_functions_length++;
+  fl = (struct spec_function *) xmalloc (sizeof (const struct spec_function)*lang_spec_functions_length);
+  for (i=0; i<lang_spec_functions_length-2; i++)
+    fl[i] = lang_spec_functions[i];
+  free (lang_spec_functions);
+  lang_spec_functions = fl;
+
+  lang_spec_functions[lang_spec_functions_length-2].name = name;
+  lang_spec_functions[lang_spec_functions_length-2].func = func;
+  lang_spec_functions[lang_spec_functions_length-1].name = NULL;
+  lang_spec_functions[lang_spec_functions_length-1].func = NULL;
+}
+
 /* Look up a spec function.  */
 
 static const struct spec_function *
@@ -6742,6 +6882,11 @@ 
     if (strcmp (sf->name, name) == 0)
       return sf;
 
+  if (lang_spec_functions != NULL)
+    for (sf = lang_spec_functions; sf->name != NULL; sf++)
+      if (strcmp (sf->name, name) == 0)
+	return sf;
+
   return NULL;
 }
 
@@ -8228,6 +8373,8 @@ 
 			   accel_dir_suffix, dir_separator_str, NULL);
   just_machine_suffix = concat (spec_machine, dir_separator_str, NULL);
 
+  lang_register_spec_functions ();
+
   specs_file = find_a_file (&startfile_prefixes, "specs", R_OK, true);
   /* Read the specs file unless it is a default one.  */
   if (specs_file != 0 && strcmp (specs_file, "specs"))
@@ -8962,7 +9109,8 @@ 
 
   /* Run ld to link all the compiler output files.  */
 
-  if (num_linker_inputs > 0 && !seen_error () && print_subprocess_help < 2)
+  if (num_linker_inputs > 0 && !seen_error () && print_subprocess_help < 2
+      && allow_linker)
     {
       int tmp = execution_count;
 
@@ -9031,7 +9179,7 @@ 
   /* If options said don't run linker,
      complain about input files to be given to the linker.  */
 
-  if (! linker_was_run && !seen_error ())
+  if (! linker_was_run && !seen_error () && allow_linker)
     for (i = 0; (int) i < n_infiles; i++)
       if (explicit_link_files[i]
 	  && !(infiles[i].language && infiles[i].language[0] == '*'))
--- gcc-git/gcc/gcc.h	2021-06-10 11:58:18.494987083 +0100
+++ gm2-floppsie/gcc/gcc.h	2021-06-17 10:20:53.199400503 +0100
@@ -73,9 +73,28 @@ 
 extern int do_spec (const char *);
 extern void record_temp_file (const char *, int, int);
 extern void set_input (const char *);
+extern void save_switch (const char *opt, size_t n_args,
+			 const char *const *args,
+			 bool validated, bool known);
+extern void handle_OPT_B (const char *arg);
+extern void fe_add_infile (const char *infile, const char *lang);
+extern void fe_add_linker_option (const char *option);
+extern void fe_add_spec_function (const char *name, const char *(*func) (int, const char **));
+extern void xputenv (const char *value);
+extern const char *xgetenv (const char *key);
+extern void print_options (const char *desc,
+			   unsigned int in_decoded_options_count,
+			   struct cl_decoded_option *in_decoded_options);
+extern void print_option (const char *desc, unsigned int i,
+			  struct cl_decoded_option *in_decoded_options);
+extern void dbg_options (unsigned int in_decoded_options_count,
+			 struct cl_decoded_option *in_decoded_options);
+
 
 /* Spec files linked with gcc.c must provide definitions for these.  */
 
+extern void lang_register_spec_functions (void);
+
 /* Called before processing to change/add/remove arguments.  */
 extern void lang_specific_driver (struct cl_decoded_option **,
 				  unsigned int *, int *);
@@ -97,4 +116,8 @@ 
 					      void *user_data),
 				   void *user_data);
 
+/* Default setting is true, but can be overridden by the language
+   front end to prohibit the linker from being invoked.  */
+extern int allow_linker;
+
 #endif /* ! GCC_GCC_H */
--- gcc-git/Makefile.def	2021-06-10 11:58:16.806976484 +0100
+++ gm2-floppsie/Makefile.def	2021-06-17 10:20:53.203400506 +0100
@@ -140,6 +140,7 @@ 
 		extra_configure_flags='--enable-shared @extra_linker_plugin_flags@ @extra_linker_plugin_configure_flags@';
 		extra_make_flags='@extra_linker_plugin_flags@'; };
 host_modules= { module= libcc1; extra_configure_flags=--enable-shared; };
+host_modules= { module= gm2tools; };
 host_modules= { module= gotools; };
 host_modules= { module= libctf; bootstrap=true; };
 
@@ -179,6 +180,7 @@ 
 target_modules = { module= zlib; };
 target_modules = { module= rda; };
 target_modules = { module= libada; };
+target_modules = { module= libgm2; lib_path=.libs; };
 target_modules = { module= libgomp; bootstrap= true; lib_path=.libs; };
 target_modules = { module= libitm; lib_path=.libs; };
 target_modules = { module= libatomic; lib_path=.libs; };
@@ -297,6 +299,8 @@ 
 flags_to_pass = { flag= GOCFLAGS_FOR_TARGET ; };
 flags_to_pass = { flag= GDC_FOR_TARGET ; };
 flags_to_pass = { flag= GDCFLAGS_FOR_TARGET ; };
+flags_to_pass = { flag= GM2_FOR_TARGET ; };
+flags_to_pass = { flag= GM2FLAGS_FOR_TARGET ; };
 flags_to_pass = { flag= LD_FOR_TARGET ; };
 flags_to_pass = { flag= LIPO_FOR_TARGET ; };
 flags_to_pass = { flag= LDFLAGS_FOR_TARGET ; };
@@ -393,6 +397,8 @@ 
 // we want version.o from gcc, and implicitly depend on libcody
 dependencies = { module=all-c++tools; on=all-gcc; };
 dependencies = { module=all-gotools; on=all-target-libgo; };
+dependencies = { module=all-gm2tools; on=all-target-libgm2; };
+dependencies = { module=all-gm2tools; on=all-target-libstdc++-v3; };
 
 dependencies = { module=all-utils; on=all-libiberty; };
 
@@ -593,6 +599,8 @@ 
 dependencies = { module=all-target-libgo; on=all-target-libbacktrace; };
 dependencies = { module=all-target-libgo; on=all-target-libffi; };
 dependencies = { module=all-target-libgo; on=all-target-libatomic; };
+dependencies = { module=configure-target-libgm2; on=all-target-libstdc++-v3; };
+dependencies = { module=all-target-libgm2; on=all-target-libatomic; };
 dependencies = { module=configure-target-libphobos; on=configure-target-libbacktrace; };
 dependencies = { module=configure-target-libphobos; on=configure-target-zlib; };
 dependencies = { module=all-target-libphobos; on=all-target-libbacktrace; };
@@ -651,6 +659,9 @@ 
 languages = { language=go;	gcc-check-target=check-go;
 				lib-check-target=check-target-libgo;
 				lib-check-target=check-gotools; };
+languages = { language=m2;	gcc-check-target=check-m2; 
+				lib-check-target=check-target-libgm2;
+				lib-check-target=check-gm2tools; };
 languages = { language=d;	gcc-check-target=check-d;
 				lib-check-target=check-target-libphobos; };
 
--- gcc-git/Makefile.in	2021-06-10 11:58:16.818976558 +0100
+++ gm2-floppsie/Makefile.in	2021-06-17 10:21:30.000000000 +0100
@@ -158,6 +158,7 @@ 
 	GOCFLAGS="$(GOCFLAGS_FOR_BUILD)"; export GOCFLAGS; \
 	GDC="$(GDC_FOR_BUILD)"; export GDC; \
 	GDCFLAGS="$(GDCFLAGS_FOR_BUILD)"; export GDCFLAGS; \
+	GM2="$(GM2_FOR_BUILD)"; export GM2; \
 	DLLTOOL="$(DLLTOOL_FOR_BUILD)"; export DLLTOOL; \
 	LD="$(LD_FOR_BUILD)"; export LD; \
 	LDFLAGS="$(LDFLAGS_FOR_BUILD)"; export LDFLAGS; \
@@ -195,6 +196,7 @@ 
 	GFORTRAN="$(GFORTRAN)"; export GFORTRAN; \
 	GOC="$(GOC)"; export GOC; \
 	GDC="$(GDC)"; export GDC; \
+	GM2="$(GM2)"; export GM2; \
 	AR="$(AR)"; export AR; \
 	AS="$(AS)"; export AS; \
 	CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \
@@ -293,6 +295,7 @@ 
 	GFORTRAN="$(GFORTRAN_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GFORTRAN; \
 	GOC="$(GOC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GOC; \
 	GDC="$(GDC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GDC; \
+	GM2="$(GM2_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GM2; \
 	DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \
 	LD="$(COMPILER_LD_FOR_TARGET)"; export LD; \
 	LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \
@@ -359,6 +362,7 @@ 
 GFORTRAN_FOR_BUILD = @GFORTRAN_FOR_BUILD@
 GOC_FOR_BUILD = @GOC_FOR_BUILD@
 GDC_FOR_BUILD = @GDC_FOR_BUILD@
+GM2_FOR_BUILD = @GM2_FOR_BUILD@
 LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@
 LD_FOR_BUILD = @LD_FOR_BUILD@
 NM_FOR_BUILD = @NM_FOR_BUILD@
@@ -428,6 +432,7 @@ 
 LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
 GOCFLAGS = $(CFLAGS)
 GDCFLAGS = $(CFLAGS)
+GM2FLAGS = $(CFLAGS)
 
 CREATE_GCOV = create_gcov
 
@@ -595,6 +600,7 @@ 
 GFORTRAN_FOR_TARGET=$(STAGE_CC_WRAPPER) @GFORTRAN_FOR_TARGET@
 GOC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GOC_FOR_TARGET@
 GDC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GDC_FOR_TARGET@
+GM2_FOR_TARGET=$(STAGE_CC_WRAPPER) @GM2_FOR_TARGET@
 DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@
 LD_FOR_TARGET=@LD_FOR_TARGET@
 
@@ -619,6 +625,7 @@ 
 LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
 LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
 LDFLAGS_FOR_TARGET = @LDFLAGS_FOR_TARGET@
+GM2FLAGS_FOR_TARGET = -O2 -g
 GOCFLAGS_FOR_TARGET = -O2 -g
 GDCFLAGS_FOR_TARGET = -O2 -g
 
@@ -645,7 +652,7 @@ 
 
 # This is the list of directories that may be needed in RPATH_ENVVAR
 # so that programs built for the target machine work.
-TARGET_LIB_PATH = $(TARGET_LIB_PATH_libstdc++-v3)$(TARGET_LIB_PATH_libsanitizer)$(TARGET_LIB_PATH_libvtv)$(TARGET_LIB_PATH_liboffloadmic)$(TARGET_LIB_PATH_libssp)$(TARGET_LIB_PATH_libphobos)$(TARGET_LIB_PATH_libgomp)$(TARGET_LIB_PATH_libitm)$(TARGET_LIB_PATH_libatomic)$(HOST_LIB_PATH_gcc)
+TARGET_LIB_PATH = $(TARGET_LIB_PATH_libstdc++-v3)$(TARGET_LIB_PATH_libsanitizer)$(TARGET_LIB_PATH_libvtv)$(TARGET_LIB_PATH_liboffloadmic)$(TARGET_LIB_PATH_libssp)$(TARGET_LIB_PATH_libphobos)$(TARGET_LIB_PATH_libgm2)$(TARGET_LIB_PATH_libgomp)$(TARGET_LIB_PATH_libitm)$(TARGET_LIB_PATH_libatomic)$(HOST_LIB_PATH_gcc)
 
 @if target-libstdc++-v3
 TARGET_LIB_PATH_libstdc++-v3 = $$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs:
@@ -671,6 +678,10 @@ 
 TARGET_LIB_PATH_libphobos = $$r/$(TARGET_SUBDIR)/libphobos/src/.libs:
 @endif target-libphobos
 
+@if target-libgm2
+TARGET_LIB_PATH_libgm2 = $$r/$(TARGET_SUBDIR)/libgm2/.libs:
+@endif target-libgm2
+
 @if target-libgomp
 TARGET_LIB_PATH_libgomp = $$r/$(TARGET_SUBDIR)/libgomp/.libs:
 @endif target-libgomp
@@ -820,6 +831,8 @@ 
 	"GOCFLAGS_FOR_TARGET=$(GOCFLAGS_FOR_TARGET)" \
 	"GDC_FOR_TARGET=$(GDC_FOR_TARGET)" \
 	"GDCFLAGS_FOR_TARGET=$(GDCFLAGS_FOR_TARGET)" \
+	"GM2_FOR_TARGET=$(GM2_FOR_TARGET)" \
+	"GM2FLAGS_FOR_TARGET=$(GM2FLAGS_FOR_TARGET)" \
 	"LD_FOR_TARGET=$(LD_FOR_TARGET)" \
 	"LIPO_FOR_TARGET=$(LIPO_FOR_TARGET)" \
 	"LDFLAGS_FOR_TARGET=$(LDFLAGS_FOR_TARGET)" \
@@ -892,6 +905,7 @@ 
 	'GFORTRAN=$(GFORTRAN)' \
 	'GOC=$(GOC)' \
 	'GDC=$(GDC)' \
+	'GM2=$(GM2)' \
 	'LD=$(LD)' \
 	'LIPO=$(LIPO)' \
 	'NM=$(NM)' \
@@ -918,6 +932,7 @@ 
 	CC="$${CC}" CC_FOR_BUILD="$${CC_FOR_BUILD}" \
 	CXX="$${CXX}" CXX_FOR_BUILD="$${CXX_FOR_BUILD}" \
 	GDC="$${GDC}" GDC_FOR_BUILD="$${GDC_FOR_BUILD}" \
+	GM2="$${GM2}" GM2_FOR_BUILD="$${GM2_FOR_BUILD}" \
 	GNATBIND="$${GNATBIND}" \
 	LDFLAGS="$${LDFLAGS}" \
 	HOST_LIBS="$${HOST_LIBS}" \
@@ -952,6 +967,8 @@ 
 	'GOCFLAGS=$$(GOCFLAGS_FOR_TARGET)' \
 	'GDC=$$(GDC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
 	'GDCFLAGS=$$(GDCFLAGS_FOR_TARGET)' \
+	'GM2=$$(GM2_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
+	'GM2FLAGS=$$(GM2FLAGS_FOR_TARGET)' \
 	'LD=$(COMPILER_LD_FOR_TARGET)' \
 	'LDFLAGS=$$(LDFLAGS_FOR_TARGET)' \
 	'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET)' \
@@ -978,6 +995,7 @@ 
 # cross-building scheme.
 EXTRA_GCC_FLAGS = \
 	"GCC_FOR_TARGET=$(GCC_FOR_TARGET)" \
+	"GM2_FOR_TARGET=$(GM2_FOR_TARGET)" \
 	"`echo 'STMP_FIXPROTO=$(STMP_FIXPROTO)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
 	"`echo 'LIMITS_H_TEST=$(LIMITS_H_TEST)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
 
@@ -1042,6 +1060,7 @@ 
     maybe-configure-gnattools \
     maybe-configure-lto-plugin \
     maybe-configure-libcc1 \
+    maybe-configure-gm2tools \
     maybe-configure-gotools \
     maybe-configure-libctf
 .PHONY: configure-target
@@ -1066,6 +1085,7 @@ 
     maybe-configure-target-zlib \
     maybe-configure-target-rda \
     maybe-configure-target-libada \
+    maybe-configure-target-libgm2 \
     maybe-configure-target-libgomp \
     maybe-configure-target-libitm \
     maybe-configure-target-libatomic
@@ -1203,6 +1223,7 @@ 
 all-host: maybe-all-lto-plugin
 @endif lto-plugin-no-bootstrap
 all-host: maybe-all-libcc1
+all-host: maybe-all-gm2tools
 all-host: maybe-all-gotools
 @if libctf-no-bootstrap
 all-host: maybe-all-libctf
@@ -1238,6 +1259,7 @@ 
 all-target: maybe-all-target-zlib
 all-target: maybe-all-target-rda
 all-target: maybe-all-target-libada
+all-target: maybe-all-target-libgm2
 @if target-libgomp-no-bootstrap
 all-target: maybe-all-target-libgomp
 @endif target-libgomp-no-bootstrap
@@ -1310,6 +1332,7 @@ 
 info-host: maybe-info-gnattools
 info-host: maybe-info-lto-plugin
 info-host: maybe-info-libcc1
+info-host: maybe-info-gm2tools
 info-host: maybe-info-gotools
 info-host: maybe-info-libctf
 
@@ -1335,6 +1358,7 @@ 
 info-target: maybe-info-target-zlib
 info-target: maybe-info-target-rda
 info-target: maybe-info-target-libada
+info-target: maybe-info-target-libgm2
 info-target: maybe-info-target-libgomp
 info-target: maybe-info-target-libitm
 info-target: maybe-info-target-libatomic
@@ -1400,6 +1424,7 @@ 
 dvi-host: maybe-dvi-gnattools
 dvi-host: maybe-dvi-lto-plugin
 dvi-host: maybe-dvi-libcc1
+dvi-host: maybe-dvi-gm2tools
 dvi-host: maybe-dvi-gotools
 dvi-host: maybe-dvi-libctf
 
@@ -1425,6 +1450,7 @@ 
 dvi-target: maybe-dvi-target-zlib
 dvi-target: maybe-dvi-target-rda
 dvi-target: maybe-dvi-target-libada
+dvi-target: maybe-dvi-target-libgm2
 dvi-target: maybe-dvi-target-libgomp
 dvi-target: maybe-dvi-target-libitm
 dvi-target: maybe-dvi-target-libatomic
@@ -1490,6 +1516,7 @@ 
 pdf-host: maybe-pdf-gnattools
 pdf-host: maybe-pdf-lto-plugin
 pdf-host: maybe-pdf-libcc1
+pdf-host: maybe-pdf-gm2tools
 pdf-host: maybe-pdf-gotools
 pdf-host: maybe-pdf-libctf
 
@@ -1515,6 +1542,7 @@ 
 pdf-target: maybe-pdf-target-zlib
 pdf-target: maybe-pdf-target-rda
 pdf-target: maybe-pdf-target-libada
+pdf-target: maybe-pdf-target-libgm2
 pdf-target: maybe-pdf-target-libgomp
 pdf-target: maybe-pdf-target-libitm
 pdf-target: maybe-pdf-target-libatomic
@@ -1580,6 +1608,7 @@ 
 html-host: maybe-html-gnattools
 html-host: maybe-html-lto-plugin
 html-host: maybe-html-libcc1
+html-host: maybe-html-gm2tools
 html-host: maybe-html-gotools
 html-host: maybe-html-libctf
 
@@ -1605,6 +1634,7 @@ 
 html-target: maybe-html-target-zlib
 html-target: maybe-html-target-rda
 html-target: maybe-html-target-libada
+html-target: maybe-html-target-libgm2
 html-target: maybe-html-target-libgomp
 html-target: maybe-html-target-libitm
 html-target: maybe-html-target-libatomic
@@ -1670,6 +1700,7 @@ 
 TAGS-host: maybe-TAGS-gnattools
 TAGS-host: maybe-TAGS-lto-plugin
 TAGS-host: maybe-TAGS-libcc1
+TAGS-host: maybe-TAGS-gm2tools
 TAGS-host: maybe-TAGS-gotools
 TAGS-host: maybe-TAGS-libctf
 
@@ -1695,6 +1726,7 @@ 
 TAGS-target: maybe-TAGS-target-zlib
 TAGS-target: maybe-TAGS-target-rda
 TAGS-target: maybe-TAGS-target-libada
+TAGS-target: maybe-TAGS-target-libgm2
 TAGS-target: maybe-TAGS-target-libgomp
 TAGS-target: maybe-TAGS-target-libitm
 TAGS-target: maybe-TAGS-target-libatomic
@@ -1760,6 +1792,7 @@ 
 install-info-host: maybe-install-info-gnattools
 install-info-host: maybe-install-info-lto-plugin
 install-info-host: maybe-install-info-libcc1
+install-info-host: maybe-install-info-gm2tools
 install-info-host: maybe-install-info-gotools
 install-info-host: maybe-install-info-libctf
 
@@ -1785,6 +1818,7 @@ 
 install-info-target: maybe-install-info-target-zlib
 install-info-target: maybe-install-info-target-rda
 install-info-target: maybe-install-info-target-libada
+install-info-target: maybe-install-info-target-libgm2
 install-info-target: maybe-install-info-target-libgomp
 install-info-target: maybe-install-info-target-libitm
 install-info-target: maybe-install-info-target-libatomic
@@ -1850,6 +1884,7 @@ 
 install-pdf-host: maybe-install-pdf-gnattools
 install-pdf-host: maybe-install-pdf-lto-plugin
 install-pdf-host: maybe-install-pdf-libcc1
+install-pdf-host: maybe-install-pdf-gm2tools
 install-pdf-host: maybe-install-pdf-gotools
 install-pdf-host: maybe-install-pdf-libctf
 
@@ -1875,6 +1910,7 @@ 
 install-pdf-target: maybe-install-pdf-target-zlib
 install-pdf-target: maybe-install-pdf-target-rda
 install-pdf-target: maybe-install-pdf-target-libada
+install-pdf-target: maybe-install-pdf-target-libgm2
 install-pdf-target: maybe-install-pdf-target-libgomp
 install-pdf-target: maybe-install-pdf-target-libitm
 install-pdf-target: maybe-install-pdf-target-libatomic
@@ -1940,6 +1976,7 @@ 
 install-html-host: maybe-install-html-gnattools
 install-html-host: maybe-install-html-lto-plugin
 install-html-host: maybe-install-html-libcc1
+install-html-host: maybe-install-html-gm2tools
 install-html-host: maybe-install-html-gotools
 install-html-host: maybe-install-html-libctf
 
@@ -1965,6 +2002,7 @@ 
 install-html-target: maybe-install-html-target-zlib
 install-html-target: maybe-install-html-target-rda
 install-html-target: maybe-install-html-target-libada
+install-html-target: maybe-install-html-target-libgm2
 install-html-target: maybe-install-html-target-libgomp
 install-html-target: maybe-install-html-target-libitm
 install-html-target: maybe-install-html-target-libatomic
@@ -2030,6 +2068,7 @@ 
 installcheck-host: maybe-installcheck-gnattools
 installcheck-host: maybe-installcheck-lto-plugin
 installcheck-host: maybe-installcheck-libcc1
+installcheck-host: maybe-installcheck-gm2tools
 installcheck-host: maybe-installcheck-gotools
 installcheck-host: maybe-installcheck-libctf
 
@@ -2055,6 +2094,7 @@ 
 installcheck-target: maybe-installcheck-target-zlib
 installcheck-target: maybe-installcheck-target-rda
 installcheck-target: maybe-installcheck-target-libada
+installcheck-target: maybe-installcheck-target-libgm2
 installcheck-target: maybe-installcheck-target-libgomp
 installcheck-target: maybe-installcheck-target-libitm
 installcheck-target: maybe-installcheck-target-libatomic
@@ -2120,6 +2160,7 @@ 
 mostlyclean-host: maybe-mostlyclean-gnattools
 mostlyclean-host: maybe-mostlyclean-lto-plugin
 mostlyclean-host: maybe-mostlyclean-libcc1
+mostlyclean-host: maybe-mostlyclean-gm2tools
 mostlyclean-host: maybe-mostlyclean-gotools
 mostlyclean-host: maybe-mostlyclean-libctf
 
@@ -2145,6 +2186,7 @@ 
 mostlyclean-target: maybe-mostlyclean-target-zlib
 mostlyclean-target: maybe-mostlyclean-target-rda
 mostlyclean-target: maybe-mostlyclean-target-libada
+mostlyclean-target: maybe-mostlyclean-target-libgm2
 mostlyclean-target: maybe-mostlyclean-target-libgomp
 mostlyclean-target: maybe-mostlyclean-target-libitm
 mostlyclean-target: maybe-mostlyclean-target-libatomic
@@ -2210,6 +2252,7 @@ 
 clean-host: maybe-clean-gnattools
 clean-host: maybe-clean-lto-plugin
 clean-host: maybe-clean-libcc1
+clean-host: maybe-clean-gm2tools
 clean-host: maybe-clean-gotools
 clean-host: maybe-clean-libctf
 
@@ -2235,6 +2278,7 @@ 
 clean-target: maybe-clean-target-zlib
 clean-target: maybe-clean-target-rda
 clean-target: maybe-clean-target-libada
+clean-target: maybe-clean-target-libgm2
 clean-target: maybe-clean-target-libgomp
 clean-target: maybe-clean-target-libitm
 clean-target: maybe-clean-target-libatomic
@@ -2300,6 +2344,7 @@ 
 distclean-host: maybe-distclean-gnattools
 distclean-host: maybe-distclean-lto-plugin
 distclean-host: maybe-distclean-libcc1
+distclean-host: maybe-distclean-gm2tools
 distclean-host: maybe-distclean-gotools
 distclean-host: maybe-distclean-libctf
 
@@ -2325,6 +2370,7 @@ 
 distclean-target: maybe-distclean-target-zlib
 distclean-target: maybe-distclean-target-rda
 distclean-target: maybe-distclean-target-libada
+distclean-target: maybe-distclean-target-libgm2
 distclean-target: maybe-distclean-target-libgomp
 distclean-target: maybe-distclean-target-libitm
 distclean-target: maybe-distclean-target-libatomic
@@ -2390,6 +2436,7 @@ 
 maintainer-clean-host: maybe-maintainer-clean-gnattools
 maintainer-clean-host: maybe-maintainer-clean-lto-plugin
 maintainer-clean-host: maybe-maintainer-clean-libcc1
+maintainer-clean-host: maybe-maintainer-clean-gm2tools
 maintainer-clean-host: maybe-maintainer-clean-gotools
 maintainer-clean-host: maybe-maintainer-clean-libctf
 
@@ -2415,6 +2462,7 @@ 
 maintainer-clean-target: maybe-maintainer-clean-target-zlib
 maintainer-clean-target: maybe-maintainer-clean-target-rda
 maintainer-clean-target: maybe-maintainer-clean-target-libada
+maintainer-clean-target: maybe-maintainer-clean-target-libgm2
 maintainer-clean-target: maybe-maintainer-clean-target-libgomp
 maintainer-clean-target: maybe-maintainer-clean-target-libitm
 maintainer-clean-target: maybe-maintainer-clean-target-libatomic
@@ -2463,7 +2511,7 @@ 
 	-rm -f texinfo/doc/Makefile texinfo/po/POTFILES
 	-rmdir texinfo/doc texinfo/info texinfo/intl texinfo/lib 2>/dev/null
 	-rmdir texinfo/makeinfo texinfo/po texinfo/util 2>/dev/null
-	-rmdir c++tools fastjar gcc gnattools gotools 2>/dev/null
+	-rmdir c++tools fastjar gcc gnattools gm2tools gotools 2>/dev/null
 	-rmdir libcc1 libiberty texinfo zlib 2>/dev/null
 	-find . -name config.cache -exec rm -f {} \; \; 2>/dev/null
 
@@ -2536,6 +2584,7 @@ 
     maybe-check-gnattools \
     maybe-check-lto-plugin \
     maybe-check-libcc1 \
+    maybe-check-gm2tools \
     maybe-check-gotools \
     maybe-check-libctf
 
@@ -2561,6 +2610,7 @@ 
     maybe-check-target-zlib \
     maybe-check-target-rda \
     maybe-check-target-libada \
+    maybe-check-target-libgm2 \
     maybe-check-target-libgomp \
     maybe-check-target-libitm \
     maybe-check-target-libatomic
@@ -2673,6 +2723,7 @@ 
     maybe-install-gnattools \
     maybe-install-lto-plugin \
     maybe-install-libcc1 \
+    maybe-install-gm2tools \
     maybe-install-gotools \
     maybe-install-libctf
 
@@ -2728,6 +2779,7 @@ 
     maybe-install-gnattools \
     maybe-install-lto-plugin \
     maybe-install-libcc1 \
+    maybe-install-gm2tools \
     maybe-install-gotools \
     maybe-install-libctf
 
@@ -2753,6 +2805,7 @@ 
     maybe-install-target-zlib \
     maybe-install-target-rda \
     maybe-install-target-libada \
+    maybe-install-target-libgm2 \
     maybe-install-target-libgomp \
     maybe-install-target-libitm \
     maybe-install-target-libatomic
@@ -2838,6 +2891,7 @@ 
     maybe-install-strip-gnattools \
     maybe-install-strip-lto-plugin \
     maybe-install-strip-libcc1 \
+    maybe-install-strip-gm2tools \
     maybe-install-strip-gotools \
     maybe-install-strip-libctf
 
@@ -2863,6 +2917,7 @@ 
     maybe-install-strip-target-zlib \
     maybe-install-strip-target-rda \
     maybe-install-strip-target-libada \
+    maybe-install-strip-target-libgm2 \
     maybe-install-strip-target-libgomp \
     maybe-install-strip-target-libitm \
     maybe-install-strip-target-libatomic
@@ -40541,6 +40596,447 @@ 
 
 
 
+.PHONY: configure-gm2tools maybe-configure-gm2tools
+maybe-configure-gm2tools:
+@if gcc-bootstrap
+configure-gm2tools: stage_current
+@endif gcc-bootstrap
+@if gm2tools
+maybe-configure-gm2tools: configure-gm2tools
+configure-gm2tools: 
+	@: $(MAKE); $(unstage)
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	test ! -f $(HOST_SUBDIR)/gm2tools/Makefile || exit 0; \
+	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gm2tools; \
+	$(HOST_EXPORTS)  \
+	echo Configuring in $(HOST_SUBDIR)/gm2tools; \
+	cd "$(HOST_SUBDIR)/gm2tools" || exit 1; \
+	case $(srcdir) in \
+	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+	  *) topdir=`echo $(HOST_SUBDIR)/gm2tools/ | \
+		sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
+	esac; \
+	module_srcdir=gm2tools; \
+	$(SHELL) \
+	  $$s/$$module_srcdir/configure \
+	  --srcdir=$${topdir}/$$module_srcdir \
+	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
+	  --target=${target_alias}  \
+	  || exit 1
+@endif gm2tools
+
+
+
+
+
+.PHONY: all-gm2tools maybe-all-gm2tools
+maybe-all-gm2tools:
+@if gcc-bootstrap
+all-gm2tools: stage_current
+@endif gcc-bootstrap
+@if gm2tools
+TARGET-gm2tools=all
+maybe-all-gm2tools: all-gm2tools
+all-gm2tools: configure-gm2tools
+	@: $(MAKE); $(unstage)
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(HOST_EXPORTS)  \
+	(cd $(HOST_SUBDIR)/gm2tools && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS)  \
+		$(TARGET-gm2tools))
+@endif gm2tools
+
+
+
+
+.PHONY: check-gm2tools maybe-check-gm2tools
+maybe-check-gm2tools:
+@if gm2tools
+maybe-check-gm2tools: check-gm2tools
+
+check-gm2tools:
+	@: $(MAKE); $(unstage)
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(HOST_EXPORTS)  \
+	(cd $(HOST_SUBDIR)/gm2tools && \
+	  $(MAKE) $(FLAGS_TO_PASS)  check)
+
+@endif gm2tools
+
+.PHONY: install-gm2tools maybe-install-gm2tools
+maybe-install-gm2tools:
+@if gm2tools
+maybe-install-gm2tools: install-gm2tools
+
+install-gm2tools: installdirs
+	@: $(MAKE); $(unstage)
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(HOST_EXPORTS) \
+	(cd $(HOST_SUBDIR)/gm2tools && \
+	  $(MAKE) $(FLAGS_TO_PASS)  install)
+
+@endif gm2tools
+
+.PHONY: install-strip-gm2tools maybe-install-strip-gm2tools
+maybe-install-strip-gm2tools:
+@if gm2tools
+maybe-install-strip-gm2tools: install-strip-gm2tools
+
+install-strip-gm2tools: installdirs
+	@: $(MAKE); $(unstage)
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(HOST_EXPORTS) \
+	(cd $(HOST_SUBDIR)/gm2tools && \
+	  $(MAKE) $(FLAGS_TO_PASS)  install-strip)
+
+@endif gm2tools
+
+# Other targets (info, dvi, pdf, etc.)
+
+.PHONY: maybe-info-gm2tools info-gm2tools
+maybe-info-gm2tools:
+@if gm2tools
+maybe-info-gm2tools: info-gm2tools
+
+info-gm2tools: \
+    configure-gm2tools 
+	@: $(MAKE); $(unstage)
+	@[ -f ./gm2tools/Makefile ] || exit 0; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(HOST_EXPORTS) \
+	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	echo "Doing info in gm2tools"; \
+	(cd $(HOST_SUBDIR)/gm2tools && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	          info) \
+	  || exit 1
+
+@endif gm2tools
+
+.PHONY: maybe-dvi-gm2tools dvi-gm2tools
+maybe-dvi-gm2tools:
+@if gm2tools
+maybe-dvi-gm2tools: dvi-gm2tools
+
+dvi-gm2tools: \
+    configure-gm2tools 
+	@: $(MAKE); $(unstage)
+	@[ -f ./gm2tools/Makefile ] || exit 0; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(HOST_EXPORTS) \
+	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	echo "Doing dvi in gm2tools"; \
+	(cd $(HOST_SUBDIR)/gm2tools && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	          dvi) \
+	  || exit 1
+
+@endif gm2tools
+
+.PHONY: maybe-pdf-gm2tools pdf-gm2tools
+maybe-pdf-gm2tools:
+@if gm2tools
+maybe-pdf-gm2tools: pdf-gm2tools
+
+pdf-gm2tools: \
+    configure-gm2tools 
+	@: $(MAKE); $(unstage)
+	@[ -f ./gm2tools/Makefile ] || exit 0; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(HOST_EXPORTS) \
+	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	echo "Doing pdf in gm2tools"; \
+	(cd $(HOST_SUBDIR)/gm2tools && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	          pdf) \
+	  || exit 1
+
+@endif gm2tools
+
+.PHONY: maybe-html-gm2tools html-gm2tools
+maybe-html-gm2tools:
+@if gm2tools
+maybe-html-gm2tools: html-gm2tools
+
+html-gm2tools: \
+    configure-gm2tools 
+	@: $(MAKE); $(unstage)
+	@[ -f ./gm2tools/Makefile ] || exit 0; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(HOST_EXPORTS) \
+	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	echo "Doing html in gm2tools"; \
+	(cd $(HOST_SUBDIR)/gm2tools && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	          html) \
+	  || exit 1
+
+@endif gm2tools
+
+.PHONY: maybe-TAGS-gm2tools TAGS-gm2tools
+maybe-TAGS-gm2tools:
+@if gm2tools
+maybe-TAGS-gm2tools: TAGS-gm2tools
+
+TAGS-gm2tools: \
+    configure-gm2tools 
+	@: $(MAKE); $(unstage)
+	@[ -f ./gm2tools/Makefile ] || exit 0; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(HOST_EXPORTS) \
+	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	echo "Doing TAGS in gm2tools"; \
+	(cd $(HOST_SUBDIR)/gm2tools && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	          TAGS) \
+	  || exit 1
+
+@endif gm2tools
+
+.PHONY: maybe-install-info-gm2tools install-info-gm2tools
+maybe-install-info-gm2tools:
+@if gm2tools
+maybe-install-info-gm2tools: install-info-gm2tools
+
+install-info-gm2tools: \
+    configure-gm2tools \
+    info-gm2tools 
+	@: $(MAKE); $(unstage)
+	@[ -f ./gm2tools/Makefile ] || exit 0; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(HOST_EXPORTS) \
+	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	echo "Doing install-info in gm2tools"; \
+	(cd $(HOST_SUBDIR)/gm2tools && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	          install-info) \
+	  || exit 1
+
+@endif gm2tools
+
+.PHONY: maybe-install-pdf-gm2tools install-pdf-gm2tools
+maybe-install-pdf-gm2tools:
+@if gm2tools
+maybe-install-pdf-gm2tools: install-pdf-gm2tools
+
+install-pdf-gm2tools: \
+    configure-gm2tools \
+    pdf-gm2tools 
+	@: $(MAKE); $(unstage)
+	@[ -f ./gm2tools/Makefile ] || exit 0; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(HOST_EXPORTS) \
+	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	echo "Doing install-pdf in gm2tools"; \
+	(cd $(HOST_SUBDIR)/gm2tools && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	          install-pdf) \
+	  || exit 1
+
+@endif gm2tools
+
+.PHONY: maybe-install-html-gm2tools install-html-gm2tools
+maybe-install-html-gm2tools:
+@if gm2tools
+maybe-install-html-gm2tools: install-html-gm2tools
+
+install-html-gm2tools: \
+    configure-gm2tools \
+    html-gm2tools 
+	@: $(MAKE); $(unstage)
+	@[ -f ./gm2tools/Makefile ] || exit 0; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(HOST_EXPORTS) \
+	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	echo "Doing install-html in gm2tools"; \
+	(cd $(HOST_SUBDIR)/gm2tools && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	          install-html) \
+	  || exit 1
+
+@endif gm2tools
+
+.PHONY: maybe-installcheck-gm2tools installcheck-gm2tools
+maybe-installcheck-gm2tools:
+@if gm2tools
+maybe-installcheck-gm2tools: installcheck-gm2tools
+
+installcheck-gm2tools: \
+    configure-gm2tools 
+	@: $(MAKE); $(unstage)
+	@[ -f ./gm2tools/Makefile ] || exit 0; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(HOST_EXPORTS) \
+	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	echo "Doing installcheck in gm2tools"; \
+	(cd $(HOST_SUBDIR)/gm2tools && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	          installcheck) \
+	  || exit 1
+
+@endif gm2tools
+
+.PHONY: maybe-mostlyclean-gm2tools mostlyclean-gm2tools
+maybe-mostlyclean-gm2tools:
+@if gm2tools
+maybe-mostlyclean-gm2tools: mostlyclean-gm2tools
+
+mostlyclean-gm2tools: 
+	@: $(MAKE); $(unstage)
+	@[ -f ./gm2tools/Makefile ] || exit 0; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(HOST_EXPORTS) \
+	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	echo "Doing mostlyclean in gm2tools"; \
+	(cd $(HOST_SUBDIR)/gm2tools && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	          mostlyclean) \
+	  || exit 1
+
+@endif gm2tools
+
+.PHONY: maybe-clean-gm2tools clean-gm2tools
+maybe-clean-gm2tools:
+@if gm2tools
+maybe-clean-gm2tools: clean-gm2tools
+
+clean-gm2tools: 
+	@: $(MAKE); $(unstage)
+	@[ -f ./gm2tools/Makefile ] || exit 0; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(HOST_EXPORTS) \
+	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	echo "Doing clean in gm2tools"; \
+	(cd $(HOST_SUBDIR)/gm2tools && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	          clean) \
+	  || exit 1
+
+@endif gm2tools
+
+.PHONY: maybe-distclean-gm2tools distclean-gm2tools
+maybe-distclean-gm2tools:
+@if gm2tools
+maybe-distclean-gm2tools: distclean-gm2tools
+
+distclean-gm2tools: 
+	@: $(MAKE); $(unstage)
+	@[ -f ./gm2tools/Makefile ] || exit 0; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(HOST_EXPORTS) \
+	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	echo "Doing distclean in gm2tools"; \
+	(cd $(HOST_SUBDIR)/gm2tools && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	          distclean) \
+	  || exit 1
+
+@endif gm2tools
+
+.PHONY: maybe-maintainer-clean-gm2tools maintainer-clean-gm2tools
+maybe-maintainer-clean-gm2tools:
+@if gm2tools
+maybe-maintainer-clean-gm2tools: maintainer-clean-gm2tools
+
+maintainer-clean-gm2tools: 
+	@: $(MAKE); $(unstage)
+	@[ -f ./gm2tools/Makefile ] || exit 0; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(HOST_EXPORTS) \
+	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	echo "Doing maintainer-clean in gm2tools"; \
+	(cd $(HOST_SUBDIR)/gm2tools && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	          maintainer-clean) \
+	  || exit 1
+
+@endif gm2tools
+
+
+
 .PHONY: configure-gotools maybe-configure-gotools
 maybe-configure-gotools:
 @if gcc-bootstrap
@@ -54318,6 +54814,464 @@ 
 
 
 
+.PHONY: configure-target-libgm2 maybe-configure-target-libgm2
+maybe-configure-target-libgm2:
+@if gcc-bootstrap
+configure-target-libgm2: stage_current
+@endif gcc-bootstrap
+@if target-libgm2
+maybe-configure-target-libgm2: configure-target-libgm2
+configure-target-libgm2: 
+	@: $(MAKE); $(unstage)
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	echo "Checking multilib configuration for libgm2..."; \
+	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libgm2; \
+	$(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/libgm2/multilib.tmp 2> /dev/null; \
+	if test -r $(TARGET_SUBDIR)/libgm2/multilib.out; then \
+	  if cmp -s $(TARGET_SUBDIR)/libgm2/multilib.tmp $(TARGET_SUBDIR)/libgm2/multilib.out; then \
+	    rm -f $(TARGET_SUBDIR)/libgm2/multilib.tmp; \
+	  else \
+	    rm -f $(TARGET_SUBDIR)/libgm2/Makefile; \
+	    mv $(TARGET_SUBDIR)/libgm2/multilib.tmp $(TARGET_SUBDIR)/libgm2/multilib.out; \
+	  fi; \
+	else \
+	  mv $(TARGET_SUBDIR)/libgm2/multilib.tmp $(TARGET_SUBDIR)/libgm2/multilib.out; \
+	fi; \
+	test ! -f $(TARGET_SUBDIR)/libgm2/Makefile || exit 0; \
+	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libgm2; \
+	$(NORMAL_TARGET_EXPORTS)  \
+	echo Configuring in $(TARGET_SUBDIR)/libgm2; \
+	cd "$(TARGET_SUBDIR)/libgm2" || exit 1; \
+	case $(srcdir) in \
+	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+	  *) topdir=`echo $(TARGET_SUBDIR)/libgm2/ | \
+		sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
+	esac; \
+	module_srcdir=libgm2; \
+	rm -f no-such-file || : ; \
+	CONFIG_SITE=no-such-file $(SHELL) \
+	  $$s/$$module_srcdir/configure \
+	  --srcdir=$${topdir}/$$module_srcdir \
+	  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
+	  --target=${target_alias}  \
+	  || exit 1
+@endif target-libgm2
+
+
+
+
+
+.PHONY: all-target-libgm2 maybe-all-target-libgm2
+maybe-all-target-libgm2:
+@if gcc-bootstrap
+all-target-libgm2: stage_current
+@endif gcc-bootstrap
+@if target-libgm2
+TARGET-target-libgm2=all
+maybe-all-target-libgm2: all-target-libgm2
+all-target-libgm2: configure-target-libgm2
+	@: $(MAKE); $(unstage)
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS)  \
+	(cd $(TARGET_SUBDIR)/libgm2 && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)   \
+		$(TARGET-target-libgm2))
+@endif target-libgm2
+
+
+
+
+
+.PHONY: check-target-libgm2 maybe-check-target-libgm2
+maybe-check-target-libgm2:
+@if target-libgm2
+maybe-check-target-libgm2: check-target-libgm2
+
+check-target-libgm2:
+	@: $(MAKE); $(unstage)
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	(cd $(TARGET_SUBDIR)/libgm2 && \
+	  $(MAKE) $(TARGET_FLAGS_TO_PASS)   check)
+
+@endif target-libgm2
+
+.PHONY: install-target-libgm2 maybe-install-target-libgm2
+maybe-install-target-libgm2:
+@if target-libgm2
+maybe-install-target-libgm2: install-target-libgm2
+
+install-target-libgm2: installdirs
+	@: $(MAKE); $(unstage)
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	(cd $(TARGET_SUBDIR)/libgm2 && \
+	  $(MAKE) $(TARGET_FLAGS_TO_PASS)  install)
+
+@endif target-libgm2
+
+.PHONY: install-strip-target-libgm2 maybe-install-strip-target-libgm2
+maybe-install-strip-target-libgm2:
+@if target-libgm2
+maybe-install-strip-target-libgm2: install-strip-target-libgm2
+
+install-strip-target-libgm2: installdirs
+	@: $(MAKE); $(unstage)
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	(cd $(TARGET_SUBDIR)/libgm2 && \
+	  $(MAKE) $(TARGET_FLAGS_TO_PASS)  install-strip)
+
+@endif target-libgm2
+
+# Other targets (info, dvi, pdf, etc.)
+
+.PHONY: maybe-info-target-libgm2 info-target-libgm2
+maybe-info-target-libgm2:
+@if target-libgm2
+maybe-info-target-libgm2: info-target-libgm2
+
+info-target-libgm2: \
+    configure-target-libgm2 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libgm2/Makefile ] || exit 0; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing info in $(TARGET_SUBDIR)/libgm2"; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libgm2 && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           info) \
+	  || exit 1
+
+@endif target-libgm2
+
+.PHONY: maybe-dvi-target-libgm2 dvi-target-libgm2
+maybe-dvi-target-libgm2:
+@if target-libgm2
+maybe-dvi-target-libgm2: dvi-target-libgm2
+
+dvi-target-libgm2: \
+    configure-target-libgm2 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libgm2/Makefile ] || exit 0; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing dvi in $(TARGET_SUBDIR)/libgm2"; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libgm2 && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           dvi) \
+	  || exit 1
+
+@endif target-libgm2
+
+.PHONY: maybe-pdf-target-libgm2 pdf-target-libgm2
+maybe-pdf-target-libgm2:
+@if target-libgm2
+maybe-pdf-target-libgm2: pdf-target-libgm2
+
+pdf-target-libgm2: \
+    configure-target-libgm2 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libgm2/Makefile ] || exit 0; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing pdf in $(TARGET_SUBDIR)/libgm2"; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libgm2 && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           pdf) \
+	  || exit 1
+
+@endif target-libgm2
+
+.PHONY: maybe-html-target-libgm2 html-target-libgm2
+maybe-html-target-libgm2:
+@if target-libgm2
+maybe-html-target-libgm2: html-target-libgm2
+
+html-target-libgm2: \
+    configure-target-libgm2 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libgm2/Makefile ] || exit 0; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing html in $(TARGET_SUBDIR)/libgm2"; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libgm2 && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           html) \
+	  || exit 1
+
+@endif target-libgm2
+
+.PHONY: maybe-TAGS-target-libgm2 TAGS-target-libgm2
+maybe-TAGS-target-libgm2:
+@if target-libgm2
+maybe-TAGS-target-libgm2: TAGS-target-libgm2
+
+TAGS-target-libgm2: \
+    configure-target-libgm2 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libgm2/Makefile ] || exit 0; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing TAGS in $(TARGET_SUBDIR)/libgm2"; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libgm2 && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           TAGS) \
+	  || exit 1
+
+@endif target-libgm2
+
+.PHONY: maybe-install-info-target-libgm2 install-info-target-libgm2
+maybe-install-info-target-libgm2:
+@if target-libgm2
+maybe-install-info-target-libgm2: install-info-target-libgm2
+
+install-info-target-libgm2: \
+    configure-target-libgm2 \
+    info-target-libgm2 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libgm2/Makefile ] || exit 0; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing install-info in $(TARGET_SUBDIR)/libgm2"; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libgm2 && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           install-info) \
+	  || exit 1
+
+@endif target-libgm2
+
+.PHONY: maybe-install-pdf-target-libgm2 install-pdf-target-libgm2
+maybe-install-pdf-target-libgm2:
+@if target-libgm2
+maybe-install-pdf-target-libgm2: install-pdf-target-libgm2
+
+install-pdf-target-libgm2: \
+    configure-target-libgm2 \
+    pdf-target-libgm2 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libgm2/Makefile ] || exit 0; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing install-pdf in $(TARGET_SUBDIR)/libgm2"; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libgm2 && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           install-pdf) \
+	  || exit 1
+
+@endif target-libgm2
+
+.PHONY: maybe-install-html-target-libgm2 install-html-target-libgm2
+maybe-install-html-target-libgm2:
+@if target-libgm2
+maybe-install-html-target-libgm2: install-html-target-libgm2
+
+install-html-target-libgm2: \
+    configure-target-libgm2 \
+    html-target-libgm2 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libgm2/Makefile ] || exit 0; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing install-html in $(TARGET_SUBDIR)/libgm2"; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libgm2 && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           install-html) \
+	  || exit 1
+
+@endif target-libgm2
+
+.PHONY: maybe-installcheck-target-libgm2 installcheck-target-libgm2
+maybe-installcheck-target-libgm2:
+@if target-libgm2
+maybe-installcheck-target-libgm2: installcheck-target-libgm2
+
+installcheck-target-libgm2: \
+    configure-target-libgm2 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libgm2/Makefile ] || exit 0; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing installcheck in $(TARGET_SUBDIR)/libgm2"; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libgm2 && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           installcheck) \
+	  || exit 1
+
+@endif target-libgm2
+
+.PHONY: maybe-mostlyclean-target-libgm2 mostlyclean-target-libgm2
+maybe-mostlyclean-target-libgm2:
+@if target-libgm2
+maybe-mostlyclean-target-libgm2: mostlyclean-target-libgm2
+
+mostlyclean-target-libgm2: 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libgm2/Makefile ] || exit 0; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing mostlyclean in $(TARGET_SUBDIR)/libgm2"; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libgm2 && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           mostlyclean) \
+	  || exit 1
+
+@endif target-libgm2
+
+.PHONY: maybe-clean-target-libgm2 clean-target-libgm2
+maybe-clean-target-libgm2:
+@if target-libgm2
+maybe-clean-target-libgm2: clean-target-libgm2
+
+clean-target-libgm2: 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libgm2/Makefile ] || exit 0; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing clean in $(TARGET_SUBDIR)/libgm2"; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libgm2 && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           clean) \
+	  || exit 1
+
+@endif target-libgm2
+
+.PHONY: maybe-distclean-target-libgm2 distclean-target-libgm2
+maybe-distclean-target-libgm2:
+@if target-libgm2
+maybe-distclean-target-libgm2: distclean-target-libgm2
+
+distclean-target-libgm2: 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libgm2/Makefile ] || exit 0; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing distclean in $(TARGET_SUBDIR)/libgm2"; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libgm2 && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           distclean) \
+	  || exit 1
+
+@endif target-libgm2
+
+.PHONY: maybe-maintainer-clean-target-libgm2 maintainer-clean-target-libgm2
+maybe-maintainer-clean-target-libgm2:
+@if target-libgm2
+maybe-maintainer-clean-target-libgm2: maintainer-clean-target-libgm2
+
+maintainer-clean-target-libgm2: 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libgm2/Makefile ] || exit 0; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing maintainer-clean in $(TARGET_SUBDIR)/libgm2"; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libgm2 && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           maintainer-clean) \
+	  || exit 1
+
+@endif target-libgm2
+
+
+
+
+
 .PHONY: configure-target-libgomp maybe-configure-target-libgomp
 maybe-configure-target-libgomp:
 @if gcc-bootstrap
@@ -56569,6 +57523,14 @@ 
 	(cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) check-go);
 check-go: check-gcc-go check-target-libgo check-gotools
 
+.PHONY: check-gcc-m2 check-m2
+check-gcc-m2:
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(HOST_EXPORTS) \
+	(cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) check-m2);
+check-m2: check-gcc-m2 check-target-libgm2 check-gm2tools
+
 .PHONY: check-gcc-d check-d
 check-gcc-d:
 	r=`${PWD_COMMAND}`; export r; \
@@ -59988,6 +60950,7 @@ 
 configure-target-zlib: stage_last
 configure-target-rda: stage_last
 configure-target-libada: stage_last
+configure-target-libgm2: stage_last
 configure-stage1-target-libgomp: maybe-all-stage1-gcc
 configure-stage2-target-libgomp: maybe-all-stage2-gcc
 configure-stage3-target-libgomp: maybe-all-stage3-gcc
@@ -60022,6 +60985,7 @@ 
 configure-target-zlib: maybe-all-gcc
 configure-target-rda: maybe-all-gcc
 configure-target-libada: maybe-all-gcc
+configure-target-libgm2: maybe-all-gcc
 configure-target-libgomp: maybe-all-gcc
 configure-target-libitm: maybe-all-gcc
 configure-target-libatomic: maybe-all-gcc
@@ -60509,6 +61473,7 @@ 
 all-stageautoprofile-lto-plugin: maybe-all-stageautoprofile-libiberty-linker-plugin
 all-stageautofeedback-lto-plugin: maybe-all-stageautofeedback-libiberty-linker-plugin
 all-gotools: maybe-all-target-libgo
+all-gm2tools: maybe-all-target-libgm2
 configure-intl: maybe-all-libiconv
 configure-stage1-intl: maybe-all-stage1-libiconv
 configure-stage2-intl: maybe-all-stage2-libiconv
@@ -61129,6 +62094,7 @@ 
 all-target-libgo: maybe-all-target-libbacktrace
 all-target-libgo: maybe-all-target-libffi
 all-target-libgo: maybe-all-target-libatomic
+all-target-libgm2: maybe-all-target-libatomic
 configure-target-libphobos: maybe-configure-target-libbacktrace
 configure-target-libphobos: maybe-configure-target-zlib
 all-target-libphobos: maybe-all-target-libbacktrace
@@ -61197,6 +62163,7 @@ 
 configure-gnattools: stage_last
 configure-libcc1: stage_last
 configure-c++tools: stage_last
+configure-gm2tools: stage_last
 configure-utils: stage_last
 configure-gdb: stage_last
 configure-gdbserver: stage_last
@@ -61215,6 +62182,7 @@ 
 configure-libcc1: maybe-configure-gcc
 all-libcc1: maybe-all-gcc
 all-c++tools: maybe-all-gcc
+all-gm2tools: maybe-all-target-libstdc++-v3
 all-utils: maybe-all-libiberty
 configure-gdb: maybe-all-intl
 configure-gdb: maybe-all-bfd
@@ -61247,6 +62215,7 @@ 
 all-flex: maybe-all-intl
 all-m4: maybe-all-intl
 configure-target-libgo: maybe-all-target-libstdc++-v3
+configure-target-libgm2: maybe-all-target-libstdc++-v3
 configure-target-liboffloadmic: maybe-configure-target-libgomp
 all-target-liboffloadmic: maybe-all-target-libgomp
 configure-target-newlib: maybe-all-binutils
@@ -61317,6 +62286,7 @@ 
 configure-target-zlib: maybe-all-target-libgcc
 configure-target-rda: maybe-all-target-libgcc
 configure-target-libada: maybe-all-target-libgcc
+configure-target-libgm2: maybe-all-target-libgcc
 configure-target-libgomp: maybe-all-target-libgcc
 configure-target-libitm: maybe-all-target-libgcc
 configure-target-libatomic: maybe-all-target-libgcc
@@ -61362,6 +62332,8 @@ 
 
 configure-target-libada: maybe-all-target-newlib maybe-all-target-libgloss
 
+configure-target-libgm2: maybe-all-target-newlib maybe-all-target-libgloss
+
 configure-target-libgomp: maybe-all-target-newlib maybe-all-target-libgloss
 
 configure-target-libitm: maybe-all-target-newlib maybe-all-target-libgloss
--- gcc-git/Makefile.tpl	2021-06-10 11:58:16.822976584 +0100
+++ gm2-floppsie/Makefile.tpl	2021-06-17 10:20:53.215400517 +0100
@@ -161,6 +161,7 @@ 
 	GOCFLAGS="$(GOCFLAGS_FOR_BUILD)"; export GOCFLAGS; \
 	GDC="$(GDC_FOR_BUILD)"; export GDC; \
 	GDCFLAGS="$(GDCFLAGS_FOR_BUILD)"; export GDCFLAGS; \
+	GM2="$(GM2_FOR_BUILD)"; export GM2; \
 	DLLTOOL="$(DLLTOOL_FOR_BUILD)"; export DLLTOOL; \
 	LD="$(LD_FOR_BUILD)"; export LD; \
 	LDFLAGS="$(LDFLAGS_FOR_BUILD)"; export LDFLAGS; \
@@ -198,6 +199,7 @@ 
 	GFORTRAN="$(GFORTRAN)"; export GFORTRAN; \
 	GOC="$(GOC)"; export GOC; \
 	GDC="$(GDC)"; export GDC; \
+	GM2="$(GM2)"; export GM2; \
 	AR="$(AR)"; export AR; \
 	AS="$(AS)"; export AS; \
 	CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \
@@ -296,6 +298,7 @@ 
 	GFORTRAN="$(GFORTRAN_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GFORTRAN; \
 	GOC="$(GOC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GOC; \
 	GDC="$(GDC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GDC; \
+	GM2="$(GM2_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GM2; \
 	DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \
 	LD="$(COMPILER_LD_FOR_TARGET)"; export LD; \
 	LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \
@@ -362,6 +365,7 @@ 
 GFORTRAN_FOR_BUILD = @GFORTRAN_FOR_BUILD@
 GOC_FOR_BUILD = @GOC_FOR_BUILD@
 GDC_FOR_BUILD = @GDC_FOR_BUILD@
+GM2_FOR_BUILD = @GM2_FOR_BUILD@
 LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@
 LD_FOR_BUILD = @LD_FOR_BUILD@
 NM_FOR_BUILD = @NM_FOR_BUILD@
@@ -431,6 +435,7 @@ 
 LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
 GOCFLAGS = $(CFLAGS)
 GDCFLAGS = $(CFLAGS)
+GM2FLAGS = $(CFLAGS)
 
 CREATE_GCOV = create_gcov
 
@@ -518,6 +523,7 @@ 
 GFORTRAN_FOR_TARGET=$(STAGE_CC_WRAPPER) @GFORTRAN_FOR_TARGET@
 GOC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GOC_FOR_TARGET@
 GDC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GDC_FOR_TARGET@
+GM2_FOR_TARGET=$(STAGE_CC_WRAPPER) @GM2_FOR_TARGET@
 DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@
 LD_FOR_TARGET=@LD_FOR_TARGET@
 
@@ -542,6 +548,7 @@ 
 LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
 LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
 LDFLAGS_FOR_TARGET = @LDFLAGS_FOR_TARGET@
+GM2FLAGS_FOR_TARGET = -O2 -g
 GOCFLAGS_FOR_TARGET = -O2 -g
 GDCFLAGS_FOR_TARGET = -O2 -g
 
@@ -647,6 +654,7 @@ 
 	'GFORTRAN=$(GFORTRAN)' \
 	'GOC=$(GOC)' \
 	'GDC=$(GDC)' \
+	'GM2=$(GM2)' \
 	'LD=$(LD)' \
 	'LIPO=$(LIPO)' \
 	'NM=$(NM)' \
@@ -673,6 +681,7 @@ 
 	CC="$${CC}" CC_FOR_BUILD="$${CC_FOR_BUILD}" \
 	CXX="$${CXX}" CXX_FOR_BUILD="$${CXX_FOR_BUILD}" \
 	GDC="$${GDC}" GDC_FOR_BUILD="$${GDC_FOR_BUILD}" \
+	GM2="$${GM2}" GM2_FOR_BUILD="$${GM2_FOR_BUILD}" \
 	GNATBIND="$${GNATBIND}" \
 	LDFLAGS="$${LDFLAGS}" \
 	HOST_LIBS="$${HOST_LIBS}" \
@@ -707,6 +716,8 @@ 
 	'GOCFLAGS=$$(GOCFLAGS_FOR_TARGET)' \
 	'GDC=$$(GDC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
 	'GDCFLAGS=$$(GDCFLAGS_FOR_TARGET)' \
+	'GM2=$$(GM2_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
+	'GM2FLAGS=$$(GM2FLAGS_FOR_TARGET)' \
 	'LD=$(COMPILER_LD_FOR_TARGET)' \
 	'LDFLAGS=$$(LDFLAGS_FOR_TARGET)' \
 	'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET)' \
@@ -733,6 +744,7 @@ 
 # cross-building scheme.
 EXTRA_GCC_FLAGS = \
 	"GCC_FOR_TARGET=$(GCC_FOR_TARGET)" \
+	"GM2_FOR_TARGET=$(GM2_FOR_TARGET)" \
 	"`echo 'STMP_FIXPROTO=$(STMP_FIXPROTO)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
 	"`echo 'LIMITS_H_TEST=$(LIMITS_H_TEST)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
 
@@ -864,7 +876,7 @@ 
 	-rm -f texinfo/doc/Makefile texinfo/po/POTFILES
 	-rmdir texinfo/doc texinfo/info texinfo/intl texinfo/lib 2>/dev/null
 	-rmdir texinfo/makeinfo texinfo/po texinfo/util 2>/dev/null
-	-rmdir c++tools fastjar gcc gnattools gotools 2>/dev/null
+	-rmdir c++tools fastjar gcc gnattools gm2tools gotools 2>/dev/null
 	-rmdir libcc1 libiberty texinfo zlib 2>/dev/null
 	-find . -name config.cache -exec rm -f {} \; \; 2>/dev/null
 
--- gcc-git/gcc/go/gospec.c	2021-06-10 11:58:18.558987486 +0100
+++ gm2-floppsie/gcc/go/gospec.c	2021-06-17 10:20:53.219400521 +0100
@@ -464,3 +464,9 @@ 
 
 /* Number of extra output files that lang_specific_pre_link may generate.  */
 int lang_specific_extra_outfiles = 0;  /* Not used for Go.  */
+
+/* lang_register_spec_functions.  Not used for Go.  */
+void
+lang_register_spec_functions (void)
+{
+}
--- gcc-git/gcc/fortran/gfortranspec.c	2021-06-10 11:58:18.450986807 +0100
+++ gm2-floppsie/gcc/fortran/gfortranspec.c	2021-06-17 10:20:53.219400521 +0100
@@ -447,4 +447,12 @@ 
 }
 
 /* Number of extra output files that lang_specific_pre_link may generate.  */
-int lang_specific_extra_outfiles = 0;	/* Not used for F77.  */
+int lang_specific_extra_outfiles = 0;	/* Not used for Fortran.  */
+
+/* lang_register_spec_functions register the Fortran associated spec
+   functions.  */
+
+void
+lang_register_spec_functions (void)
+{
+}
--- gcc-git/gcc/d/d-spec.cc	2021-06-10 11:58:18.298985852 +0100
+++ gm2-floppsie/gcc/d/d-spec.cc	2021-06-17 10:20:53.219400521 +0100
@@ -490,3 +490,10 @@ 
 
 int lang_specific_extra_outfiles = 0;  /* Not used for D.  */
 
+/* lang_register_spec_functions register the D associated spec
+   functions.  Not used for D.  */
+
+void
+lang_register_spec_functions (void)
+{
+}
--- gcc-git/gcc/jit/jit-spec.c	2021-06-10 11:58:18.618987863 +0100
+++ gm2-floppsie/gcc/jit/jit-spec.c	2021-06-17 10:20:53.219400521 +0100
@@ -39,3 +39,9 @@ 
 
 /* Number of extra output files that lang_specific_pre_link may generate.  */
 int lang_specific_extra_outfiles = 0;  /* Not used for jit.  */
+
+/* lang_register_spec_functions.  Not used for jit.  */
+void
+lang_register_spec_functions (void)
+{
+}
--- gcc-git/gcc/hwint.h	2021-06-10 11:58:18.570987562 +0100
+++ gm2-floppsie/gcc/hwint.h	2021-06-17 10:20:53.223400525 +0100
@@ -257,11 +257,14 @@ 
   (HOST_WIDE_INT_1U << (HOST_BITS_PER_WIDE_INT - 1))
 #define HOST_WIDE_INT_MAX (~(HOST_WIDE_INT_MIN))
 
+#ifndef __cplusplus
 extern HOST_WIDE_INT abs_hwi (HOST_WIDE_INT);
 extern unsigned HOST_WIDE_INT absu_hwi (HOST_WIDE_INT);
-extern HOST_WIDE_INT gcd (HOST_WIDE_INT, HOST_WIDE_INT);
 extern HOST_WIDE_INT pos_mul_hwi (HOST_WIDE_INT, HOST_WIDE_INT);
 extern HOST_WIDE_INT mul_hwi (HOST_WIDE_INT, HOST_WIDE_INT);
+#endif  /* !cplusplus.  */
+
+extern HOST_WIDE_INT gcd (HOST_WIDE_INT, HOST_WIDE_INT);
 extern HOST_WIDE_INT least_common_multiple (HOST_WIDE_INT, HOST_WIDE_INT);
 
 /* Like ctz_hwi, except 0 when x == 0.  */
@@ -316,6 +319,7 @@ 
     }
 }
 
+#ifdef __cplusplus
 /* Compute the absolute value of X.  */
 
 inline HOST_WIDE_INT
@@ -374,5 +378,6 @@ 
   return result;
 #endif
 }
+#endif /* ! __cplusplus */
 
 #endif /* ! GCC_HWINT_H */
--- gcc-git/gcc/doc/install.texi	2021-06-10 11:58:18.366986279 +0100
+++ gm2-floppsie/gcc/doc/install.texi	2021-06-17 17:22:04.645530103 +0100
@@ -1777,18 +1777,19 @@ 
 @smallexample
 grep ^language= */config-lang.in
 @end smallexample
-Currently, you can use any of the following:
-@code{all}, @code{default}, @code{ada}, @code{c}, @code{c++}, @code{d},
-@code{fortran}, @code{go}, @code{jit}, @code{lto}, @code{objc}, @code{obj-c++}.
-Building the Ada compiler has special requirements, see below.
-If you do not pass this flag, or specify the option @code{default}, then the
-default languages available in the @file{gcc} sub-tree will be configured.
-Ada, D, Go, Jit, and Objective-C++ are not default languages.  LTO is not a
-default language, but is built by default because @option{--enable-lto} is
-enabled by default.  The other languages are default languages.  If
-@code{all} is specified, then all available languages are built.  An
-exception is @code{jit} language, which requires
-@option{--enable-host-shared} to be included with @code{all}.
+Currently, you can use any of the following: @code{all},
+@code{default}, @code{ada}, @code{c}, @code{c++}, @code{d},
+@code{fortran}, @code{go}, @code{jit}, @code{lto}, @code{m2},
+@code{objc}, @code{obj-c++}.  Building the Ada compiler has special
+requirements, see below.  If you do not pass this flag, or specify the
+option @code{default}, then the default languages available in the
+@file{gcc} sub-tree will be configured.  Ada, D, Go, Jit,
+Objective-C++ and Modula-2 are not default languages.  LTO is not a
+default language, but is built by default because
+@option{--enable-lto} is enabled by default.  The other languages are
+default languages.  If @code{all} is specified, then all available
+languages are built.  An exception is @code{jit} language, which
+requires @option{--enable-host-shared} to be included with @code{all}.
 
 @item --enable-stage1-languages=@var{lang1},@var{lang2},@dots{}
 Specify that a particular subset of compilers and their runtime
@@ -1811,6 +1812,10 @@ 
 previous Ada build procedures, when it was required to explicitly
 do a @samp{make -C gcc gnatlib_and_tools}.
 
+@item --disable-libgm2
+Specify that the run-time libraries and tools used by Modula-2 should not
+be built.  This can be useful for debugging.
+
 @item --disable-libsanitizer
 Specify that the run-time libraries for the various sanitizers should
 not be built.
@@ -3070,10 +3075,10 @@ 
 In order to run sets of tests selectively, there are targets
 @samp{make check-gcc} and language specific @samp{make check-c},
 @samp{make check-c++}, @samp{make check-d} @samp{make check-fortran},
-@samp{make check-ada}, @samp{make check-objc}, @samp{make check-obj-c++},
-@samp{make check-lto}
-in the @file{gcc} subdirectory of the object directory.  You can also
-just run @samp{make check} in a subdirectory of the object directory.
+@samp{make check-ada}, @samp{make check-m2}, @samp{make check-objc},
+@samp{make check-obj-c++}, @samp{make check-lto} in the @file{gcc}
+subdirectory of the object directory.  You can also just run
+@samp{make check} in a subdirectory of the object directory.
 
 
 A more selective way to just run all @command{gcc} execute tests in the
--- gcc-git/gcc/doc/sourcebuild.texi	2021-06-10 11:58:18.382986380 +0100
+++ gm2-floppsie/gcc/doc/sourcebuild.texi	2021-06-17 10:20:53.227400528 +0100
@@ -52,6 +52,9 @@ 
 language front ends, and testsuites.  @xref{gcc Directory, , The
 @file{gcc} Subdirectory}, for details.
 
+@item gm2tools
+Support tools for Modula-2.
+
 @item gnattools
 Support tools for GNAT.
 
@@ -84,6 +87,9 @@ 
 @item libgfortran
 The Fortran runtime library.
 
+@item libgm2
+The Modula-2 runtime library.
+
 @item libgo
 The Go runtime library.  The bulk of this library is mirrored from the
 @uref{https://github.com/@/golang/go, master Go repository}.
@@ -163,13 +169,12 @@ 
 @item @var{language}
 Subdirectories for various languages.  Directories containing a file
 @file{config-lang.in} are language subdirectories.  The contents of
-the subdirectories @file{c} (for C), @file{cp} (for C++),
-@file{objc} (for Objective-C), @file{objcp} (for Objective-C++),
-and @file{lto} (for LTO) are documented in this
-manual (@pxref{Passes, , Passes and Files of the Compiler});
-those for other languages are not.  @xref{Front End, ,
-Anatomy of a Language Front End}, for details of the files in these
-directories.
+the subdirectories @file{c} (for C), @file{cp} (for C++), @file{m2}
+(for Modula-2), @file{objc} (for Objective-C), @file{objcp} (for
+Objective-C++), and @file{lto} (for LTO) are documented in this manual
+(@pxref{Passes, , Passes and Files of the Compiler}); those for other
+languages are not.  @xref{Front End, , Anatomy of a Language Front
+End}, for details of the files in these directories.
 
 @item common
 Source files shared between the compiler drivers (such as