aboutsummaryrefslogtreecommitdiff
path: root/bfd/linker.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2023-11-21 09:26:19 +0000
committerNick Clifton <nickc@redhat.com>2023-11-21 09:26:19 +0000
commit1c320501655ec8d5077d0a3231652c7d661249bc (patch)
tree14682d855e58471f07ca95611448ab42ca477934 /bfd/linker.c
parenta68722065fd544995137677fb0e57c392ef00e0e (diff)
downloadfsf-binutils-gdb-1c320501655ec8d5077d0a3231652c7d661249bc.zip
fsf-binutils-gdb-1c320501655ec8d5077d0a3231652c7d661249bc.tar.gz
fsf-binutils-gdb-1c320501655ec8d5077d0a3231652c7d661249bc.tar.bz2
Fix: symbols eliminated by --gc-sections still trigger warnings for gnu.warning.SYM
PR 31067 * linker.c (_bfd_generic_link_add_one_symbol): When issuing a warning message, also display a message about the warning not being affected by garbage colleciton. * ld.texi (Special Sections): New entry in the linker manual. Describes how the .gnu.warning and .gnu.warning.SYM sections behave.
Diffstat (limited to 'bfd/linker.c')
-rw-r--r--bfd/linker.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/bfd/linker.c b/bfd/linker.c
index 28fffc3..90dc581 100644
--- a/bfd/linker.c
+++ b/bfd/linker.c
@@ -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. */