From 61f41c3c243bbcc0ab2e5adb3157ce00dc11fc27 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Tue, 12 Aug 2014 10:31:41 +0930 Subject: [PATCH] Fix non-plugin warning symbol handling PR ld/16746 include/ * bfdlink.h (struct bfd_link_info): Add lto_plugin_active. bfd/ * linker.c (_bfd_generic_link_add_one_symbol ): Handle !lto_plugin_active. ld/ * plugin.c (plugin_load_plugins): Set link_info.lto_plugin_active. --- bfd/linker.c | 4 +++- include/bfdlink.h | 3 +++ ld/plugin.c | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/bfd/linker.c b/bfd/linker.c index d4b053c9c6f..1a5ecef8480 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 fc14a9fadb6..58dba2a1724 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 f10c2730310..8d6ae05123a 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; } -- 2.30.2