delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2005/08/02/17:15:38

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws;
s=beta; d=gmail.com;
h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type;
b=qv27i71OW9OezCE+npkpCu0sq0I2GCCvJVugAfUGVUUm75r9UY0mZ57SnbLQWo+c9C6nPMpOaisGQrjz5+qJW1YTGf3PLuwfv9mCPRiyzidy88yIIBbSF6uCyPaYxM941DFQfx8vodcqClQ2d2WlNzBOUPoTpPdW5rK3KfysDKM=
Message-ID: <2497d9a2050802141537ca5ba8@mail.gmail.com>
Date: Tue, 2 Aug 2005 17:15:02 -0400
From: Matthew Petricone <strstream AT gmail DOT com>
To: djgpp AT delorie DOT com
Subject: ___divdi3 and ___moddi3
Mime-Version: 1.0
Reply-To: djgpp AT delorie DOT com

------=_Part_14104_5990509.1123017302074
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Now that I have code that compiles, there seems to be a linking error with=
=20
the folowing code.
 void bc_puti(long long fmt, int base)
{
static char buf[32] =3D {0};
int i =3D 30;
if (fmt < 0)
{
bc_pchar('-');=20
fmt =3D -fmt;
}
for (;fmt && i;fmt /=3D base)
{
buf[i] =3D "0123456789abcdef"[fmt % base];
}
bc_puts(buf);
}=20
  it compiles ok. but it won't like either with djgpp's ld or ld-elf
 it gives the following errors: undifined reference to '___moddi3'
and undifined reference to '___divdi3'
 as i understand it they are gcc internals used for division and modulus=20
operations. Is there anway around this short of writing assembly for modulu=
s=20
and division?

------=_Part_14104_5990509.1123017302074
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

<div>Now that I have code that compiles, there seems to be a linking error&=
nbsp; with the folowing code.</div>
<div>&nbsp;</div>
<div>void bc_puti(long long fmt, int base)<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;=
 static char buf[32] =3D {0};<br>&nbsp;&nbsp;&nbsp;&nbsp; int i =3D 30;<br>=
&nbsp;&nbsp;&nbsp;&nbsp; if (fmt &lt; 0)<br>&nbsp;&nbsp;&nbsp;&nbsp; {<br>&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bc_pchar('-');&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fmt =3D -fmt;<br>&nbsp;&nbsp;&nbsp=
;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (;fmt &amp;&amp=
; i;fmt /=3D base)
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp; buf[i] =3D &quot;0123456789abcdef&quot;[fmt % bas=
e];<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&n=
bsp; bc_puts(buf);<br>} </div>
<div>&nbsp;</div>
<div>&nbsp;it compiles ok. but it won't like either with djgpp's ld or ld-e=
lf</div>
<div>&nbsp;</div>
<div>it gives the following errors: undifined reference to '___moddi3'</div=
>
<div>and&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;undifin=
ed reference to '___divdi3'</div>
<div>&nbsp;</div>
<div>as i understand it they are gcc internals used for division and modulu=
s operations. Is there anway around this short of writing assembly for modu=
lus and division?</div>

------=_Part_14104_5990509.1123017302074--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019