* 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.
This commit is contained in:
Alexandre Oliva 2001-09-12 23:53:31 +00:00
parent c265b1cc5d
commit aa4f99bbfd
11 changed files with 56 additions and 120 deletions

View file

@ -1,3 +1,28 @@
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> 2001-09-11 Richard Henderson <rth@redhat.com>
* elf64-alpha.c (elf64_alpha_section_flags): New. * elf64-alpha.c (elf64_alpha_section_flags): New.

View file

@ -1517,7 +1517,8 @@ mn10200_elf_get_relocated_section_contents (output_bfd, link_info, link_order,
#define TARGET_LITTLE_SYM bfd_elf32_mn10200_vec #define TARGET_LITTLE_SYM bfd_elf32_mn10200_vec
#define TARGET_LITTLE_NAME "elf32-mn10200" #define TARGET_LITTLE_NAME "elf32-mn10200"
#define ELF_ARCH bfd_arch_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_MAXPAGESIZE 0x1000
#define elf_info_to_howto mn10200_info_to_howto #define elf_info_to_howto mn10200_info_to_howto

127
bfd/elf.c
View file

@ -3347,119 +3347,22 @@ prep_headers (abfd)
case bfd_arch_unknown: case bfd_arch_unknown:
i_ehdrp->e_machine = EM_NONE; i_ehdrp->e_machine = EM_NONE;
break; break;
case bfd_arch_sparc:
if (bfd_get_arch_size (abfd) == 64) /* There used to be a long list of cases here, each one setting
i_ehdrp->e_machine = EM_SPARCV9; e_machine to the same EM_* macro #defined as ELF_MACHINE_CODE
else in the corresponding bfd definition. To avoid duplication,
i_ehdrp->e_machine = EM_SPARC; the switch was removed. Machines that need special handling
break; can generally do it in elf_backend_final_write_processing(),
case bfd_arch_i370: unless they need the information earlier than the final write.
i_ehdrp->e_machine = EM_S370; Such need can generally be supplied by replacing the tests for
break; e_machine with the conditions used to determine it. */
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;
default: 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_version = bed->s->ev_current;
i_ehdrp->e_ehsize = bed->s->sizeof_ehdr; i_ehdrp->e_ehsize = bed->s->sizeof_ehdr;

View file

@ -207,7 +207,6 @@ arc_elf_final_write_processing (abfd, linker)
val = E_ARC_MACH_ARC8; val = E_ARC_MACH_ARC8;
break; break;
} }
elf_elfheader (abfd)->e_machine = EM_ARC;
elf_elfheader (abfd)->e_flags &=~ EF_ARC_MACH; elf_elfheader (abfd)->e_flags &=~ EF_ARC_MACH;
elf_elfheader (abfd)->e_flags |= val; elf_elfheader (abfd)->e_flags |= val;
} }

View file

@ -914,7 +914,8 @@ elf32_avr_object_p (abfd)
bfd *abfd; bfd *abfd;
{ {
int e_set = bfd_mach_avr2; 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; int e_mach = elf_elfheader (abfd)->e_flags & EF_AVR_MACH;
switch (e_mach) switch (e_mach)
@ -947,6 +948,7 @@ elf32_avr_object_p (abfd)
#define ELF_ARCH bfd_arch_avr #define ELF_ARCH bfd_arch_avr
#define ELF_MACHINE_CODE EM_AVR #define ELF_MACHINE_CODE EM_AVR
#define ELF_MACHINE_ALT1 EM_AVR_OLD
#define ELF_MAXPAGESIZE 1 #define ELF_MAXPAGESIZE 1
#define TARGET_LITTLE_SYM bfd_elf32_avr_vec #define TARGET_LITTLE_SYM bfd_elf32_avr_vec

View file

@ -515,7 +515,8 @@ elf32_d10v_relocate_section (output_bfd, info, input_bfd, input_section,
return true; return true;
} }
#define ELF_ARCH bfd_arch_d10v #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 ELF_MAXPAGESIZE 0x1000
#define TARGET_BIG_SYM bfd_elf32_d10v_vec #define TARGET_BIG_SYM bfd_elf32_d10v_vec

View file

@ -546,7 +546,8 @@ d30v_info_to_howto_rela (abfd, cache_ptr, dst)
} }
#define ELF_ARCH bfd_arch_d30v #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 ELF_MAXPAGESIZE 0x1000
#define TARGET_BIG_SYM bfd_elf32_d30v_vec #define TARGET_BIG_SYM bfd_elf32_d30v_vec

View file

@ -792,7 +792,8 @@ fr30_elf_check_relocs (abfd, info, sec, relocs)
} }
#define ELF_ARCH bfd_arch_fr30 #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 ELF_MAXPAGESIZE 0x1000
#define TARGET_BIG_SYM bfd_elf32_fr30_vec #define TARGET_BIG_SYM bfd_elf32_fr30_vec

View file

@ -2168,7 +2168,8 @@ m32r_elf_check_relocs (abfd, info, sec, relocs)
} }
#define ELF_ARCH bfd_arch_m32r #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 ELF_MAXPAGESIZE 0x1 /* Explicitly requested by Mitsubishi. */
#define TARGET_BIG_SYM bfd_elf32_m32r_vec #define TARGET_BIG_SYM bfd_elf32_m32r_vec

View file

@ -341,6 +341,7 @@ pj_elf_final_write_processing (abfd, linker)
#define TARGET_LITTLE_NAME "elf32-pjl" #define TARGET_LITTLE_NAME "elf32-pjl"
#define ELF_ARCH bfd_arch_pj #define ELF_ARCH bfd_arch_pj
#define ELF_MACHINE_CODE EM_PJ #define ELF_MACHINE_CODE EM_PJ
#define ELF_MACHINE_ALT1 EM_PJ_OLD
#define ELF_MAXPAGESIZE 0x1000 #define ELF_MAXPAGESIZE 0x1000
#define bfd_elf32_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents #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 bfd_elf32_bfd_reloc_type_lookup pj_elf_reloc_type_lookup

View file

@ -2218,7 +2218,8 @@ v850_elf_fake_sections (abfd, hdr, sec)
#define TARGET_LITTLE_SYM bfd_elf32_v850_vec #define TARGET_LITTLE_SYM bfd_elf32_v850_vec
#define TARGET_LITTLE_NAME "elf32-v850" #define TARGET_LITTLE_NAME "elf32-v850"
#define ELF_ARCH bfd_arch_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_MAXPAGESIZE 0x1000
#define elf_info_to_howto v850_elf_info_to_howto_rela #define elf_info_to_howto v850_elf_info_to_howto_rela