Fix non-plugin warning symbol handling
authorAlan Modra <amodra@gmail.com>
Tue, 12 Aug 2014 01:01:41 +0000 (10:31 +0930)
committerAlan Modra <amodra@gmail.com>
Tue, 12 Aug 2014 01:01:41 +0000 (10:31 +0930)
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.

bfd/linker.c
include/bfdlink.h
ld/plugin.c

index d4b053c9c6f905dffc7b1e7044fe9a90078fe599..1a5ecef8480279f7dc9e43f5014bcce35551de95 100644 (file)
@@ -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))
index fc14a9fadb638660b70e8ee80705cc82bf388ee5..58dba2a1724f86d61234c6a43130e2a2821abb22 100644 (file)
@@ -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;
 
index f10c27303104a47e7e8d6f42cfd71d1fd9aa378d..8d6ae05123af33e3ca714c2c5979ee14f9644171 100644 (file)
@@ -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;
 }