gm2
[Top][All Lists]
Advanced

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

Re: [Gm2] Potential woe with gm2-4.1.2


From: john o goyo
Subject: Re: [Gm2] Potential woe with gm2-4.1.2
Date: Tue, 8 Oct 2013 11:22:35 -0400


On 8 Oct 2013, at 10:32, Gaius Mulley wrote:
[...]
for example on my system I get the following:

$ cat chello.mod
MODULE chello ;

FROM libc IMPORT printf ;

BEGIN
  printf("hello world\n")
END chello.
[...]

One main module works as it should. (in particular, your example works.)

Witness (with a few blank lines added for clarity):

johng: 541 [init]=> cat main.mod
MODULE main;

FROM other IMPORT n;

BEGIN
  n := 1;
  HALT
END main.

johng: 542 [init]=> cat other.def
DEFINITION MODULE other;

VAR
  n :CARDINAL;

END other.

johng: 543 [init]=> cat other.mod
IMPLEMENTATION MODULE other;

BEGIN
  n := 1
END other.

johng: 544 [init]=> gm2 -g -c main.mod
johng: 545 [init]=> nm main.o

main.o:

[Index]   Value          Size        Type  Bind  Other Shndx   Name

[--- chopped --]
[18] | 0| 0|NOTY |GLOB |0 |UNDEF | M2RTS_HALT [20] | 56| 12|FUNC |GLOB |0 |1 | _M2_main_finish [15] | 0| 56|FUNC |GLOB |0 |1 | _M2_main_init [19] | 0| 0|NOTY |GLOB |0 |UNDEF | __gxx_personality_v0
[1]     |             0|           0|FILE |LOCL |0    |ABS    |main.mod
[17]    |             0|           0|NOTY |GLOB |0    |UNDEF  |other_n

johng: 546 [init]=> gm2 -g -c other.mod
johng: 547 [init]=> nm other.o

other.o:

[Index]   Value          Size        Type  Bind  Other Shndx   Name

[-- chopped --]
[18] | 36| 12|FUNC |GLOB |0 |1 | _M2_other_finish [14] | 0| 36|FUNC |GLOB |0 |1 | _M2_other_init [17] | 0| 0|NOTY |GLOB |0 |UNDEF | __gxx_personality_v0
[1]     |             0|           0|FILE |LOCL |0    |ABS    |other.mod
[16]    |             0|           4|OBJT |GLOB |0    |4      |other_n

johng: 548 [init]=> gm2 -g main.mod other.mod
johng: 549 [init]=> ./a.out
johng: 550 [init]=> nm a.out |grep _init
[823] | 4295007808| 12|FUNC |GLOB |0 |12 | _M2_ASCII_init [758] | 4295085788| 12|FUNC |GLOB |0 |166 | _M2_Debug_init [553] | 4295047496| 20|FUNC |GLOB |0 |97 | _M2_FIO_init [709] | 4295007832| 20|FUNC |GLOB |0 |14 | _M2_IO_init [611] | 4295097296| 12|FUNC |GLOB |0 |249 | _M2_Indexing_init [827] | 4295090416| 76|FUNC |GLOB |0 |194 | _M2_M2EXCEPTION_init [659] | 4295012200| 92|FUNC |GLOB |0 |29 | _M2_M2RTS_init [812] | 4295017452| 12|FUNC |GLOB |0 |62 | _M2_NumberIO_init [748] | 4295090824| 20|FUNC |GLOB |0 |198 | _M2_RTExceptions_init [549] | 4295038592| 12|FUNC |GLOB |0 |87 | _M2_SYSTEM_init [631] | 4295088360| 100|FUNC |GLOB |0 |184 | _M2_StdIO_init [693] | 4295088140| 12|FUNC |GLOB |0 |178 | _M2_Storage_init [724] | 4295075256| 32|FUNC |GLOB |0 |148 | _M2_StrIO_init [786] | 4295078520| 12|FUNC |GLOB |0 |156 | _M2_StrLib_init [647] | 4294991672| 8|FUNC |GLOB |0 |9 | _M2_SysExceptions_init [540] | 4295087540| 12|FUNC |GLOB |0 |171 | _M2_SysStorage_init [681] | 4294985396| 8|FUNC |GLOB |0 |9 | _M2_errno_init [592] | 4294985328| 36|FUNC |GLOB |0 |9 | _M2_other_init [608] | 4294991252| 8|FUNC |GLOB |0 |9 | _M2_termios_init
[595]   |    4295007760|          28|FUNC |GLOB |0    |10     |_init
[485] | 4294999472| 640|FUNC |LOCL |0 |9 | uw_init_context_1

johng: 551 [init]=> grep main_init main_m2.cpp
extern "C" void _M2_main_init (int argc, char *argv[]);
       _M2_main_init (argc, argv);

johng: 552 [init]=> gcc -g -c main_m2.cpp
johng: 553 [init]=> gm2 -g main_m2.o main.o other.o
johng: 554 [init]=> ./a.out
Abort (core dumped)

So, oddly enough, the function call is in the C++ file in the object file but seems to be absent or mangled in the link-editted version. Compiling the C++ and linking it direclty works.

This is truly odd (and I appreciate probably very difficult for you to investigate).

john



reply via email to

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