From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1022 invoked by alias); 10 Jul 2006 08:15:20 -0000 Received: (qmail 1013 invoked by uid 22791); 10 Jul 2006 08:15:19 -0000 X-Spam-Check-By: sourceware.org Received: from bender.bawue.de (HELO bender.bawue.de) (193.7.176.20) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 10 Jul 2006 08:15:15 +0000 Received: from lagash (88-106-172-167.dynamic.dsl.as9105.com [88.106.172.167]) (using TLSv1 with cipher DES-CBC3-SHA (168/168 bits)) (No client certificate requested) by bender.bawue.de (Postfix) with ESMTP id 628734643B; Mon, 10 Jul 2006 10:15:11 +0200 (MEST) Received: from ths by lagash with local (Exim 4.62) (envelope-from ) id 1Fzqqm-0006qK-MF; Mon, 10 Jul 2006 09:10:40 +0100 Date: Mon, 10 Jul 2006 08:15:00 -0000 To: Tzu-Chien Chiu Cc: binutils@sourceware.org Subject: Re: LD: function-level linking Message-ID: <20060710081040.GK4375@networkno.de> References: <4d77c5f20607092350j26ab6056t9c9a3b40fdb5493@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4d77c5f20607092350j26ab6056t9c9a3b40fdb5493@mail.gmail.com> User-Agent: Mutt/1.5.11+cvs20060403 From: Thiemo Seufer X-IsSubscribed: yes Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2006-07/txt/msg00113.txt.bz2 Tzu-Chien Chiu wrote: > Hello all. > > I'm looking for a similar feature available in Visual C++. > Function-level linking. > > In Visual C++, there is an option "/Gy" which enables "function-level > linking". That is, each function is packaged separately as a COMDAT, > and later the linker option "/OPT:REF" eliminates the COMDATs which > are never referenced. > > FYI: http://msdn2.microsoft.com/en-us/library/bxwfs976.aspx > > In this way, the entire object file won't have to be linked as a whole > when only one of the functions in it is referenced. It's preferred > linking for embedded system software. Not all libraries are design ed > as glibc, which has a separate file for each file, and it's sometimes > not easy or feasible to modify the source code of the libraries. > > I can not find similar compiler and linker options in the GNU tool > chain. What I missed? There's gcc's -ffunction-sections, and ld's -Wl,--gc-sections. Thiemo