delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2005/08/04/03:46:39

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:to:subject:in-reply-to:mime-version:content-type:references;
b=VMc7zC4AQhnpabBE4tNzWOjaJstdMYFzxugB3kUIvd9Rj92PiqSYArbBe+IgKury3zlSty2xCK6D1+RBJUuMFYxBXzu1fnRu2bwlL/ntcP+ZJHsb6GM0IjVQoENbqH2ndyjp4OjFVAELQmGPdo038gQK3zOratWCLCHZqNA6LNs=
Message-ID: <2497d9a205080400454dc1ef9d@mail.gmail.com>
Date: Thu, 4 Aug 2005 03:45:40 -0400
From: Matthew Petricone <strstream AT gmail DOT com>
To: djgpp AT delorie DOT com
Subject: Re: ___divdi3 and ___moddi3
In-Reply-To: <2497d9a20508032131663f0572@mail.gmail.com>
Mime-Version: 1.0
References: <2497d9a2050802141537ca5ba8 AT mail DOT gmail DOT com>
<3lbkd9F11piefU1 AT news DOT dfncis DOT de>
<2497d9a20508032131663f0572 AT mail DOT gmail DOT com>
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

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

An Update. I found the problem. I was dividing a variable defined as "long=
=20
long" in an attempt to make sure the size wasn't ever really going to be an=
=20
issue. Apparently gcc handles different sized integers differently when it=
=20
divides. So i just clipped it off to a long and now the problem has been=20
resolved.
 oddly enough... reading up on assembly brought this to mind.
 Thanks again for your help Mr. Broeker.

 On 8/4/05, Matthew Petricone <strstream AT gmail DOT com> wrote:=20
>=20
> On 3 Aug 2005 10:25:45 GMT, Hans-Bernhard Broeker <
> broeker AT physik DOT rwth-aachen DOT de> wrote:=20
> >=20
> > Matthew Petricone <strstream AT gmail DOT com> wrote:
> >=20
> > > it compiles ok. but it won't like either with djgpp's ld or ld-elf=20
> >=20
> > It's almost never a good idea to invoke 'ld' directly unless you have=
=20
> > very
> > particular reasons for doing so. Let 'gcc' handle that for you.
>=20
>  =20
> > it gives the following errors: undifined reference to '___moddi3'
> > > and undifined reference to '___divdi3'=20
> >=20
> > Those are from libgcc.a, which a linker run coordinated by 'gcc' would
> > have included automatically.
>=20
>  True but i'm pretty sure that would break the kernel.
>=20
> --
> > Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de )
> > Even if all the snow were burnt, ashes would remain.
> >=20
>   I use ld-elf because I have to link the c code with asm compiled with=
=20
> nasm. Plus i like to use elf since Grub seems to be easier to use with=20
> binaries in ELF format. I beleive there is a way around that though.=20
>  The funny thing is, I use the divide operator in other files, and they=
=20
> don't throw me the error upon linking.
>=20
>

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

<div>An Update. I found the problem. I was dividing a variable defined as &=
quot;long long&quot; in an attempt to make sure the size wasn't ever really=
 going to be an issue. Apparently gcc handles different sized integers diff=
erently when it divides.&nbsp; So i just clipped it off to a long and now t=
he problem has been resolved.
</div>
<div>&nbsp;</div>
<div>oddly enough... reading up on assembly brought this to mind.</div>
<div>&nbsp;</div>
<div>Thanks again for your help Mr. Broeker.<br><br>&nbsp;</div>
<div><span class=3D"gmail_quote">On 8/4/05, <b class=3D"gmail_sendername">M=
atthew Petricone</b> &lt;<a href=3D"mailto:strstream AT gmail DOT com">strstream AT g=
mail.com</a>&gt; wrote:</span>
<blockquote class=3D"gmail_quote" style=3D"PADDING-LEFT: 1ex; MARGIN: 0px 0=
px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div><span class=3D"q"><span class=3D"gmail_quote">On 3 Aug 2005 10:25:45 G=
MT, <b class=3D"gmail_sendername">Hans-Bernhard Broeker</b> &lt;<a onclick=
=3D"return top.js.OpenExtLink(window,event,this)" href=3D"mailto:broeker AT ph=
ysik.rwth-aachen.de" target=3D"_blank">
broeker AT physik DOT rwth-aachen DOT de</a>&gt; wrote:</span>=20
<blockquote class=3D"gmail_quote" style=3D"PADDING-LEFT: 1ex; MARGIN: 0px 0=
px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Matthew Petricone &lt;<a onclick=
=3D"return top.js.OpenExtLink(window,event,this)" href=3D"mailto:strstream@=
gmail.com" target=3D"_blank">
strstream AT gmail DOT com</a>&gt; wrote:<br><br>&gt;&nbsp;&nbsp; it compiles ok. =
but it won't like either with djgpp's ld or ld-elf <br><br>It's almost neve=
r a good idea to invoke 'ld' directly unless you have very<br>particular re=
asons for doing so.&nbsp;&nbsp;Let 'gcc' handle that for you.
</blockquote>
<div>&nbsp;</div>
<div>&nbsp;</div><br>
<blockquote class=3D"gmail_quote" style=3D"PADDING-LEFT: 1ex; MARGIN: 0px 0=
px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">&gt;&nbsp;&nbsp;it gives the fol=
lowing errors: undifined reference to '___moddi3'<br>&gt; and undifined ref=
erence to '___divdi3'=20
<br><br>Those are from libgcc.a, which a linker run coordinated by 'gcc' wo=
uld<br>have included automatically.</blockquote>
<div>&nbsp;</div></span>
<div>True but i'm pretty sure that would break the kernel.</div><br>
<blockquote class=3D"gmail_quote" style=3D"PADDING-LEFT: 1ex; MARGIN: 0px 0=
px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">--<span class=3D"q"><br>Hans-Ber=
nhard Broeker (<a onclick=3D"return top.js.OpenExtLink(window,event,this)" =
href=3D"mailto:broeker AT physik DOT rwth-aachen DOT de" target=3D"_blank">
broeker AT physik DOT rwth-aachen DOT de</a> )<br>Even if all the snow were burnt, ash=
es would remain.<br></span></blockquote></div>
<div>&nbsp;</div>
<div>&nbsp;I use ld-elf because&nbsp;I have to link the c code with asm com=
piled with nasm. Plus i like to use elf since Grub seems to be easier to us=
e with binaries in ELF format. I beleive there is a way around that though.=
 </div>

<div>&nbsp;</div>
<div>The funny thing is, I use the divide operator in other files, and they=
 don't throw me the error upon linking.<br><br>&nbsp;</div></blockquote></d=
iv><br>

------=_Part_661_12672103.1123141540101--

- Raw text -


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