www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/04/21/15:37:32

Date: Fri, 21 Apr 1995 09:43:02 -0700 (PDT)
From: RDC <rdc AT freenet DOT vancouver DOT bc DOT ca>
Sender: RDC <rdc AT freenet DOT vancouver DOT bc DOT ca>
Reply-To: RDC <rdc AT freenet DOT vancouver DOT bc DOT ca>
Subject: Re: Multiple references in a link step
To: Dave New <den AT aisinc DOT com>
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu, ckann AT seas DOT gwu DOT edu

On Thu, 20 Apr 1995, den AT aisinc DOT com (Dave New) wrote:
> > On Wed, 19 Apr 1995, ckann AT seas DOT gwu DOT edu (Charles W. Kann) wrote:
> > I am trying to link a program which has redefined a number of standard
> > functions (such as malloc).  When I use ld to link, I get a message
> > that the function has multiple definitions.  I want to use the functions
> > with the package, not the standard ones.  
> > 
> > If I use the -nonstandard flag, I lose all the definitions.  How can
> > I get ld to use the redefined functions but still use the standard 
> > libraries?
> > 
> > Chuck Kann
> > 

> I suspect that you will need to do some sleuthing to find what other references
> are sucking in the standard library functions.  We have encountered such
> situations using the GNU toolset on SunOS for cross-compiling for i960.

[good sleuthing advice snipped, see prior post]

> runtime environment, and sucking in standard things like malloc(), etc., are 
> deadly.  Whenever this happens, it costs us a day or two to track down the 
> culprit -- a real waste of time.
> 

Just Unzip the library sources ...
compile with gcc (verbosly) and redo the link step without -l ...
now see whats missing and include the individual 'C' (C++) source for the lib
that is missing adding in funtions until errors are gone.

This produces tiny packages; one can rewrite the program to use sprintf()
and fput() instead of the whole printf() works and save a few K; similar
savings are possible in other areas.

This is an uncommon use as the compiler is quite optimal as it is.

You'd only want to do this if you had a memory hole you wanted to fill with
a driver or wanted to embed it in limited rom - dollor for ram chip it not
worth the extra effort in many cases.

Rob


- Raw text -


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