/* Disassembler code for Renesas RL78.
- Copyright (C) 2011-2017 Free Software Foundation, Inc.
+ Copyright (C) 2011-2023 Free Software Foundation, Inc.
Contributed by Red Hat.
Written by DJ Delorie.
#include "bfd.h"
#include "elf-bfd.h"
-#include "dis-asm.h"
+#include "disassemble.h"
#include "opcode/rl78.h"
#include "elf/rl78.h"
#endif
struct private priv;
- dis->private_data = (PTR) &priv;
+ dis->private_data = &priv;
rl78_data.pc = addr;
rl78_data.dis = dis;
disassembler_ftype
rl78_get_disassembler (bfd *abfd)
{
- int cpu = abfd->tdata.elf_obj_data->elf_header->e_flags & E_FLAG_RL78_CPU_MASK;
+ int cpu = E_FLAG_RL78_ANY_CPU;
+
+ 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)
{
case E_FLAG_RL78_G10: