+2019-11-22 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * dwarf.c (init_dwarf_regnames_by_bfd_arch_and_mach): New
+ function.
+ * dwarf.h (init_dwarf_regnames_by_bfd_arch_and_mach): Declare.
+ * objdump.c (dump_dwarf): Call new function instead of calling
+ specific initialization routines. Restrucure so that eh_addr_size
+ is still calculated correctly.
+
2019-11-22 Andrew Burgess <andrew.burgess@embecosm.com>
* dwarf.c (init_dwarf_regnames): Renamed to...
}
}
+/* Initialize the DWARF register name lookup state based on the
+ architecture and specific machine type of a BFD. */
+
+void
+init_dwarf_regnames_by_bfd_arch_and_mach (enum bfd_architecture arch,
+ unsigned long mach)
+{
+ switch (arch)
+ {
+ case bfd_arch_i386:
+ switch (mach)
+ {
+ case bfd_mach_x86_64:
+ case bfd_mach_x86_64_intel_syntax:
+ case bfd_mach_x86_64_nacl:
+ case bfd_mach_x64_32:
+ case bfd_mach_x64_32_intel_syntax:
+ case bfd_mach_x64_32_nacl:
+ init_dwarf_regnames_x86_64 ();
+ break;
+
+ default:
+ init_dwarf_regnames_i386 ();
+ break;
+ }
+ break;
+
+ case bfd_arch_iamcu:
+ init_dwarf_regnames_iamcu ();
+ break;
+
+ case bfd_arch_aarch64:
+ init_dwarf_regnames_aarch64();
+ break;
+
+ case bfd_arch_s390:
+ init_dwarf_regnames_s390 ();
+ break;
+
+ case bfd_arch_riscv:
+ init_dwarf_regnames_riscv ();
+ break;
+
+ default:
+ break;
+ }
+}
+
static const char *
regname (unsigned int regno, int row)
{
extern int dwarf_check;
extern void init_dwarf_regnames_by_elf_machine_code (unsigned int);
+extern void init_dwarf_regnames_by_bfd_arch_and_mach (enum bfd_architecture arch,
+ unsigned long mach);
extern void init_dwarf_regnames_i386 (void);
extern void init_dwarf_regnames_iamcu (void);
extern void init_dwarf_regnames_x86_64 (void);
return;
}
- eh_addr_size = bfd_arch_bits_per_address (abfd) / 8;
-
switch (bfd_get_arch (abfd))
{
- case bfd_arch_i386:
- switch (bfd_get_mach (abfd))
- {
- case bfd_mach_x86_64:
- case bfd_mach_x86_64_intel_syntax:
- case bfd_mach_x86_64_nacl:
- case bfd_mach_x64_32:
- case bfd_mach_x64_32_intel_syntax:
- case bfd_mach_x64_32_nacl:
- init_dwarf_regnames_x86_64 ();
- break;
-
- default:
- init_dwarf_regnames_i386 ();
- break;
- }
- break;
-
- case bfd_arch_iamcu:
- init_dwarf_regnames_iamcu ();
- break;
-
- case bfd_arch_aarch64:
- init_dwarf_regnames_aarch64();
- break;
-
- case bfd_arch_s390:
- init_dwarf_regnames_s390 ();
- break;
-
- case bfd_arch_riscv:
- init_dwarf_regnames_riscv ();
- break;
-
case bfd_arch_s12z:
/* S12Z has a 24 bit address space. But the only known
producer of dwarf_info encodes addresses into 32 bits. */
break;
default:
+ eh_addr_size = bfd_arch_bits_per_address (abfd) / 8;
break;
}
+ init_dwarf_regnames_by_bfd_arch_and_mach (bfd_get_arch (abfd),
+ bfd_get_mach (abfd));
+
bfd_map_over_sections (abfd, dump_dwarf_section, NULL);
}
\f