From owner-freebsd-hackers Sun Sep 13 18:09:04 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id SAA03426 for freebsd-hackers-outgoing; Sun, 13 Sep 1998 18:09:04 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from word.smith.net.au (castles233.castles.com [208.214.165.233]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id SAA03420 for ; Sun, 13 Sep 1998 18:08:59 -0700 (PDT) (envelope-from mike@word.smith.net.au) Received: from word.smith.net.au (localhost [127.0.0.1]) by word.smith.net.au (8.9.1/8.8.8) with ESMTP id SAA08497; Sun, 13 Sep 1998 18:14:33 -0700 (PDT) (envelope-from mike@word.smith.net.au) Message-Id: <199809140114.SAA08497@word.smith.net.au> X-Mailer: exmh version 2.0.2 2/24/98 To: Kent Vander Velden cc: Terry Lambert , freebsd-hackers@FreeBSD.ORG Subject: Re: Unused functions In-reply-to: Your message of "Sun, 13 Sep 1998 19:09:16 CDT." <199809140009.TAA28013@isua4.iastate.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sun, 13 Sep 1998 18:14:32 -0700 From: Mike Smith Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > 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