aboutsummaryrefslogtreecommitdiff
path: root/bfd
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
parenta68722065fd544995137677fb0e57c392ef00e0e (diff)
downloadgdb-1c320501655ec8d5077d0a3231652c7d661249bc.zip
gdb-1c320501655ec8d5077d0a3231652c7d661249bc.tar.gz
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')
-rw-r--r--bfd/ChangeLog7
-rw-r--r--bfd/linker.c8
2 files changed, 15 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 1430698..e9f571a 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,10 @@
+2023-11-21 Nick Clifton <nickc@redhat.com>
+
+ 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.
+
2023-11-15 Arsen Arsenović <arsen@aarsen.me>
* aclocal.m4: Regenerate.
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. */