From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1549 invoked by alias); 17 May 2011 14:30:49 -0000 Received: (qmail 1522 invoked by uid 22791); 17 May 2011 14:30:48 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.44.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 17 May 2011 14:30:33 +0000 Received: from kpbe19.cbf.corp.google.com (kpbe19.cbf.corp.google.com [172.25.105.83]) by smtp-out.google.com with ESMTP id p4HEUWTl013788 for ; Tue, 17 May 2011 07:30:33 -0700 Received: from pvg7 (pvg7.prod.google.com [10.241.210.135]) by kpbe19.cbf.corp.google.com with ESMTP id p4HEUVSP019541 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Tue, 17 May 2011 07:30:31 -0700 Received: by pvg7 with SMTP id 7so324181pvg.37 for ; Tue, 17 May 2011 07:30:30 -0700 (PDT) Received: by 10.68.9.132 with SMTP id z4mr1139904pba.282.1305642630798; Tue, 17 May 2011 07:30:30 -0700 (PDT) Received: from coign.google.com ([67.218.110.18]) by mx.google.com with ESMTPS id p1sm406314pbi.26.2011.05.17.07.30.29 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 17 May 2011 07:30:29 -0700 (PDT) From: Ian Lance Taylor To: "H.J. Lu" Cc: binutils@sourceware.org Subject: Re: PATCH: PR ld/12761: .gnu.warning.* doesn't work when building shared library In-Reply-To: (H. J. Lu's message of "Tue, 17 May 2011 06:12:34 -0700") References: <20110516190512.GA10653@intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Date: Tue, 17 May 2011 14:30:00 -0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-System-Of-Record: true 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/msg00242.txt.bz2 "H.J. Lu" writes: > On Mon, May 16, 2011 at 11:03 PM, Ian Lance Taylor wrot= e: >> "H.J. Lu" writes: >> >>> We should issure a gnu warning when building shared library. =C2=A0This= patch >>> implements it. =C2=A0OK for trunk? >> >> No, this is not how warning symbols are supposed to work. =C2=A0We only = want >> to issue the warning for a warning symbol if there is some reference to >> the symbol in the main program. =C2=A0If we issue the warnings for a sha= red >> library, then we will wind up issuing the warnings even if the program >> does not ever refer to the symbol. =C2=A0That is undesirable and will al= most >> 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: Hmmm, that's interesting. Sounds like an oversight on my part, but perhaps it doesn't matter. >> 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. The difference is that the author of a shared library can call a function with a warning safely from another externally visible function which does not require a warning. But I'm willing to let other people decide this issue. Ian