Default e_machine to EM_IAMCU for i?86-*-elfiamcu
authorH.J. Lu <hjl.tools@gmail.com>
Mon, 11 May 2015 19:01:57 +0000 (12:01 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Mon, 11 May 2015 19:06:33 +0000 (12:06 -0700)
This patch sets the default ELF output format of assembler and linker to
EM_IAMCU when binutils is configured to i?86-*-elfiamcu target.

gas/

* configure.tgt (arch): Set to iamcu for i386-*-elfiamcu target.
* config/tc-i386.c (i386_mach): Support iamcu.
(i386_target_format): Likewise.

ld/

* configure.tgt: Support i[3-7]86-*-elfiamcu target.

ld/testsuite/

* ld-i386/i386.exp (iamcu_tests): Run iamcu-4.
* ld-i386/iamcu-4.d: New file.

gas/ChangeLog
gas/config/tc-i386.c
gas/configure.tgt
ld/ChangeLog
ld/configure.tgt
ld/testsuite/ChangeLog
ld/testsuite/ld-i386/i386.exp
ld/testsuite/ld-i386/iamcu-4.d [new file with mode: 0644]

index ce9c7338c281d5d0aa317087917f2521947393fd..7010e644ceae4da625ce228e92bb74c4937ace87 100644 (file)
@@ -1,3 +1,9 @@
+2015-05-11  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * configure.tgt (arch): Set to iamcu for i386-*-elfiamcu target.
+       * config/tc-i386.c (i386_mach): Support iamcu.
+       (i386_target_format): Likewise.
+
 2015-05-11  H.J. Lu  <hongjiu.lu@intel.com>
 
        * config/tc-i386.c (cpu_arch): Add iamcu.
index 8a6da64b03a0b6a44842119444ff7ac562096b3d..db263eeb2622894b643acba828be8ccb7dfe9229 100644 (file)
@@ -2468,7 +2468,8 @@ i386_mach (void)
       else
        return bfd_mach_x64_32;
     }
-  else if (!strcmp (default_arch, "i386"))
+  else if (!strcmp (default_arch, "i386")
+          || !strcmp (default_arch, "iamcu"))
     {
       if (cpu_arch_isa == PROCESSOR_IAMCU)
        {
@@ -10071,6 +10072,27 @@ i386_target_format (void)
     }
   else if (!strcmp (default_arch, "i386"))
     update_code_flag (CODE_32BIT, 1);
+  else if (!strcmp (default_arch, "iamcu"))
+    {
+      update_code_flag (CODE_32BIT, 1);
+      if (cpu_arch_isa == PROCESSOR_UNKNOWN)
+       {
+         static const i386_cpu_flags iamcu_flags = CPU_IAMCU_FLAGS;
+         cpu_arch_name = "iamcu";
+         cpu_sub_arch_name = NULL;
+         cpu_arch_flags = iamcu_flags;
+         cpu_arch_isa = PROCESSOR_IAMCU;
+         cpu_arch_isa_flags = iamcu_flags;
+         if (!cpu_arch_tune_set)
+           {
+             cpu_arch_tune = cpu_arch_isa;
+             cpu_arch_tune_flags = cpu_arch_isa_flags;
+           }
+       }
+      else
+       as_fatal (_("Intel MCU doesn't support `%s' architecture"),
+                 cpu_arch_name);
+    }
   else
     as_fatal (_("unknown architecture"));
 
index 09ee2758326e7813a595ee6e18b434910f2cd1ca..d14bcdf5faf7f10578f9652aa4dcfd5aed5a16ad 100644 (file)
@@ -215,6 +215,7 @@ case ${generic_target} in
   i386-*-beospe*)                      fmt=coff em=pe ;;
   i386-*-beos*)                                fmt=elf ;;
   i386-*-coff)                         fmt=coff ;;
+  i386-*-elfiamcu)                     fmt=elf arch=iamcu ;;
   i386-*-elf*)                         fmt=elf ;;
   i386-*-kaos*)                                fmt=elf ;;
   i386-*-bsd*)                         fmt=aout em=386bsd ;;
index bbb819b18766bc784b790b493f81430c2b443045..4cd77f75908f080a627f612633e0f017d9ca3dc1 100644 (file)
@@ -1,3 +1,7 @@
+2015-05-11  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * configure.tgt: Support i[3-7]86-*-elfiamcu target.
+
 2015-05-11  H.J. Lu  <hongjiu.lu@intel.com>
 
        * Makefile.am (ALL_EMULATION_SOURCES): Add eelf_iamcu.c.
index e1f5be79a54f6aa36922df51dadc6da04468b1cf..e4eacd4d56f28316768839ac163534ab5654e054 100644 (file)
@@ -304,6 +304,8 @@ x86_64-*-netbsd*)   targ_emul=elf_x86_64
                                        sed -e 's/netbsd/netbsdelf/'`;;
                        esac ;;
 i[3-7]86-*-netware)    targ_emul=i386nw ;;
+i[3-7]86-*-elfiamcu)   targ_emul=elf_iamcu
+                       targ_extra_emuls=elf_i386 ;;
 i[3-7]86-*-elf*)       targ_emul=elf_i386
                        targ_extra_emuls=elf_iamcu ;;
 x86_64-*-elf*)         targ_emul=elf_x86_64
index 52f09fbb7d94bfcf3c853e4860e95171a7371d2f..89f695cb2ac3f2df33752d42c2dbdbfcad296972 100644 (file)
@@ -1,3 +1,8 @@
+2015-05-11  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * ld-i386/i386.exp (iamcu_tests): Run iamcu-4.
+       * ld-i386/iamcu-4.d: New file.
+
 2015-05-11  H.J. Lu  <hongjiu.lu@intel.com>
 
        * ld-i386/abs-iamcu.d: New file.
index 7309910a4905f8b23819ce783fa94dd6c14da22f..2e59522f95957bc70c7863b108f43c83267f397e 100644 (file)
@@ -248,6 +248,7 @@ proc iamcu_tests {} {
     run_dump_test "iamcu-1"
     run_dump_test "iamcu-2"
     run_dump_test "iamcu-3"
+    run_dump_test "iamcu-4"
 }
 
 iamcu_tests
diff --git a/ld/testsuite/ld-i386/iamcu-4.d b/ld/testsuite/ld-i386/iamcu-4.d
new file mode 100644 (file)
index 0000000..b43d048
--- /dev/null
@@ -0,0 +1,16 @@
+#source: dummy.s
+#ld: tmpdir/startiamcu.o tmpdir/fooiamcu.o
+#readelf: -h
+#target: i?86-*-elfiamcu
+
+ELF Header:
+  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 
+  Class:                             ELF32
+  Data:                              2's complement, little endian
+  Version:                           1 \(current\)
+  OS/ABI:                            UNIX - System V
+  ABI Version:                       0
+  Type:                              EXEC \(Executable file\)
+  Machine:                           Intel MCU
+  Version:                           0x1
+#pass