Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Sep 1998 18:14:32 -0700
From:      Mike Smith <mike@smith.net.au>
To:        Kent Vander Velden <graphix@iastate.edu>
Cc:        Terry Lambert <tlambert@primenet.com>, freebsd-hackers@FreeBSD.ORG
Subject:   Re: Unused functions 
Message-ID:  <199809140114.SAA08497@word.smith.net.au>
In-Reply-To: Your message of "Sun, 13 Sep 1998 19:09:16 CDT." <199809140009.TAA28013@isua4.iastate.edu> 

next in thread | previous in thread | raw e-mail | index | archive | help
>   Just so I completely understand, if I truely use only one function in from
> a .o file and no other function is using anything in this .o file, the 
> entire .o file is still pulled into the executable?  So, there are could be 
> a lot of unused, unreachable code in an executable.  Nothing can be done to
> remove the bloat after the executable has been linked?  Is this commonly the 
> way its done on other systems as well?  I had always assumed that unused
> functions and data were tosed out.

In most object formats, reference information is kept on a per-object 
basis (ie. per .o file).  Keeping this sort of information on any 
smaller granularity would lead to an insane increase in the complexity 
and corresponding performance reduction of the link phase.

This is why an experienced programmer will group only related items in 
a given object.  It allows the programmer and the C scoping rules to 
work together to determine what should be associated and what need not.

-- 
\\  Sometimes you're ahead,       \\  Mike Smith
\\  sometimes you're behind.      \\  mike@smith.net.au
\\  The race is long, and in the  \\  msmith@freebsd.org
\\  end it's only with yourself.  \\  msmith@cdrom.com



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199809140114.SAA08497>