aboutsummaryrefslogtreecommitdiff
path: root/ld/plugin.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2011-05-17 13:02:18 +0000
committerAlan Modra <amodra@gmail.com>2011-05-17 13:02:18 +0000
commit16d96b5b8fc6ea4aeccccfd805a7049438ad1f6b (patch)
treea7d64dee0a9e5322558b8fbd450a04b715f4d1f7 /ld/plugin.c
parentcd3da28e23c6fe0f229cd09975b28c6b3b1d8779 (diff)
downloadgdb-16d96b5b8fc6ea4aeccccfd805a7049438ad1f6b.zip
gdb-16d96b5b8fc6ea4aeccccfd805a7049438ad1f6b.tar.gz
gdb-16d96b5b8fc6ea4aeccccfd805a7049438ad1f6b.tar.bz2
PR ld/12760
include/ * bfdlink.h (struct bfd_link_callbacks <notice>): Add "flags" and "string" param. bfd/ * coff-aux.c (coff_m68k_aux_link_add_one_symbol): Adjust "notice" call. * elflink.c (elf_link_add_object_symbols): Likewise. * linker.c (_bfd_generic_link_add_one_symbol): Likewise. ld/ * ldmain.c (notice): Add "flags" and "string" param. * plugin.c (plugin_notice): Likewise. Handle indirect, warning and constructor syms.
Diffstat (limited to 'ld/plugin.c')
-rw-r--r--ld/plugin.c40
1 files changed, 34 insertions, 6 deletions
diff --git a/ld/plugin.c b/ld/plugin.c
index 07c6068..60eb102 100644
--- a/ld/plugin.c
+++ b/ld/plugin.c
@@ -125,9 +125,9 @@ static const enum ld_plugin_tag tv_header_tags[] =
static const size_t tv_header_size = ARRAY_SIZE (tv_header_tags);
/* Forward references. */
-static bfd_boolean plugin_notice (struct bfd_link_info *info,
- struct bfd_link_hash_entry *h, bfd *abfd,
- asection *section, bfd_vma value);
+static bfd_boolean plugin_notice (struct bfd_link_info *,
+ struct bfd_link_hash_entry *, bfd *,
+ asection *, bfd_vma, flagword, const char *);
#if !defined (HAVE_DLFCN_H) && defined (HAVE_WINDOWS_H)
@@ -908,7 +908,9 @@ plugin_notice (struct bfd_link_info *info,
struct bfd_link_hash_entry *h,
bfd *abfd,
asection *section,
- bfd_vma value)
+ bfd_vma value,
+ flagword flags,
+ const char *string)
{
if (h != NULL)
{
@@ -918,8 +920,33 @@ plugin_notice (struct bfd_link_info *info,
if (is_ir_dummy_bfd (abfd))
return TRUE;
+ /* Making an indirect symbol counts as a reference unless this
+ is a brand new symbol. */
+ if (bfd_is_ind_section (section)
+ || (flags & BSF_INDIRECT) != 0)
+ {
+ if (h->type != bfd_link_hash_new)
+ {
+ struct bfd_link_hash_entry *inh;
+
+ h->non_ir_ref = TRUE;
+ inh = bfd_wrapped_link_hash_lookup (abfd, info, string, FALSE,
+ FALSE, FALSE);
+ if (inh != NULL)
+ inh->non_ir_ref = TRUE;
+ }
+ }
+
+ /* Nothing to do here for warning symbols. */
+ else if ((flags & BSF_WARNING) != 0)
+ ;
+
+ /* Nothing to do here for constructor symbols. */
+ else if ((flags & BSF_CONSTRUCTOR) != 0)
+ ;
+
/* If this is a ref, set non_ir_ref. */
- if (bfd_is_und_section (section))
+ else if (bfd_is_und_section (section))
h->non_ir_ref = TRUE;
/* Otherwise, it must be a new def. Ensure any symbol defined
@@ -945,6 +972,7 @@ plugin_notice (struct bfd_link_info *info,
|| (info->notice_hash != NULL
&& bfd_hash_lookup (info->notice_hash, h->root.string,
FALSE, FALSE) != NULL))
- return (*orig_callbacks->notice) (info, h, abfd, section, value);
+ return (*orig_callbacks->notice) (info, h,
+ abfd, section, value, flags, string);
return TRUE;
}