X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=bfd%2Flinker.c;h=327426e3c519d0efa77ac98b2cf903c0948d635d;hb=f13a99db51c0ca487f4a0a41b14dc255d386c4ff;hp=8d0925fbb1d5d217e6519d23efec1d9420f120bd;hpb=cd123cb70c845b890eed231a84e6e84c92c2ef92;p=deliverable%2Fbinutils-gdb.git diff --git a/bfd/linker.c b/bfd/linker.c index 8d0925fbb1..327426e3c5 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 + 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. Written by Steve Chamberlain and Ian Lance Taylor, Cygnus Support @@ -151,9 +151,9 @@ SUBSUBSECTION Sometimes the <<_bfd_link_add_symbols>> function must store some information in the hash table entry to be used by the - <<_bfd_final_link>> function. In such a case the <> - field of the hash table must be checked to make sure that the - hash table was created by an object file of the same format. + <<_bfd_final_link>> function. In such a case the output bfd + xvec must be checked to make sure that the hash table was + created by an object file of the same format. The <<_bfd_final_link>> routine must be prepared to handle a hash entry without any extra information added by the @@ -165,7 +165,7 @@ SUBSUBSECTION initialization function. See <> for an example of how to - check the <> field before saving information (in this + check the output bfd before saving information (in this case, the ECOFF external symbol debugging information) in a hash table entry. @@ -471,13 +471,12 @@ _bfd_link_hash_newfunc (struct bfd_hash_entry *entry, bfd_boolean _bfd_link_hash_table_init (struct bfd_link_hash_table *table, - bfd *abfd, + bfd *abfd ATTRIBUTE_UNUSED, struct bfd_hash_entry *(*newfunc) (struct bfd_hash_entry *, struct bfd_hash_table *, const char *), unsigned int entsize) { - table->creator = abfd->xvec; table->undefs = NULL; table->undefs_tail = NULL; table->type = bfd_link_generic_hash_table; @@ -1316,7 +1315,7 @@ generic_link_add_symbol_list (bfd *abfd, struct generic_link_hash_entry *h; struct bfd_link_hash_entry *bh; - name = bfd_asymbol_name (p); + string = name = bfd_asymbol_name (p); if (((p->flags & BSF_INDIRECT) != 0 || bfd_is_ind_section (p->section)) && pp + 1 < ppend) @@ -1329,12 +1328,9 @@ generic_link_add_symbol_list (bfd *abfd, { /* The name of P is actually the warning string, and the next symbol is the one to warn about. */ - string = name; pp++; name = bfd_asymbol_name (*pp); } - else - string = NULL; bh = NULL; if (! (_bfd_generic_link_add_one_symbol @@ -1362,7 +1358,7 @@ generic_link_add_symbol_list (bfd *abfd, hash table other than the generic hash table, so we only do this if we are certain that the hash table is a generic one. */ - if (info->hash->creator == abfd->xvec) + if (info->output_bfd->xvec == abfd->xvec) { if (h->sym == NULL || (! bfd_is_und_section (bfd_get_section (p)) @@ -2246,7 +2242,7 @@ _bfd_generic_link_output_symbols (bfd *output_bfd, this routine will be called with a hash table other than a generic hash table, so we double check that. */ - if (info->hash->creator == input_bfd->xvec) + if (info->output_bfd->xvec == input_bfd->xvec) { if (h->sym != NULL) *sym_ptr = sym = h->sym; @@ -2926,7 +2922,7 @@ bfd_section_already_linked_table_lookup (const char *name) TRUE, FALSE)); } -void +bfd_boolean bfd_section_already_linked_table_insert (struct bfd_section_already_linked_hash_entry *already_linked_list, asection *sec) @@ -2936,9 +2932,12 @@ bfd_section_already_linked_table_insert /* Allocate the memory from the same obstack as the hash table is kept in. */ l = bfd_hash_allocate (&_bfd_section_already_linked_table, sizeof *l); + if (l == NULL) + return FALSE; l->sec = sec; l->next = already_linked_list->entry; already_linked_list->entry = l; + return TRUE; } static struct bfd_hash_entry * @@ -2949,6 +2948,9 @@ already_linked_newfunc (struct bfd_hash_entry *entry ATTRIBUTE_UNUSED, struct bfd_section_already_linked_hash_entry *ret = bfd_hash_allocate (table, sizeof *ret); + if (ret == NULL) + return NULL; + ret->entry = NULL; return &ret->root; @@ -2973,7 +2975,7 @@ bfd_section_already_linked_table_free (void) void _bfd_generic_section_already_linked (bfd *abfd, asection *sec, - struct bfd_link_info *info ATTRIBUTE_UNUSED) + struct bfd_link_info *info) { flagword flags; const char *name; @@ -3074,7 +3076,8 @@ _bfd_generic_section_already_linked (bfd *abfd, asection *sec, } /* This is the first section with this name. Record it. */ - bfd_section_already_linked_table_insert (already_linked_list, sec); + if (! bfd_section_already_linked_table_insert (already_linked_list, sec)) + info->callbacks->einfo (_("%F%P: already_linked_table: %E")); } /* Convert symbols in excluded output sections to use a kept section. */