public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/modula-2] Partial cleanup to implement calling cc1 from within cc1gm2.
@ 2022-08-13 23:12 Gaius Mulley
  0 siblings, 0 replies; only message in thread
From: Gaius Mulley @ 2022-08-13 23:12 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:6e8e31eb93e736eb3e7b4c588f75951204017888

commit 6e8e31eb93e736eb3e7b4c588f75951204017888
Author: Gaius Mulley <gaius.mulley@southwales.ac.uk>
Date:   Sun Aug 14 00:10:41 2022 +0100

    Partial cleanup to implement calling cc1 from within cc1gm2.
    
    A partial cleanup in preparation for removing
    lang_register_spec_functions.  Allow the preprocessor to be invoked
    from cc1gm2 without passing the path of cc1 though lang-specs.
    
    gcc/m2/ChangeLog:
    
            * Make-lang.in (GM2_C_OBJS): Added m2/gm2-gcc/m2configure.o.
            (m2/gm2-gcc/m2configure.o) New rule.  (GM2-COMP-BOOT-DEFS)
            Removed M2Configure.mod.  (GM2-GCC-DEFS) Removed M2Configure.def.
            (GM2-COMP-MODS) Removed M2Configure.mod.  (GM2-VERIFY-MODS)
            Removed M2Configure.mod.
            * el/gm2-mode.el (m2-link-command-default): Remove -fonlylink.
            * gm2-compiler/M2AsmUtil.def: Purged all unused declarations.
            * gm2-compiler/M2AsmUtil.mod: Purged all unused declarations.
            * gm2-compiler/M2GCCDeclare.mod (M2Configure): Removed import.
            (PushParametersLeftToRight) Removed asserts.
            * gm2-compiler/M2GenGCC.mod (M2AsmUtil): Removed import.
            * gm2-compiler/M2Options.def (SetB): New procedure.
            (GetB) New procedure function.
            * gm2-compiler/M2Options.mod (SetB): New procedure implemented.
            (GetB) New procedure function implemented.  (CppCommandLine)
            Check CPreProcessor and return NIL if true.  Use FulPathCPP.
            (CppRemember) Remove -fcpp-prog= test.  (Barg) Declared
            and initialized to NIL.
            * gm2-compiler/M2Preprocess.mod: Check result of command
            and return filename if NIL.
            * gm2-compiler/M2Quads.mod (M2Configure): Remove import.
            (PushParametersLeftToRight) Remove all condition tests
            and rewrite to assume left to right parameters.
            * gm2-gcc/m2configure.def: New file (Renamed from
            gm2-compiler/M2Configure.def).
            * gm2-gcc/m2options.h (SetB): New declaration.
            (GetB) New declaration.
            * gm2-lang.cc (gm2_langhook_handle_option): Add OPT_B
            case.  (OPT_fcpp_prog_) Removed.
            * gm2spec.cc (seen_B): Removed.  (B_path) Removed.
            (gen_gm2_libexec) Removed.  (add_exec_dir) Removed.
            (lang_specific_driver) Removed OPT_B case.
            (lang_register_spec_functions) commented out fe_add_spec_function.
            * lang-specs.h (M2CPP): Removed exec_prefix(cc1).
            Pass %{B*} to cc1gm2.
            * lang.opt: Added -B option.   (fcpp-prog=) Removed.
            * gm2-gcc/m2configure.cc: New file.
    
    Signed-off-by: Gaius Mulley <gaius.mulley@southwales.ac.uk>

Diff:
---
 gcc/m2/Make-lang.in                                |  25 ++--
 gcc/m2/el/gm2-mode.el                              |   8 +-
 gcc/m2/gm2-compiler/M2AsmUtil.def                  |  63 +---------
 gcc/m2/gm2-compiler/M2AsmUtil.mod                  | 134 +--------------------
 gcc/m2/gm2-compiler/M2Configure.def                |  73 -----------
 gcc/m2/gm2-compiler/M2GCCDeclare.mod               |   8 +-
 gcc/m2/gm2-compiler/M2GenGCC.mod                   |   1 -
 gcc/m2/gm2-compiler/M2Options.def                  |  19 ++-
 gcc/m2/gm2-compiler/M2Options.mod                  |  71 +++++------
 gcc/m2/gm2-compiler/M2Preprocess.mod               |   2 +-
 gcc/m2/gm2-compiler/M2Quads.mod                    |  71 +++--------
 gcc/m2/gm2-gcc/m2configure.cc                      | 101 ++++++++++++++++
 .../M2Configure.mod => gm2-gcc/m2configure.def}    |  28 ++++-
 gcc/m2/gm2-gcc/m2options.h                         |   2 +
 gcc/m2/gm2-lang.cc                                 |   6 +-
 gcc/m2/gm2spec.cc                                  |  63 +---------
 gcc/m2/lang-specs.h                                |   4 +-
 gcc/m2/lang.opt                                    |   8 +-
 18 files changed, 237 insertions(+), 450 deletions(-)

diff --git a/gcc/m2/Make-lang.in b/gcc/m2/Make-lang.in
index 42f97b2d423..281b417c358 100644
--- a/gcc/m2/Make-lang.in
+++ b/gcc/m2/Make-lang.in
@@ -497,8 +497,9 @@ GM2_C_OBJS        = m2/gm2-lang.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/m2configure.o \
+                    m2/gm2-gcc/m2convert.o \
                     m2/gm2-gcc/m2decl.o \
                     m2/gm2-gcc/m2expr.o \
                     m2/gm2-gcc/m2linemap.o \
@@ -569,6 +570,16 @@ m2/gm2-gcc/%.o: $(srcdir)/m2/gm2-gcc/%.cc $(GCC_HEADER_DEPENDENCIES_FOR_M2)
 	$(COMPILER) -c -g $(ALL_COMPILERFLAGS) \
              $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
 
+m2/gm2-gcc/m2configure.o: $(srcdir)/m2/gm2-gcc/m2configure.cc \
+               $(SYSTEM_H) $(GCC_H) $(CONFIG_H) \
+               m2/gm2config.h $(TARGET_H) $(PLUGIN_HEADERS) \
+               $(generated_files) $(C_TREE_H) insn-attr-common.h
+	$(COMPILER) $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
+         $(DRIVER_DEFINES) \
+		-DLIBSUBDIR=\"$(libsubdir)\" \
+                -DPREFIX=\"$(prefix)\" \
+                -c $(srcdir)/m2/gm2-gcc/m2configure.cc $(OUTPUT_OPTION)
+
 m2/gm2-lang.o: $(srcdir)/m2/gm2-lang.cc gt-m2-gm2-lang.h $(GCC_HEADER_DEPENDENCIES_FOR_M2)
 	$(COMPILER) -c -g -I$(GM2GCC) $(ALL_COMPILERFLAGS) \
             $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
@@ -638,7 +649,7 @@ GM2-COMP-BOOT-DEFS = FifoQueue.def   M2Debug.def     M2Optimize.def  M2Defaults.
                      M2LexBuf.def    M2Version.def   M2Error.def     M2Graph.def     \
                      M2Students.def  \
                      M2GenGCC.def    M2GCCDeclare.def \
-                     M2Configure.def SymbolTable.def Lists.def       SymbolConversion.def \
+                     SymbolTable.def Lists.def       SymbolConversion.def \
                      P0SyntaxCheck.def \
                      P1Build.def     P2Build.def     P3Build.def     PHBuild.def     \
                      M2Printf.def    bnflex.def      M2Quiet.def     M2Preprocess.def \
@@ -653,7 +664,7 @@ GM2-COMP-BOOT-DEFS = FifoQueue.def   M2Debug.def     M2Optimize.def  M2Defaults.
 GM2-COMP-BOOT-MODS = FifoQueue.mod   M2LexBuf.mod                             \
                      M2AsmUtil.mod   M2Optimize.mod  M2StackWord.mod \
                      M2Options.mod   M2Pass.mod      M2Batch.mod     M2Quads.mod     \
-                     M2Comp.mod      M2Reserved.mod  M2Configure.mod M2StackAddress.mod \
+                     M2Comp.mod      M2Reserved.mod                  M2StackAddress.mod \
                      M2Debug.mod     M2Defaults.mod  NameKey.mod     \
                      M2FileName.mod  P0SymBuild.mod  P1SymBuild.mod  P2SymBuild.mod  \
                      P3SymBuild.mod  \
@@ -675,7 +686,7 @@ GM2-COMP-BOOT-MODS = FifoQueue.mod   M2LexBuf.mod                             \
 GM2-GCC-DEFS      =  m2builtins.def  m2except.def    m2convert.def   m2decl.def \
                      m2except.def    m2expr.def      m2misc.def      m2block.def \
                      m2statement.def m2top.def       m2tree.def      m2treelib.def \
-                     m2type.def      m2linemap.def   m2color.def
+                     m2type.def      m2linemap.def   m2color.def     m2configure.def
 
 # The following tables define the source files used to build gm2 using only Modula-2
 # sources (except for interfacing to libc and gcc).
@@ -726,7 +737,7 @@ GM2-COMP-DEFS      = FifoQueue.def     M2Debug.def     M2Optimize.def  M2Default
                      M2System.def      P2SymBuild.def  M2Code.def      M2Comp.def      \
                      NameKey.def       M2Version.def   M2Error.def     M2StackAddress.def \
                      M2Students.def    M2GenGCC.def    \
-                     M2GCCDeclare.def  M2Configure.def SymbolTable.def Lists.def       \
+                     M2GCCDeclare.def  SymbolTable.def Lists.def       \
                      P0SyntaxCheck.def bnflex.def      P1Build.def     P2Build.def     \
                      P3Build.def       PHBuild.def     SymbolConversion.def \
                      M2Preprocess.def  M2Printf.def    M2LexBuf.def    M2Quiet.def     \
@@ -738,7 +749,7 @@ GM2-COMP-DEFS      = FifoQueue.def     M2Debug.def     M2Optimize.def  M2Default
 
 GM2-COMP-MODS      = FifoQueue.mod     M2AsmUtil.mod                   M2Optimize.mod  \
                      M2StackWord.mod   M2Options.mod   M2Pass.mod      M2Batch.mod     \
-                     M2Quads.mod       M2Comp.mod      M2Reserved.mod  M2Configure.mod \
+                     M2Quads.mod       M2Comp.mod      M2Reserved.mod                  \
                      M2Debug.mod       M2Defaults.mod  NameKey.mod     M2Graph.mod     \
                      M2FileName.mod    P0SymBuild.mod  P1SymBuild.mod  P2SymBuild.mod  \
                      P3SymBuild.mod  \
@@ -769,7 +780,7 @@ GM2-LIBIBERTY-DEFS = choosetemp.def    pexecute.def
 
 GM2-VERIFY-MODS    = FifoQueue.mod     M2AsmUtil.mod                   M2Optimize.mod  \
                      M2StackWord.mod                   M2Pass.mod      M2Batch.mod     \
-                     M2Quads.mod       M2Comp.mod      M2Reserved.mod  M2Configure.mod \
+                     M2Quads.mod       M2Comp.mod      M2Reserved.mod  \
                      M2Debug.mod       M2Defaults.mod  NameKey.mod     \
                      M2FileName.mod    P0SymBuild.mod  P1SymBuild.mod  P2SymBuild.mod  \
                      P3SymBuild.mod  \
diff --git a/gcc/m2/el/gm2-mode.el b/gcc/m2/el/gm2-mode.el
index 1e939c5efb2..d1f7903aa10 100644
--- a/gcc/m2/el/gm2-mode.el
+++ b/gcc/m2/el/gm2-mode.el
@@ -1,4 +1,4 @@
-;; Copyright (C) 1985-2021
+;; Copyright (C) 1985-2022
 
 ;; Free Software Foundation, Inc.
 
@@ -138,7 +138,7 @@
   (progn
     (concat m2-compile-command-default " " m2-options)))
 
-(defcustom m2-link-command-default "gm2 -fonlylink"
+(defcustom m2-link-command-default "gm2 "
   "command to link Modula-2 programs"
   :type 'string
   :group 'gm2)
@@ -439,7 +439,7 @@
 
 (defun m2-move-to-procedure-start ()
   "moves to the start of the procedure implementation (before the
-							      comments start - if they exist)."
+   comments start - if they exist)."
   (beginning-of-line)
   (let (m2-point)
     (setq m2-point (point))
@@ -468,7 +468,7 @@
 
 (defun m2-is-forward-declaration ()
   "returns true if this procedure heading is just a FORWARD declaration
-  of a implementation further down the file."
+   of a implementation further down the file."
   (interactive)
   (save-excursion
     (m2-forward-to-token)
diff --git a/gcc/m2/gm2-compiler/M2AsmUtil.def b/gcc/m2/gm2-compiler/M2AsmUtil.def
index 37a2ce8b91f..6369823e94c 100644
--- a/gcc/m2/gm2-compiler/M2AsmUtil.def
+++ b/gcc/m2/gm2-compiler/M2AsmUtil.def
@@ -26,49 +26,12 @@ DEFINITION MODULE M2AsmUtil ;
    Title      : M2AsmUtil
    Date       : Thu Feb  1 15:34:08 GMT 1990
    Description: Provides utilities relating symbols in the SymbolTable
-                to their equalalent representation in ASM format.
+                to their equivalent representation in ASM format.
 *)
 
 FROM DynamicStrings IMPORT String ;
 FROM NameKey IMPORT Name ;
-EXPORT QUALIFIED WriteAsmName, WriteName, GetAsmName, GetFullSymName,
-                 UnderScoreString, DotifyLabel,
-                 GetModuleInitName, GetModuleFinallyName,
-                 GetFullScopeAsmName ;
-
-
-(*
-   DotifyLabel - place a dot infront of the label if necessary.
-                 The string, s, should no longer be used after
-                 this function. A new string is returned.
-*)
-
-PROCEDURE DotifyLabel (s: String) : String ;
-
-
-(*
-   WriteAsmName - displays the symbol, Sym, name using module prefixes
-                  if it is EXPORT QUALIFIED.
-*)
-
-PROCEDURE WriteAsmName (Sym: CARDINAL) ;
-
-
-(*
-   WriteName - writes out the symbol, Sym, name using module prefixes
-               if it is EXPORT QUALIFIED.
-               The procedure differs from the above because it does
-               not generate any _ prefix to the name.
-*)
-
-PROCEDURE WriteName (Sym: CARDINAL) ;
-
-
-(*
-   GetAsmName - returns the NameKey for the assembler string of a symbol.
-*)
-
-PROCEDURE GetAsmName (Sym: CARDINAL) : Name ;
+EXPORT QUALIFIED GetFullSymName, GetFullScopeAsmName ;
 
 
 (*
@@ -89,26 +52,4 @@ PROCEDURE GetFullSymName (Sym: CARDINAL) : Name ;
 PROCEDURE GetFullScopeAsmName (Sym: CARDINAL) : Name ;
 
 
-(*
-   UnderScoreString - emits a string with a leading underscore if the C compiler
-                      uses _ prefixes. The string without the underscore is returned.
-*)
-
-PROCEDURE UnderScoreString (s: String) : String ;
-
-
-(*
-   GetModuleInitName - returns the name of the initialization section of a module.
-*)
-
-PROCEDURE GetModuleInitName (Sym: CARDINAL) : Name ;
-
-
-(*
-   GetModuleFinallyName - returns the name of the finalization section of a module.
-*)
-
-PROCEDURE GetModuleFinallyName (Sym: CARDINAL) : Name ;
-
-
 END M2AsmUtil.
diff --git a/gcc/m2/gm2-compiler/M2AsmUtil.mod b/gcc/m2/gm2-compiler/M2AsmUtil.mod
index 02571b89217..77afee0711a 100644
--- a/gcc/m2/gm2-compiler/M2AsmUtil.mod
+++ b/gcc/m2/gm2-compiler/M2AsmUtil.mod
@@ -44,7 +44,7 @@ FROM SymbolTable IMPORT NulSym,
                         IsDefinitionForC ;
 
 FROM M2Error IMPORT InternalError ;
-FROM M2Configure IMPORT UseUnderscoreForC, UseDotForJumpLabels ;
+FROM m2configure IMPORT UseUnderscoreForC ;
 
 
 (*
@@ -61,23 +61,6 @@ BEGIN
 END StringToKey ;
 
 
-(*
-   DotifyLabel - place a dot infront of the label if necessary.
-                 The string, s, should no longer be used after
-                 this function.
-*)
-
-PROCEDURE DotifyLabel (s: String) : String ;
-BEGIN
-   IF UseDotForJumpLabels
-   THEN
-      RETURN( ConCat(InitString('.'), Mark(s)) )
-   ELSE
-      RETURN( s )
-   END
-END DotifyLabel ;
-
-
 (*
    GetFullScopeAsmName - returns the fully qualified name for the symbol.
                          This will take the format
@@ -102,28 +85,6 @@ BEGIN
 END GetFullScopeAsmName ;
 
 
-(*
-   GetAsmName - returns the NameKey for the assembler string of a symbol.
-*)
-
-PROCEDURE GetAsmName (Sym: CARDINAL) : Name ;
-VAR
-   Module: String ;
-   Scope : CARDINAL ;
-BEGIN
-   Scope := GetScope(Sym) ;
-   IF UseUnderscoreForC
-   THEN
-      Module := InitString('_')
-   ELSE
-      Module := InitString('')
-   END ;
-   Module := ConCat(GetModulePrefix(Module, Sym, Scope),
-                    InitStringCharStar(KeyToCharStar(GetSymName(Sym)))) ;
-   RETURN( StringToKey(Module) )
-END GetAsmName ;
-
-
 (*
    GetFullSymName - returns the NameKey for the symbol name (which also
                     may contain the module name).
@@ -140,47 +101,6 @@ BEGIN
 END GetFullSymName ;
 
 
-(*
-   WriteAsmName - displays the symbol, Sym, name using module prefixes
-                  if it is EXPORT QUALIFIED.
-*)
-
-PROCEDURE WriteAsmName (Sym: CARDINAL) ;
-VAR
-   Scope: CARDINAL ;
-BEGIN
-   IF UseUnderscoreForC
-   THEN
-      Write('_')
-   END ;
-   Scope := GetScope(Sym) ;
-   WriteModulePrefix(Sym, Scope) ;
-   WriteKey(GetSymName(Sym))
-END WriteAsmName ;
-
-
-(*
-   WriteName - displays the symbol, Sym, name using module prefixes
-               if it is EXPORT QUALIFIED.
-               This procedure differs from the above procedure because
-               it does not generate any _ prefix.
-*)
-
-PROCEDURE WriteName (Sym: CARDINAL) ;
-VAR
-   Scope: CARDINAL ;
-BEGIN
-   IF IsVar(Sym) OR IsProcedure(Sym)
-   THEN
-      Scope := GetScope(Sym) ;
-      WriteModulePrefix(Sym, Scope) ;
-      WriteKey(GetSymName(Sym))
-   ELSE
-      InternalError ('Expecting Var or Procedure symbol')
-   END
-END WriteName ;
-
-
 (*
    SymNeedsModulePrefix -
 *)
@@ -256,20 +176,6 @@ BEGIN
 END GetFullScopePrefix ;
 
 
-(*
-   WriteModulePrefix - writes the module prefix for module, ModSym,
-                       providing symbol, Sym, is exported.
-*)
-
-PROCEDURE WriteModulePrefix (Sym, ModSym: CARDINAL) ;
-VAR
-   s: String ;
-BEGIN
-   s := GetModulePrefix(InitString(''), Sym, ModSym) ;
-   s := KillString(WriteS(StdOut, s))
-END WriteModulePrefix ;
-
-
 (*
    UnderScoreString - emits a string with a leading underscore if the C compiler
                       uses _ prefixes. The string without the underscore is returned.
@@ -285,42 +191,4 @@ BEGIN
 END UnderScoreString ;
 
 
-(*
-   GetModuleInitName - returns the name of the initialization section of a module.
-*)
-
-PROCEDURE GetModuleInitName (Sym: CARDINAL) : Name ;
-VAR
-   s: String ;
-BEGIN
-   s := ConCat(ConCat(InitString('_M2_'), Mark(GetModulePrefix(InitStringCharStar(KeyToCharStar(GetSymName(Sym))),
-                                                               Sym, GetScope(Sym)))),
-               Mark(InitString('_init'))) ;
-   IF UseUnderscoreForC
-   THEN
-      s := ConCat(InitString('_'), Mark(s))
-   END ;
-   RETURN( StringToKey(s) )
-END GetModuleInitName ;
-
-
-(*
-   GetModuleFinallyName - returns the name of the finalization section of a module.
-*)
-
-PROCEDURE GetModuleFinallyName (Sym: CARDINAL) : Name ;
-VAR
-   s: String ;
-BEGIN
-   s := ConCat(ConCat(InitString('_M2_'), Mark(GetModulePrefix(InitStringCharStar(KeyToCharStar(GetSymName(Sym))),
-                                                               Sym, GetScope(Sym)))),
-               Mark(InitString('_finish'))) ;
-   IF UseUnderscoreForC
-   THEN
-      s := ConCat(InitString('_'), Mark(s))
-   END ;
-   RETURN( StringToKey(s) )
-END GetModuleFinallyName ;
-
-
 END M2AsmUtil.
diff --git a/gcc/m2/gm2-compiler/M2Configure.def b/gcc/m2/gm2-compiler/M2Configure.def
deleted file mode 100644
index 970c86789bb..00000000000
--- a/gcc/m2/gm2-compiler/M2Configure.def
+++ /dev/null
@@ -1,73 +0,0 @@
-(* M2Configure.def exports configuration constants.
-
-Copyright (C) 2001-2022 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 GNU Modula-2; see the file COPYING3.  If not see
-<http://www.gnu.org/licenses/>.  *)
-
-DEFINITION MODULE M2Configure ;
-
-(*
-   Author     : Gaius Mulley
-   Title      : M2Configure
-   Date       : Thu May 17 17:45:37 BST 1990
-   Description: Exports configuration constants.
-   Last update: Thu May 17 17:46:57 BST 1990
-*)
-
-EXPORT QUALIFIED PushParametersLeftToRight,
-                 UseUnderscoreForC,
-                 UseDotForJumpLabels,
-                 UsingGCCBackend ;
-
-CONST
-
-(*
-   PushParametersLeftToRight - if TRUE indicates that the parameters
-                               are pushed in order from left to right.
-                               if FALSE indicates that the parameters
-                               are pushed in order from right to left.
-*)
-
-   PushParametersLeftToRight = TRUE ;
-
-
-(*
-   UseUnderscoreForC - if true then the C compiler uses _ in front of
-                       all declarations.
-*)
-
-   (* we let gcc add _ to all identifiers otherwise we get two _ *)
-   UseUnderscoreForC     = FALSE ;
-
-
-(*
-   UseDotForJumpLabels - if true then the C compiler produced .L2: for jump
-                         labels. If false then the C compiler produced L2
-*)
-
-   UseDotForJumpLabels = FALSE ;
-
-
-(*
-   UsingGCCBackend - is the compiler being built with the GCC code generator?
-*)
-
-   UsingGCCBackend = TRUE ;
-
-
-END M2Configure.
diff --git a/gcc/m2/gm2-compiler/M2GCCDeclare.mod b/gcc/m2/gm2-compiler/M2GCCDeclare.mod
index 78e9d86db67..8c880b803d2 100644
--- a/gcc/m2/gm2-compiler/M2GCCDeclare.mod
+++ b/gcc/m2/gm2-compiler/M2GCCDeclare.mod
@@ -40,13 +40,10 @@ IMPORT FIO ;
 FROM M2Options IMPORT DisplayQuadruples,
                       GenerateDebugging, GenerateLineDebug, Iso, Optimizing, WholeProgram ;
 
-FROM M2AsmUtil IMPORT WriteAsmName, WriteName, GetAsmName, GetFullSymName,
-                      UnderScoreString, GetModuleInitName, GetModuleFinallyName,
-                      GetFullScopeAsmName ;
+FROM M2AsmUtil IMPORT GetFullSymName, GetFullScopeAsmName ;
 
 FROM NameKey IMPORT Name, MakeKey, NulName, KeyToCharStar, makekey ;
 FROM M2FileName IMPORT CalculateFileName ;
-FROM M2Configure IMPORT PushParametersLeftToRight ;
 FROM DynamicStrings IMPORT String, string, InitString, KillString, InitStringCharStar, Mark ;
 FROM FormatStrings IMPORT Sprintf1 ;
 FROM M2LexBuf IMPORT TokenToLineNo, FindFileNameFromToken, TokenToLocation, UnknownTokenNo ;
@@ -2346,7 +2343,6 @@ VAR
 BEGIN
    IF (NOT GccKnowsAbout(Sym)) AND (NOT IsPseudoProcFunc(Sym))
    THEN
-      Assert(PushParametersLeftToRight) ;
       BuildStartFunctionDeclaration(UsesVarArgs(Sym)) ;
       p := NoOfParam(Sym) ;
       i := p ;
@@ -2427,7 +2423,6 @@ BEGIN
        IsExported(GetModuleWhereDeclared (Sym), Sym) OR
        IsExtern (Sym))
    THEN
-      Assert(PushParametersLeftToRight) ;
       BuildStartFunctionDeclaration(UsesVarArgs(Sym)) ;
       p := NoOfParam(Sym) ;
       i := p ;
@@ -4823,7 +4818,6 @@ BEGIN
    InitFunctionTypeParameters ;
    p := NoOfParam(Sym) ;
    i := p ;
-   Assert(PushParametersLeftToRight) ;
    WHILE i>0 DO
       Son := GetNthParam(Sym, i) ;
       location := TokenToLocation(GetDeclaredMod(Son)) ;
diff --git a/gcc/m2/gm2-compiler/M2GenGCC.mod b/gcc/m2/gm2-compiler/M2GenGCC.mod
index 5754ef19184..0b5c31bd82e 100644
--- a/gcc/m2/gm2-compiler/M2GenGCC.mod
+++ b/gcc/m2/gm2-compiler/M2GenGCC.mod
@@ -114,7 +114,6 @@ FROM DynamicStrings IMPORT string, InitString, KillString, String,
 FROM FormatStrings IMPORT Sprintf0, Sprintf1, Sprintf2, Sprintf3, Sprintf4 ;
 FROM M2System IMPORT Address, Word, System, TBitSize, MakeAdr, IsSystemType, IsGenericSystemType, IsRealN, IsComplexN, IsSetN, IsWordN, Loc, Byte ;
 FROM M2FileName IMPORT CalculateFileName ;
-FROM M2AsmUtil IMPORT GetModuleInitName, GetModuleFinallyName ;
 FROM SymbolConversion IMPORT AddModGcc, Mod2Gcc, GccKnowsAbout, RemoveMod2Gcc ;
 
 FROM M2StackWord IMPORT InitStackWord, StackOfWord, PeepWord, ReduceWord,
diff --git a/gcc/m2/gm2-compiler/M2Options.def b/gcc/m2/gm2-compiler/M2Options.def
index 250e45fa386..12086ecc909 100644
--- a/gcc/m2/gm2-compiler/M2Options.def
+++ b/gcc/m2/gm2-compiler/M2Options.def
@@ -53,7 +53,7 @@ EXPORT QUALIFIED SetReturnCheck, SetNilCheck, SetCaseCheck,
                  SetLowerCaseKeywords,
                  SetIndex, SetRange, SetWholeDiv, SetStrictTypeChecking,
                  Setc, Getc, SetUselist, GetUselist, GetUselistFilename,
-                 SetShared,
+                 SetShared, SetB,
 
                  Iso, Pim, Pim2, Pim3, Pim4,
                  cflag,
@@ -90,7 +90,8 @@ EXPORT QUALIFIED SetReturnCheck, SetNilCheck, SetCaseCheck,
                  SetScaffoldDynamic, SetScaffoldStatic,
                  SetScaffoldMain, ScaffoldMain,
                  SetRuntimeModuleOverride, GetRuntimeModuleOverride,
-                 SetGenModuleList, GetGenModuleFilename, SharedFlag ;
+                 SetGenModuleList, GetGenModuleFilename, SharedFlag,
+                 GetB ;
 
 
 VAR
@@ -194,6 +195,20 @@ PROCEDURE Setc (value: BOOLEAN) ;
 PROCEDURE Getc () : BOOLEAN ;
 
 
+(*
+   SetB - assigns Barg to arg.
+*)
+
+PROCEDURE SetB (arg: ADDRESS) ;
+
+
+(*
+   GetB - returns argument to the -B option as a string or NIL if it were never set.
+*)
+
+PROCEDURE GetB () : ADDRESS ;
+
+
 (*
    SetScaffoldDynamic - set the -fscaffold-dynamic flag.
 *)
diff --git a/gcc/m2/gm2-compiler/M2Options.mod b/gcc/m2/gm2-compiler/M2Options.mod
index a35412accd9..eee1d9cffac 100644
--- a/gcc/m2/gm2-compiler/M2Options.mod
+++ b/gcc/m2/gm2-compiler/M2Options.mod
@@ -30,6 +30,7 @@ FROM M2Printf IMPORT printf0, printf1 ;
 FROM libc IMPORT exit ;
 FROM Debug IMPORT Halt ;
 FROM m2linemap IMPORT location_t ;
+FROM m2configure IMPORT FullPathCPP ;
 
 FROM DynamicStrings IMPORT String, Length, InitString, Mark, Slice, EqualArray,
                            InitStringCharStar, ConCatChar, ConCat, KillString,
@@ -51,10 +52,10 @@ CONST
    Debugging = FALSE ;
 
 VAR
+   Barg,
    GenModuleListFilename,
    UselistFilename,
    RuntimeModuleOverride,
-   CppProgram,
    CppArgs              : String ;
    UselistFlag,
    GenModuleListFlag,
@@ -109,6 +110,27 @@ END DSdbExit ;
 *)
 
 
+(*
+   SetB - assigns Barg to arg.
+*)
+
+PROCEDURE SetB (arg: ADDRESS) ;
+BEGIN
+   Barg := KillString (Barg) ;
+   Barg := InitStringCharStar (arg)
+END SetB ;
+
+
+(*
+   GetB - returns Barg value as a C string or NIL if it was never set.
+*)
+
+PROCEDURE GetB () : ADDRESS ;
+BEGIN
+   RETURN string (Barg)
+END GetB ;
+
+
 (*
    DisplayVersion - displays the version of the compiler.
 *)
@@ -137,38 +159,28 @@ END DisplayVersion ;
 
 (*
    CppCommandLine - returns the Cpp command line and all arguments.
+                    NIL is returned if the -fcpp is absent.
 *)
 
 PROCEDURE CppCommandLine () : String ;
 VAR
    s: String ;
 BEGIN
-   IF EqualArray(CppProgram, '')
+   IF CPreProcessor
    THEN
-      RETURN( NIL )
-   ELSE
-      s := Dup(CppProgram) ;
-      s := ConCat(ConCatChar(s, ' '), CppArgs) ;
+      s := InitStringCharStar (FullPathCPP ()) ;
+      s := ConCat (ConCatChar (s, ' '), CppArgs) ;
       IF CC1Quiet
       THEN
-         s := ConCat(ConCatChar(s, ' '), Mark(InitString('-quiet')))
+         s := ConCat (ConCatChar (s, ' '), Mark (InitString ('-quiet')))
       END ;
-      RETURN( s )
+      RETURN s
+   ELSE
+      RETURN NIL
    END
 END CppCommandLine ;
 
 
-(*
-   CppProg - sets the cpp program to be, program.
-*)
-
-PROCEDURE CppProg (program: ADDRESS) ;
-BEGIN
-   CppProgram := KillString(CppProgram) ;
-   CppProgram := InitStringCharStar(program)
-END CppProg ;
-
-
 (*
    CppArg - sets the option and arg in the cpp command line.
 *)
@@ -181,10 +193,6 @@ BEGIN
    IF EqualArray(s, '-fcpp-begin') OR EqualArray(s, '-fcpp-end')
    THEN
       (* do nothing *)
-   ELSIF EqualArray(s, '-fcpp-prog=')
-   THEN
-      CppProgram := KillString(CppProgram) ;
-      CppProgram := InitStringCharStar(arg)
    ELSE
       IF NOT EqualArray(CppArgs, '')
       THEN
@@ -211,17 +219,12 @@ END CppArg ;
 
 PROCEDURE CppRemember (s: String) ;
 BEGIN
-   IF EqualArray(Mark(Slice(s, 0, 10)), '-fcpp-prog=')
+   IF (CppArgs=NIL) OR EqualArray (CppArgs, '')
    THEN
-      CppProg(string(Mark(Slice(s, 10, 0))))
+      CppArgs := Dup (s)
    ELSE
-      IF (CppArgs=NIL) OR EqualArray(CppArgs, '')
-      THEN
-         CppArgs := Dup(s)
-      ELSE
-         CppArgs := ConCatChar(CppArgs, ' ') ;
-         CppArgs := ConCat(CppArgs, s)
-      END
+      CppArgs := ConCatChar (CppArgs, ' ') ;
+      CppArgs := ConCat (CppArgs, s)
    END
 END CppRemember ;
 
@@ -1198,7 +1201,6 @@ BEGIN
    cflag                        := FALSE ;  (* -c.  *)
    RuntimeModuleOverride        := NIL ;
    CppArgs                      := InitString ('') ;
-   CppProgram                   := InitString ('') ;
    Pim                          :=  TRUE ;
    Pim2                         := FALSE ;
    Pim3                         := FALSE ;
@@ -1258,5 +1260,6 @@ BEGIN
    UselistFilename              := NIL ;
    GenModuleList                := FALSE ;
    GenModuleListFilename        := NIL ;
-   SharedFlag                   := FALSE
+   SharedFlag                   := FALSE ;
+   Barg                         := NIL
 END M2Options.
diff --git a/gcc/m2/gm2-compiler/M2Preprocess.mod b/gcc/m2/gm2-compiler/M2Preprocess.mod
index 59361155bfc..44a688d2008 100644
--- a/gcc/m2/gm2-compiler/M2Preprocess.mod
+++ b/gcc/m2/gm2-compiler/M2Preprocess.mod
@@ -105,7 +105,7 @@ VAR
    commandLine: String ;
 BEGIN
    command := CppCommandLine () ;
-   IF EqualArray (command, '')
+   IF (command = NIL) OR EqualArray (command, '')
    THEN
       RETURN filename
    ELSE
diff --git a/gcc/m2/gm2-compiler/M2Quads.mod b/gcc/m2/gm2-compiler/M2Quads.mod
index ac3cccb61ed..a51f80cde2d 100644
--- a/gcc/m2/gm2-compiler/M2Quads.mod
+++ b/gcc/m2/gm2-compiler/M2Quads.mod
@@ -126,7 +126,6 @@ FROM SymbolTable IMPORT ModeOfAddr, GetMode, PutMode, GetSymName, IsUnknown,
                         IsUnused,
                         NulSym ;
 
-FROM M2Configure IMPORT PushParametersLeftToRight, UsingGCCBackend ;
 FROM M2Batch IMPORT MakeDefinitionSource ;
 FROM M2GCCDeclare IMPORT PutToBeSolvedByQuads ;
 
@@ -4995,41 +4994,21 @@ BEGIN
    THEN
       GenQuad (ParamOp, 0, Proc, ProcSym)  (* Space for return value *)
    END ;
-   IF PushParametersLeftToRight
+   IF (NoOfParameters+1=NoOfParam(Proc)) AND UsesOptArg(Proc)
    THEN
-      IF (NoOfParameters+1=NoOfParam(Proc)) AND UsesOptArg(Proc)
+      GenQuad (OptParamOp, NoOfParam(Proc), Proc, Proc)
+   END ;
+   i := NoOfParameters ;
+   pi := 1 ;     (* stack index referencing stacked parameter, i *)
+   WHILE i>0 DO
+      paramtok := OperandTtok (pi) ;
+      GenQuadO (paramtok, ParamOp, i, Proc, OperandT (pi), TRUE) ;
+      IF NOT IsConst (OperandT (pi))
       THEN
-         GenQuad (OptParamOp, NoOfParam(Proc), Proc, Proc)
+         ParamConstant := FALSE
       END ;
-      i := NoOfParameters ;
-      pi := 1 ;     (* stack index referencing stacked parameter, i *)
-      WHILE i>0 DO
-         paramtok := OperandTtok (pi) ;
-         GenQuadO (paramtok, ParamOp, i, Proc, OperandT (pi), TRUE) ;
-         IF NOT IsConst (OperandT (pi))
-         THEN
-            ParamConstant := FALSE
-         END ;
-         DEC (i) ;
-         INC (pi)
-      END
-   ELSE
-      i := 1 ;
-      pi := NoOfParameters ;   (* stack index referencing stacked parameter, i *)
-      WHILE i<=NoOfParameters DO
-         paramtok := OperandTtok (pi) ;
-         GenQuadO (paramtok, ParamOp, i, Proc, OperandT(pi), TRUE) ;
-         IF NOT IsConst (OperandT (pi))
-         THEN
-            ParamConstant := FALSE
-         END ;
-         INC (i) ;
-         DEC (pi)
-      END ;
-      IF (NoOfParameters+1 = NoOfParam (Proc)) AND UsesOptArg (Proc)
-      THEN
-         GenQuad (OptParamOp, NoOfParam (Proc), Proc, Proc)
-      END
+      DEC (i) ;
+      INC (pi)
    END ;
    GenQuadO (proctok, CallOp, NulSym, NulSym, ProcSym, TRUE) ;
    PopN (NoOfParameters+1) ; (* Destroy arguments and procedure call *)
@@ -8650,25 +8629,13 @@ BEGIN
       starttok := OperandTok (NoOfParameters + 1) ;  (* ADR token.  *)
       endtok := OperandTok (1) ;  (* last parameter.  *)
       GenQuad (ParamOp, 0, MakeAdr, MakeAdr) ;
-      IF PushParametersLeftToRight
-      THEN
-         i := NoOfParameters ;
-         (* stack index referencing stacked parameter, i *)
-         pi := 1 ;
-         WHILE i > 0 DO
-            GenQuadO (OperandTok (pi), ParamOp, i, MakeAdr, OperandT (pi), TRUE) ;
-            DEC (i) ;
-            INC (pi)
-         END
-      ELSE
-         i := 1 ;
-         (* stack index referencing stacked parameter, i *)
-         pi := NoOfParameters ;
-         WHILE i <= NoOfParameters DO
-            GenQuadO (OperandTok (pi), ParamOp, i, MakeAdr, OperandT (pi), TRUE) ;
-            INC (i) ;
-            DEC (pi)
-         END
+      i := NoOfParameters ;
+      (* stack index referencing stacked parameter, i *)
+      pi := 1 ;
+      WHILE i > 0 DO
+         GenQuadO (OperandTok (pi), ParamOp, i, MakeAdr, OperandT (pi), TRUE) ;
+         DEC (i) ;
+         INC (pi)
       END ;
       AreConst := TRUE ;
       i := 1 ;
diff --git a/gcc/m2/gm2-gcc/m2configure.cc b/gcc/m2/gm2-gcc/m2configure.cc
new file mode 100644
index 00000000000..6b40fcb0680
--- /dev/null
+++ b/gcc/m2/gm2-gcc/m2configure.cc
@@ -0,0 +1,101 @@
+/* m2configure.cc provides an interface to some configuration values.
+
+Copyright (C) 2022 Free Software Foundation, Inc.
+Contributed by Gaius Mulley <gaius@glam.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 GNU Modula-2; see the file COPYING3.  If not see
+<http://www.gnu.org/licenses/>.  */
+
+#include "config.h"
+#include "system.h"
+#include "libiberty.h"
+
+#include "config.h"
+#include "system.h"
+#include "libiberty.h"
+
+#include "gcc-consolidation.h"
+
+#include "../gm2-lang.h"
+#include "../m2-tree.h"
+#include "m2convert.h"
+
+/* Prototypes.  */
+
+#define m2configure_c
+
+#include "m2assert.h"
+#include "m2builtins.h"
+#include "m2convert.h"
+#include "m2decl.h"
+#include "m2expr.h"
+#include "m2options.h"
+#include "m2configure.h"
+
+#include "m2/gm2version.h"
+#include "m2/gm2config.h"
+
+#define CPPPROGRAM  "cc1"
+
+
+/* gen_gm2_libexec returns a string containing libexec /
+   DEFAULT_TARGET_MACHINE string / DEFAULT_TARGET_MACHINE.  */
+
+static char *
+gen_gm2_libexec (const char *libexec)
+{
+  int l = strlen (libexec) + 1 + strlen (DEFAULT_TARGET_MACHINE) + 1
+          + strlen (DEFAULT_TARGET_VERSION) + 1;
+  char *s = (char *)xmalloc (l);
+  char dir_sep[2];
+
+  dir_sep[0] = DIR_SEPARATOR;
+  dir_sep[1] = (char)0;
+
+  strcpy (s, libexec);
+  strcat (s, dir_sep);
+  strcat (s, DEFAULT_TARGET_MACHINE);
+  strcat (s, dir_sep);
+  strcat (s, DEFAULT_TARGET_VERSION);
+  return s;
+}
+
+/* FullPathCPP returns the fullpath and program name to cpp.  */
+
+char *
+m2configure_FullPathCPP (void)
+{
+  if (M2Options_GetCpp ())
+    {
+      char *path = (char *) M2Options_GetB ();
+
+      if (path == NULL)
+	path = gen_gm2_libexec (STANDARD_LIBEXEC_PREFIX);
+
+      if (strcmp (path, "") == 0)
+	return xstrdup (CPPPROGRAM);
+
+      char *full = (char *)xmalloc (strlen (path) + 1 + strlen (CPPPROGRAM) + 1);
+      strcpy (full, path);
+      char *sep = (char *)alloca (2);
+      sep[0] = DIR_SEPARATOR;
+      sep[1] = (char)0;
+      strcat (full, sep);
+      strcat (full, CPPPROGRAM);
+      return full;
+    }
+  return NULL;
+}
diff --git a/gcc/m2/gm2-compiler/M2Configure.mod b/gcc/m2/gm2-gcc/m2configure.def
similarity index 54%
rename from gcc/m2/gm2-compiler/M2Configure.mod
rename to gcc/m2/gm2-gcc/m2configure.def
index 70feb1b9f51..64ce20f9977 100644
--- a/gcc/m2/gm2-compiler/M2Configure.mod
+++ b/gcc/m2/gm2-gcc/m2configure.def
@@ -1,6 +1,6 @@
-(* M2Configure.mod exports configuration constants.
+(* m2configure.def exports configuration constants.
 
-Copyright (C) 2001-2022 Free Software Foundation, Inc.
+Copyright (C) 2022 Free Software Foundation, Inc.
 Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
 
 This file is part of GNU Modula-2.
@@ -19,6 +19,26 @@ You should have received a copy of the GNU General Public License
 along with GNU Modula-2; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  *)
 
-IMPLEMENTATION MODULE M2Configure ;
+DEFINITION MODULE FOR "C" m2configure ;
 
-END M2Configure.
+FROM SYSTEM IMPORT ADDRESS ;
+EXPORT QUALIFIED UseUnderscoreForC, FullPathCPP ;
+
+
+CONST
+(*
+   UseUnderscoreForC - true if gcc places an underscore in front of global functions.
+*)
+   UseUnderscoreForC = FALSE ;
+
+
+(*
+   FullPathCPP - return a string to the full path of the C preprocessor cpp.
+                 It checks the -B option (if provided) otherwise it uses
+                 the STANDARD_LIBEXEC_PREFIX.
+*)
+
+PROCEDURE FullPathCPP () : ADDRESS ;
+
+
+END m2configure.
diff --git a/gcc/m2/gm2-gcc/m2options.h b/gcc/m2/gm2-gcc/m2options.h
index 2962bb21eea..bcf60eeb145 100644
--- a/gcc/m2/gm2-gcc/m2options.h
+++ b/gcc/m2/gm2-gcc/m2options.h
@@ -120,6 +120,8 @@ EXTERN void M2Options_SetScaffoldMain (int value);
 EXTERN void M2Options_SetRuntimeModuleOverride (const char *override);
 EXTERN void M2Options_SetGenModuleList (int value, const char *filename);
 EXTERN void M2Options_SetShared (int value);
+EXTERN void M2Options_SetB (const char *arg);
+EXTERN char *M2Options_GetB (void);
 
 #undef EXTERN
 #endif /* m2options_h.  */
diff --git a/gcc/m2/gm2-lang.cc b/gcc/m2/gm2-lang.cc
index e17f7a513b6..63950722cdd 100644
--- a/gcc/m2/gm2-lang.cc
+++ b/gcc/m2/gm2-lang.cc
@@ -204,6 +204,9 @@ gm2_langhook_handle_option (
 
   switch (code)
     {
+    case OPT_B:
+      M2Options_SetB (arg);
+      return 1;
     case OPT_c:
       M2Options_Setc (value);
       return 1;
@@ -352,9 +355,6 @@ gm2_langhook_handle_option (
     case OPT_fcpp_end:
       insideCppArgs = FALSE;
       return 1;
-    case OPT_fcpp_prog_:
-      M2Options_CppProg (arg);
-      return 1;
     case OPT_fq:
       M2Options_SetQuadDebugging (value);
       return 1;
diff --git a/gcc/m2/gm2spec.cc b/gcc/m2/gm2spec.cc
index 83655e1dd77..dba38d608b8 100644
--- a/gcc/m2/gm2spec.cc
+++ b/gcc/m2/gm2spec.cc
@@ -140,8 +140,6 @@ static bool seen_uselist = false;
 static bool uselist = false;
 static bool gen_module_list = true;  // Default uses -fgen-module-list=-.
 static const char *gen_module_filename = "-";
-static bool seen_B = false;
-static const char *B_path = NULL;
 static const char *multilib_dir = NULL;
 /* The original argument list and related info is copied here.  */
 static unsigned int gm2_xargc;
@@ -230,61 +228,6 @@ append_option (size_t opt_index, const char *arg, int value)
   append_arg (&decoded);
 }
 
-/* gen_gm2_libexec returns a string containing libexec /
-   DEFAULT_TARGET_MACHINE string / DEFAULT_TARGET_MACHINE.  */
-
-static const char *
-gen_gm2_libexec (const char *libexec)
-{
-  int l = strlen (libexec) + 1 + strlen (DEFAULT_TARGET_MACHINE) + 1
-          + strlen (DEFAULT_TARGET_VERSION) + 1;
-  char *s = (char *)xmalloc (l);
-  char dir_sep[2];
-
-  dir_sep[0] = DIR_SEPARATOR;
-  dir_sep[1] = (char)0;
-
-  strcpy (s, libexec);
-  strcat (s, dir_sep);
-  strcat (s, DEFAULT_TARGET_MACHINE);
-  strcat (s, dir_sep);
-  strcat (s, DEFAULT_TARGET_VERSION);
-  return s;
-}
-
-/* add_exec_dir wraps the exec path with the -fcpp-prog= option.  */
-
-static const char *
-add_exec_dir (int argc, const char *argv[])
-{
-  if (argc == 1 && argv[0] != NULL)
-    {
-      const char *path;
-
-      if (seen_B)
-        path = xstrdup (B_path);
-      else
-        path = gen_gm2_libexec (STANDARD_LIBEXEC_PREFIX);
-
-      if (path != NULL)
-        {
-          char *opt = (char *)xmalloc (strlen ("-fcpp-prog=") + strlen (path)
-                                       + 1 + strlen (argv[0]) + 1);
-          char *sep = (char *)alloca (2);
-
-          sep[0] = DIR_SEPARATOR;
-          sep[1] = (char)0;
-
-          strcpy (opt, "-fcpp-prog=");
-          strcat (opt, path);
-          strcat (opt, sep);
-          strcat (opt, argv[0]);
-          return opt;
-        }
-    }
-  return "-fcpp-prog=none";
-}
-
 /* build_archive_path returns a string containing the path to the
    archive defined by libpath and dialectLib.  */
 
@@ -733,10 +676,6 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
 	case OPT_fm2_version:
 	  gm2_version (false);
 	  break;
-        case OPT_B:
-          seen_B = true;
-          B_path = decoded_options[i].arg;
-          break;
         case OPT_fpthread:
           need_pthread = decoded_options[i].value;
           break;
@@ -1008,7 +947,7 @@ int lang_specific_extra_outfiles = 0;
 void
 lang_register_spec_functions (void)
 {
-#if 1
+#if 0
   fe_add_spec_function ("exec_prefix", add_exec_dir);
 #endif
 }
diff --git a/gcc/m2/lang-specs.h b/gcc/m2/lang-specs.h
index c5b2fbfca83..706064fc8db 100644
--- a/gcc/m2/lang-specs.h
+++ b/gcc/m2/lang-specs.h
@@ -24,14 +24,14 @@ along with GCC; see the file COPYING3.  If not see
 /* Pass the preprocessor options on the command line together with
    the exec prefix.  */
 
-#define M2CPP "%{fcpp:-fcpp-begin %:exec_prefix(cc1)" \
+#define M2CPP "%{fcpp:-fcpp-begin " \
               "      -E -lang-asm -traditional-cpp " \
               "      %(cpp_unique_options) -fcpp-end}"
 
   {".mod", "@modula-2", 0, 0, 0},
   {"@modula-2",
       "cc1gm2 " M2CPP
-      "      %(cc1_options) %{c*} %{f*} %{+e*} %{I*} "
+      "      %(cc1_options) %{B*} %{c*} %{f*} %{+e*} %{I*} "
       "      %{MD} %{MMD} %{M} %{MM} %{MA} %{MT*} %{MF*} %V"
       "      %{save-temps*}"
       "      %i %{!fsyntax-only:%(invoke_as)}",
diff --git a/gcc/m2/lang.opt b/gcc/m2/lang.opt
index b46b6b05325..7dd6cc2ee89 100644
--- a/gcc/m2/lang.opt
+++ b/gcc/m2/lang.opt
@@ -26,6 +26,10 @@
 Language
 Modula-2
 
+B
+Modula-2
+; Documented in c.opt
+
 D
 Modula-2
 ; Documented in c.opt
@@ -114,10 +118,6 @@ fcpp-begin
 Modula-2
 passed to the preprocessor if -fcpp is used (internal switch)
 
-fcpp-prog=
-Modula-2 Joined
-passed to the preprocessor if -fcpp is used (internal switch)
-
 fdebug-builtins
 Modula-2
 call a real function, rather than the builtin equivalent


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-08-13 23:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-13 23:12 [gcc/devel/modula-2] Partial cleanup to implement calling cc1 from within cc1gm2 Gaius Mulley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).