X-Git-Url: http://drtracing.org/?a=blobdiff_plain;ds=sidebyside;f=bfd%2Foasys.c;h=a2e78b01a4d00128835f2613093ac7eaf16bb2fd;hb=ec892a0718dc47c2d009532865c353daa749eaa1;hp=a8cb34198c9e98ee4e03688dc54bf7d81dc18e6f;hpb=116c20d240af833e0a1f1f959951f57b6e465782;p=deliverable%2Fbinutils-gdb.git diff --git a/bfd/oasys.c b/bfd/oasys.c index a8cb34198c..a2e78b01a4 100644 --- a/bfd/oasys.c +++ b/bfd/oasys.c @@ -1,13 +1,12 @@ /* BFD back-end for oasys objects. - Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2001, - 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 1990-2015 Free Software Foundation, Inc. Written by Steve Chamberlain of Cygnus Support, . This file is part of BFD, the Binary File Descriptor library. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -17,15 +16,17 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, + MA 02110-1301, USA. */ #define UNDERSCORE_HACK 1 -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "safe-ctype.h" #include "libbfd.h" #include "oasys.h" #include "liboasys.h" +#include "libiberty.h" /* Read in all the section data and relocation stuff too. */ @@ -384,11 +385,13 @@ oasys_slurp_section_data (bfd *const abfd) if (! per->initialized) { + arelent **relpp; + per->data = bfd_zalloc (abfd, section->size); if (!per->data) return FALSE; - per->reloc_tail_ptr - = (oasys_reloc_type **) §ion->relocation; + relpp = §ion->relocation; + per->reloc_tail_ptr = (oasys_reloc_type **) relpp; per->had_vma = FALSE; per->initialized = TRUE; section->reloc_count = 0; @@ -683,9 +686,13 @@ oasys_print_symbol (bfd *abfd, void * afile, asymbol *symbol, bfd_print_symbol_t static bfd_boolean oasys_new_section_hook (bfd *abfd, asection *newsect) { - newsect->used_by_bfd = bfd_alloc (abfd, (bfd_size_type) sizeof (oasys_per_section_type)); if (!newsect->used_by_bfd) - return FALSE; + { + newsect->used_by_bfd + = bfd_alloc (abfd, (bfd_size_type) sizeof (oasys_per_section_type)); + if (!newsect->used_by_bfd) + return FALSE; + } oasys_per_section (newsect)->data = NULL; oasys_per_section (newsect)->section = newsect; oasys_per_section (newsect)->offset = 0; @@ -695,7 +702,7 @@ oasys_new_section_hook (bfd *abfd, asection *newsect) /* Turn the section string into an index. */ sscanf (newsect->name, "%u", &newsect->target_index); - return TRUE; + return _bfd_generic_new_section_hook (abfd, newsect); } @@ -779,7 +786,7 @@ oasys_write_syms (bfd *abfd) { unsigned int count; asymbol **generic = bfd_get_outsymbols (abfd); - unsigned int index = 0; + unsigned int sym_index = 0; for (count = 0; count < bfd_get_symcount (abfd); count++) { @@ -792,8 +799,8 @@ oasys_write_syms (bfd *abfd) if (bfd_is_com_section (g->section)) { symbol.relb = RELOCATION_TYPE_COM; - H_PUT_16 (abfd, index, symbol.refno); - index++; + H_PUT_16 (abfd, sym_index, symbol.refno); + sym_index++; } else if (bfd_is_abs_section (g->section)) { @@ -803,9 +810,9 @@ oasys_write_syms (bfd *abfd) else if (bfd_is_und_section (g->section)) { symbol.relb = RELOCATION_TYPE_UND; - H_PUT_16 (abfd, index, symbol.refno); - /* Overload the value field with the output index number */ - index++; + H_PUT_16 (abfd, sym_index, symbol.refno); + /* Overload the value field with the output sym_index number */ + sym_index++; } else if (g->flags & BSF_DEBUGGING) /* Throw it away. */ @@ -852,7 +859,7 @@ oasys_write_syms (bfd *abfd) name[0]) + l)) return FALSE; } - g->value = index - 1; + g->value = sym_index - 1; } return TRUE; @@ -898,9 +905,11 @@ oasys_write_header (bfd *abfd) if (length > (size_t) sizeof (r.module_name)) length = sizeof (r.module_name); + else if (length < (size_t) sizeof (r.module_name)) + (void) memset (r.module_name + length, ' ', + sizeof (r.module_name) - length); (void) memcpy (r.module_name, abfd->filename, length); - (void) memset (r.module_name + length, ' ', sizeof (r.module_name) - length); r.version_number = OASYS_VERSION_NUMBER; r.rev_number = OASYS_REV_NUMBER; @@ -1077,12 +1086,12 @@ static asymbol * oasys_make_empty_symbol (bfd *abfd) { bfd_size_type amt = sizeof (oasys_symbol_type); - oasys_symbol_type *new = bfd_zalloc (abfd, amt); + oasys_symbol_type *new_symbol_type = bfd_zalloc (abfd, amt); - if (!new) + if (!new_symbol_type) return NULL; - new->symbol.the_bfd = abfd; - return &new->symbol; + new_symbol_type->symbol.the_bfd = abfd; + return &new_symbol_type->symbol; } /* User should have checked the file flags; perhaps we should return @@ -1108,7 +1117,7 @@ oasys_openr_next_archived_file (bfd *arch, bfd *prev) { p->abfd = _bfd_create_empty_archive_element_shell (arch); p->abfd->origin = p->pos; - p->abfd->filename = p->name; + p->abfd->filename = xstrdup (p->name); /* Fixup a pointer to this element for the member. */ p->abfd->arelt_data = (void *) p; @@ -1120,17 +1129,9 @@ oasys_openr_next_archived_file (bfd *arch, bfd *prev) return NULL; } -static bfd_boolean -oasys_find_nearest_line (bfd *abfd ATTRIBUTE_UNUSED, - asection *section ATTRIBUTE_UNUSED, - asymbol **symbols ATTRIBUTE_UNUSED, - bfd_vma offset ATTRIBUTE_UNUSED, - const char **filename_ptr ATTRIBUTE_UNUSED, - const char **functionname_ptr ATTRIBUTE_UNUSED, - unsigned int *line_ptr ATTRIBUTE_UNUSED) -{ - return FALSE; -} +#define oasys_find_nearest_line _bfd_nosymbols_find_nearest_line +#define oasys_find_line _bfd_nosymbols_find_line +#define oasys_find_inliner_info _bfd_nosymbols_find_inliner_info static int oasys_generic_stat_arch_elt (bfd *abfd, struct stat *buf) @@ -1149,7 +1150,8 @@ oasys_generic_stat_arch_elt (bfd *abfd, struct stat *buf) } static int -oasys_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, bfd_boolean exec ATTRIBUTE_UNUSED) +oasys_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info ATTRIBUTE_UNUSED) { return 0; } @@ -1162,28 +1164,34 @@ oasys_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, bfd_boolean exec ATTRIBUTE_UNU #define oasys_truncate_arname bfd_dont_truncate_arname #define oasys_write_armap ((bfd_boolean (*) (bfd *, unsigned int, struct orl *, unsigned int, int)) bfd_true) #define oasys_read_ar_hdr bfd_nullvoidptr +#define oasys_write_ar_hdr ((bfd_boolean (*) (bfd *, bfd *)) bfd_false) #define oasys_get_elt_at_index _bfd_generic_get_elt_at_index #define oasys_update_armap_timestamp bfd_true #define oasys_bfd_is_local_label_name bfd_generic_is_local_label_name #define oasys_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) #define oasys_get_lineno _bfd_nosymbols_get_lineno +#define oasys_get_symbol_version_string _bfd_nosymbols_get_symbol_version_string #define oasys_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol #define oasys_read_minisymbols _bfd_generic_read_minisymbols #define oasys_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol #define oasys_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup +#define oasys_bfd_reloc_name_lookup _bfd_norelocs_bfd_reloc_name_lookup #define oasys_set_arch_mach bfd_default_set_arch_mach #define oasys_get_section_contents_in_window _bfd_generic_get_section_contents_in_window #define oasys_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents #define oasys_bfd_relax_section bfd_generic_relax_section #define oasys_bfd_gc_sections bfd_generic_gc_sections +#define oasys_bfd_lookup_section_flags bfd_generic_lookup_section_flags #define oasys_bfd_merge_sections bfd_generic_merge_sections #define oasys_bfd_is_group_section bfd_generic_is_group_section #define oasys_bfd_discard_group bfd_generic_discard_group #define oasys_section_already_linked _bfd_generic_section_already_linked +#define oasys_bfd_define_common_symbol bfd_generic_define_common_symbol #define oasys_bfd_link_hash_table_create _bfd_generic_link_hash_table_create -#define oasys_bfd_link_hash_table_free _bfd_generic_link_hash_table_free #define oasys_bfd_link_add_symbols _bfd_generic_link_add_symbols #define oasys_bfd_link_just_syms _bfd_generic_link_just_syms +#define oasys_bfd_copy_link_hash_symbol_type \ + _bfd_generic_copy_link_hash_symbol_type #define oasys_bfd_final_link _bfd_generic_final_link #define oasys_bfd_link_split_section _bfd_generic_link_split_section @@ -1201,6 +1209,7 @@ const bfd_target oasys_vec = 0, /* Leading underscore. */ ' ', /* AR_pad_char. */ 16, /* AR_max_namelen. */ + 0, /* match priority. */ bfd_getb64, bfd_getb_signed_64, bfd_putb64, bfd_getb32, bfd_getb_signed_32, bfd_putb32, bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Data. */