From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22044 invoked by alias); 17 May 2010 18:24:01 -0000 Received: (qmail 22026 invoked by uid 22791); 17 May 2010 18:23:59 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from vaxjo.synopsys.com (HELO vaxjo.synopsys.com) (198.182.60.75) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 17 May 2010 18:23:53 +0000 Received: from mother.synopsys.com (mother.synopsys.com [146.225.100.171]) by vaxjo.synopsys.com (Postfix) with ESMTP id 59083E57A; Mon, 17 May 2010 11:23:51 -0700 (PDT) Received: from godel.synopsys.com (localhost [127.0.0.1]) by mother.synopsys.com (8.9.1/8.9.1) with ESMTP id LAA09960; Mon, 17 May 2010 11:23:50 -0700 (PDT) Received: from godel.synopsys.com (localhost [127.0.0.1]) by godel.synopsys.com (8.13.1/8.12.3) with ESMTP id o4HINoLD024982; Mon, 17 May 2010 11:23:50 -0700 Received: (from jbuck@localhost) by godel.synopsys.com (8.13.1/8.13.1/Submit) id o4HINfa3024981; Mon, 17 May 2010 11:23:41 -0700 Date: Mon, 17 May 2010 18:24:00 -0000 From: Joe Buck To: Toon Moene Cc: Dave Korn , "gcc@gcc.gnu.org" Subject: Re: Does `-fwhole-program' make sense when compiling shared libraries? Message-ID: <20100517182340.GQ26047@synopsys.com> References: <4BF1861F.5020406@gmail.com> <4BF1838B.2090603@moene.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4BF1838B.2090603@moene.org> User-Agent: Mutt/1.4.1i Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2010-05/txt/msg00307.txt.bz2 On Mon, May 17, 2010 at 10:57:31AM -0700, Toon Moene wrote: > On 05/17/2010 08:08 PM, Dave Korn wrote: > > > > Hi! > > > > PR42904 is a bug where, when compiling a windows DLL using -fwhole-program, > > the compiler optimises away the entire library body, because there's no > > dependency chain related to 'main' to anchor it. Not a bug, but perhaps the beginning of a reasonable enhancement project. > Aren't "shared library" and "whole program" mutually exclusive concepts ? > > The mere fact that you are building a library means that it cannot be > the whole program, and because a shared library cannot be determined to > have being used by any fixed program, by definition cannot be "the whole > program". > > Or so I'd think. The concept would need to be extended so that the compiler would be told exactly what interfaces of the shared library are considered free, and which are considered internal calls. Then a -fwhole-library could make sense.