aboutsummaryrefslogtreecommitdiff
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
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.
-rw-r--r--bfd/ChangeLog7
-rw-r--r--bfd/coff-aux.c3
-rw-r--r--bfd/elflink.c6
-rw-r--r--bfd/linker.c3
-rw-r--r--include/ChangeLog6
-rw-r--r--include/bfdlink.h7
-rw-r--r--ld/ChangeLog7
-rw-r--r--ld/ldmain.c6
-rw-r--r--ld/plugin.c40
9 files changed, 70 insertions, 15 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 8733a69..a5355b5 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,10 @@
+2011-05-17 Alan Modra <amodra@gmail.com>
+
+ PR ld/12760
+ * 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.
+
2011-05-16 Alan Modra <amodra@gmail.com>
* linker.c (_bfd_generic_link_add_one_symbol): Don't init u.undef.weak.
diff --git a/bfd/coff-aux.c b/bfd/coff-aux.c
index 20a680c..84805a8 100644
--- a/bfd/coff-aux.c
+++ b/bfd/coff-aux.c
@@ -105,7 +105,8 @@ coff_m68k_aux_link_add_one_symbol (info, abfd, name, flags, section, value,
&& (bfd_hash_lookup (info->notice_hash, name, FALSE, FALSE)
!= (struct bfd_hash_entry *) NULL))
{
- if (! (*info->callbacks->notice) (info, h, abfd, section, value))
+ if (! (*info->callbacks->notice) (info, h, abfd, section, value,
+ flags, string))
return FALSE;
}
diff --git a/bfd/elflink.c b/bfd/elflink.c
index e4f728d..b08b150 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -3814,7 +3814,7 @@ error_free_dyn:
/* Make a special call to the linker "notice" function to
tell it that we are about to handle an as-needed lib. */
if (!(*info->callbacks->notice) (info, NULL, abfd, NULL,
- notice_as_needed))
+ notice_as_needed, 0, NULL))
goto error_free_vers;
/* Clone the symbol table and sym hashes. Remember some
@@ -4561,7 +4561,7 @@ error_free_dyn:
/* Make a special call to the linker "notice" function to
tell it that symbols added for crefs may need to be removed. */
if (!(*info->callbacks->notice) (info, NULL, abfd, NULL,
- notice_not_needed))
+ notice_not_needed, 0, NULL))
goto error_free_vers;
free (old_tab);
@@ -4575,7 +4575,7 @@ error_free_dyn:
if (old_tab != NULL)
{
if (!(*info->callbacks->notice) (info, NULL, abfd, NULL,
- notice_needed))
+ notice_needed, 0, NULL))
goto error_free_vers;
free (old_tab);
old_tab = NULL;
diff --git a/bfd/linker.c b/bfd/linker.c
index d92a9d8..90ab63e 100644
--- a/bfd/linker.c
+++ b/bfd/linker.c
@@ -1607,7 +1607,8 @@ _bfd_generic_link_add_one_symbol (struct bfd_link_info *info,
|| (info->notice_hash != NULL
&& bfd_hash_lookup (info->notice_hash, name, FALSE, FALSE) != NULL))
{
- if (! (*info->callbacks->notice) (info, h, abfd, section, value))
+ if (! (*info->callbacks->notice) (info, h,
+ abfd, section, value, flags, string))
return FALSE;
}
diff --git a/include/ChangeLog b/include/ChangeLog
index 1f8b378..7fd79a0 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,3 +1,9 @@
+2011-05-17 Alan Modra <amodra@gmail.com>
+
+ PR ld/12760
+ * bfdlink.h (struct bfd_link_callbacks <notice>): Add "flags" and
+ "string" param.
+
2011-05-16 Alan Modra <amodra@gmail.com>
* bfdlink.h (struct bfd_link_hash_entry): Remove u.undef.weak field.
diff --git a/include/bfdlink.h b/include/bfdlink.h
index d3ac8d9..bb62fbe 100644
--- a/include/bfdlink.h
+++ b/include/bfdlink.h
@@ -573,10 +573,13 @@ struct bfd_link_callbacks
/* A function which is called when a symbol in notice_hash is
defined or referenced. H is the symbol. ABFD, SECTION and
ADDRESS are the (new) value of the symbol. If SECTION is
- bfd_und_section, this is a reference. */
+ bfd_und_section, this is a reference. FLAGS are the symbol
+ BSF_* flags. STRING is the name of the symbol to indirect to if
+ the sym is indirect, or the warning string if a warning sym. */
bfd_boolean (*notice)
(struct bfd_link_info *, struct bfd_link_hash_entry *h,
- bfd *abfd, asection *section, bfd_vma address);
+ bfd *abfd, asection *section, bfd_vma address, flagword flags,
+ const char *string);
/* Error or warning link info message. */
void (*einfo)
(const char *fmt, ...);
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 6697fc1..7b782c8 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,10 @@
+2011-05-17 Alan Modra <amodra@gmail.com>
+
+ PR ld/12760
+ * ldmain.c (notice): Add "flags" and "string" param.
+ * plugin.c (plugin_notice): Likewise. Handle indirect, warning
+ and constructor syms.
+
2010-05-16 Daniel Jacobowitz <dan@codesourcery.com>
* ldlang.c (print_assignment): Use the symbol's section if we
diff --git a/ld/ldmain.c b/ld/ldmain.c
index bfa6066..96f3bda 100644
--- a/ld/ldmain.c
+++ b/ld/ldmain.c
@@ -151,7 +151,7 @@ static bfd_boolean unattached_reloc
(struct bfd_link_info *, const char *, bfd *, asection *, bfd_vma);
static bfd_boolean notice
(struct bfd_link_info *, struct bfd_link_hash_entry *,
- bfd *, asection *, bfd_vma);
+ bfd *, asection *, bfd_vma, flagword, const char *);
static struct bfd_link_callbacks link_callbacks =
{
@@ -1483,7 +1483,9 @@ notice (struct bfd_link_info *info,
struct bfd_link_hash_entry *h,
bfd *abfd,
asection *section,
- bfd_vma value)
+ bfd_vma value,
+ flagword flags ATTRIBUTE_UNUSED,
+ const char *string ATTRIBUTE_UNUSED)
{
const char *name;
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;
}