aboutsummaryrefslogtreecommitdiff
path: root/ld/ldmain.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2008-08-17 03:12:50 +0000
committerAlan Modra <amodra@gmail.com>2008-08-17 03:12:50 +0000
commit5c1d2f5f4c7747c36eae8be3abd4ef4e9669690c (patch)
tree3be4145ee7086fe0315ad0ce506626b5ca560759 /ld/ldmain.c
parent1f5064de53c27d99fb92efd65a6785e2f1ec0835 (diff)
downloadgdb-5c1d2f5f4c7747c36eae8be3abd4ef4e9669690c.zip
gdb-5c1d2f5f4c7747c36eae8be3abd4ef4e9669690c.tar.gz
gdb-5c1d2f5f4c7747c36eae8be3abd4ef4e9669690c.tar.bz2
bfd/
* bfd.c (struct _bfd): Correct outsymbols comment. * bfd-in2.h: Regenerate. * linker.c (bfd_generic_link_read_symbols): Renamed from.. (generic_link_read_symbols): ..this, and made global. include/ * bfdlink.h (bfd_generic_link_read_symbols): Declare. ld/ PR 6478 * ldcref.c (check_local_sym_xref): Use bfd_generic_link_read_symbols. Don't free symbol pointer array. (check_refs): Likewise. * ldmain.c (warning_callback): Likewise. * ldmisc.c (vfinfo): Likewise. * pe-dll.c (process_def_file): Likewise. (pe_walk_relocs_of_symbol, generate_reloc): Likewise. * emultempl/pe.em (pe_find_data_imports): Likewise. (gld_${EMULATION_NAME}_after_open): Likewise. * emultempl/pep.em (pep_find_data_imports): Likewise. (gld_${EMULATION_NAME}_after_open): Likewise. * ldlang.h (lang_input_statement_type): Delete asymbols, symbol_count, passive_position, closed. * ldlang.c (new_afile): Don't set asymbols and symbol_count. * ldmain.c (add_archive_element): xcalloc lang_input_statement_type.
Diffstat (limited to 'ld/ldmain.c')
-rw-r--r--ld/ldmain.c44
1 files changed, 5 insertions, 39 deletions
diff --git a/ld/ldmain.c b/ld/ldmain.c
index bf3c0e6..7060587 100644
--- a/ld/ldmain.c
+++ b/ld/ldmain.c
@@ -778,21 +778,10 @@ add_archive_element (struct bfd_link_info *info,
{
lang_input_statement_type *input;
- input = xmalloc (sizeof (lang_input_statement_type));
+ input = xcalloc (1, sizeof (lang_input_statement_type));
input->filename = abfd->filename;
input->local_sym_name = abfd->filename;
input->the_bfd = abfd;
- input->asymbols = NULL;
- input->next = NULL;
- input->just_syms_flag = FALSE;
- input->loaded = FALSE;
- input->search_dirs_flag = FALSE;
-
- /* FIXME: The following fields are not set: header.next,
- header.type, closed, passive_position, symbol_count,
- next_real_file, is_archive, target, real. This bit of code is
- from the old decode_library_subfile function. I don't know
- whether any of those fields matters. */
ldlang_add_file (input);
@@ -1107,45 +1096,22 @@ warning_callback (struct bfd_link_info *info ATTRIBUTE_UNUSED,
einfo ("%B: %s%s\n", abfd, _("warning: "), warning);
else
{
- lang_input_statement_type *entry;
- asymbol **asymbols;
struct warning_callback_info info;
/* Look through the relocs to see if we can find a plausible
address. */
- entry = (lang_input_statement_type *) abfd->usrdata;
- if (entry != NULL && entry->asymbols != NULL)
- asymbols = entry->asymbols;
- else
- {
- long symsize;
- long symbol_count;
-
- symsize = bfd_get_symtab_upper_bound (abfd);
- if (symsize < 0)
- einfo (_("%B%F: could not read symbols: %E\n"), abfd);
- asymbols = xmalloc (symsize);
- symbol_count = bfd_canonicalize_symtab (abfd, asymbols);
- if (symbol_count < 0)
- einfo (_("%B%F: could not read symbols: %E\n"), abfd);
- if (entry != NULL)
- {
- entry->asymbols = asymbols;
- entry->symbol_count = symbol_count;
- }
- }
+
+ if (!bfd_generic_link_read_symbols (abfd))
+ einfo (_("%B%F: could not read symbols: %E\n"), abfd);
info.found = FALSE;
info.warning = warning;
info.symbol = symbol;
- info.asymbols = asymbols;
+ info.asymbols = bfd_get_outsymbols (abfd);
bfd_map_over_sections (abfd, warning_find_reloc, &info);
if (! info.found)
einfo ("%B: %s%s\n", abfd, _("warning: "), warning);
-
- if (entry == NULL)
- free (asymbols);
}
return TRUE;