From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23607 invoked by alias); 23 May 2006 19:35:37 -0000 Received: (qmail 23593 invoked by uid 22791); 23 May 2006 19:35:36 -0000 X-Spam-Check-By: sourceware.org Received: from web31711.mail.mud.yahoo.com (HELO web31711.mail.mud.yahoo.com) (68.142.201.191) by sourceware.org (qpsmtpd/0.31) with SMTP; Tue, 23 May 2006 19:35:31 +0000 Received: (qmail 73584 invoked by uid 60001); 23 May 2006 19:35:29 -0000 Message-ID: <20060523193529.73582.qmail@web31711.mail.mud.yahoo.com> Received: from [68.125.56.218] by web31711.mail.mud.yahoo.com via HTTP; Tue, 23 May 2006 12:35:29 PDT Date: Tue, 23 May 2006 19:35:00 -0000 From: Jason Lam Subject: Re: Linking un-referenced function To: John Carter Cc: gcc-help@gcc.gnu.org In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit 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-05/txt/msg00230.txt.bz2 Thanks for the quick response, John. It looks like these options will arrange the functions to different sections in the final image but it still doesn't exclude them. Am I missing something? Thanks, Jason --- John Carter wrote: > On Mon, 22 May 2006, Jason Lam wrote: > > > I looked through the documents and couldn't find > an > > option to not link an un-referenced function into > the > > final image. Does GCC support it? Could someone > > please help? > > Sorry, I got confuddled... > > Use > `--gc-sections' > option on linker and... > > > `-ffunction-sections' > `-fdata-sections' > Place each function or data item into its own > section in the output > file if the target supports arbitrary > sections. The name of the > function or the name of the data item > determines the section's name > in the output file. > > Use these options on systems where the linker > can perform > optimizations to improve locality of reference > in the instruction > space. Most systems using the ELF object > format and SPARC > processors running Solaris 2 have linkers with > such optimizations. > AIX may have these optimizations in the > future. > > Only use these options when there are > significant benefits from > doing so. When you specify these options, the > assembler and > linker will create larger object and > executable files and will > also be slower. You will not be able to use > `gprof' on all > systems if you specify this option and you may > have problems with > debugging if you specify both this option and > `-g'. > > > John Carter Phone : > (64)(3) 358 6639 > Tait Electronics Fax : > (64)(3) 359 4632 > PO Box 1645 Christchurch Email : > john.carter@tait.co.nz > New Zealand > > Carter's Clarification of Murphy's Law. > > "Things only ever go right so that they may go more > spectacularly wrong later." > > From this principle, all of life and physics may be > deduced. > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com