aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-m68k.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2009-09-28 09:34:20 +0000
committerNick Clifton <nickc@redhat.com>2009-09-28 09:34:20 +0000
commitfc9f1df98e169c50b9cc1b7b016a3fb712c3af1f (patch)
tree33b752cd966e453d79e48c323bd3108dfbea193f /bfd/elf32-m68k.c
parent2d88202ad431b7c4c15b89fe5fe6c12355f97842 (diff)
downloadgdb-fc9f1df98e169c50b9cc1b7b016a3fb712c3af1f.zip
gdb-fc9f1df98e169c50b9cc1b7b016a3fb712c3af1f.tar.gz
gdb-fc9f1df98e169c50b9cc1b7b016a3fb712c3af1f.tar.bz2
* elf32-m68k.c (elf_m68k_final_write_processing): New function.
(elf_backend_final_write_processing): Macro defined as above function.
Diffstat (limited to 'bfd/elf32-m68k.c')
-rw-r--r--bfd/elf32-m68k.c62
1 files changed, 62 insertions, 0 deletions
diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c
index 1237935..17a5e0b 100644
--- a/bfd/elf32-m68k.c
+++ b/bfd/elf32-m68k.c
@@ -1080,7 +1080,68 @@ elf32_m68k_object_p (bfd *abfd)
return TRUE;
}
+/* Somewhat reverse of elf32_m68k_object_p, this sets the e_flag
+ field based on the machine number. */
+
+static void
+elf_m68k_final_write_processing (bfd *abfd,
+ bfd_boolean linker ATTRIBUTE_UNUSED)
+{
+ int mach = bfd_get_mach (abfd);
+ unsigned long e_flags = elf_elfheader (abfd)->e_flags;
+
+ if (!e_flags)
+ {
+ unsigned int arch_mask;
+
+ arch_mask = bfd_m68k_mach_to_features (mach);
+
+ if (arch_mask & m68000)
+ e_flags = EF_M68K_M68000;
+ else if (arch_mask & cpu32)
+ e_flags = EF_M68K_CPU32;
+ else if (arch_mask & fido_a)
+ e_flags = EF_M68K_FIDO;
+ else
+ {
+ switch (arch_mask
+ & (mcfisa_a | mcfisa_aa | mcfisa_b | mcfisa_c | mcfhwdiv | mcfusp))
+ {
+ case mcfisa_a:
+ e_flags |= EF_M68K_CF_ISA_A_NODIV;
+ break;
+ case mcfisa_a | mcfhwdiv:
+ e_flags |= EF_M68K_CF_ISA_A;
+ break;
+ case mcfisa_a | mcfisa_aa | mcfhwdiv | mcfusp:
+ e_flags |= EF_M68K_CF_ISA_A_PLUS;
+ break;
+ case mcfisa_a | mcfisa_b | mcfhwdiv:
+ e_flags |= EF_M68K_CF_ISA_B_NOUSP;
+ break;
+ case mcfisa_a | mcfisa_b | mcfhwdiv | mcfusp:
+ e_flags |= EF_M68K_CF_ISA_B;
+ break;
+ case mcfisa_a | mcfisa_c | mcfhwdiv | mcfusp:
+ e_flags |= EF_M68K_CF_ISA_C;
+ break;
+ case mcfisa_a | mcfisa_c | mcfusp:
+ e_flags |= EF_M68K_CF_ISA_C_NODIV;
+ break;
+ }
+ if (arch_mask & mcfmac)
+ e_flags |= EF_M68K_CF_MAC;
+ else if (arch_mask & mcfemac)
+ e_flags |= EF_M68K_CF_EMAC;
+ if (arch_mask & cfloat)
+ e_flags |= EF_M68K_CF_FLOAT | EF_M68K_CFV4E;
+ }
+ elf_elfheader (abfd)->e_flags = e_flags;
+ }
+}
+
/* Keep m68k-specific flags in the ELF header. */
+
static bfd_boolean
elf32_m68k_set_private_flags (abfd, flags)
bfd *abfd;
@@ -4764,6 +4825,7 @@ elf_m68k_plt_sym_val (bfd_vma i, const asection *plt,
elf_m68k_adjust_dynamic_symbol
#define elf_backend_size_dynamic_sections \
elf_m68k_size_dynamic_sections
+#define elf_backend_final_write_processing elf_m68k_final_write_processing
#define elf_backend_init_index_section _bfd_elf_init_1_index_section
#define elf_backend_relocate_section elf_m68k_relocate_section
#define elf_backend_finish_dynamic_symbol \