<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
Daniel, please look at the file.<BR>
<BR>
<BR>
If you write the following sorts of Modula-3 code:<BR>
<BR>
PROCEDURE Add64(a,b: LONGINT):LONGINT= RETURN a + b; END Add64;<BR>
PROCEDURE Mult64(a,b: LONGINT):LONGINT= RETURN a * b; END Mult64;<BR>
PROCEDURE Div64(a,b: LONGINT):LONGINT= RETURN a / b; END Div64;<BR>
<BR> <BR>
Or the following sorts of C code:<BR><BR>
long long add64(long long a, long long b) { return a + b; }<BR>
long long mult64(long long a, long long b) { return a * b; }<BR>
long long div64(long long a, long long b) { return a / b; }<BR>
<BR>
fanything that does these operations, not just functions that /only/ do them,<BR>
<BR>
<BR>on some architectures (esp. 32 bit ones), the backend (or C compiler)<BR>
will emit function calls.<BR>
<BR>
<BR>
If gcc is the compiler/linker, it always throws libgcc.a or such,<BR>
and the functions are resolved.<BR>
<BR>
<BR>
Any C code has this property.<BR>
libgcc.a is liberally licensed.<BR>
Again, any C code possibly links in this code.<BR>
<BR>
<BR>
On systems where m3cg is the backend but gcc is not the compiler/linker,<BR>
e.g. SOLsun, you don't get libgcc.a, but you still get these function calls.<BR>
<BR>
<BR>
Therefore, on a platform like SOLsun, the solution is write<BR>
functions very much like the above, but with names that<BR>
match what the backend emits.<BR>
<BR>
<BR>
In fact, what might occur is Sun CC emits function calls<BR>
to functions with yet other names. That's awfully inefficient<BR>
(two function calls to do a multiply) but it does work.<BR>
<BR>
<BR>
It might be good if we could teach m3cg about the function names<BR>
used by other compilers/runtimes.<BR>
<BR>
<BR>
<BR>
But it's also probably only a problem on 32bit platforms and they are the past.<BR>
<BR>
<BR>
Apparently there is some doubt as to if these functions are needed on 64bit platforms,<BR>
as you can see in the comments (at least in the original).<BR>
<BR>
<BR>
- Jay<BR><BR> <BR>> Date: Wed, 23 Dec 2009 03:42:24 +0000<BR>> From: dabenavidesd@yahoo.es<BR>> To: m3commit@elegosoft.com; jkrell@elego.de<BR>> CC: m3devel@elegosoft.com<BR>> Subject: Re: [M3devel] [M3commit] CVS Update: cm3<BR>> <BR>> Hi all:<BR>> forgive my ignorance about the actual changes going on below copied M3commit message of Monday, December 21, 16:00:40 but what is this to have gcc code inside the compiler libs, I recommend to check the strict rules about this before performing such changes, Is there any problem getting gcc code inside the runtime libraries, even if this only used in level C code, this gets more C dependences in non-M3 code we are not able to guarantee, better UNSAFE than totally unmarked unsafe again. If this is not the case, and just a piece of m3cc related code I don't disqualify it yet.<BR>> Thanks in advance <BR>> <BR>> --- El lun, 21/12/09, Jay Krell <jkrell@elego.de> escribió:<BR>> <BR>> > De: Jay Krell <jkrell@elego.de><BR>> > Asunto: [M3commit] CVS Update: cm3<BR>> > Para: m3commit@elegosoft.com<BR>> > Fecha: lunes, 21 de diciembre, 2009 11:00<BR>> > CVSROOT: /usr/cvs<BR>> > Changes by: <BR>> > jkrell@birch. 09/12/21 16:00:40<BR>> > <BR>> > Modified files:<BR>> > cm3/m3-libs/m3core/src/Csupport/libgcc/:<BR>> > libgcc.c <BR>> > <BR>> > cm3/m3-libs/m3core/src/runtime/ALPHA_OSF/: RTStackC.c <BR>> > cm3/m3-libs/m3core/src/runtime/DS3100/:<BR>> > RTStackC.c <BR>> > cm3/m3-libs/m3core/src/runtime/POSIX/:<BR>> > RTOSbrk.c RTOSmmap.c <BR>> > cm3/m3-libs/m3core/src/runtime/SOLgnu/:<BR>> > RTStackC.c <BR>> > cm3/m3-libs/m3core/src/runtime/SOLsun/:<BR>> > RTStackC.c <BR>> > cm3/m3-libs/m3core/src/runtime/WIN32/:<BR>> > RTOSc.c <BR>> > <BR>> > cm3/m3-libs/m3core/src/runtime/ex_frame/: RTStackC.c <BR>> > <BR>> > Log message:<BR>> > add mising #ifdef cplusplus extern "C" {<BR>> > }<BR>> > <BR>> > <BR>> <BR>> <BR>> <BR> </body>
</html>