delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2005/08/04/06:30:25

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: ___divdi3 and ___moddi3
Date: 4 Aug 2005 10:27:33 GMT
Lines: 31
Message-ID: <3le8slF1218m6U1@news.dfncis.de>
References: <2497d9a2050802141537ca5ba8 AT mail DOT gmail DOT com> <3lbkd9F11piefU1 AT news DOT dfncis DOT de> <2497d9a20508032131663f0572 AT mail DOT gmail DOT com>
X-Trace: news.dfncis.de AiMMqABzhUpcxarTcMRJZgFTVehVXndZaEDY9Lk04R0Zh+p+Rwmka+nz83
X-Orig-Path: not-for-mail
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Matthew Petricone <strstream AT gmail DOT com> wrote:

>   I use ld-elf because I have to link the c code with asm compiled with 
> nasm. 

I don't agree that this would be sufficient reason.  NASM can easily
be told to output files which the normal DJGPP linker can handle.

> Plus i like to use elf since Grub seems to be easier to use with
> binaries in ELF format. 

I somewhat doubt that --- the binaries that Grub is best trained to
work with are neither ELF nor COFF: they're raw binary images
prepended by a PC-style boot sektor, also known as "Linux kernels".

> The funny thing is, I use the divide operator in other files, and
> they don't throw me the error upon linking.

The divdi3 and moddi3 are the intrinsic functions used by GCC to
implement 64-bit division on platforms like ours, that don't have
64-bit CPUs.  They're in a library called libgcc.a.  If you want to
use them, you have to link to that library.  A linker run coordinated
by gcc.exe does that for you automatically.  If you run ld yourself,
this is one of the things you have to know about.  That's why in case
of doubt, you should always construct your own invocation of ld by
looking what 'gcc -v' prints out as the command for a normal link, and
modifying that, rather than starting from scratch.

-- 
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.

- Raw text -


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