From bf64a9511f73684c4880fd1818928fdfa1725c4f Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Mon, 11 May 2015 10:30:32 -0700 Subject: [PATCH] Add Intel MCU support to bfd bfd/ * Makefile.am (ALL_MACHINES): Add cpu-iamcu.lo. (ALL_MACHINES_CFILES): Likewise. * archures.c (bfd_mach_iamcu): New. (bfd_mach_i386_iamcu): Likewise. (bfd_mach_i386_iamcu_intel_syntax): Likewise. (bfd_iamcu_arch): Likewise. (bfd_archures_list): Add &bfd_iamcu_arch. * config.bfd (targ_selvecs): Add iamcu_elf32_vec to i386_elf32_vec. (targ_archs): Add bfd_iamcu_arch if needed. * configure.ac: Support iamcu_elf32_vec. * cpu-iamcu.c: New file. * elf32-i386.c (elf32_iamcu_elf_object_p): New function. Add support for iamcu_elf32_vec and elf32_iamcu_bed. * targets.c (iamcu_elf32_vec): New. (_bfd_target_vector): Add iamcu_elf32_vec. * Makefile.in: Regenerated. * bfd-in2.h: Likewise. * configure: Likewise. binutils/testsuite/ * binutils-all/objdump.exp (cpus_expected): Append iamcu. --- bfd/ChangeLog | 22 ++++++++ bfd/Makefile.am | 2 + bfd/Makefile.in | 3 + bfd/archures.c | 6 ++ bfd/bfd-in2.h | 4 ++ bfd/config.bfd | 62 ++++++++++++--------- bfd/configure | 1 + bfd/configure.ac | 1 + bfd/cpu-iamcu.c | 60 ++++++++++++++++++++ bfd/elf32-i386.c | 41 ++++++++++++++ bfd/targets.c | 3 + binutils/testsuite/ChangeLog | 4 ++ binutils/testsuite/binutils-all/objdump.exp | 2 +- 13 files changed, 185 insertions(+), 26 deletions(-) create mode 100644 bfd/cpu-iamcu.c diff --git a/bfd/ChangeLog b/bfd/ChangeLog index f2930e57f6..d27830bdd2 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,25 @@ +2015-05-11 H.J. Lu + + * Makefile.am (ALL_MACHINES): Add cpu-iamcu.lo. + (ALL_MACHINES_CFILES): Likewise. + * archures.c (bfd_mach_iamcu): New. + (bfd_mach_i386_iamcu): Likewise. + (bfd_mach_i386_iamcu_intel_syntax): Likewise. + (bfd_iamcu_arch): Likewise. + (bfd_archures_list): Add &bfd_iamcu_arch. + * config.bfd (targ_selvecs): Add iamcu_elf32_vec to + i386_elf32_vec. + (targ_archs): Add bfd_iamcu_arch if needed. + * configure.ac: Support iamcu_elf32_vec. + * cpu-iamcu.c: New file. + * elf32-i386.c (elf32_iamcu_elf_object_p): New function. + Add support for iamcu_elf32_vec and elf32_iamcu_bed. + * targets.c (iamcu_elf32_vec): New. + (_bfd_target_vector): Add iamcu_elf32_vec. + * Makefile.in: Regenerated. + * bfd-in2.h: Likewise. + * configure: Likewise. + 2015-05-11 H.J. Lu * elfcode.h (elf_object_p): Replace EM_486 with EM_IAMCU. diff --git a/bfd/Makefile.am b/bfd/Makefile.am index 03b644261a..295a83adf5 100644 --- a/bfd/Makefile.am +++ b/bfd/Makefile.am @@ -111,6 +111,7 @@ ALL_MACHINES = \ cpu-hppa.lo \ cpu-i370.lo \ cpu-i386.lo \ + cpu-iamcu.lo \ cpu-l1om.lo \ cpu-k1om.lo \ cpu-i860.lo \ @@ -197,6 +198,7 @@ ALL_MACHINES_CFILES = \ cpu-hppa.c \ cpu-i370.c \ cpu-i386.c \ + cpu-iamcu.c \ cpu-l1om.c \ cpu-k1om.c \ cpu-i860.c \ diff --git a/bfd/Makefile.in b/bfd/Makefile.in index aac3eb2b9d..7092c82651 100644 --- a/bfd/Makefile.in +++ b/bfd/Makefile.in @@ -414,6 +414,7 @@ ALL_MACHINES = \ cpu-hppa.lo \ cpu-i370.lo \ cpu-i386.lo \ + cpu-iamcu.lo \ cpu-l1om.lo \ cpu-k1om.lo \ cpu-i860.lo \ @@ -500,6 +501,7 @@ ALL_MACHINES_CFILES = \ cpu-hppa.c \ cpu-i370.c \ cpu-i386.c \ + cpu-iamcu.c \ cpu-l1om.c \ cpu-k1om.c \ cpu-i860.c \ @@ -1341,6 +1343,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-i860.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-i960.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-ia64.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-iamcu.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-ip2k.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-iq2000.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-k1om.Plo@am__quote@ diff --git a/bfd/archures.c b/bfd/archures.c index 7a12985cf5..677c4708e9 100644 --- a/bfd/archures.c +++ b/bfd/archures.c @@ -211,6 +211,10 @@ DESCRIPTION .#define bfd_mach_i386_i386_nacl (bfd_mach_i386_i386 | bfd_mach_i386_nacl) .#define bfd_mach_x86_64_nacl (bfd_mach_x86_64 | bfd_mach_i386_nacl) .#define bfd_mach_x64_32_nacl (bfd_mach_x64_32 | bfd_mach_i386_nacl) +. bfd_arch_iamcu, {* Intel MCU *} +.#define bfd_mach_iamcu (1 << 8) +.#define bfd_mach_i386_iamcu (bfd_mach_i386_i386 | bfd_mach_iamcu) +.#define bfd_mach_i386_iamcu_intel_syntax (bfd_mach_i386_iamcu | bfd_mach_i386_intel_syntax) . bfd_arch_we32k, {* AT&T WE32xxx *} . bfd_arch_tahoe, {* CCI/Harris Tahoe *} . bfd_arch_i860, {* Intel 860 *} @@ -566,6 +570,7 @@ extern const bfd_arch_info_type bfd_h8500_arch; extern const bfd_arch_info_type bfd_hppa_arch; extern const bfd_arch_info_type bfd_i370_arch; extern const bfd_arch_info_type bfd_i386_arch; +extern const bfd_arch_info_type bfd_iamcu_arch; extern const bfd_arch_info_type bfd_i860_arch; extern const bfd_arch_info_type bfd_i960_arch; extern const bfd_arch_info_type bfd_ia64_arch; @@ -657,6 +662,7 @@ static const bfd_arch_info_type * const bfd_archures_list[] = &bfd_hppa_arch, &bfd_i370_arch, &bfd_i386_arch, + &bfd_iamcu_arch, &bfd_i860_arch, &bfd_i960_arch, &bfd_ia64_arch, diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 7c85fe823b..ade49ffc61 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -2004,6 +2004,10 @@ enum bfd_architecture #define bfd_mach_i386_i386_nacl (bfd_mach_i386_i386 | bfd_mach_i386_nacl) #define bfd_mach_x86_64_nacl (bfd_mach_x86_64 | bfd_mach_i386_nacl) #define bfd_mach_x64_32_nacl (bfd_mach_x64_32 | bfd_mach_i386_nacl) + bfd_arch_iamcu, /* Intel MCU */ +#define bfd_mach_iamcu (1 << 8) +#define bfd_mach_i386_iamcu (bfd_mach_i386_i386 | bfd_mach_iamcu) +#define bfd_mach_i386_iamcu_intel_syntax (bfd_mach_i386_iamcu | bfd_mach_i386_intel_syntax) bfd_arch_we32k, /* AT&T WE32xxx */ bfd_arch_tahoe, /* CCI/Harris Tahoe */ bfd_arch_i860, /* Intel 860 */ diff --git a/bfd/config.bfd b/bfd/config.bfd index aad87d2eba..e08bb3b254 100644 --- a/bfd/config.bfd +++ b/bfd/config.bfd @@ -531,7 +531,7 @@ case "${targ}" in i[3-7]86-*-elf* | i[3-7]86-*-sco3.2v5* | \ i[3-7]86-*-dgux* | i[3-7]86-*-sysv5*) targ_defvec=i386_elf32_vec - targ_selvecs=i386_coff_vec + targ_selvecs="iamcu_elf32_vec i386_coff_vec" ;; i[3-7]86-*-solaris2*) targ_defvec=i386_elf32_sol2_vec @@ -552,16 +552,19 @@ case "${targ}" in ;; i[3-7]86-*-nto*) targ_defvec=i386_elf32_vec - targ_selvecs=i386_coff_vec + targ_selvecs="iamcu_elf32_vec i386_coff_vec" ;; i[3-7]86-*-aros*) targ_defvec=i386_elf32_vec + targ_selvecs=iamcu_elf32_vec ;; i[3-7]86-*-chorus*) targ_defvec=i386_elf32_vec + targ_selvecs=iamcu_elf32_vec ;; i[3-7]86-*-dicos*) targ_defvec=i386_elf32_vec + targ_selvecs=iamcu_elf32_vec targ64_selvecs="x86_64_elf64_vec l1om_elf64_vec k1om_elf64_vec" ;; *-*-msdosdjgpp* | *-*-go32* ) @@ -574,7 +577,7 @@ case "${targ}" in ;; i[3-7]86-*-rtems*) targ_defvec=i386_elf32_vec - targ_selvecs="i386_coff_vec i386_aout_vec" + targ_selvecs="iamcu_elf32_vec i386_coff_vec i386_aout_vec" ;; i[3-7]86-*-darwin* | i[3-7]86-*-macos10* | i[3-7]86-*-rhapsody*) targ_defvec=i386_mach_o_vec @@ -592,6 +595,7 @@ case "${targ}" in ;; i[3-7]86-*-dragonfly*) targ_defvec=i386_elf32_vec + targ_selvecs=iamcu_elf32_vec targ64_selvecs="x86_64_elf64_vec l1om_elf64_vec k1om_elf64_vec" ;; i[3-7]86-*-freebsdaout* | i[3-7]86-*-freebsd[12].* | \ @@ -602,7 +606,7 @@ case "${targ}" in ;; i[3-7]86-*-freebsd* | i[3-7]86-*-kfreebsd*-gnu) targ_defvec=i386_elf32_fbsd_vec - targ_selvecs="i386_elf32_vec i386_pei_vec i386_coff_vec" + targ_selvecs="i386_elf32_vec iamcu_elf32_vec i386_pei_vec i386_coff_vec" targ64_selvecs="x86_64_elf64_fbsd_vec x86_64_elf64_vec x86_64_pei_vec l1om_elf64_vec l1om_elf64_fbsd_vec k1om_elf64_vec k1om_elf64_fbsd_vec" # FreeBSD <= 4.0 supports only the old nonstandard way of ABI labelling. case "${targ}" in @@ -612,35 +616,35 @@ case "${targ}" in ;; i[3-7]86-*-netbsdelf* | i[3-7]86-*-netbsd*-gnu* | i[3-7]86-*-knetbsd*-gnu) targ_defvec=i386_elf32_vec - targ_selvecs=i386_aout_nbsd_vec + targ_selvecs="i386_aout_nbsd_vec iamcu_elf32_vec" targ64_selvecs="x86_64_elf64_vec l1om_elf64_vec k1om_elf64_vec" ;; i[3-7]86-*-netbsdpe*) targ_defvec=i386_pe_vec - targ_selvecs="i386_pe_vec i386_pei_vec i386_elf32_vec" + targ_selvecs="i386_pe_vec i386_pei_vec i386_elf32_vec iamcu_elf32_vec" ;; i[3-7]86-*-netbsdaout* | i[3-7]86-*-netbsd* | \ i[3-7]86-*-openbsd[0-2].* | i[3-7]86-*-openbsd3.[0-3]) targ_defvec=i386_aout_nbsd_vec - targ_selvecs="i386_elf32_vec i386_aout_bsd_vec" + targ_selvecs="i386_elf32_vec iamcu_elf32_vec i386_aout_bsd_vec" targ_underscore=yes ;; i[3-7]86-*-openbsd*) targ_defvec=i386_elf32_vec - targ_selvecs=i386_aout_nbsd_vec + targ_selvecs="iamcu_elf32_vec i386_aout_nbsd_vec" ;; i[3-7]86-*-netware*) targ_defvec=i386_elf32_vec - targ_selvecs="i386_nlm32_vec i386_coff_vec i386_aout_vec" + targ_selvecs="iamcu_elf32_vec i386_nlm32_vec i386_coff_vec i386_aout_vec" ;; i[3-7]86-*-linux*aout*) targ_defvec=i386_aout_linux_vec - targ_selvecs=i386_elf32_vec + targ_selvecs="i386_elf32_vec iamcu_elf32_vec" targ_underscore=yes ;; i[3-7]86-*-linux-*) targ_defvec=i386_elf32_vec - targ_selvecs="i386_aout_linux_vec i386_pei_vec" + targ_selvecs="iamcu_elf32_vec i386_aout_linux_vec i386_pei_vec" targ64_selvecs="x86_64_elf64_vec x86_64_elf32_vec x86_64_pei_vec l1om_elf64_vec k1om_elf64_vec" ;; i[3-7]86-*-nacl*) @@ -662,32 +666,32 @@ case "${targ}" in ;; x86_64-*-dicos*) targ_defvec=x86_64_elf64_vec - targ_selvecs="i386_elf32_vec l1om_elf64_vec k1om_elf64_vec" + targ_selvecs="i386_elf32_vec iamcu_elf32_vec l1om_elf64_vec k1om_elf64_vec" want64=true ;; x86_64-*-elf*) targ_defvec=x86_64_elf64_vec - targ_selvecs="i386_elf32_vec x86_64_elf32_vec l1om_elf64_vec k1om_elf64_vec" + targ_selvecs="i386_elf32_vec iamcu_elf32_vec x86_64_elf32_vec l1om_elf64_vec k1om_elf64_vec" want64=true ;; x86_64-*-dragonfly*) targ_defvec=x86_64_elf64_vec - targ_selvecs="i386_elf32_vec l1om_elf64_vec k1om_elf64_vec" + targ_selvecs="i386_elf32_vec iamcu_elf32_vec l1om_elf64_vec k1om_elf64_vec" want64=true ;; x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu) targ_defvec=x86_64_elf64_fbsd_vec - targ_selvecs="i386_elf32_fbsd_vec i386_coff_vec i386_pei_vec x86_64_pei_vec i386_elf32_vec x86_64_elf64_vec l1om_elf64_vec l1om_elf64_fbsd_vec k1om_elf64_vec k1om_elf64_fbsd_vec" + targ_selvecs="i386_elf32_fbsd_vec iamcu_elf32_vec i386_coff_vec i386_pei_vec x86_64_pei_vec i386_elf32_vec x86_64_elf64_vec l1om_elf64_vec l1om_elf64_fbsd_vec k1om_elf64_vec k1om_elf64_fbsd_vec" want64=true ;; x86_64-*-netbsd* | x86_64-*-openbsd*) targ_defvec=x86_64_elf64_vec - targ_selvecs="i386_elf32_vec i386_aout_nbsd_vec i386_coff_vec i386_pei_vec x86_64_pei_vec l1om_elf64_vec k1om_elf64_vec" + targ_selvecs="i386_elf32_vec iamcu_elf32_vec i386_aout_nbsd_vec i386_coff_vec i386_pei_vec x86_64_pei_vec l1om_elf64_vec k1om_elf64_vec" want64=true ;; x86_64-*-linux-*) targ_defvec=x86_64_elf64_vec - targ_selvecs="i386_elf32_vec x86_64_elf32_vec i386_aout_linux_vec i386_pei_vec x86_64_pei_vec l1om_elf64_vec k1om_elf64_vec" + targ_selvecs="i386_elf32_vec iamcu_elf32_vec x86_64_elf32_vec i386_aout_linux_vec i386_pei_vec x86_64_pei_vec l1om_elf64_vec k1om_elf64_vec" want64=true ;; x86_64-*-nacl*) @@ -698,7 +702,7 @@ case "${targ}" in ;; x86_64-*-mingw* | x86_64-*-pe | x86_64-*-pep | x86_64-*-cygwin) targ_defvec=x86_64_pe_vec - targ_selvecs="x86_64_pe_vec x86_64_pei_vec x86_64_pe_be_vec x86_64_elf64_vec l1om_elf64_vec k1om_elf64_vec i386_pe_vec i386_pei_vec i386_elf32_vec" + targ_selvecs="x86_64_pe_vec x86_64_pei_vec x86_64_pe_be_vec x86_64_elf64_vec l1om_elf64_vec k1om_elf64_vec i386_pe_vec i386_pei_vec i386_elf32_vec iamcu_elf32_vec" want64=true targ_underscore=no ;; @@ -709,10 +713,11 @@ case "${targ}" in #endif i[3-7]86-*-lynxos*) targ_defvec=i386_elf32_vec - targ_selvecs="i386_coff_lynx_vec i386_aout_lynx_vec" + targ_selvecs="iamcu_elf32_vec i386_coff_lynx_vec i386_aout_lynx_vec" ;; i[3-7]86-*-gnu*) targ_defvec=i386_elf32_vec + targ_selvecs=iamcu_elf32_vec ;; i[3-7]86-*-mach* | i[3-7]86-*-osf1mk*) targ_defvec=i386_aout_mach3_vec @@ -728,7 +733,7 @@ case "${targ}" in ;; i[3-7]86-*-moss*) targ_defvec=i386_elf32_vec - targ_selvecs="i386_msdos_vec i386_aout_vec" + targ_selvecs="iamcu_elf32_vec i386_msdos_vec i386_aout_vec" ;; i[3-7]86-*-beospe*) targ_defvec=i386_pe_vec @@ -736,7 +741,7 @@ case "${targ}" in ;; i[3-7]86-*-beoself* | i[3-7]86-*-beos*) targ_defvec=i386_elf32_vec - targ_selvecs="i386_pe_vec i386_pei_vec" + targ_selvecs="iamcu_elf32_vec i386_pe_vec i386_pei_vec" ;; i[3-7]86-*-interix*) targ_defvec=i386_pei_vec @@ -746,11 +751,11 @@ case "${targ}" in ;; i[3-7]86-*-rdos*) targ_defvec=i386_elf32_vec - targ_selvecs=i386_coff_vec + targ_selvecs="iamcu_elf32_vec i386_coff_vec" ;; i[3-7]86-*-mingw32* | i[3-7]86-*-cygwin* | i[3-7]86-*-winnt | i[3-7]86-*-pe) targ_defvec=i386_pe_vec - targ_selvecs="i386_pe_vec i386_pei_vec i386_elf32_vec" + targ_selvecs="i386_pe_vec i386_pei_vec i386_elf32_vec iamcu_elf32_vec" targ_underscore=yes ;; i[3-7]86-none-*) @@ -765,7 +770,7 @@ case "${targ}" in ;; i[3-7]86-*-chaos) targ_defvec=i386_elf32_vec - targ_selfvecs=i386chaos_vec + targ_selfvecs="iamcu_elf32_vec i386chaos_vec" ;; i860-*-mach3* | i860-*-osf1* | i860-*-coff*) @@ -1207,7 +1212,7 @@ case "${targ}" in pjl-*-*) targ_defvec=pj_elf32_le_vec - targ_selvecs="pj_elf32_le_vec pj_elf32_vec i386_elf32_vec" + targ_selvecs="pj_elf32_le_vec pj_elf32_vec i386_elf32_vec iamcu_elf32_vec" ;; powerpc-*-aix5.[01] | rs6000-*-aix5.[01]) @@ -1766,6 +1771,13 @@ case "${targ_defvec} ${targ_selvecs}" in ;; esac +# If we support Intel MCU target, then add support for bfd_iamcu_arch. +case "${targ_defvec} ${targ_selvecs}" in + *iamcu_elf32*) + targ_archs="$targ_archs bfd_iamcu_arch" + ;; +esac + # If we support Intel L1OM target, then add support for bfd_l1om_arch. case "${targ_defvec} ${targ_selvecs}" in *l1om_elf64*) diff --git a/bfd/configure b/bfd/configure index be53faf8ef..eeeb89a681 100755 --- a/bfd/configure +++ b/bfd/configure @@ -15323,6 +15323,7 @@ do i386_nlm32_vec) tb="$tb nlm32-i386.lo nlm32.lo nlm.lo" ;; i386_pe_vec) tb="$tb pe-i386.lo peigen.lo $coff" ;; i386_pei_vec) tb="$tb pei-i386.lo peigen.lo $coff" ;; + iamcu_elf32_vec) tb="$tb elf32-i386.lo elf-ifunc.lo elf-nacl.lo elf-vxworks.lo elf32.lo $elf" ;; i860_coff_vec) tb="$tb coff-i860.lo $coff" ;; i860_elf32_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;; i860_elf32_le_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;; diff --git a/bfd/configure.ac b/bfd/configure.ac index 8ac36de4c2..4225f7d426 100644 --- a/bfd/configure.ac +++ b/bfd/configure.ac @@ -789,6 +789,7 @@ do i386_nlm32_vec) tb="$tb nlm32-i386.lo nlm32.lo nlm.lo" ;; i386_pe_vec) tb="$tb pe-i386.lo peigen.lo $coff" ;; i386_pei_vec) tb="$tb pei-i386.lo peigen.lo $coff" ;; + iamcu_elf32_vec) tb="$tb elf32-i386.lo elf-ifunc.lo elf-nacl.lo elf-vxworks.lo elf32.lo $elf" ;; i860_coff_vec) tb="$tb coff-i860.lo $coff" ;; i860_elf32_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;; i860_elf32_le_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;; diff --git a/bfd/cpu-iamcu.c b/bfd/cpu-iamcu.c new file mode 100644 index 0000000000..33d3dccd14 --- /dev/null +++ b/bfd/cpu-iamcu.c @@ -0,0 +1,60 @@ +/* BFD support for the Intel MCU architecture. + Copyright (C) 2015 Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, + MA 02110-1301, USA. */ + +#include "sysdep.h" +#include "bfd.h" +#include "libbfd.h" + +extern void * bfd_arch_i386_short_nop_fill (bfd_size_type, bfd_boolean, + bfd_boolean); + +static const bfd_arch_info_type bfd_iamcu_arch_intel_syntax = +{ + 32, /* 32 bits in a word */ + 32, /* 32 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_iamcu, + bfd_mach_i386_iamcu_intel_syntax, + "iamcu:intel", + "iamcu:intel", + 3, + TRUE, + bfd_default_compatible, + bfd_default_scan, + bfd_arch_i386_short_nop_fill, + 0 +}; + +const bfd_arch_info_type bfd_iamcu_arch = +{ + 32, /* 32 bits in a word */ + 32, /* 32 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_iamcu, + bfd_mach_i386_iamcu, + "iamcu", + "iamcu", + 3, + TRUE, + bfd_default_compatible, + bfd_default_scan, + bfd_arch_i386_short_nop_fill, + &bfd_iamcu_arch_intel_syntax +}; diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index 715961a3c0..f7a7818248 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -5422,6 +5422,47 @@ elf_i386_fbsd_post_process_headers (bfd *abfd, struct bfd_link_info *info) #include "elf32-target.h" +/* Intel MCU support. */ + +static bfd_boolean +elf32_iamcu_elf_object_p (bfd *abfd) +{ + /* Set the right machine number for an IAMCU elf32 file. */ + bfd_default_set_arch_mach (abfd, bfd_arch_iamcu, bfd_mach_i386_iamcu); + return TRUE; +} + +#undef TARGET_LITTLE_SYM +#define TARGET_LITTLE_SYM iamcu_elf32_vec +#undef TARGET_LITTLE_NAME +#define TARGET_LITTLE_NAME "elf32-iamcu" +#undef ELF_ARCH +#define ELF_ARCH bfd_arch_iamcu + +#undef ELF_MACHINE_CODE +#define ELF_MACHINE_CODE EM_IAMCU + +#undef ELF_OSABI + +#undef elf32_bed +#define elf32_bed elf32_iamcu_bed + +#undef elf_backend_object_p +#define elf_backend_object_p elf32_iamcu_elf_object_p + +#undef elf_backend_static_tls_alignment + +#undef elf_backend_want_plt_sym +#define elf_backend_want_plt_sym 0 + +#include "elf32-target.h" + +/* Restore defaults. */ +#undef ELF_ARCH +#define ELF_ARCH bfd_arch_i386 +#undef ELF_MACHINE_CODE +#define ELF_MACHINE_CODE EM_386 + /* Native Client support. */ #undef TARGET_LITTLE_SYM diff --git a/bfd/targets.c b/bfd/targets.c index 2319d23a0a..1ada260bb5 100644 --- a/bfd/targets.c +++ b/bfd/targets.c @@ -663,6 +663,7 @@ extern const bfd_target i386_msdos_vec; extern const bfd_target i386_nlm32_vec; extern const bfd_target i386_pe_vec; extern const bfd_target i386_pei_vec; +extern const bfd_target iamcu_elf32_vec; extern const bfd_target i860_coff_vec; extern const bfd_target i860_elf32_vec; extern const bfd_target i860_elf32_le_vec; @@ -1094,6 +1095,8 @@ static const bfd_target * const _bfd_target_vector[] = &i386_pe_vec, &i386_pei_vec, + &iamcu_elf32_vec, + &i860_coff_vec, &i860_elf32_vec, &i860_elf32_le_vec, diff --git a/binutils/testsuite/ChangeLog b/binutils/testsuite/ChangeLog index 2dd3f0e09b..43461adf08 100644 --- a/binutils/testsuite/ChangeLog +++ b/binutils/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2015-05-11 H.J. Lu + + * binutils-all/objdump.exp (cpus_expected): Append iamcu. + 2015-05-11 H.J. Lu * binutils-all/elfedit-5.d: New file. diff --git a/binutils/testsuite/binutils-all/objdump.exp b/binutils/testsuite/binutils-all/objdump.exp index 53ac0b5314..62c91d820f 100644 --- a/binutils/testsuite/binutils-all/objdump.exp +++ b/binutils/testsuite/binutils-all/objdump.exp @@ -35,7 +35,7 @@ set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -i"] set cpus_expected [list] lappend cpus_expected aarch64 alpha arc arm cris -lappend cpus_expected d10v d30v fr30 fr500 fr550 h8 hppa i386 i860 i960 ip2022 +lappend cpus_expected d10v d30v fr30 fr500 fr550 h8 hppa i386 i860 i960 iamcu ip2022 lappend cpus_expected m16c m32c m32r m68hc11 m68hc12 m68k m88k MCore mep c5 h1 MicroBlaze lappend cpus_expected mips mn10200 mn10300 ms1 msp MSP430 nds32 n1h_v3 ns32k lappend cpus_expected or1k or1knd pj powerpc pyramid romp rs6000 s390 sh sparc -- 2.34.1