gm2
[Top][All Lists]
Advanced

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

Re: [Gm2] Linking order oddity


From: Gaius Mulley
Subject: Re: [Gm2] Linking order oddity
Date: Wed, 07 Jan 2009 18:32:55 +0000
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux)

john o goyo <address@hidden> writes:

> The order specified on the command line seems to determine
> whether or not certain libraries are linked.  Witness the
> following session (gm2-2008-12-15 on Solaris 10/sparc).
>
> decus: 1750 test=> cat add.def
> DEFINITION MODULE add;
>
> PROCEDURE add(x, y :CARDINAL) :CARDINAL;
>
> END add.
> decus: 1751 test=> cat add.mod
> IMPLEMENTATION MODULE add;
>
> PROCEDURE add(x, y :CARDINAL) :CARDINAL;
> VAR
>     z : CARDINAL;
> BEGIN
>     z := x + y;
>     RETURN z
> END add;
>
> BEGIN
> END add.
> decus: 1752 test=> cat addtest.mod
> MODULE addtest;
>
> FROM InOut IMPORT WriteLn, WriteString;
> FROM NumberIO IMPORT WriteCard;
>
> FROM add IMPORT add;
>
> VAR
>     x, y, z :CARDINAL;
>
> BEGIN
>     x := 2;
>     WriteString("x = "); WriteCard(x, 2); WriteLn;
>     y := 3;
>     z := add(x, y);
>     WriteString("z = "); WriteCard(z, 2); WriteLn;
> END addtest.
> decus: 1753 test=> gm2 -c add.mod addtest.mod
> decus: 1754 test=> file add.o addtest.o
> add.o: ELF 64-bit MSB relocatable SPARCV9 Version 1
> addtest.o: ELF 64-bit MSB relocatable SPARCV9 Version 1
> decus: 1755 test=> gm2 -o addtest addtest.mod add.mod
> decus: 1756 test=> file addtest
> addtest: ELF 64-bit MSB executable SPARCV9 Version 1, dynamically
> linked, not stripped
> decus: 1758 test=> gm2 -o addtest add.mod addtest.mod
> decus: 1759 test=> file addtest
> addtest: ELF 64-bit MSB executable SPARCV9 Version 1, dynamically
> linked, not stripped
> decus: 1760 test=> ./addtest
> x =  2
> z =  5
>
> Output only occurs if the main module is given last.  In fact,
> gdb-6.8 cannot even
> find the init part of the main module unless it is given last.
>
> john

Hi John,

ahh yes gm2 can only compile one module at a time (unless you use the
-fmakeall option).  It should be possible to modify this easily
enough, if desired?

regards,
Gaius




reply via email to

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