From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14976 invoked by alias); 17 May 2011 13:12:49 -0000 Received: (qmail 14876 invoked by uid 22791); 17 May 2011 13:12:48 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST X-Spam-Check-By: sourceware.org Received: from mail-qy0-f176.google.com (HELO mail-qy0-f176.google.com) (209.85.216.176) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 17 May 2011 13:12:34 +0000 Received: by qyk30 with SMTP id 30so340026qyk.0 for ; Tue, 17 May 2011 06:12:34 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.27.65 with SMTP id h1mr404954qcc.216.1305637954129; Tue, 17 May 2011 06:12:34 -0700 (PDT) Received: by 10.229.182.7 with HTTP; Tue, 17 May 2011 06:12:34 -0700 (PDT) In-Reply-To: References: <20110516190512.GA10653@intel.com> Date: Tue, 17 May 2011 13:12:00 -0000 Message-ID: Subject: Re: PATCH: PR ld/12761: .gnu.warning.* doesn't work when building shared library From: "H.J. Lu" To: Ian Lance Taylor Cc: binutils@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2011-05/txt/msg00240.txt.bz2 On Mon, May 16, 2011 at 11:03 PM, Ian Lance Taylor wrote: > "H.J. Lu" writes: > >> We should issure a gnu warning when building shared library. =A0This pat= ch >> implements it. =A0OK for trunk? > > No, this is not how warning symbols are supposed to work. =A0We only want > to issue the warning for a warning symbol if there is some reference to > the symbol in the main program. =A0If we issue the warnings for a shared > library, then we will wind up issuing the warnings even if the program > does not ever refer to the symbol. =A0That is undesirable and will almost > certainly break some uses of warning symbols. We aren't consistent: 1. Gold always issues a warning when building a shared library. 2. Ld sometimes issues a warning when building a shared library: static void gld${EMULATION_NAME}_before_allocation (void) { ... /* Look for any sections named .gnu.warning. As a GNU extensions, we treat such sections as containing warning messages. We print out the warning message, and then zero out the section size so that it does not get copied into the output file. */ My patch makes it consistent within ld as well as with gold. > I think it would be reasonable to issue a warning when building a shared > library for a reference to a symbol defined in some other shared > library, but it is necessary to not give a warning for references to > symbols defined in the library being created. > What is the difference between defined inside vs outside of DSO? They both reference a function with a warning. --=20 H.J.