backend data.
* elf-m10200.c (ELF_MACHINE_CODE): Redefine to EM_MN10200.
(ELF_MACHINE_ALT1): Define to EM_CYGNUS_MN10200.
* elf-m10300.c (ELF_MACHINE_CODE): Redefine to EM_MN10300.
(ELF_MACHINE_ALT1): Define to EM_CYGNUS_MN10300.
* elf-arc.c (arc_elf_final_write_processing): Don't override
e_machine, it's now properly set in prep_headers.
* elf32-avr.c (elf32_avr_object_p): Accept both EM_AVR and
EM_AVR_OLD.
(ELF_MACHINE_ALT1): Define to EM_AVR_OLD.
* elf-d10v.c (ELF_MACHINE_CODE): Redefine to EM_D10V.
(ELF_MACHINE_ALT1): Define to EM_CYGNUS_D10V.
* elf-d30v.c (ELF_MACHINE_CODE): Redefine to EM_D30V.
(ELF_MACHINE_ALT1): Define to EM_CYGNUS_D30V.
* elf-fr30.c (ELF_MACHINE_CODE): Redefine to EM_FR30.
(ELF_MACHINE_ALT1): Define to EM_CYGNUS_FR30.
* elf-m32r.c (ELF_MACHINE_CODE): Redefine to EM_M32R.
(ELF_MACHINE_ALT1): Define to EM_CYGNUS_M32R.
* elf32-pj.c (ELF_MACHINE_ALT1): DEfine to EM_PJ_OLD.
* elf-v850.c (ELF_MACHINE_CODE): Redefine to EM_V850.
(ELF_MACHINE_ALT1): Define to EM_CYGNUS_V850.
+2001-09-12 Alexandre Oliva <aoliva@redhat.com>
+
+ * elf.c (prep_headers): Get the machine code from the elf
+ backend data.
+ * elf-m10200.c (ELF_MACHINE_CODE): Redefine to EM_MN10200.
+ (ELF_MACHINE_ALT1): Define to EM_CYGNUS_MN10200.
+ * elf-m10300.c (ELF_MACHINE_CODE): Redefine to EM_MN10300.
+ (ELF_MACHINE_ALT1): Define to EM_CYGNUS_MN10300.
+ * elf-arc.c (arc_elf_final_write_processing): Don't override
+ e_machine, it's now properly set in prep_headers.
+ * elf32-avr.c (elf32_avr_object_p): Accept both EM_AVR and
+ EM_AVR_OLD.
+ (ELF_MACHINE_ALT1): Define to EM_AVR_OLD.
+ * elf-d10v.c (ELF_MACHINE_CODE): Redefine to EM_D10V.
+ (ELF_MACHINE_ALT1): Define to EM_CYGNUS_D10V.
+ * elf-d30v.c (ELF_MACHINE_CODE): Redefine to EM_D30V.
+ (ELF_MACHINE_ALT1): Define to EM_CYGNUS_D30V.
+ * elf-fr30.c (ELF_MACHINE_CODE): Redefine to EM_FR30.
+ (ELF_MACHINE_ALT1): Define to EM_CYGNUS_FR30.
+ * elf-m32r.c (ELF_MACHINE_CODE): Redefine to EM_M32R.
+ (ELF_MACHINE_ALT1): Define to EM_CYGNUS_M32R.
+ * elf32-pj.c (ELF_MACHINE_ALT1): DEfine to EM_PJ_OLD.
+ * elf-v850.c (ELF_MACHINE_CODE): Redefine to EM_V850.
+ (ELF_MACHINE_ALT1): Define to EM_CYGNUS_V850.
+
2001-09-11 Richard Henderson <rth@redhat.com>
* elf64-alpha.c (elf64_alpha_section_flags): New.
#define TARGET_LITTLE_SYM bfd_elf32_mn10200_vec
#define TARGET_LITTLE_NAME "elf32-mn10200"
#define ELF_ARCH bfd_arch_mn10200
-#define ELF_MACHINE_CODE EM_CYGNUS_MN10200
+#define ELF_MACHINE_CODE EM_MN10200
+#define ELF_MACHINE_ALT1 EM_CYGNUS_MN10200
#define ELF_MAXPAGESIZE 0x1000
#define elf_info_to_howto mn10200_info_to_howto
case bfd_arch_unknown:
i_ehdrp->e_machine = EM_NONE;
break;
- case bfd_arch_sparc:
- if (bfd_get_arch_size (abfd) == 64)
- i_ehdrp->e_machine = EM_SPARCV9;
- else
- i_ehdrp->e_machine = EM_SPARC;
- break;
- case bfd_arch_i370:
- i_ehdrp->e_machine = EM_S370;
- break;
- case bfd_arch_i386:
- if (bfd_get_arch_size (abfd) == 64)
- i_ehdrp->e_machine = EM_X86_64;
- else
- i_ehdrp->e_machine = EM_386;
- break;
- case bfd_arch_ia64:
- i_ehdrp->e_machine = EM_IA_64;
- break;
- case bfd_arch_m68hc11:
- i_ehdrp->e_machine = EM_68HC11;
- break;
- case bfd_arch_m68hc12:
- i_ehdrp->e_machine = EM_68HC12;
- break;
- case bfd_arch_s390:
- i_ehdrp->e_machine = EM_S390;
- break;
- case bfd_arch_m68k:
- i_ehdrp->e_machine = EM_68K;
- break;
- case bfd_arch_m88k:
- i_ehdrp->e_machine = EM_88K;
- break;
- case bfd_arch_i860:
- i_ehdrp->e_machine = EM_860;
- break;
- case bfd_arch_i960:
- i_ehdrp->e_machine = EM_960;
- break;
- case bfd_arch_mips: /* MIPS Rxxxx */
- i_ehdrp->e_machine = EM_MIPS; /* only MIPS R3000 */
- break;
- case bfd_arch_hppa:
- i_ehdrp->e_machine = EM_PARISC;
- break;
- case bfd_arch_powerpc:
- if (bed->s->arch_size == 64)
- i_ehdrp->e_machine = EM_PPC64;
- else
- i_ehdrp->e_machine = EM_PPC;
- break;
- case bfd_arch_alpha:
- i_ehdrp->e_machine = EM_ALPHA;
- break;
- case bfd_arch_sh:
- i_ehdrp->e_machine = EM_SH;
- break;
- case bfd_arch_d10v:
- i_ehdrp->e_machine = EM_CYGNUS_D10V;
- break;
- case bfd_arch_d30v:
- i_ehdrp->e_machine = EM_CYGNUS_D30V;
- break;
- case bfd_arch_fr30:
- i_ehdrp->e_machine = EM_CYGNUS_FR30;
- break;
- case bfd_arch_mcore:
- i_ehdrp->e_machine = EM_MCORE;
- break;
- case bfd_arch_avr:
- i_ehdrp->e_machine = EM_AVR;
- break;
- case bfd_arch_v850:
- switch (bfd_get_mach (abfd))
- {
- default:
- case 0: i_ehdrp->e_machine = EM_CYGNUS_V850; break;
- }
- break;
- case bfd_arch_arc:
- i_ehdrp->e_machine = EM_CYGNUS_ARC;
- break;
- case bfd_arch_arm:
- i_ehdrp->e_machine = EM_ARM;
- break;
- case bfd_arch_m32r:
- i_ehdrp->e_machine = EM_CYGNUS_M32R;
- break;
- case bfd_arch_mn10200:
- i_ehdrp->e_machine = EM_CYGNUS_MN10200;
- break;
- case bfd_arch_mn10300:
- i_ehdrp->e_machine = EM_CYGNUS_MN10300;
- break;
- case bfd_arch_pj:
- i_ehdrp->e_machine = EM_PJ;
- break;
- case bfd_arch_cris:
- i_ehdrp->e_machine = EM_CRIS;
- break;
- case bfd_arch_openrisc:
- i_ehdrp->e_machine = EM_OPENRISC;
- break;
- /* Also note that EM_M32, AT&T WE32100 is unknown to bfd. */
- case bfd_arch_h8300:
- i_ehdrp->e_machine = EM_H8_300;
- break;
- case bfd_arch_h8500:
- i_ehdrp->e_machine = EM_H8_500;
- break;
+
+ /* There used to be a long list of cases here, each one setting
+ e_machine to the same EM_* macro #defined as ELF_MACHINE_CODE
+ in the corresponding bfd definition. To avoid duplication,
+ the switch was removed. Machines that need special handling
+ can generally do it in elf_backend_final_write_processing(),
+ unless they need the information earlier than the final write.
+ Such need can generally be supplied by replacing the tests for
+ e_machine with the conditions used to determine it. */
default:
- i_ehdrp->e_machine = EM_NONE;
- }
+ if (get_elf_backend_data (abfd) != NULL)
+ i_ehdrp->e_machine = get_elf_backend_data (abfd)->elf_machine_code;
+ else
+ i_ehdrp->e_machine = EM_NONE;
+ }
+
i_ehdrp->e_version = bed->s->ev_current;
i_ehdrp->e_ehsize = bed->s->sizeof_ehdr;
val = E_ARC_MACH_ARC8;
break;
}
- elf_elfheader (abfd)->e_machine = EM_ARC;
elf_elfheader (abfd)->e_flags &=~ EF_ARC_MACH;
elf_elfheader (abfd)->e_flags |= val;
}
bfd *abfd;
{
int e_set = bfd_mach_avr2;
- if (elf_elfheader (abfd)->e_machine == EM_AVR)
+ if (elf_elfheader (abfd)->e_machine == EM_AVR
+ || elf_elfheader (abfd)->e_machine == EM_AVR_OLD)
{
int e_mach = elf_elfheader (abfd)->e_flags & EF_AVR_MACH;
switch (e_mach)
#define ELF_ARCH bfd_arch_avr
#define ELF_MACHINE_CODE EM_AVR
+#define ELF_MACHINE_ALT1 EM_AVR_OLD
#define ELF_MAXPAGESIZE 1
#define TARGET_LITTLE_SYM bfd_elf32_avr_vec
return true;
}
#define ELF_ARCH bfd_arch_d10v
-#define ELF_MACHINE_CODE EM_CYGNUS_D10V
+#define ELF_MACHINE_CODE EM_D10V
+#define ELF_MACHINE_ALT1 EM_CYGNUS_D10V
#define ELF_MAXPAGESIZE 0x1000
#define TARGET_BIG_SYM bfd_elf32_d10v_vec
}
#define ELF_ARCH bfd_arch_d30v
-#define ELF_MACHINE_CODE EM_CYGNUS_D30V
+#define ELF_MACHINE_CODE EM_D30V
+#define ELF_MACHINE_ALT1 EM_CYGNUS_D30V
#define ELF_MAXPAGESIZE 0x1000
#define TARGET_BIG_SYM bfd_elf32_d30v_vec
}
\f
#define ELF_ARCH bfd_arch_fr30
-#define ELF_MACHINE_CODE EM_CYGNUS_FR30
+#define ELF_MACHINE_CODE EM_FR30
+#define ELF_MACHINE_ALT1 EM_CYGNUS_FR30
#define ELF_MAXPAGESIZE 0x1000
#define TARGET_BIG_SYM bfd_elf32_fr30_vec
}
\f
#define ELF_ARCH bfd_arch_m32r
-#define ELF_MACHINE_CODE EM_CYGNUS_M32R
+#define ELF_MACHINE_CODE EM_M32R
+#define ELF_MACHINE_ALT1 EM_CYGNUS_M32R
#define ELF_MAXPAGESIZE 0x1 /* Explicitly requested by Mitsubishi. */
#define TARGET_BIG_SYM bfd_elf32_m32r_vec
#define TARGET_LITTLE_NAME "elf32-pjl"
#define ELF_ARCH bfd_arch_pj
#define ELF_MACHINE_CODE EM_PJ
+#define ELF_MACHINE_ALT1 EM_PJ_OLD
#define ELF_MAXPAGESIZE 0x1000
#define bfd_elf32_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents
#define bfd_elf32_bfd_reloc_type_lookup pj_elf_reloc_type_lookup
#define TARGET_LITTLE_SYM bfd_elf32_v850_vec
#define TARGET_LITTLE_NAME "elf32-v850"
#define ELF_ARCH bfd_arch_v850
-#define ELF_MACHINE_CODE EM_CYGNUS_V850
+#define ELF_MACHINE_CODE EM_V850
+#define ELF_MACHINE_ALT1 EM_CYGNUS_V850
#define ELF_MAXPAGESIZE 0x1000
#define elf_info_to_howto v850_elf_info_to_howto_rela