From a6626e8c3089ee949fcb177dc0a3253a8c3b9c58 Mon Sep 17 00:00:00 2001 From: Michael Snyder Date: Fri, 27 Jul 2007 01:04:29 +0000 Subject: [PATCH] 2007-07-26 Michael Snyder * linker.c (bfd_section_already_linked_table_insert): Change return type from void to boolean. Return FALSE on failure. (_bfd_generic_section_already_linked): Test return value of bfd_section_already_linked_table_insert, call fatal on error. * elflink.c (_bfd_elf_section_already_linked): Test return value of bfd_section_already_linked_table_insert, call fatal on error. * libbfd-in.h (bfd_section_already_linked_table_insert): Update return type to bfd_boolean. * libbfd.h: Regenerate. --- bfd/ChangeLog | 15 +++++++++++++++ bfd/elflink.c | 3 ++- bfd/libbfd-in.h | 2 +- bfd/libbfd.h | 2 +- bfd/linker.c | 12 ++++++++---- 5 files changed, 27 insertions(+), 7 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 42a1e745993..2cf4d1f93d1 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,18 @@ +2007-07-26 Michael Snyder + + * linker.c (bfd_section_already_linked_table_insert): Change + return type from void to boolean. Return FALSE on failure. + (_bfd_generic_section_already_linked): Test return value of + bfd_section_already_linked_table_insert, call fatal on error. + + * elflink.c (_bfd_elf_section_already_linked): Test return value + of bfd_section_already_linked_table_insert, call fatal on error. + + * libbfd-in.h (bfd_section_already_linked_table_insert): Update + return type to bfd_boolean. + + * libbfd.h: Regenerate. + 2007-07-26 Adam Nemet * archive.c (do_slurp_bsd_armap, do_slurp_coff_armap, diff --git a/bfd/elflink.c b/bfd/elflink.c index 1e98cb7fd04..6cfb8b96092 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -12235,7 +12235,8 @@ _bfd_elf_section_already_linked (bfd *abfd, struct bfd_section *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")); } bfd_boolean diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h index 6aa250d33f0..ec11bd5d6b0 100644 --- a/bfd/libbfd-in.h +++ b/bfd/libbfd-in.h @@ -726,7 +726,7 @@ struct bfd_section_already_linked extern struct bfd_section_already_linked_hash_entry * bfd_section_already_linked_table_lookup (const char *); -extern void bfd_section_already_linked_table_insert +extern bfd_boolean bfd_section_already_linked_table_insert (struct bfd_section_already_linked_hash_entry *, asection *); extern void bfd_section_already_linked_table_traverse (bfd_boolean (*) (struct bfd_section_already_linked_hash_entry *, diff --git a/bfd/libbfd.h b/bfd/libbfd.h index bfc31e07769..2d5b5b3dec0 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -731,7 +731,7 @@ struct bfd_section_already_linked extern struct bfd_section_already_linked_hash_entry * bfd_section_already_linked_table_lookup (const char *); -extern void bfd_section_already_linked_table_insert +extern bfd_boolean bfd_section_already_linked_table_insert (struct bfd_section_already_linked_hash_entry *, asection *); extern void bfd_section_already_linked_table_traverse (bfd_boolean (*) (struct bfd_section_already_linked_hash_entry *, diff --git a/bfd/linker.c b/bfd/linker.c index a679a32c46e..fb293cca71f 100644 --- a/bfd/linker.c +++ b/bfd/linker.c @@ -2923,7 +2923,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) @@ -2933,9 +2933,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 * @@ -2947,7 +2950,7 @@ already_linked_newfunc (struct bfd_hash_entry *entry ATTRIBUTE_UNUSED, bfd_hash_allocate (table, sizeof *ret); if (ret == NULL) - return ret; + return NULL; ret->entry = NULL; @@ -2973,7 +2976,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 +3077,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. */ -- 2.30.2