Re: Smart linking under UNIX

hyatt@cis.uab.edu (Robert Hyatt)
Thu, 22 Aug 1991 14:51:53 GMT

          From comp.compilers

Related articles
Smart linking under UNIX umh@vax5.cit.cornell.edu (1991-08-19)
Re: Smart linking under UNIX mengel@fnal.fnal.gov (Marc Mengel) (1991-08-19)
Re: Smart linking under UNIX schwartz@groucho.cs.psu.edu (1991-08-19)
Re: Smart linking under UNIX sef@kithrup.COM (1991-08-20)
Re: Smart linking under UNIX jones@pyrite.cs.uiowa.edu (1991-08-21)
Re: Smart linking under UNIX rro@debussy.cs.colostate.edu (1991-08-22)
Re: Smart linking under UNIX hyatt@cis.uab.edu (1991-08-22)
Re: Smart linking under UNIX henrik@tazdevil.llnl.gov (1991-08-22)
Re: Smart linking under UNIX henrik@tazdevil.llnl.gov (1991-08-22)
Re: Smart linking under UNIX weitek!ars@Sun.COM (1991-08-22)
Re: Smart linking under UNIX dalamb@umiacs.umd.edu (1991-08-23)
Re: Smart linking under UNIX pardo@gar.cs.washington.edu (1991-08-23)
Re: Smart linking under UNIX thorinn@diku.dk (1991-08-25)
[4 later articles]
| List of all articles for this month |
Newsgroups: comp.arch,comp.compilers
From: hyatt@cis.uab.edu (Robert Hyatt)
Keywords: linker
Organization: University of Alabama at Birmingham
References: 91-08-095 91-08-108
Date: Thu, 22 Aug 1991 14:51:53 GMT

In article 91-08-108 jones@pyrite.cs.uiowa.edu (Douglas W. Jones) writes:
>Furthermore, it hardly takes any bother to make a linker that can selectively
>link only those routines in the library that are needed!


What unix are you using? There *is* a difference between libraries and simply
groups of object (.o) files that are specifically included into an executable.


My unix experience (admittedly 4.2/4.3 with Unicos as my only System V system)
has been that *real* libraries are scanned and only those routines that are
called are included. I just finished using "nm" to verify this on an
executable.


Granted, if you include a .o file with an unused entry point (procedure), it
is kept in the executable.... and omitting it would make debugging more
difficult in certain cases.... ie, a routine *only* called when you type in a
debugger command... such as one to check the validity of some complex data
structure you think might be crapped out... but you only do it from the
debugger prompt.... omitting that would require a dummy call somewhere to get
it included.... then the optimizer might determine that the "dummy call" is
never reached and remove that........ use a library, the -l link option to
specify said library and stop complaining..... surely there are enough
optimization problems (and the like) to minimize the importance of this when
there *is* a workaround....
[The point was that if there is more than one routine in a .o file, even a .o
file in a library, the entire .o is dragged into the executable, even though
the rest of the routines are not useful and may themselves have external
references that cause yet more unneeded stuff to be included. -John]
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.