This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] PR ld/16746: Don't issue a warning for reference in LTO IR
- From: Alan Modra <amodra at gmail dot com>
- To: Hans-Peter Nilsson <hans-peter dot nilsson at axis dot com>
- Cc: binutils at sourceware dot org, hjl dot tools at gmail dot com
- Date: Tue, 12 Aug 2014 10:41:51 +0930
- Subject: Re: [PATCH] PR ld/16746: Don't issue a warning for reference in LTO IR
- Authentication-results: sourceware.org; auth=none
- References: <20140807005451 dot GU8921 at bubble dot grove dot modra dot org> <201408112221 dot s7BMLlCi018860 at ignucius dot se dot axis dot com>
On Tue, Aug 12, 2014 at 12:21:47AM +0200, Hans-Peter Nilsson wrote:
> This, commit db7129469b, regressed ld-cris/warn3 for cris-elf:
> Running /home/hp/binutils/src/ld/testsuite/ld-cris/cris.exp ...
> FAIL: ld-cris/warn3
That was silly of me. non_ir_ref is only valid when plugins are
active.
PR ld/16746
include/
* bfdlink.h (struct bfd_link_info): Add lto_plugin_active.
bfd/
* linker.c (_bfd_generic_link_add_one_symbol <WARN>): Handle
!lto_plugin_active.
ld/
* plugin.c (plugin_load_plugins): Set link_info.lto_plugin_active.
diff --git a/bfd/linker.c b/bfd/linker.c
index d4b053c..1a5ecef 100644
--- a/bfd/linker.c
+++ b/bfd/linker.c
@@ -1806,7 +1806,9 @@ _bfd_generic_link_add_one_symbol (struct bfd_link_info *info,
case WARN:
/* Warn if this symbol has been referenced already from non-IR,
otherwise add a warning. */
- if (h->non_ir_ref)
+ if ((!info->lto_plugin_active
+ && (h->u.undef.next != NULL || info->hash->undefs_tail == h))
+ || h->non_ir_ref)
{
if (! (*info->callbacks->warning) (info, string, h->root.string,
hash_entry_bfd (h), NULL, 0))
diff --git a/include/bfdlink.h b/include/bfdlink.h
index fc14a9f..58dba2a 100644
--- a/include/bfdlink.h
+++ b/include/bfdlink.h
@@ -292,6 +292,9 @@ struct bfd_link_info
callback. */
unsigned int notice_all: 1;
+ /* TRUE if the LTO plugin is active. */
+ unsigned int lto_plugin_active: 1;
+
/* TRUE if we are loading LTO outputs. */
unsigned int loading_lto_outputs: 1;
diff --git a/ld/plugin.c b/ld/plugin.c
index f10c273..8d6ae05 100644
--- a/ld/plugin.c
+++ b/ld/plugin.c
@@ -841,6 +841,7 @@ plugin_load_plugins (void)
plugin_callbacks = *orig_callbacks;
plugin_callbacks.notice = &plugin_notice;
link_info.notice_all = TRUE;
+ link_info.lto_plugin_active = TRUE;
link_info.callbacks = &plugin_callbacks;
}
--
Alan Modra
Australia Development Lab, IBM