mirror of
https://github.com/darlinghq/darling-gdb.git
synced 2024-12-23 12:39:41 +00:00
d003868ea7
* bfd.c (_bfd_default_error_handler): Handle %A and %B. (bfd_archive_filename, bfd_get_section_ident): Delete. * ecofflink.c (bfd_ecoff_debug_accumulate_other): Don't call bfd_archive_filename. * elflink.c (elf_link_input_bfd): Don't use callbacks->error_handler to warn about symbols in discarded sections. Use _bfd_error_handler. * aout-adobe.c (aout_adobe_callback): See below. * aout-cris.c (swap_ext_reloc_in): .. * coff-arm.c (find_thumb_glue, find_arm_glue, coff_arm_relocate_section, bfd_arm_process_before_allocation, coff_arm_merge_private_bfd_data, _bfd_coff_arm_set_private_flags, coff_arm_copy_private_bfd_data): .. * coff-i860.c (i860_reloc_processing): .. * coff-mcore.c (mcore_coff_unsupported_reloc, coff_mcore_relocate_section): .. * coff-ppc.c (coff_ppc_relocate_section): .. * coff-rs6000.c (xcoff_create_csect_from_smclas * coff-sh.c (sh_relax_section, sh_relax_delete_bytes, sh_swap_insns, sh_relocate_section): .. * coff-tic54x.c (tic54x_reloc_processing): .. * coff-tic80.c (coff_tic80_relocate_section): .. * coff64-rs6000.c (xcoff64_create_csect_from_smclas): .. * coffcode.h (styp_to_sec_flags, coff_slurp_line_table, coff_slurp_symbol_table, coff_classify_symbol, coff_slurp_reloc_table): .. * coffgen.c (_bfd_coff_read_string_table): .. * cofflink.c (coff_link_add_symbols, _bfd_coff_link_input_bfd, _bfd_coff_generic_relocate_section): .. * cpu-arm.c (bfd_arm_merge_machines): .. * cpu-sh.c (sh_merge_bfd_arch): .. * elf-hppa.h (elf_hppa_relocate_section): .. * elf.c (bfd_elf_string_from_elf_section, setup_group, _bfd_elf_setup_group_pointers, bfd_section_from_shdr, assign_section_numbers, _bfd_elf_symbol_from_bfd_symbol, copy_private_bfd_data, _bfd_elf_validate_reloc): .. * elf32-arm.h (find_thumb_glue, find_arm_glue, bfd_elf32_arm_process_before_allocation, elf32_thumb_to_arm_stub, elf32_arm_to_thumb_stub, elf32_arm_final_link_relocate, elf32_arm_relocate_section, elf32_arm_set_private_flags, elf32_arm_copy_private_bfd_data, elf32_arm_merge_private_bfd_data): .. * elf32-cris.c (cris_elf_relocate_section, cris_elf_check_relocs, cris_elf_merge_private_bfd_data * elf32-frv.c (elf32_frv_relocate_section, elf32_frv_check_relocs): .. * elf32-gen.c (elf32_generic_link_add_symbols): .. * elf32-hppa.c (hppa_add_stub, hppa_build_one_stub, elf32_hppa_check_relocs, get_local_syms, final_link_relocate, elf32_hppa_relocate_section): .. * elf32-i370.c (i370_elf_merge_private_bfd_data, i370_elf_check_relocs, i370_elf_relocate_section): .. * elf32-i386.c (elf_i386_info_to_howto_rel, elf_i386_check_relocs, elf_i386_relocate_section): .. * elf32-m32r.c (m32r_elf_relocate_section, m32r_elf_merge_private_bfd_data): .. * elf32-m68hc1x.c (m68hc12_add_stub, _bfd_m68hc11_elf_merge_private_bfd_data): .. * elf32-m68k.c (elf_m68k_relocate_section): .. * elf32-mcore.c (mcore_elf_unsupported_reloc, mcore_elf_relocate_section): .. * elf32-ppc.c (ppc_elf_merge_private_bfd_data, bad_shared_reloc, ppc_elf_check_relocs, ppc_elf_relocate_section, ppc_elf_begin_write_processing): .. * elf32-s390.c (elf_s390_check_relocs, invalid_tls_insn, elf_s390_relocate_section): .. * elf32-sh-symbian.c (sh_symbian_import_as, sh_symbian_process_embedded_commands, sh_symbian_relocate_section): .. * elf32-sh.c (sh_elf_relax_section, sh_elf_relax_delete_bytes, sh_elf_swap_insns, sh_elf_relocate_section, sh_elf_check_relocs, sh_elf_merge_private_data): .. * elf32-sparc.c (elf32_sparc_check_relocs, elf32_sparc_relocate_section, elf32_sparc_merge_private_bfd_data): .. * elf32-v850.c (v850_elf_check_relocs, v850_elf_merge_private_bfd_data): .. * elf32-xtensa.c (elf_xtensa_check_relocs, elf_xtensa_relocate_section, elf_xtensa_merge_private_bfd_data): .. * elf64-alpha.c (elf64_alpha_relax_with_lituse, elf64_alpha_relax_got_load, elf64_alpha_size_got_sections, elf64_alpha_relocate_section_r, elf64_alpha_relocate_section): .. * elf64-gen.c (elf64_generic_link_add_symbols): .. * elf64-ppc.c (ppc64_elf_merge_private_bfd_data, ppc_add_stub, ppc64_elf_check_relocs, ppc64_elf_edit_opd, ppc64_elf_relocate_section): .. * elf64-s390.c (elf_s390_check_relocs, invalid_tls_insn, elf_s390_relocate_section): .. * elf64-sh64.c (sh_elf64_relocate_section): .. * elf64-sparc.c (sparc64_elf_check_relocs, sparc64_elf_add_symbol_hook, sparc64_elf_relocate_section, sparc64_elf_merge_private_bfd_data): .. * elf64-x86-64.c (elf64_x86_64_check_relocs, elf64_x86_64_relocate_section): .. * elflink.c (_bfd_elf_add_default_symbol, _bfd_elf_link_assign_sym_version, elf_link_read_relocs_from_section, _bfd_elf_link_output_relocs, elf_link_add_object_symbols, bfd_elf_size_dynamic_sections, elf_link_output_extsym, elf_get_linked_section_vma, elf_fixup_link_order, bfd_elf_final_link, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtinherit, _bfd_elf_section_already_linked): .. * elfxx-ia64.c (elfNN_ia64_relax_section, elfNN_ia64_relocate_section, elfNN_ia64_merge_private_bfd_data): .. * elfxx-mips.c (mips_elf_perform_relocation, _bfd_mips_elf_check_relocs, _bfd_mips_elf_merge_private_bfd_data): .. * ieee.c (ieee_slurp_external_symbols): .. * ihex.c (ihex_bad_byte, ihex_scan, ihex_read_section): .. * libbfd.c (_bfd_generic_verify_endian_match): .. * linker.c (_bfd_generic_link_add_one_symbol, _bfd_generic_section_already_linked): .. * pdp11.c (translate_to_native_sym_flags): .. * pe-mips.c (coff_pe_mips_relocate_section): .. * peicode.h (pe_ILF_build_a_bfd): .. * srec.c (srec_bad_byte): .. * stabs.c (_bfd_link_section_stabs): .. * xcofflink.c (xcoff_link_add_symbols, xcoff_link_input_bfd): .. Replace all uses of bfd_archive_filename and bfd_get_section_ident with corresponding %B and %A in _bfd_error_handler format string. Replace occurrences of "fprintf (stderr," with _bfd_error_handler calls to use %A and %B. Fix "against symbol .. from section" and similar error messages. Combine multiple _bfd_error_handler calls where they were separated due to bfd_archive_filename deficiencies. * bfd-in2.h: Regenerate. include/ * bfdlink.h (struct bfd_link_callbacks): Remove "error_handler". (LD_DEFINITION_IN_DISCARDED_SECTION): Delete. ld/ * ldmain.c (link_callbacks): Remove "error_handler". * ldmisc.c: Include elf-bfd.h. (vfinfo): Sort comment. Handle %A. Use %A instead of bfd_get_section_indent. (error_handler): Delete. * ldmisc.h (error_handler): Delete declaration.
459 lines
13 KiB
C
459 lines
13 KiB
C
/* BFD library support routines for the Renesas / SuperH SH architecture.
|
|
Copyright 1993, 1994, 1997, 1998, 2000, 2001, 2002, 2003, 2004
|
|
Free Software Foundation, Inc.
|
|
Hacked 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
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
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. */
|
|
|
|
#include "bfd.h"
|
|
#include "sysdep.h"
|
|
#include "libbfd.h"
|
|
#include "../opcodes/sh-opc.h"
|
|
|
|
#define SH_NEXT &arch_info_struct[0]
|
|
#define SH2_NEXT &arch_info_struct[1]
|
|
#define SH2E_NEXT &arch_info_struct[2]
|
|
#define SH_DSP_NEXT &arch_info_struct[3]
|
|
#define SH3_NEXT &arch_info_struct[4]
|
|
#define SH3_NOMMU_NEXT &arch_info_struct[5]
|
|
#define SH3_DSP_NEXT &arch_info_struct[6]
|
|
#define SH3E_NEXT &arch_info_struct[7]
|
|
#define SH4_NEXT &arch_info_struct[8]
|
|
#define SH4A_NEXT &arch_info_struct[9]
|
|
#define SH4AL_DSP_NEXT &arch_info_struct[10]
|
|
#define SH4_NOFPU_NEXT &arch_info_struct[11]
|
|
#define SH4_NOMMU_NOFPU_NEXT &arch_info_struct[12]
|
|
#define SH4A_NOFPU_NEXT &arch_info_struct[13]
|
|
#define SH2A_NEXT &arch_info_struct[14]
|
|
#define SH2A_NOFPU_NEXT &arch_info_struct[15]
|
|
#define SH64_NEXT NULL
|
|
|
|
static const bfd_arch_info_type arch_info_struct[] =
|
|
{
|
|
{
|
|
32, /* 32 bits in a word */
|
|
32, /* 32 bits in an address */
|
|
8, /* 8 bits in a byte */
|
|
bfd_arch_sh,
|
|
bfd_mach_sh2,
|
|
"sh", /* arch_name */
|
|
"sh2", /* printable name */
|
|
1,
|
|
FALSE, /* not the default */
|
|
bfd_default_compatible,
|
|
bfd_default_scan,
|
|
SH2_NEXT
|
|
},
|
|
{
|
|
32, /* 32 bits in a word */
|
|
32, /* 32 bits in an address */
|
|
8, /* 8 bits in a byte */
|
|
bfd_arch_sh,
|
|
bfd_mach_sh2e,
|
|
"sh", /* arch_name */
|
|
"sh2e", /* printable name */
|
|
1,
|
|
FALSE, /* not the default */
|
|
bfd_default_compatible,
|
|
bfd_default_scan,
|
|
SH2E_NEXT
|
|
},
|
|
{
|
|
32, /* 32 bits in a word */
|
|
32, /* 32 bits in an address */
|
|
8, /* 8 bits in a byte */
|
|
bfd_arch_sh,
|
|
bfd_mach_sh_dsp,
|
|
"sh", /* arch_name */
|
|
"sh-dsp", /* printable name */
|
|
1,
|
|
FALSE, /* not the default */
|
|
bfd_default_compatible,
|
|
bfd_default_scan,
|
|
SH_DSP_NEXT
|
|
},
|
|
{
|
|
32, /* 32 bits in a word */
|
|
32, /* 32 bits in an address */
|
|
8, /* 8 bits in a byte */
|
|
bfd_arch_sh,
|
|
bfd_mach_sh3,
|
|
"sh", /* arch_name */
|
|
"sh3", /* printable name */
|
|
1,
|
|
FALSE, /* not the default */
|
|
bfd_default_compatible,
|
|
bfd_default_scan,
|
|
SH3_NEXT
|
|
},
|
|
{
|
|
32, /* 32 bits in a word */
|
|
32, /* 32 bits in an address */
|
|
8, /* 8 bits in a byte */
|
|
bfd_arch_sh,
|
|
bfd_mach_sh3_nommu,
|
|
"sh", /* arch_name */
|
|
"sh3-nommu", /* printable name */
|
|
1,
|
|
FALSE, /* not the default */
|
|
bfd_default_compatible,
|
|
bfd_default_scan,
|
|
SH3_NOMMU_NEXT
|
|
},
|
|
{
|
|
32, /* 32 bits in a word */
|
|
32, /* 32 bits in an address */
|
|
8, /* 8 bits in a byte */
|
|
bfd_arch_sh,
|
|
bfd_mach_sh3_dsp,
|
|
"sh", /* arch_name */
|
|
"sh3-dsp", /* printable name */
|
|
1,
|
|
FALSE, /* not the default */
|
|
bfd_default_compatible,
|
|
bfd_default_scan,
|
|
SH3_DSP_NEXT
|
|
},
|
|
{
|
|
32, /* 32 bits in a word */
|
|
32, /* 32 bits in an address */
|
|
8, /* 8 bits in a byte */
|
|
bfd_arch_sh,
|
|
bfd_mach_sh3e,
|
|
"sh", /* arch_name */
|
|
"sh3e", /* printable name */
|
|
1,
|
|
FALSE, /* not the default */
|
|
bfd_default_compatible,
|
|
bfd_default_scan,
|
|
SH3E_NEXT
|
|
},
|
|
{
|
|
32, /* 32 bits in a word */
|
|
32, /* 32 bits in an address */
|
|
8, /* 8 bits in a byte */
|
|
bfd_arch_sh,
|
|
bfd_mach_sh4,
|
|
"sh", /* arch_name */
|
|
"sh4", /* printable name */
|
|
1,
|
|
FALSE, /* not the default */
|
|
bfd_default_compatible,
|
|
bfd_default_scan,
|
|
SH4_NEXT
|
|
},
|
|
{
|
|
32, /* 32 bits in a word */
|
|
32, /* 32 bits in an address */
|
|
8, /* 8 bits in a byte */
|
|
bfd_arch_sh,
|
|
bfd_mach_sh4a,
|
|
"sh", /* arch_name */
|
|
"sh4a", /* printable name */
|
|
1,
|
|
FALSE, /* not the default */
|
|
bfd_default_compatible,
|
|
bfd_default_scan,
|
|
SH4A_NEXT
|
|
},
|
|
{
|
|
32, /* 32 bits in a word */
|
|
32, /* 32 bits in an address */
|
|
8, /* 8 bits in a byte */
|
|
bfd_arch_sh,
|
|
bfd_mach_sh4al_dsp,
|
|
"sh", /* arch_name */
|
|
"sh4al-dsp", /* printable name */
|
|
1,
|
|
FALSE, /* not the default */
|
|
bfd_default_compatible,
|
|
bfd_default_scan,
|
|
SH4AL_DSP_NEXT
|
|
},
|
|
{
|
|
32, /* 32 bits in a word */
|
|
32, /* 32 bits in an address */
|
|
8, /* 8 bits in a byte */
|
|
bfd_arch_sh,
|
|
bfd_mach_sh4_nofpu,
|
|
"sh", /* arch_name */
|
|
"sh4-nofpu", /* printable name */
|
|
1,
|
|
FALSE, /* not the default */
|
|
bfd_default_compatible,
|
|
bfd_default_scan,
|
|
SH4_NOFPU_NEXT
|
|
},
|
|
{
|
|
32, /* 32 bits in a word */
|
|
32, /* 32 bits in an address */
|
|
8, /* 8 bits in a byte */
|
|
bfd_arch_sh,
|
|
bfd_mach_sh4_nommu_nofpu,
|
|
"sh", /* arch_name */
|
|
"sh4-nommu-nofpu", /* printable name */
|
|
1,
|
|
FALSE, /* not the default */
|
|
bfd_default_compatible,
|
|
bfd_default_scan,
|
|
SH4_NOMMU_NOFPU_NEXT
|
|
},
|
|
{
|
|
32, /* 32 bits in a word */
|
|
32, /* 32 bits in an address */
|
|
8, /* 8 bits in a byte */
|
|
bfd_arch_sh,
|
|
bfd_mach_sh4a_nofpu,
|
|
"sh", /* arch_name */
|
|
"sh4a-nofpu", /* printable name */
|
|
1,
|
|
FALSE, /* not the default */
|
|
bfd_default_compatible,
|
|
bfd_default_scan,
|
|
SH4A_NOFPU_NEXT
|
|
},
|
|
{
|
|
32, /* 32 bits in a word. */
|
|
32, /* 32 bits in an address. */
|
|
8, /* 8 bits in a byte. */
|
|
bfd_arch_sh,
|
|
bfd_mach_sh2a,
|
|
"sh", /* Arch_name. */
|
|
"sh2a", /* Printable name. */
|
|
1,
|
|
FALSE, /* Not the default. */
|
|
bfd_default_compatible,
|
|
bfd_default_scan,
|
|
SH2A_NEXT
|
|
},
|
|
{
|
|
32, /* 32 bits in a word. */
|
|
32, /* 32 bits in an address. */
|
|
8, /* 8 bits in a byte. */
|
|
bfd_arch_sh,
|
|
bfd_mach_sh2a_nofpu,
|
|
"sh", /* Arch_name. */
|
|
"sh2a-nofpu", /* Printable name. */
|
|
1,
|
|
FALSE, /* Not the default. */
|
|
bfd_default_compatible,
|
|
bfd_default_scan,
|
|
SH2A_NOFPU_NEXT
|
|
},
|
|
{
|
|
64, /* 64 bits in a word */
|
|
64, /* 64 bits in an address */
|
|
8, /* 8 bits in a byte */
|
|
bfd_arch_sh,
|
|
bfd_mach_sh5,
|
|
"sh", /* arch_name */
|
|
"sh5", /* printable name */
|
|
1,
|
|
FALSE, /* not the default */
|
|
bfd_default_compatible,
|
|
bfd_default_scan,
|
|
SH64_NEXT
|
|
},
|
|
};
|
|
|
|
const bfd_arch_info_type bfd_sh_arch =
|
|
{
|
|
32, /* 32 bits in a word */
|
|
32, /* 32 bits in an address */
|
|
8, /* 8 bits in a byte */
|
|
bfd_arch_sh,
|
|
bfd_mach_sh,
|
|
"sh", /* arch_name */
|
|
"sh", /* printable name */
|
|
1,
|
|
TRUE, /* the default machine */
|
|
bfd_default_compatible,
|
|
bfd_default_scan,
|
|
SH_NEXT
|
|
};
|
|
|
|
|
|
/* This table defines the mappings from the BFD internal numbering
|
|
system to the opcodes internal flags system.
|
|
It is used by the functions defined below.
|
|
The prototypes for these SH specific functions are found in
|
|
sh-opc.h . */
|
|
|
|
static struct { unsigned long bfd_mach, arch, arch_up; } bfd_to_arch_table[] =
|
|
{
|
|
{ bfd_mach_sh, arch_sh1, arch_sh1_up },
|
|
{ bfd_mach_sh2, arch_sh2, arch_sh2_up },
|
|
{ bfd_mach_sh2e, arch_sh2e, arch_sh2e_up },
|
|
{ bfd_mach_sh_dsp, arch_sh_dsp, arch_sh_dsp_up },
|
|
{ bfd_mach_sh2a, arch_sh2a, arch_sh2a_up },
|
|
{ bfd_mach_sh2a_nofpu, arch_sh2a_nofpu, arch_sh2a_nofpu_up },
|
|
{ bfd_mach_sh3, arch_sh3, arch_sh3_up },
|
|
{ bfd_mach_sh3_nommu, arch_sh3_nommu, arch_sh3_nommu_up },
|
|
{ bfd_mach_sh3_dsp, arch_sh3_dsp, arch_sh3_dsp_up },
|
|
{ bfd_mach_sh3e, arch_sh3e, arch_sh3e_up },
|
|
{ bfd_mach_sh4, arch_sh4, arch_sh4_up },
|
|
{ bfd_mach_sh4a, arch_sh4a, arch_sh4a_up },
|
|
{ bfd_mach_sh4al_dsp, arch_sh4al_dsp, arch_sh4al_dsp_up },
|
|
{ bfd_mach_sh4_nofpu, arch_sh4_nofpu, arch_sh4_nofp_up },
|
|
{ bfd_mach_sh4_nommu_nofpu, arch_sh4_nommu_nofpu, arch_sh4_nommu_nofpu_up },
|
|
{ bfd_mach_sh4a_nofpu, arch_sh4a_nofpu, arch_sh4a_nofp_up },
|
|
{ 0, 0, 0 } /* Terminator. */
|
|
};
|
|
|
|
|
|
/* Convert a BFD mach number into the right opcodes arch flags
|
|
using the table above. */
|
|
|
|
unsigned int
|
|
sh_get_arch_from_bfd_mach (unsigned long mach)
|
|
{
|
|
int i = 0;
|
|
|
|
while (bfd_to_arch_table[i].bfd_mach != 0)
|
|
if (bfd_to_arch_table[i].bfd_mach == mach)
|
|
return bfd_to_arch_table[i].arch;
|
|
else
|
|
i++;
|
|
|
|
/* mach not found. */
|
|
BFD_FAIL();
|
|
|
|
return SH_ARCH_UNKNOWN_ARCH;
|
|
}
|
|
|
|
|
|
/* Convert a BFD mach number into a set of opcodes arch flags
|
|
describing all the compatible architectures (i.e. arch_up)
|
|
using the table above. */
|
|
|
|
unsigned int
|
|
sh_get_arch_up_from_bfd_mach (unsigned long mach)
|
|
{
|
|
int i = 0;
|
|
|
|
while (bfd_to_arch_table[i].bfd_mach != 0)
|
|
if (bfd_to_arch_table[i].bfd_mach == mach)
|
|
return bfd_to_arch_table[i].arch_up;
|
|
else
|
|
i++;
|
|
|
|
/* mach not found. */
|
|
BFD_FAIL();
|
|
|
|
return SH_ARCH_UNKNOWN_ARCH;
|
|
}
|
|
|
|
|
|
/* Convert an arbitary arch_set - not necessarily corresponding
|
|
directly to anything in the table above - to the most generic
|
|
architecture which supports all the required features, and
|
|
return the corresponding BFD mach. */
|
|
|
|
unsigned long
|
|
sh_get_bfd_mach_from_arch_set (unsigned int arch_set)
|
|
{
|
|
unsigned long result = 0;
|
|
unsigned int best = ~arch_set;
|
|
unsigned int co_mask = ~0;
|
|
int i = 0;
|
|
|
|
/* If arch_set permits variants with no coprocessor then do not allow
|
|
the other irrelevant co-processor bits to influence the choice:
|
|
e.g. if dsp is disallowed by arch_set, then the algorithm would
|
|
prefer fpu variants over nofpu variants because they also disallow
|
|
dsp - even though the nofpu would be the most correct choice.
|
|
This assumes that EVERY fpu/dsp variant has a no-coprocessor
|
|
counter-part, or their non-fpu/dsp instructions do not have the
|
|
no co-processor bit set. */
|
|
if (arch_set & arch_sh_no_co)
|
|
co_mask = ~(arch_sh_sp_fpu | arch_sh_dp_fpu | arch_sh_has_dsp);
|
|
|
|
while (bfd_to_arch_table[i].bfd_mach != 0)
|
|
{
|
|
unsigned int try = bfd_to_arch_table[i].arch_up & co_mask;
|
|
|
|
/* Conceptually: Find the architecture with the least number
|
|
of extra features or, if they have the same number, then
|
|
the greatest number of required features. Disregard
|
|
architectures where the required features alone do
|
|
not describe a valid architecture. */
|
|
if (((try & ~arch_set) < (best & ~arch_set)
|
|
|| ((try & ~arch_set) == (best & ~arch_set)
|
|
&& (~try & arch_set) < (~best & arch_set)))
|
|
&& SH_MERGE_ARCH_SET_VALID (try, arch_set))
|
|
{
|
|
result = bfd_to_arch_table[i].bfd_mach;
|
|
best = try;
|
|
}
|
|
|
|
i++;
|
|
}
|
|
|
|
/* This might happen if a new variant is added to sh-opc.h
|
|
but no corresponding entry is added to the table above. */
|
|
BFD_ASSERT (result != 0);
|
|
|
|
return result;
|
|
}
|
|
|
|
|
|
/* Merge the architecture type of two BFD files, such that the
|
|
resultant architecture supports all the features required
|
|
by the two input BFDs.
|
|
If the input BFDs are multually incompatible - i.e. one uses
|
|
DSP while the other uses FPU - or there is no known architecture
|
|
that fits the requirements then an error is emitted. */
|
|
|
|
bfd_boolean
|
|
sh_merge_bfd_arch (bfd *ibfd, bfd *obfd)
|
|
{
|
|
unsigned int old_arch, new_arch, merged_arch;
|
|
|
|
if (! _bfd_generic_verify_endian_match (ibfd, obfd))
|
|
return FALSE;
|
|
|
|
old_arch = sh_get_arch_up_from_bfd_mach (bfd_get_mach (obfd));
|
|
new_arch = sh_get_arch_up_from_bfd_mach (bfd_get_mach (ibfd));
|
|
|
|
merged_arch = SH_MERGE_ARCH_SET (old_arch, new_arch);
|
|
|
|
if (!SH_VALID_CO_ARCH_SET (merged_arch))
|
|
{
|
|
(*_bfd_error_handler)
|
|
("%B: uses %s instructions while previous modules use %s instructions",
|
|
ibfd,
|
|
SH_ARCH_SET_HAS_DSP (new_arch) ? "dsp" : "floating point",
|
|
SH_ARCH_SET_HAS_DSP (new_arch) ? "floating point" : "dsp");
|
|
bfd_set_error (bfd_error_bad_value);
|
|
return FALSE;
|
|
}
|
|
else if (!SH_VALID_ARCH_SET (merged_arch))
|
|
{
|
|
(*_bfd_error_handler)
|
|
("internal error: merge of architecture '%s' with architecture '%s' produced unknown architecture\n",
|
|
bfd_printable_name (obfd),
|
|
bfd_printable_name (ibfd));
|
|
bfd_set_error (bfd_error_bad_value);
|
|
return FALSE;
|
|
}
|
|
|
|
bfd_default_set_arch_mach (obfd, bfd_arch_sh,
|
|
sh_get_bfd_mach_from_arch_set (merged_arch));
|
|
|
|
return TRUE;
|
|
}
|