From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3552 invoked by alias); 11 May 2009 19:04:06 -0000 Received: (qmail 3413 invoked by uid 22791); 11 May 2009 19:04:05 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from londo.lunn.ch (HELO londo.lunn.ch) (80.238.139.98) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 11 May 2009 19:03:59 +0000 Received: from lunn by londo.lunn.ch with local (Exim 3.36 #1 (Debian)) id 1M3an3-0006LQ-00; Mon, 11 May 2009 21:03:53 +0200 Date: Mon, 11 May 2009 19:04:00 -0000 From: Andrew Lunn To: Evgeniy Dushistov Cc: Dave Milter , ecos-discuss@ecos.sourceware.org, ecos-devel@ecos.sourceware.org Subject: Re: [ECOS] raw output to serial port and dataflash + legacy API questions Message-ID: <20090511190353.GB4940@lunn.ch> Mail-Followup-To: Evgeniy Dushistov , Dave Milter , ecos-discuss@ecos.sourceware.org, ecos-devel@ecos.sourceware.org References: <2a382c6e0905070357u76683dacqfe8bd885c9260671@mail.gmail.com> <20090511172638.GA27330@rain> <20090511175743.GA4940@lunn.ch> <20090511181726.GA29238@rain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090511181726.GA29238@rain> User-Agent: Mutt/1.5.18 (2008-05-17) X-IsSubscribed: yes Mailing-List: contact ecos-devel-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: ecos-devel-owner@ecos.sourceware.org X-SW-Source: 2009-05/txt/msg00007.txt.bz2 > > If something is not referenced, the linker will throw it away. It is > > unwanted bloat. > > > > The variable that is not referenced is marked as __attribute__((used)). I _think_ this just stops the warning. The symbol itself is not changed. This attribute is most often used for parameters passed to a function where for backward compatibility etc, you don't reference one of the parameters passed in. > So compiler doesn't inform linker that there is no need to throw it > away? I don't think so. > And as you see, actually I not add reference to variable in > workaround, I add function to which add reference. > So reference count to flash driver descriptions hasn't changed, > but linker do not remove it. This might suggest you are not using --function-sections and --data-sections. Using these options the compiler puts each function and variable into its own section and so allows the linker to do finer grain garbage discard. Without these options it can only throw away complete files when all symbols in a file are not used. With these options it can throw away individual unused functions and variables. Andrew