From: Ian Lance Taylor <iant@google.com>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: binutils@sourceware.org
Subject: Re: PATCH: PR ld/12761: .gnu.warning.* doesn't work when building shared library
Date: Tue, 17 May 2011 14:30:00 -0000 [thread overview]
Message-ID: <mcrd3jhz9fg.fsf@coign.corp.google.com> (raw)
In-Reply-To: <BANLkTin3aehZppucE8Rr9DUhjHPmZCQnDw@mail.gmail.com> (H. J. Lu's message of "Tue, 17 May 2011 06:12:34 -0700")
"H.J. Lu" <hjl.tools@gmail.com> writes:
> On Mon, May 16, 2011 at 11:03 PM, Ian Lance Taylor <iant@google.com> wrote:
>> "H.J. Lu" <hongjiu.lu@intel.com> writes:
>>
>>> We should issure a gnu warning when building shared library. This patch
>>> implements it. OK for trunk?
>>
>> No, this is not how warning symbols are supposed to work. We only want
>> to issue the warning for a warning symbol if there is some reference to
>> the symbol in the main program. If 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. That 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:
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
next prev parent reply other threads:[~2011-05-17 14:30 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-16 19:05 H.J. Lu
2011-05-17 1:51 ` Alan Modra
2011-05-17 6:04 ` Ian Lance Taylor
2011-05-17 13:12 ` H.J. Lu
2011-05-17 14:30 ` Ian Lance Taylor [this message]
2011-05-17 14:36 ` H.J. Lu
2011-05-17 15:02 ` Ian Lance Taylor
2011-05-17 15:05 ` H.J. Lu
2011-05-17 16:34 ` Ian Lance Taylor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=mcrd3jhz9fg.fsf@coign.corp.google.com \
--to=iant@google.com \
--cc=binutils@sourceware.org \
--cc=hjl.tools@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).