[mercury-users] Bug in NT Version?

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Sep 23 23:31:12 AEST 1999


On 23-Sep-1999, Ralph Becket <rbeck at microsoft.com> wrote:
> I seem to recall having seen this crop up before on the mailing list.  Is
> there any way mmake could spot the problem automatically?  For example, by
> grepping out some magic symbol from the .o/.c files or whatever (gross, but
> it's the first thing that popped into my head.)

Good idea.  Actually, we already generate references to special symbols
in the .c files, to ensure that you won't be able to link files compiled
in different grades.  This is mentioned in the Mercury User's Guide:

 | Compilation model options
 | =========================
 | 
 |    The following compilation options affect the generated code in such
 | a way that the entire program must be compiled with the same setting of
 | these options, and it must be linked to a version of the Mercury
 | library which has been compiled with the same setting.  (Attempting to
 | link object files compiled with different settings of these options
 | will generally result in an error at link time, typically of the form
 | `undefined symbol MR_grade_...' or `symbol MR_runtime_grade multiply
 | defined'.)

However, due to an oversight, this insertion of special symbol references
was done only for the ordinary .c files generated by the Mercury compiler,
not for the *_init.c files generated by `mkinit'.  I have now corrected
this in our development version.

I have also changed the Mercury linker/demangler so it detects this
situation and appends an explanatory message:

 | bash$ mmake hello
 | ml --grade asm_fast.gc         -o hello Mercury/os/hello_init.o \
 |         Mercury/os/hello.o
 | /usr/bin/ld:
 | Error: Undefined:
 | MR_grade_v1_asm_fast_tags3_ubf
 | collect2: ld returned 1 exit status
 | gmake: *** [hello] Error 1
 | Mercury Linker:
 |         Note: the symbol `MR_grade_v1_asm_fast_tags3_ubf' was mentioned.
 |         Any link errors are most likely due to linking together object
 |         files compiled with different compilation model options.
 |         Try doing `mmake clean' and then rebuilding.

Does that look OK?  If anyone has any suggestions about that error message,
please mail them to mercury-developers at cs.mu.oz.au.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list