]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fixes to allow -fcpp and regression test link changes.
authorGaius Mulley <gaius.mulley@southwales.ac.uk>
Sun, 26 Jun 2022 12:50:27 +0000 (13:50 +0100)
committerGaius Mulley <gaius.mulley@southwales.ac.uk>
Sun, 26 Jun 2022 12:50:27 +0000 (13:50 +0100)
This patch fixes (re-introduces) the -fcpp option and it
migrates more testsuite tcl files to use the new linking mechanism.

2022-06-26  Gaius Mulley  <gaius.mulley@southwales.ac.uk>

gcc/m2/ChangeLog:

* bnf/gm2l.bnf (ScanArgs): -fcppbegin changed to -fcpp-begin.
* gm2-compiler/M2DriverOptions.mod (ScanCppArgs):
-fcppbegin changed to -fcpp-begin, -fcppend changed to
-fcpp-end.
* gm2-compiler/M2GenGCC.mod (CodeFinallyEnd): Check
we are compiling the main module before generating
the scaffold.
* gm2-compiler/M2Options.mod (CppRemember): -fcppbegin
changed to -fcpp-begin.  (CppArg) -fcppbegin
changed to -fcpp-begin, -fcppend changed to -fcpp-end.
-fcppprog changed to -fcpp-prog.
* gm2-compiler/P2SymBuild.mod (BlockEnd): Added assert.
(PopBlock) bug fix, curModuleSym is popped in
correct sequence.
* gm2-lang.cc (gm2_langhook_init_options):
-fcppbegin changed to -fcpp-begin.  -fcppend changed to
-fcpp-end.  -fcppprog changed to -fcpp-prog.
* gm2spec.cc (get_libexec):  New function.
(gen_gm2_libexec) New function.  (add_exec_dir) New function.
(lang_register_spec_functions) add exec_prefix.
* lang-specs.h: -fcppbegin changed to -fcpp-begin.
-fcppend changed to -fcpp-end.
* lang.opt: Uniform internal switch statement used
where necessary.  -fcppbegin changed to -fcpp-begin.
-fcppend changed to -fcpp-end.  -fcppprog= changed to -fcpp-prog=.

libgm2/Changelog:

* libm2iso/m2rts.h: (New file).

Signed-off-by: Gaius Mulley <gaius.mulley@southwales.ac.uk>
28 files changed:
gcc/m2/bnf/gm2l.bnf
gcc/m2/gm2-compiler/M2DriverOptions.mod
gcc/m2/gm2-compiler/M2GenGCC.mod
gcc/m2/gm2-compiler/M2Options.mod
gcc/m2/gm2-compiler/P2SymBuild.mod
gcc/m2/gm2-lang.cc
gcc/m2/gm2spec.cc
gcc/m2/lang-specs.h
gcc/m2/lang.opt
gcc/testsuite/gm2/coroutines/pim/run/pass/coroutines-pim-run-pass.exp
gcc/testsuite/gm2/exceptions/run/pass/exceptions-run-pass.exp
gcc/testsuite/gm2/extensions/run/fail/extensions-run-fail.exp
gcc/testsuite/gm2/extensions/run/pass/extensions-run-pass.exp
gcc/testsuite/gm2/iso/run/pass/iso-run-pass.exp
gcc/testsuite/gm2/pim/options/optimize/run/pass/pim-options-optimize-run-pass.exp
gcc/testsuite/gm2/pimcoroutines/run/pass/pimcoroutines-run-pass.exp
gcc/testsuite/gm2/pimlib/base/run/pass/pimlib-base-run-pass.exp
gcc/testsuite/gm2/pimlib/logitech/run/pass/pimlib-logitech-run-pass.exp
gcc/testsuite/gm2/pimlib/run/pass/pimlib-run-pass.exp
gcc/testsuite/gm2/quads/run/pass/quads-run-pass.exp
gcc/testsuite/gm2/sets/run/pass/sets-run-pass.exp
gcc/testsuite/gm2/switches/check-all/run/fail/switches-check-all-run-fail.exp
gcc/testsuite/gm2/switches/check-all/run/pass/switches-check-all-run-pass.exp
gcc/testsuite/gm2/switches/iso/run/pass/switches-iso-run-pass.exp
gcc/testsuite/gm2/switches/makeall/pass/switches-makeall-pass.exp
gcc/testsuite/gm2/switches/pim2/run/pass/switches-pim2-run-pass.exp
gcc/testsuite/gm2/types/run/pass/types-run-pass.exp
libgm2/libm2iso/m2rts.h [new file with mode: 0644]

index 5d1fb880a3f64d06dcc5828be02d029f494fad91..88cbb1ddc627e29dea3c906c6827a9113b560f3f 100644 (file)
@@ -867,7 +867,7 @@ BEGIN
             ELSIF EqualArray(Mark (Slice (s, 0, 6)), '-fmod=')
             THEN
                SetModExtension (Slice (s, 6, 0))
-            ELSIF EqualArray (s, '-fcppbegin')
+            ELSIF EqualArray (s, '-fcpp-begin')
             THEN
                i := ScanCppArgs (i)
             ELSIF EqualArray (s, '--M2RTS') OR EqualArray (s, '-M2RTS')
index e27dd72146e42364d1fe723732d95c44b24ac376..e3971e6b29eb18c9afa14ed7fb34a14161282b54 100644 (file)
@@ -70,11 +70,11 @@ PROCEDURE ScanCppArgs (i: CARDINAL) : CARDINAL ;
 VAR
    option: String ;
 BEGIN
-   IF GetArg (option, i) AND EqualArray (option, '-fcppbegin')
+   IF GetArg (option, i) AND EqualArray (option, '-fcpp-begin')
    THEN
       INC (i) ;
       WHILE GetArg (option, i) DO
-         IF EqualArray (option, '-fcppend')
+         IF EqualArray (option, '-fcpp-end')
          THEN
             RETURN i
          ELSE
index 570713c4126dc8ba399470e55fbfb32d8afbccd3..fd7d7fb75bb897f6b22dc8401741f48818dbaa42 100644 (file)
@@ -1156,7 +1156,9 @@ BEGIN
                             IsModuleWithinProcedure (moduleSym)) ;
       IF ScaffoldMain OR (NOT cflag)
       THEN
-         IF CompilingMainModule AND (ScaffoldDynamic OR ScaffoldStatic OR ScaffoldMain)
+         IF CompilingMainModule AND
+            (ScaffoldDynamic OR ScaffoldStatic OR ScaffoldMain) AND
+            (moduleSym = GetMainModule ())
          THEN
             qprintf0 ("generating scaffold m2link information\n");
             DeclareM2linkGlobals (location, VAL (INTEGER, ScaffoldStatic), GetRuntimeModuleOverride ())
index 00df4ddde94b304a2c48c032351405bd59e2d766..450c08a25ed16954974b62a3aa481fc6cd68bade 100644 (file)
@@ -175,10 +175,10 @@ VAR
    s: String ;
 BEGIN
    s := InitStringCharStar(opt) ;
-   IF EqualArray(s, '-fcppbegin') OR EqualArray(s, '-fcppend')
+   IF EqualArray(s, '-fcpp-begin') OR EqualArray(s, '-fcpp-end')
    THEN
       (* do nothing *)
-   ELSIF EqualArray(s, '-fcppprog=')
+   ELSIF EqualArray(s, '-fcpp-prog=')
    THEN
       CppProgram := KillString(CppProgram) ;
       CppProgram := InitStringCharStar(arg)
@@ -208,7 +208,7 @@ END CppArg ;
 
 PROCEDURE CppRemember (s: String) ;
 BEGIN
-   IF EqualArray(Mark(Slice(s, 0, 10)), '-fcppprog=')
+   IF EqualArray(Mark(Slice(s, 0, 10)), '-fcpp-prog=')
    THEN
       CppProg(string(Mark(Slice(s, 10, 0))))
    ELSE
index 97aeb8de0eb6710806518b74e7d12c4232fe2557..d5c8d24996310dab45e8fedd7b2bab8a3b498845 100644 (file)
@@ -199,6 +199,7 @@ PROCEDURE BlockEnd (tokno: CARDINAL) ;
 BEGIN
    curBeginTok := propageteTokenPosition (curStartTok, curBeginTok) ;
    curFinallyTok := propageteTokenPosition (tokno, curFinallyTok) ;
+   Assert (curModuleSym # NulSym) ;
    MakeModuleCtor (curStartTok, curBeginTok, curFinallyTok,
                    curModuleSym) ;
    PopBlock
@@ -250,11 +251,11 @@ END PushBlock ;
 
 PROCEDURE PopBlock ;
 BEGIN
+   curModuleSym := PopWord (BlockStack) ;
    curFinallyTok := PopWord (BlockStack) ;
    curEndTok := PopWord (BlockStack) ;
    curBeginTok := PopWord (BlockStack) ;
-   curStartTok := PopWord (BlockStack) ;
-   curModuleSym := PopWord (BlockStack)
+   curStartTok := PopWord (BlockStack)
 END PopBlock ;
 
 
index fd03d9c5387673179c3fbe44e7d3d586fb7e00a4..5b1021b79500f8afdc682419bf705f5e5c419f3d 100644 (file)
@@ -167,10 +167,10 @@ gm2_langhook_init_options (unsigned int decoded_options_count,
     {
       switch (decoded_options[i].opt_index)
         {
-        case OPT_fcppbegin:
+        case OPT_fcpp_begin:
           in_cpp_args = true;
           break;
-        case OPT_fcppend:
+        case OPT_fcpp_end:
           in_cpp_args = false;
           break;
         case OPT_SPECIAL_input_file:
@@ -343,13 +343,13 @@ gm2_langhook_handle_option (
     case OPT_fcpp:
       M2Options_SetCpp (value);
       return 1;
-    case OPT_fcppbegin:
+    case OPT_fcpp_begin:
       insideCppArgs = TRUE;
       return 1;
-    case OPT_fcppend:
+    case OPT_fcpp_end:
       insideCppArgs = FALSE;
       return 1;
-    case OPT_fcppprog_:
+    case OPT_fcpp_prog_:
       M2Options_CppProg (arg);
       return 1;
     case OPT_fq:
index 8d834252eefdc50affdedb995753b73c5d3da716..1305d9ceb53dc53965899e55195f2f8aa3412871 100644 (file)
@@ -117,6 +117,9 @@ static void insert_option (unsigned int *in_decoded_options_count,
                            struct cl_decoded_option **in_decoded_options,
                            unsigned int position);
 static const char *gen_link_path (const char *libpath, const char *dialect);
+static const char *add_exec_dir (int argc, const char *argv[]);
+static const char *gen_gm2_libexec (const char *path);
+static const char *get_libexec (void);
 
 static bool seen_B = false;
 static const char *B_path = NULL;
@@ -130,6 +133,71 @@ static const char *multilib_dir = NULL;
 #endif
 
 
+static const char *
+get_libexec (void)
+{
+  const char *libexec = getenv (GM2_LIBEXEC_ENV);
+
+  if (libexec == NULL || (strcmp (libexec, "") == 0))
+    return STANDARD_LIBEXEC_PREFIX;
+  else
+    return libexec;
+}
+
+/* gen_gm2_libexec, return a libexec string.  */
+
+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 prepends the exec path to the given executable filename.  */
+
+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 (get_libexec ());
+
+      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";
+}
+
 /* fe_generate_option wrap up arg and pass it to fe_save_switch.  */
 
 static void
@@ -793,4 +861,5 @@ lang_specific_pre_link (void)
 void
 lang_register_spec_functions (void)
 {
+  fe_add_spec_function ("exec_prefix", add_exec_dir);
 }
index d7f1e696e8d1cc781e95e85342dba2e517133274..c5b2fbfca83e0d5bd963059f33df2304651e2fbe 100644 (file)
@@ -24,9 +24,9 @@ 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:-fcppbegin %:exec_prefix(cc1)" \
+#define M2CPP "%{fcpp:-fcpp-begin %:exec_prefix(cc1)" \
               "      -E -lang-asm -traditional-cpp " \
-              "      %(cpp_unique_options) -fcppend}"
+              "      %(cpp_unique_options) -fcpp-end}"
 
   {".mod", "@modula-2", 0, 0, 0},
   {"@modula-2",
index 01f6a9ad188d4a05f70093176dd5ed159c88ab83..14176fa60395bad69bfeaef4a2008c4a9071448c 100644 (file)
@@ -80,7 +80,7 @@ automatically initializes all pointers to NIL
 
 flocation=
 Modula-2 Joined
-set all location values to a specific value (internal)
+set all location values to a specific value (internal switch)
 
 fbounds
 Modula-2
@@ -326,17 +326,17 @@ fobjc-std=objc1
 Modula-2
 ; Documented in c.opt
 
-fcppend
+fcpp-end
 Modula-2
-passed to the preprocessor if -fcpp is used
+passed to the preprocessor if -fcpp is used (internal switch)
 
-fcppbegin
+fcpp-begin
 Modula-2
-passed to the preprocessor if -fcpp is used
+passed to the preprocessor if -fcpp is used (internal switch)
 
-fcppprog=
+fcpp-prog=
 Modula-2 Joined
-passed to the preprocessor if -fcpp is used
+passed to the preprocessor if -fcpp is used (internal switch)
 
 E
 Modula-2
index 4d7076bf6cce1ca0c8cb83a3ecfc48e04a757096..ec2483bbc609522659f33fc2b6a5d23c90cb0798 100644 (file)
@@ -28,7 +28,7 @@ load_lib gm2-torture.exp
 set gm2src ${srcdir}/../gm2
 
 gm2_init_cor
-gm2_link_with "-lm2cor -lm2pim -lm2iso -lpthread"
+gm2_link_with "-lm2cor"
 
 foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] {
     # If we're only testing specific files and this isn't one of them, skip it.
index 729c63f2d386de94036be577f699d0fe84b10c6c..9616ff11c06c6542b183748eca3c480071d8cff9 100644 (file)
@@ -29,7 +29,6 @@ load_lib gm2-torture.exp
 
 
 set output [target_compile $srcdir/$subdir/cpp.cpp cpp.o object "-g"]
-set output [target_compile $srcdir/$subdir/mycpp.cpp mycpp.o object "-g"]
 
 #
 #  notice this uses PIM libraries with exceptions - this is a useful test.
@@ -39,6 +38,7 @@ set output [target_compile $srcdir/$subdir/mycpp.cpp mycpp.o object "-g"]
 set gm2src ${srcdir}/../m2
 
 gm2_init_pim "${srcdir}/gm2/exceptions/run/pass"
+gm2_link_with "cpp.o"
 
 foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] {
     # If we're only testing specific files and this isn't one of them, skip it.
index 224ebb252ecdcb37e2a13bd33eb6f6136e1cc677..ede8efb40a7a1d857d161395ef4f28c070b24383 100644 (file)
@@ -28,7 +28,6 @@ load_lib gm2-torture.exp
 set gm2src ${srcdir}/../m2
 
 gm2_init_pim "${srcdir}/gm2/extensions/run/fail" -fsoft-check-all -fno-m2-plugin
-gm2_link_with "-lm2pim -lm2iso -lpthread"
 
 foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] {
     # If we're only testing specific files and this isn't one of them, skip it.
index 04227121000e24e7786b7a6a0b74fdd025497d7d..40d40fb6e5089009bcccc10a8640482acaee7944 100644 (file)
@@ -28,7 +28,7 @@ load_lib gm2-torture.exp
 set gm2src ${srcdir}/../m2
 
 gm2_init_pim "${srcdir}/gm2/extensions/run/pass" -fsoft-check-all
-gm2_link_with "cvararg.o -lm2pim -lm2iso -lpthread"
+gm2_link_with "cvararg.o"
 
 set output [target_compile $srcdir/$subdir/cvararg.c cvararg.o object "-g"]
 
index ba6ebc6dc79049a927a64232ca6841aaae02cf81..7f284ec4a99cd8770ec42500f6ff7a35ea0e0544 100644 (file)
@@ -25,6 +25,7 @@ if $tracelevel then {
 load_lib gm2-torture.exp
 
 gm2_init_iso "${srcdir}/gm2/iso/run/pass" -fsoft-check-all
+gm2_link_with fileio.o
 
 foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] {
     # If we're only testing specific files and this isn't one of them, skip it.
index 28deba3ce484bf85a444382bedff398f107e3c4b..746cb5f296b5e449413cb63f7fb84652f59ef2ab 100644 (file)
@@ -82,7 +82,7 @@ proc gm2_target_compile_options_optimize { source dest type options } {
 set gm2src ${srcdir}/../m2
 
 gm2_init_pim "${srcdir}/gm2/pim/options/optimize/run/pass"
-gm2_link_with "-lm2pim -lm2iso -lpthread"
+gm2_link_with "-lm2pim -lm2iso -lpthread"
 
 #
 #  compile library file
index a224ce8089276ea685cface5d904062fdd000d30..a6157d0233ab917daa8d5cdcfd5e56057b79ace7 100644 (file)
@@ -27,7 +27,7 @@ load_lib gm2-torture.exp
 set gm2src ${srcdir}/../m2
 
 gm2_init_cor "${srcdir}/gm2/pim/run/pass"
-gm2_link_with "-lm2cor -lm2pim -lm2iso -lpthread"
+gm2_link_with "-lm2cor"
 
 
 foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] {
index 447b16d77969ad3c2fbfe99888044740e56a54a2..ba0d677b931a79f28d30f544eb69bce6a145f9a9 100644 (file)
@@ -28,7 +28,6 @@ load_lib gm2-torture.exp
 set gm2src ${srcdir}/../m2
 
 gm2_init_pim "${srcdir}/gm2/pimlib/base/run/pass"
-gm2_link_with "-lm2pim -lm2iso -lpthread"
 
 foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] {
     # If we're only testing specific files and this isn't one of them, skip it.
index 77afa0aa354d2caf07738db3ac21ed44166e7b9c..1a10a77cd72be4e78ac1292a4e890407dac879f2 100644 (file)
@@ -29,7 +29,7 @@ set gm2src ${srcdir}/../m2
 
 gm2_init_log
 
-gm2_link_with "-lm2log -lm2pim -lm2iso -lpthread"
+gm2_link_with "-lm2log"
 
 
 foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] {
index a04c33308a3e1d55c642f49a58b8cb79ec9dafd6..b2078c62d0596ec9b80efa5951d6a12a5a885a4f 100644 (file)
@@ -29,7 +29,7 @@ set gm2src ${srcdir}/../m2
 
 gm2_init_log
 
-gm2_link_with "-lm2pim -lm2log -lm2iso -lpthread"
+gm2_link_with "-lm2log"
 
 foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] {
     # If we're only testing specific files and this isn't one of them, skip it.
index 06dfd44c8e464971542c6be27d58196cd0698a5b..01d40d29d9fcecbf3d15a3bde785c5e0baec5012 100644 (file)
@@ -28,7 +28,6 @@ load_lib gm2-torture.exp
 set gm2src ${srcdir}/../m2
 
 gm2_init_pim "${gm2src}/gm2-compiler"
-gm2_link_with "-lm2pim -lm2iso -lpthread"
 
 foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] {
     # If we're only testing specific files and this isn't one of them, skip it.
index b90725df29393e1249d1ac6e944eb40a943948bc..96670450fc9deac4d085cb98caccbed5cd724fd0 100644 (file)
@@ -28,7 +28,6 @@ load_lib gm2-torture.exp
 set gm2src ${srcdir}/../m2
 
 gm2_init_iso "${srcdir}/gm2/sets/run/pass/"
-gm2_link_with "-lm2iso -lm2pim -lpthread"
 
 foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] {
     # If we're only testing specific files and this isn't one of them, skip it.
index 076f90a531b185b232a2939c8175d067bdb77557..38acb74db8cb7b8094a727033509a0898495862c 100644 (file)
@@ -28,7 +28,6 @@ load_lib gm2-torture.exp
 set gm2src ${srcdir}/../m2
 
 gm2_init_pim "${srcdir}/gm2/switches/check-all/run/fail" -fsoft-check-all -fno-m2-plugin
-gm2_link_with "-lm2pim -lm2iso -lpthread"
 
 #
 #  compile the support module
index 1ee2f3ff38e1adb24ef3a4c8cd06d1d0b5d1e5fb..a6eb4669615445cc57b04c88f5505ba913035fa0 100644 (file)
@@ -28,7 +28,6 @@ load_lib gm2-torture.exp
 set gm2src ${srcdir}/../m2
 
 gm2_init_iso "${srcdir}/gm2/switches/check-all/run/pass" -fsoft-check-all
-gm2_link_with "-lm2iso -lm2pim -lpthread"
 
 foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] {
     # If we're only testing specific files and this isn't one of them, skip it.
index e7a36c9ac85ac69d7c7ab3d1cc47481d5af5e647..114f5f8a92b4619039ed1dfc2a121124cb82bf5c 100644 (file)
@@ -27,7 +27,6 @@ load_lib gm2-torture.exp
 set gm2src ${srcdir}/../m2
 
 gm2_init_iso "${srcdir}/gm2/switches/iso/run/pass"
-gm2_link_with "-lm2iso -lm2pim -lpthread"
 
 foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] {
     # If we're only testing specific files and this isn't one of them, skip it.
index 9c43b98edbba30ed2ad9f6d5c7feccec60df431c..82d057430c54d564144e2a1020ad275aab207ab5 100644 (file)
@@ -26,7 +26,6 @@ load_lib gm2-torture.exp
 
 gm2_init "-I${srcdir}/gm2/switches/makeall/pass" -fmakeall
 gm2_init_pim4 "${srcdir}/gm2/switches/makeall/pass"
-gm2_link_with "-lm2pim -lm2iso -lpthread"
 
 foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] {
     # If we're only testing specific files and this isn't one of them, skip it.
index 6e915e961918761079940b1f5f968d5f41b7b9bc..9444780b5eedeccb88dbe6cfba8484e5c42ac793 100644 (file)
@@ -28,7 +28,6 @@ load_lib gm2-torture.exp
 set gm2src ${srcdir}/../m2
 
 gm2_init_pim2
-gm2_link_with "-lm2pim -lm2iso -lpthread"
 
 foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] {
     # If we're only testing specific files and this isn't one of them, skip it.
index 50903547367903930741fe843cb7d293ccfb5131..375c7012e7d096eb5700362a23f0c2b1b68e90a8 100644 (file)
@@ -28,7 +28,7 @@ load_lib gm2-torture.exp
 set gm2src ${srcdir}/../m2
 
 gm2_init_pim "${srcdir}/gm2/types/run/pass"
-gm2_link_with "d.o -lm2pim -lm2iso -lpthread"
+gm2_link_with "d.o"
 
 set output [target_compile $srcdir/$subdir/d.c d.o object "-g"]
 
diff --git a/libgm2/libm2iso/m2rts.h b/libgm2/libm2iso/m2rts.h
new file mode 100644 (file)
index 0000000..57e6e90
--- /dev/null
@@ -0,0 +1,41 @@
+/* m2rts.h provides a C interface to M2RTS.mod.
+
+Copyright (C) 2019-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.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+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/>.  */
+
+
+typedef void (*proc_con) (int, char **, char **);
+typedef void (*proc_dep) (void);
+
+extern "C" void M2RTS_RequestDependant (const char *modulename, const char *dependancy);
+extern "C" void M2RTS_RegisterModule (const char *modulename,
+                                     proc_con init, proc_con fini, proc_dep dependencies);
+extern "C" void _M2_M2RTS_init (void);
+
+extern "C" void M2RTS_ConstructModules (const char *,
+                                       int argc, char *argv[], char *envp[]);
+extern "C" void M2RTS_Terminate (void);
+extern "C" void M2RTS_DeconstructModules (void);
+
+extern "C" void M2RTS_Halt (const char *, int, const char *, const char *) __attribute__ ((noreturn));