gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Query on linking order


From: Michael Riedl
Subject: Re: Query on linking order
Date: Mon, 3 Jul 2023 00:04:37 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:102.0) Gecko/20100101 Thunderbird/102.11.0

John, Gaius,

that looks quite similar to an observation I made when linking "C" code with a "normal" definition module (no 'FOR "C"' clause) and I also had an implementation module in the subdir with a corresponding name (e.g. foo.def, foo.c foo.o (compiled out of foo.c) and foo.mod) and and "IMPORT foo" in the main module. OK - here I "fooled" the linker by mistake (though giving foo.o explicitly in the argument list for the linker), so renaming foo.mod e.g. to foo.mi fixed the issue.

Maybe also related to issue with the linking of my bigger programs I reported quite a while ago.

The linker "walks" though all implementation modules and makes nonsense if this is too much code (in my huge sample it claimed errors where there where non) or imports even unused code.

In Johns sample I would assume there was an import of "IO" somewhere in dependency tree - if I rename IO.{def|mod} to IOlocal.{def|mod} the error vanishes.

Gruß

Michael

PS: John, your error is reproducible on an Linux/Intel machine

---------

mriedl@laptop:~/Modula-2/GM2/John$gm2 -c -fscaffold-main first.mod
./IO.mod:10:5: Warnung: In procedure »Something«: syntax warning, »END« missing
   10 | END Something;
      |     ^~~~~~~~~
/usr/local/gm2-13.1.0/bin/../lib/gcc/i686-pc-linux-gnu/13.1.0/./m2/m2pim/StdIO.mod:163:18: Fehler: In implementation module »StdIO«: unknown ident in the construction of a qualident
  163 |    PushOutput(IO.Write) ;
      |                  ^~~~~
/usr/local/gm2-13.1.0/bin/../lib/gcc/i686-pc-linux-gnu/13.1.0/./m2/m2pim/StdIO.mod:164:17: Fehler: unknown ident in the construction of a qualident
  164 |    PushInput(IO.Read)
      |                 ^~~~
mriedl@laptop:~/Modula-2/GM2/John$

--------

Am 02.07.23 um 20:01 schrieb john o goyo:
Greetings, Gaius.

What is the linking order for gm2?

Reason: When linking, it seems that gm2 looks in the current directory even though there is no reference to the current directoy.

Example: Note the following sequence.

[~/prj/tst]=> cat first.mod
MODULE first;

   FROM InOut IMPORT WriteString, WriteLn;

BEGIN
   WriteString("Modula-2. What else?"); WriteLn;
END first.

[~/prj/tst]=> cat IO.def
DEFINITION MODULE IO;

(*
 * Test module for gm2 linking order.
 *)

PROCEDURE Something(i :CARDINAL) :CARDINAL;

END IO.

[~/prj/tst]=> cat IO.mod
IMPLEMENTATION MODULE IO;

(*
 * Test module for gm2 linking order.
 *)

PROCEDURE Something(i :CARDINAL) :CARDINAL;
BEGIN
  IF ODD(i) THEN RETURN i + 1
END Something;

END IO.

[~/prj/tst]=> gm2 -c first.mod
[~/prj/tst]=> gm2 first.mod
./IO.mod:10:5: warning: In procedure : syntax warning,  missing
   10 | END Something;
      |     ^~~~~~~~~
/home/build/gcc/13.1.0/lib/gcc/sparc-sun-solaris2.11/13.1.0/m2/m2pim/StdIO.mod:163:18: error: In implementation module : unknown ident in the construction of a qualident
  163 |    PushOutput(IO.Write) ;
      |                  ^~~~~
/home/build/gcc/13.1.0/lib/gcc/sparc-sun-solaris2.11/13.1.0/m2/m2pim/StdIO.mod:164:17: error: unknown ident in the construction of a qualident
  164 |    PushInput(IO.Read)
      |                 ^~~~


It seems that gm2 tries to include the IO.mod is the current directory, despite no directive to do so.

I could not find anything relevant in the gm2 documenation.

Please advise.

Sincerely,
john




reply via email to

[Prev in Thread] Current Thread [Next in Thread]