diff options
author | Nick Clifton <nickc@redhat.com> | 2010-02-04 09:16:43 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2010-02-04 09:16:43 +0000 |
commit | 4dfe6ac6feb4515960e05c7c4a428b54318c75a3 (patch) | |
tree | a7abb34e98ddf06506e83475dde75472851f83c0 /bfd/elf32-m68hc1x.c | |
parent | 11334b8260ff935cb9a6e98de0096048a662e48a (diff) | |
download | gdb-4dfe6ac6feb4515960e05c7c4a428b54318c75a3.zip gdb-4dfe6ac6feb4515960e05c7c4a428b54318c75a3.tar.gz gdb-4dfe6ac6feb4515960e05c7c4a428b54318c75a3.tar.bz2 |
* elf-bfd.h (emum elf_object_id): Rename to elf_target_id. Add
entries for other architectures.
(struct elf_link_hash_table): Add hash_table_id field.
(elf_hash_table_id): New accessor macro.
* elflink.c (_bfd_elf_link_hash_table_init): Add target_id
parameter.
* elf-m10300.c (elf32_mn10300_hash_table): Check table id before
returning cast pointer.
(elf32_mn10300_link_hash_table_create): Identify new table as
containing MN10300 extensions.
(mn10300_elf_relax_section): Check pointer returned by
elf32_mn10300_hash_table.
* elf32-arm.c: Likewise, except using ARM extensions.
* elf32-avr.c: Likewise, except using AVR extensions.
* elf32-bfin.c: Likewise, except using BFIN extensions.
* elf32-cris.c: Likewise, except using CRIS extensions.
* elf32-frv.c: Likewise, except using FRV extensions.
* elf32-hppa.c: Likewise, except using HPPA32 extensions.
* elf32-i386.c: Likewise, except using I386 extensions.
* elf32-lm32.c: Likewise, except using LM32 extensions.
* elf32-m32r.c: Likewise, except using M32RM extensions.
* elf32-m68hc11.c: Likewise, except using M68HC11 extensions.
* elf32-m68hc1x.c: Likewise, except using M68HC11 extensions.
* elf32-m68hc1x.h: Likewise, except using M68HC11 extensions.
* elf32-m68k.c: Likewise, except using M68K extensions.
* elf32-microblaze.c: Likewise, except using MICROBLAZE extensions.
* elf32-ppc.c: Likewise, except using PPC32 extensions.
* elf32-s390.c: Likewise, except using S390 extensions.
* elf32-sh.c: Likewise, except using SH extensions.
* elf32-spu.c: Likewise, except using SPU extensions.
* elf32-xtensa.c: Likewise, except using XTENSA extensions.
* elf64-alpha.c: Likewise, except using ALPHA extensions.
* elf64-hppa.c: Likewise, except using HPPA64 extensions.
* elf64-ppc.c: Likewise, except using PPC64 extensions.
* elf64-s390.c: Likewise, except using S390 extensions.
* elf64-x86-64.c: Likewise, except using X86_64 extensions.
* elfxx-ia64.c: Likewise, except using IA64 extensions.
* elfxx-mips.c: Likewise, except using MIPS extensions.
* elfxx-sparc.c: Likewise, except using SPARC extensions.
* elfxx-sparc.h: Likewise, except using SPARC extensions.
* elf32-cr16.c (struct elf32_cr16_link_hash_table): Delete
redundant structure.
(elf32_cr16_hash_table): Delete unused macro.
(elf32_cr16_link_hash_traverse): Delete unused macro.
* elf32-score.c: Likewise.
* elf32-score7.c: Likewise.
* elf32-vax.c: Likewise.
* elf64-sh64.c: Likewise.
* emultempl/alphaelf.em: Update value expected from elf_object_id.
* emultempl/hppaelf.em: Likewise.
* emultempl/mipself.em: Likewise.
* emultempl/ppc32elf.em: Likewise.
* emultempl/ppc64elf.em: Likewise.
Diffstat (limited to 'bfd/elf32-m68hc1x.c')
-rw-r--r-- | bfd/elf32-m68hc1x.c | 48 |
1 files changed, 35 insertions, 13 deletions
diff --git a/bfd/elf32-m68hc1x.c b/bfd/elf32-m68hc1x.c index db63856..9199f69 100644 --- a/bfd/elf32-m68hc1x.c +++ b/bfd/elf32-m68hc1x.c @@ -1,6 +1,6 @@ /* Motorola 68HC11/HC12-specific support for 32-bit ELF Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, - 2009 Free Software Foundation, Inc. + 2009, 2010 Free Software Foundation, Inc. Contributed by Stephane Carrez (stcarrez@nerim.fr) This file is part of BFD, the Binary File Descriptor library. @@ -74,7 +74,8 @@ m68hc11_elf_hash_table_create (bfd *abfd) memset (ret, 0, amt); if (!_bfd_elf_link_hash_table_init (&ret->root, abfd, _bfd_elf_link_hash_newfunc, - sizeof (struct elf_link_hash_entry))) + sizeof (struct elf_link_hash_entry), + M68HC11_ELF_DATA)) { free (ret); return NULL; @@ -232,6 +233,8 @@ elf32_m68hc11_setup_section_lists (bfd *output_bfd, struct bfd_link_info *info) struct m68hc11_elf_link_hash_table *htab; htab = m68hc11_elf_hash_table (info); + if (htab == NULL) + return -1; if (bfd_get_flavour (info->output_bfd) != bfd_target_elf_flavour) return 0; @@ -320,9 +323,11 @@ elf32_m68hc11_size_stubs (bfd *output_bfd, bfd *stub_bfd, unsigned int bfd_indx, bfd_count; bfd_size_type amt; asection *stub_sec; - struct m68hc11_elf_link_hash_table *htab = m68hc11_elf_hash_table (info); + if (htab == NULL) + return FALSE; + /* Stash our params away. */ htab->stub_bfd = stub_bfd; htab->add_stub_section = add_stub_section; @@ -331,9 +336,7 @@ elf32_m68hc11_size_stubs (bfd *output_bfd, bfd *stub_bfd, for (input_bfd = info->input_bfds, bfd_count = 0; input_bfd != NULL; input_bfd = input_bfd->link_next) - { - bfd_count += 1; - } + bfd_count += 1; /* We want to read in symbol extension records only once. To do this we need to read in the local symbols in parallel and save them for @@ -567,6 +570,8 @@ m68hc11_elf_export_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) info = (struct bfd_link_info *) in_arg; htab = m68hc11_elf_hash_table (info); + if (htab == NULL) + return FALSE; /* Massage our args to the form they really have. */ stub_entry = (struct elf32_m68hc11_stub_hash_entry *) gen_entry; @@ -628,6 +633,8 @@ elf32_m68hc11_build_stubs (bfd *abfd, struct bfd_link_info *info) m68hc11_elf_get_bank_parameters (info); htab = m68hc11_elf_hash_table (info); + if (htab == NULL) + return FALSE; for (stub_sec = htab->stub_bfd->sections; stub_sec != NULL; @@ -677,8 +684,13 @@ m68hc11_elf_get_bank_parameters (struct bfd_link_info *info) unsigned i; struct m68hc11_page_info *pinfo; struct bfd_link_hash_entry *h; + struct m68hc11_elf_link_hash_table *htab; + + htab = m68hc11_elf_hash_table (info); + if (htab == NULL) + return; - pinfo = &m68hc11_elf_hash_table (info)->pinfo; + pinfo = & htab->pinfo; if (pinfo->bank_param_initialized) return; @@ -891,16 +903,22 @@ elf32_m68hc11_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, const char *name = NULL; struct m68hc11_page_info *pinfo; const struct elf_backend_data * const ebd = get_elf_backend_data (input_bfd); + struct m68hc11_elf_link_hash_table *htab; symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; sym_hashes = elf_sym_hashes (input_bfd); + htab = m68hc11_elf_hash_table (info); + if (htab == NULL) + return FALSE; + /* Get memory bank parameters. */ m68hc11_elf_get_bank_parameters (info); - pinfo = &m68hc11_elf_hash_table (info)->pinfo; + pinfo = & htab->pinfo; rel = relocs; relend = relocs + input_section->reloc_count; + for (; rel < relend; rel++) { int r_type; @@ -993,9 +1011,7 @@ elf32_m68hc11_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, if (is_far && ELF32_R_TYPE (rel->r_info) == R_M68HC11_16) { struct elf32_m68hc11_stub_hash_entry* stub; - struct m68hc11_elf_link_hash_table *htab; - htab = m68hc11_elf_hash_table (info); stub = m68hc12_stub_hash_lookup (htab->stub_hash_table, name, FALSE, FALSE); if (stub) @@ -1320,15 +1336,22 @@ void elf32_m68hc11_post_process_headers (bfd *abfd, struct bfd_link_info *link_info) { struct m68hc11_scan_param param; + struct m68hc11_elf_link_hash_table *htab; + + if (link_info == NULL) + return; - if (link_info == 0) + htab = m68hc11_elf_hash_table (link_info); + if (htab == NULL) return; m68hc11_elf_get_bank_parameters (link_info); param.use_memory_banks = FALSE; - param.pinfo = &m68hc11_elf_hash_table (link_info)->pinfo; + param.pinfo = & htab->pinfo; + bfd_map_over_sections (abfd, scan_sections_for_abi, ¶m); + if (param.use_memory_banks) { Elf_Internal_Ehdr * i_ehdrp; @@ -1337,4 +1360,3 @@ elf32_m68hc11_post_process_headers (bfd *abfd, struct bfd_link_info *link_info) i_ehdrp->e_flags |= E_M68HC12_BANKS; } } - |