]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - bfd/linker.c
Fix: symbols eliminated by --gc-sections still trigger warnings for gnu.warning.SYM
[thirdparty/binutils-gdb.git] / bfd / linker.c
index 28fffc3ad6319ebb5fd1856e2c0507d028ba742d..90dc581cfe3242145c120d324e54963c3e494fe1 100644 (file)
@@ -1784,6 +1784,14 @@ _bfd_generic_link_add_one_symbol (struct bfd_link_info *info,
            {
              (*info->callbacks->warning) (info, string, h->root.string,
                                           hash_entry_bfd (h), NULL, 0);
+             /* PR 31067: If garbage collection is enabled then the
+                referenced symbol may actually be discarded later on.
+                This could be very confusing to the user.  So give them
+                a hint as to what might be happening.  */
+             if (info->gc_sections)
+               (*info->callbacks->info)
+                 (_("%P: %pB: note: the message above does not take linker garbage collection into account\n"),
+                  hash_entry_bfd (h));
              break;
            }
          /* Fall through.  */