diff options
author | Alan Modra <amodra@gmail.com> | 2011-04-20 00:11:33 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2011-04-20 00:11:33 +0000 |
commit | 24f58f47de96a6c061fc6eeb37a699c03dde970a (patch) | |
tree | 6d218f4096841f46c906ecab5f7090df8723161e /bfd | |
parent | 43a8278ee9e14776343b7b3692650b130c301363 (diff) | |
download | gdb-24f58f47de96a6c061fc6eeb37a699c03dde970a.zip gdb-24f58f47de96a6c061fc6eeb37a699c03dde970a.tar.gz gdb-24f58f47de96a6c061fc6eeb37a699c03dde970a.tar.bz2 |
PR ld/12365
include/
* bfdlink.h (struct bfd_link_callbacks): Modify multiple_definition
and multiple_common parameters to pass in a bfd_link_hash_entry
pointer rather than name,bfd etc. found in the hash entry.
bfd/
* elflink.c (_bfd_elf_merge_symbol): Update multiple_common calls.
* linker.c (_bfd_generic_link_add_one_symbol): Likewise. Call
multiple_definition regardless of allow_multiple_definition.
* simple.c (simple_dummy_multiple_definition): Update.
* xcofflink.c (xcoff_link_add_symbols): Update multiple_definition
calls.
ld/
* ldmain.c (multiple_definition): Take a bfd_link_hash_entry
pointer arg rather than "name", "obfd", "osec", "oval". Add code
removed from linker.c. Hack around xcofflink.c oddity in
passing NULL nbfd.
(multiple_common): Similarly.
* plugin.c (orig_allow_multiple_defs): Delete.
(plugin_call_all_symbols_read): Don't twiddle allow_multiple_definition.
(plugin_multiple_definition): Update.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 10 | ||||
-rw-r--r-- | bfd/elflink.c | 8 | ||||
-rw-r--r-- | bfd/linker.c | 71 | ||||
-rw-r--r-- | bfd/simple.c | 7 | ||||
-rw-r--r-- | bfd/xcofflink.c | 12 |
5 files changed, 30 insertions, 78 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index ecd1f03..0d532e8 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,13 @@ +2011-04-20 Alan Modra <amodra@gmail.com> + + PR ld/12365 + * elflink.c (_bfd_elf_merge_symbol): Update multiple_common calls. + * linker.c (_bfd_generic_link_add_one_symbol): Likewise. Call + multiple_definition regardless of allow_multiple_definition. + * simple.c (simple_dummy_multiple_definition): Update. + * xcofflink.c (xcoff_link_add_symbols): Update multiple_definition + calls. + 2011-04-18 Tristan Gingold <gingold@adacore.com> * coff-rs6000.c: Convert to ISO-C. Remove PARAMS macro. diff --git a/bfd/elflink.c b/bfd/elflink.c index 2275503..f0ad579 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -1,6 +1,6 @@ /* ELF linking support for BFD. Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, - 2005, 2006, 2007, 2008, 2009, 2010 + 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -1361,8 +1361,7 @@ _bfd_elf_merge_symbol (bfd *abfd, symbols defined in dynamic objects. */ if (! ((*info->callbacks->multiple_common) - (info, h->root.root.string, oldbfd, bfd_link_hash_common, - h->size, abfd, bfd_link_hash_common, sym->st_size))) + (info, &h->root, abfd, bfd_link_hash_common, sym->st_size))) return FALSE; if (sym->st_size > h->size) @@ -1513,8 +1512,7 @@ _bfd_elf_merge_symbol (bfd *abfd, common symbol, but we don't know what to use for the section or the alignment. */ if (! ((*info->callbacks->multiple_common) - (info, h->root.root.string, oldbfd, bfd_link_hash_common, - h->size, abfd, bfd_link_hash_common, sym->st_size))) + (info, &h->root, abfd, bfd_link_hash_common, sym->st_size))) return FALSE; /* If the presumed common symbol in the dynamic object is diff --git a/bfd/linker.c b/bfd/linker.c index 2b52ba9..8c577f2 100644 --- a/bfd/linker.c +++ b/bfd/linker.c @@ -1,6 +1,6 @@ /* linker.c -- BFD linker routines Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, - 2003, 2004, 2005, 2006, 2007, 2008, 2009 + 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. Written by Steve Chamberlain and Ian Lance Taylor, Cygnus Support @@ -1651,9 +1651,7 @@ _bfd_generic_link_add_one_symbol (struct bfd_link_info *info, previously common. */ BFD_ASSERT (h->type == bfd_link_hash_common); if (! ((*info->callbacks->multiple_common) - (info, h->root.string, - h->u.c.p->section->owner, bfd_link_hash_common, h->u.c.size, - abfd, bfd_link_hash_defined, 0))) + (info, h, abfd, bfd_link_hash_defined, 0))) return FALSE; /* Fall through. */ case DEF: @@ -1782,9 +1780,7 @@ _bfd_generic_link_add_one_symbol (struct bfd_link_info *info, two sizes, and use the section required by the larger symbol. */ BFD_ASSERT (h->type == bfd_link_hash_common); if (! ((*info->callbacks->multiple_common) - (info, h->root.string, - h->u.c.p->section->owner, bfd_link_hash_common, h->u.c.size, - abfd, bfd_link_hash_common, value))) + (info, h, abfd, bfd_link_hash_common, value))) return FALSE; if (value > h->u.c.size) { @@ -1821,23 +1817,11 @@ _bfd_generic_link_add_one_symbol (struct bfd_link_info *info, break; case CREF: - { - bfd *obfd; - - /* We have found a common definition for a symbol which - was already defined. FIXME: It would nice if we could - report the BFD which defined an indirect symbol, but we - don't have anywhere to store the information. */ - if (h->type == bfd_link_hash_defined - || h->type == bfd_link_hash_defweak) - obfd = h->u.def.section->owner; - else - obfd = NULL; - if (! ((*info->callbacks->multiple_common) - (info, h->root.string, obfd, h->type, 0, - abfd, bfd_link_hash_common, value))) - return FALSE; - } + /* We have found a common definition for a symbol which + was already defined. */ + if (! ((*info->callbacks->multiple_common) + (info, h, abfd, bfd_link_hash_common, value))) + return FALSE; break; case MIND: @@ -1848,47 +1832,16 @@ _bfd_generic_link_add_one_symbol (struct bfd_link_info *info, /* Fall through. */ case MDEF: /* Handle a multiple definition. */ - if (!info->allow_multiple_definition) - { - asection *msec = NULL; - bfd_vma mval = 0; - - switch (h->type) - { - case bfd_link_hash_defined: - msec = h->u.def.section; - mval = h->u.def.value; - break; - case bfd_link_hash_indirect: - msec = bfd_ind_section_ptr; - mval = 0; - break; - default: - abort (); - } - - /* Ignore a redefinition of an absolute symbol to the - same value; it's harmless. */ - if (h->type == bfd_link_hash_defined - && bfd_is_abs_section (msec) - && bfd_is_abs_section (section) - && value == mval) - break; - - if (! ((*info->callbacks->multiple_definition) - (info, h->root.string, msec->owner, msec, mval, - abfd, section, value))) - return FALSE; - } + if (! ((*info->callbacks->multiple_definition) + (info, h, abfd, section, value))) + return FALSE; break; case CIND: /* Create an indirect symbol from an existing common symbol. */ BFD_ASSERT (h->type == bfd_link_hash_common); if (! ((*info->callbacks->multiple_common) - (info, h->root.string, - h->u.c.p->section->owner, bfd_link_hash_common, h->u.c.size, - abfd, bfd_link_hash_indirect, 0))) + (info, h, abfd, bfd_link_hash_indirect, 0))) return FALSE; /* Fall through. */ case IND: diff --git a/bfd/simple.c b/bfd/simple.c index 03d1a15..e5a5b58 100644 --- a/bfd/simple.c +++ b/bfd/simple.c @@ -1,5 +1,5 @@ /* simple.c -- BFD simple client routines - Copyright 2002, 2003, 2004, 2005, 2007, 2008, 2009 + Copyright 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. Contributed by MontaVista Software, Inc. @@ -82,10 +82,7 @@ simple_dummy_unattached_reloc (struct bfd_link_info *link_info ATTRIBUTE_UNUSED, static bfd_boolean simple_dummy_multiple_definition (struct bfd_link_info *link_info ATTRIBUTE_UNUSED, - const char *name ATTRIBUTE_UNUSED, - bfd *obfd ATTRIBUTE_UNUSED, - asection *osec ATTRIBUTE_UNUSED, - bfd_vma oval ATTRIBUTE_UNUSED, + struct bfd_link_hash_entry *h ATTRIBUTE_UNUSED, bfd *nbfd ATTRIBUTE_UNUSED, asection *nsec ATTRIBUTE_UNUSED, bfd_vma nval ATTRIBUTE_UNUSED) diff --git a/bfd/xcofflink.c b/bfd/xcofflink.c index 7ff920a..47e094e 100644 --- a/bfd/xcofflink.c +++ b/bfd/xcofflink.c @@ -1,6 +1,6 @@ /* POWER/PowerPC XCOFF linker support. Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, - 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. Written by Ian Lance Taylor <ian@cygnus.com>, Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -1996,11 +1996,7 @@ xcoff_link_add_symbols (bfd *abfd, struct bfd_link_info *info) handle them, and that would only be a warning, not an error. */ if (! ((*info->callbacks->multiple_definition) - (info, (*sym_hash)->root.root.string, - NULL, NULL, (bfd_vma) 0, - (*sym_hash)->root.u.def.section->owner, - (*sym_hash)->root.u.def.section, - (*sym_hash)->root.u.def.value))) + (info, &(*sym_hash)->root, NULL, NULL, (bfd_vma) 0))) goto error_return; /* Try not to give this error too many times. */ (*sym_hash)->flags &= ~XCOFF_MULTIPLY_DEFINED; @@ -3119,9 +3115,7 @@ bfd_xcoff_import_symbol (bfd *output_bfd, || h->root.u.def.value != val)) { if (! ((*info->callbacks->multiple_definition) - (info, h->root.root.string, h->root.u.def.section->owner, - h->root.u.def.section, h->root.u.def.value, - output_bfd, bfd_abs_section_ptr, val))) + (info, &h->root, output_bfd, bfd_abs_section_ptr, val))) return FALSE; } |