From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27887 invoked by alias); 29 Jun 2006 05:16:45 -0000 Received: (qmail 27859 invoked by uid 22791); 29 Jun 2006 05:16:43 -0000 X-Spam-Check-By: sourceware.org Received: from mxout01.versatel.de (HELO mxout01.versatel.de) (212.7.152.117) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 29 Jun 2006 05:16:39 +0000 Received: from mx02.versatel.de (mx01.versatel.de [212.7.146.1]) by mxout01.versatel.de (8.12.11/8.12.11) with ESMTP id k5T5GZRu031381 for ; Thu, 29 Jun 2006 07:16:35 +0200 Received: from ask.home.net (i53878A96.versanet.de [83.135.138.150]) by mx02.versatel.de (8.12.11.20060614/8.12.11) with ESMTP id k5T5GZRO010914 for ; Thu, 29 Jun 2006 07:16:35 +0200 Received: (qmail 13678 invoked from network); 29 Jun 2006 07:16:34 +0200 Received: from localhost (127.0.0.1) by localhost with SMTP; 29 Jun 2006 07:16:34 +0200 From: Ingo Krabbe To: gcc-help@gcc.gnu.org Subject: Re: Symbols which were not used, still in binary Date: Thu, 29 Jun 2006 05:16:00 -0000 User-Agent: KMail/1.9.3 References: <44A2DF65.8010704@web.de> <44A2E3C9.90201@eagercon.com> <44A2F293.7353A1FF@dessent.net> In-Reply-To: <44A2F293.7353A1FF@dessent.net> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200606290716.34386.ikrabbe.ask@web.de> X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2006-06/txt/msg00270.txt.bz2 Am Mittwoch, 28. Juni 2006 23:20 schrieb Brian Dessent: > Michael Eager wrote: > > Arguably, the linker should know > > that add is not referenced and could remove it, but linkers are not > > usually able to slice and dice object files. > > You address this limitation by compiling with "-ffunction-sections > -fdata-sections -Wl,--gc-sections". However, it's still better to use > "static" on these kinds of local functions that are only used from the > same .o file. This has a number of benefits: > > - it ensures that internal functions of a library are not exported for > use by other code when they are not part of the defined ABI/API > - it prevents them from taking up needless relocations, which can slow > linking > - when compiled -fpic (as in a shared library) it allows for direct > calls to the function instead of having to go through the PLT which is > slower > - it allows the compiler freedom to inline > and you are warned about unused static symbols. hmm, reminds me of cleaning my attic ... > Brian