From fc9f1df98e169c50b9cc1b7b016a3fb712c3af1f Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Mon, 28 Sep 2009 09:34:20 +0000 Subject: [PATCH] * elf32-m68k.c (elf_m68k_final_write_processing): New function. (elf_backend_final_write_processing): Macro defined as above function. --- bfd/ChangeLog | 5 ++++ bfd/elf32-m68k.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 34cb253e671..860297be5d7 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2009-09-28 Philippe De Muyter + + * elf32-m68k.c (elf_m68k_final_write_processing): New function. + (elf_backend_final_write_processing): Macro defined as above function. + 2009-09-25 Martin Thuresson Update soruces to make alpha and arm targets compile cleanly with diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c index 12379351c4d..17a5e0b5276 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 \ -- 2.30.2