if (info->section && info->section->owner)
{
bfd *abfd = info->section->owner;
- mep_config_index = abfd->tdata.elf_obj_data->elf_header->e_flags & EF_MEP_INDEX_MASK;
- /* This instantly redefines MEP_CONFIG, MEP_OMASK, .... MEP_VLIW64 */
+ if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
+ {
+ mep_config_index = abfd->tdata.elf_obj_data->elf_header->e_flags & EF_MEP_INDEX_MASK;
+ /* This instantly redefines MEP_CONFIG, MEP_OMASK, .... MEP_VLIW64 */
- cop_type = abfd->tdata.elf_obj_data->elf_header->e_flags & EF_MEP_COP_MASK;
- if (cop_type == EF_MEP_COP_IVC2)
- ivc2 = 1;
+ cop_type = abfd->tdata.elf_obj_data->elf_header->e_flags & EF_MEP_COP_MASK;
+ if (cop_type == EF_MEP_COP_IVC2)
+ ivc2 = 1;
+ }
}
/* Picking the right ISA bitmask for the current context is tricky. */
{
obj_attribute *attr;
const char *sec_name = NULL;
- if (!abfd)
+ if (!abfd || bfd_get_flavour (abfd) != bfd_target_elf_flavour)
dis_info.isa = CSKY_DEFAULT_ISA;
else
{
if (info->section && info->section->owner)
{
bfd *abfd = info->section->owner;
- mep_config_index = abfd->tdata.elf_obj_data->elf_header->e_flags & EF_MEP_INDEX_MASK;
- /* This instantly redefines MEP_CONFIG, MEP_OMASK, .... MEP_VLIW64 */
+ if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
+ {
+ mep_config_index = abfd->tdata.elf_obj_data->elf_header->e_flags & EF_MEP_INDEX_MASK;
+ /* This instantly redefines MEP_CONFIG, MEP_OMASK, .... MEP_VLIW64 */
- cop_type = abfd->tdata.elf_obj_data->elf_header->e_flags & EF_MEP_COP_MASK;
- if (cop_type == EF_MEP_COP_IVC2)
- ivc2 = 1;
+ cop_type = abfd->tdata.elf_obj_data->elf_header->e_flags & EF_MEP_COP_MASK;
+ if (cop_type == EF_MEP_COP_IVC2)
+ ivc2 = 1;
+ }
}
/* Picking the right ISA bitmask for the current context is tricky. */
{
const char *default_arch = "rv64gc";
- if (abfd)
+ if (abfd && bfd_get_flavour (abfd) == bfd_target_elf_flavour)
{
- const struct elf_backend_data *ebd = get_elf_backend_data (abfd);
- if (ebd)
+ const char *sec_name = get_elf_backend_data (abfd)->obj_attrs_section;
+ if (bfd_get_section_by_name (abfd, sec_name) != NULL)
{
- const char *sec_name = ebd->obj_attrs_section;
- if (bfd_get_section_by_name (abfd, sec_name) != NULL)
- {
- obj_attribute *attr = elf_known_obj_attributes_proc (abfd);
- unsigned int Tag_a = Tag_RISCV_priv_spec;
- unsigned int Tag_b = Tag_RISCV_priv_spec_minor;
- unsigned int Tag_c = Tag_RISCV_priv_spec_revision;
- riscv_get_priv_spec_class_from_numbers (attr[Tag_a].i,
- attr[Tag_b].i,
- attr[Tag_c].i,
- &default_priv_spec);
- default_arch = attr[Tag_RISCV_arch].s;
- }
+ obj_attribute *attr = elf_known_obj_attributes_proc (abfd);
+ unsigned int Tag_a = Tag_RISCV_priv_spec;
+ unsigned int Tag_b = Tag_RISCV_priv_spec_minor;
+ unsigned int Tag_c = Tag_RISCV_priv_spec_revision;
+ riscv_get_priv_spec_class_from_numbers (attr[Tag_a].i,
+ attr[Tag_b].i,
+ attr[Tag_c].i,
+ &default_priv_spec);
+ default_arch = attr[Tag_RISCV_arch].s;
}
}
{
int cpu = E_FLAG_RL78_ANY_CPU;
- if (abfd != NULL)
+ if (abfd != NULL && bfd_get_flavour (abfd) == bfd_target_elf_flavour)
cpu = abfd->tdata.elf_obj_data->elf_header->e_flags & E_FLAG_RL78_CPU_MASK;
switch (cpu)