[PATCH] PR ld/16746: Don't issue a warning for reference in LTO IR

H.J. Lu hjl.tools@gmail.com
Wed Mar 26 19:29:00 GMT 2014


On Tue, Mar 25, 2014 at 5:41 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Tue, Mar 25, 2014 at 4:52 PM, Alan Modra <amodra@gmail.com> wrote:
>> On Tue, Mar 25, 2014 at 03:50:05PM -0700, H.J. Lu wrote:
>>> On Tue, Mar 25, 2014 at 3:39 PM, Alan Modra <amodra@gmail.com> wrote:
>>> > On Tue, Mar 25, 2014 at 01:39:52PM -0700, H.J. Lu wrote:
>>> >>       case WARNC:
>>> >> -       /* Issue a warning and cycle.  */
>>> >> -       if (h->u.i.warning != NULL)
>>> >> +       /* Issue a warning and cycle.  Don't issue a warning for
>>> >> +          reference in LTO IR which may be removed by LTO later. */
>>> >> +       if (h->u.i.warning != NULL
>>> >> +           && (abfd->flags & BFD_PLUGIN) == 0)
>>> >
>>> > So here you're handling references in LTO IR for warning symbols
>>> > defined in real object files or other LTO IR files..
>>>
>>> Yes.
>>>
>>> >>       case WARN:
>>> >> +       /* Don't issue a warning for reference in LTO IR which may be
>>> >> +          removed by LTO later.  Make a warning symbol instead.  */
>>> >> +       if ((hash_entry_bfd (h)->flags & BFD_PLUGIN) != 0)
>>> >> +         goto mwarn;
>>> >> +
>>> >
>>> > And here you have the case where the new symbol is a warning symbol,
>>> > in either LTO IR or real object files, but the reference was in an LTO
>>> > IR file.
>>>
>>> Yes.
>>>
>>> > What about the CWARN case, where you already have a definition that
>>> > may have been referenced, and the new symbol is a warning symbol?
>>> > You'll need to test h->non_ir_ref I think.
>>>
>>> It is:
>>>
>>> https://sourceware.org/bugzilla/show_bug.cgi?id=12760
>>
>> That's a different issue, isn't it?  I'm talking about the sequence
>> 1a) symbol referenced,
>> 2a) symbol defined,
>> 3a) warning symbol defined.
>> or
>> 1b) symbol defined,
>> 2b) symbol referenced,
>> 3b) warning symbol defined.
>>
>> If (1a) or (2b) is an IR reference then we don't want to warn.
>
> The symbol is referenced and used even if it has been inlined.
> Testing h->non_ir_ref isn't sufficient.  We also want to know
> if it is used in LTO.
>

With the fix for PR 16756:

https://sourceware.org/ml/binutils/2014-03/msg00275.html

we won't issue warnings for (1a) or (2b) if they are either
inlined or removed.

-- 
H.J.



More information about the Binutils mailing list