XCOFF disassembler
authorAlan Modra <amodra@gmail.com>
Wed, 7 Mar 2018 00:36:15 +0000 (11:06 +1030)
committerAlan Modra <amodra@gmail.com>
Wed, 7 Mar 2018 06:26:39 +0000 (16:56 +1030)
xcoff (32-bit) objdump accepted but ignored -M options unless
-mpowerpc was also given.  This patch fixes that, leaving the default
as -Mpwr for xcoff.  I've also enabled more tests for xcoff targets.

binutils/
* configure.ac: Add objdump_private_desc_xcoff for rs6000.
* configure: Regenerate.
gas/
* testsuite/gas/ppc/aix.exp: Run for rs6000 too.
* testsuite/gas/ppc/ppc.exp: Run more tests for non-ELF targets.
* testsuite/gas/ppc/machine.d: Don't run for PE targets.
opcodes/
* disassemble.c (disassembler): Use bfd_arch_powerpc entry for
bfd_arch_rs6000.
* disassemble.h (print_insn_rs6000): Delete.
* ppc-dis.c (powerpc_init_dialect): Handle rs6000.
(disassemble_init_powerpc): Call powerpc_init_dialect for rs6000.
(print_insn_rs6000): Delete.

binutils/ChangeLog
binutils/configure
binutils/configure.ac
gas/ChangeLog
gas/testsuite/gas/ppc/aix.exp
gas/testsuite/gas/ppc/machine.d
gas/testsuite/gas/ppc/ppc.exp
opcodes/ChangeLog
opcodes/disassemble.c
opcodes/disassemble.h
opcodes/ppc-dis.c

index 8af73448357f16982249e97d364bd722d7dc9057..3f3a9ddb5670253437dac1a3b29d5777a4e306f4 100644 (file)
@@ -1,3 +1,8 @@
+2018-03-07  Alan Modra  <amodra@gmail.com>
+
+       * configure.ac: Add objdump_private_desc_xcoff for rs6000.
+       * configure: Regenerate.
+
 2018-03-05  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR binutils/22911
index 9ce9f3f8d328dda9af22b932e5c36cce37a0a3fa..e11c43fc394a29cf7f45e2c8820cfcda790a4284 100755 (executable)
@@ -14599,7 +14599,7 @@ do
        avr-*-*)
          od_vectors="$od_vectors objdump_private_desc_elf32_avr"
          ;;
-       powerpc-*-aix*)
+       powerpc*-*-aix* | rs6000-*-aix*)
          od_vectors="$od_vectors objdump_private_desc_xcoff"
          ;;
         *-*-darwin*)
index 30898aee55723f9da8955bbf90fced8aa11d790e..430192b80113c019d5527b498ef0830b3a723b35 100644 (file)
@@ -417,7 +417,7 @@ changequote([,])dnl
        avr-*-*)
          od_vectors="$od_vectors objdump_private_desc_elf32_avr"
          ;;
-       powerpc-*-aix*)
+       powerpc*-*-aix* | rs6000-*-aix*)
          od_vectors="$od_vectors objdump_private_desc_xcoff"
          ;;
         *-*-darwin*)
index d8f5892711176449ece923be871be5dfb00f0776..ed7c5cd8426cb93b162fb4aa02323da307cd643d 100644 (file)
@@ -1,3 +1,9 @@
+2018-03-07  Alan Modra  <amodra@gmail.com>
+
+       * testsuite/gas/ppc/aix.exp: Run for rs6000 too.
+       * testsuite/gas/ppc/ppc.exp: Run more tests for non-ELF targets.
+       * testsuite/gas/ppc/machine.d: Don't run for PE targets.
+
 2018-03-02  Thomas Preud'homme  <thomas.preudhomme@arm.com>
 
        * config/tc-arm.c (md_begin): Add NULL pointer check before
index d92a1b8b7de496209c085660443e08c1fcb19bb8..c0858eafb2a8a07248106c17eb92cf32c10fcb60 100644 (file)
@@ -56,7 +56,7 @@ proc do_align_test {} {
 }
 
 
-if [istarget powerpc-ibm-aix*] then {
+if { [istarget "powerpc*-*-aix*"] || [istarget "rs6000-*-aix*"] } then {
 
     # Make sure that symbols are correctly aligned 
     do_align_test
index 7f9b8b4cd39bff37a0a8b984a91a2eac4f88d2a2..b8ec7a3b37de3bb1a0076197d6d90f24338134f3 100644 (file)
@@ -1,5 +1,6 @@
 #objdump: -s -j .text
 #name: PowerPC .machine test
+#not-target: *-*-pe *-*-winnt* *-*-cygwin*
 
 .*
 
index bdce3dccb61f2a32715c9c043e48c211e2759821..f3b37de1bf551de477ca729fe56085fa3bcca74a 100644 (file)
 # Some PowerPC tests
 #
 
+if { ![istarget "powerpc*-*-*"] && ![istarget "rs6000-*-*"] } then {
+    return
+}
+
+run_dump_test "regnames"
+run_dump_test "misalign"
+run_dump_test "misalign2"
+run_dump_test "machine"
+run_dump_test "simpshft"
+run_dump_test "altivec_and_spe"
+run_list_test "range" "-a32"
+run_dump_test "cell"
+
+if { [istarget "*-*-aix*"]
+     || [istarget "*-*-macos*"]
+     || [istarget "*-*-beos*"] } then {
+    run_dump_test "test1xcoff32"
+    run_dump_test "test2xcoff32"
+    run_dump_test "altivec_xcoff"
+    run_dump_test "altivec_xcoff64"
+}
+
 # These tests are currently ELF specific, only because nobody has
 # converted them to look for XCOFF relocations.
+if { ![is_elf_format] } then {
+    return
+}
 
 if { [istarget powerpc64*-*-*] || [istarget *-*-elf64*]} then {
 # FIXME: Pass -x to objdump as well as -Dr for astest64 and astest2_64.
@@ -28,84 +53,59 @@ if { [istarget powerpc64*-*-*] || [istarget *-*-elf64*]} then {
     run_dump_test "test1elf64"
     run_dump_test "power4"
     run_list_test "range64" "-a64"
-} elseif { [istarget powerpc*-*aix*] } then {
-    run_dump_test "test1xcoff32"
-    run_dump_test "test2xcoff32"
-} elseif { [istarget powerpc*-*-*bsd*] \
-     || [istarget powerpc*-*-elf*] \
-     || [istarget powerpc*-*-eabi*] \
-     || [istarget powerpc*-*-sysv4*] \
-     || [istarget powerpc*-*-linux*] \
-     || [istarget powerpc*-*-solaris*] \
-     || [istarget powerpc*-*-rtems*] } then {
+} else {
     run_dump_test "astest"
     run_dump_test "astest2"
     run_dump_test "test1elf32"
 }
 
-if { [istarget powerpc*-*-*] } then {
-    run_dump_test "regnames"
-    run_dump_test "misalign"
-    run_dump_test "misalign2"
-    if { [is_elf_format] } then {
-       run_dump_test "machine"
-       run_dump_test "common"
-       run_dump_test "476"
-       run_dump_test "a2"
-       run_dump_test "pr21303"
-       run_dump_test "vle"
-       run_dump_test "vle-reloc"
-       run_dump_test "vle-simple-1"
-       run_dump_test "vle-simple-2"
-       run_dump_test "vle-simple-3"
-       run_dump_test "vle-simple-4"
-       run_dump_test "vle-simple-5"
-       run_dump_test "vle-simple-6"
-       run_dump_test "vle-mult-ld-st-insns"
+run_dump_test "common"
+run_dump_test "476"
+run_dump_test "a2"
+run_dump_test "pr21303"
+run_dump_test "vle"
+run_dump_test "vle-reloc"
+run_dump_test "vle-simple-1"
+run_dump_test "vle-simple-2"
+run_dump_test "vle-simple-3"
+run_dump_test "vle-simple-4"
+run_dump_test "vle-simple-5"
+run_dump_test "vle-simple-6"
+run_dump_test "vle-mult-ld-st-insns"
 
-       #fail expected until get_powerpc_dialect() patch not applied
-       setup_xfail "*-*-*"
-       run_dump_test "lsp"
-       run_dump_test "lsp-checks"
-       run_dump_test "efs"
-       run_dump_test "efs2"
-       run_dump_test "spe2"
-       run_dump_test "spe2-checks"
-       run_dump_test "spe"
+#fail expected until get_powerpc_dialect() patch not applied
+setup_xfail "*-*-*"
+run_dump_test "lsp"
 
-       setup_xfail "*-*-*"
-       run_dump_test "spe_ambiguous"
-    }
+run_dump_test "lsp-checks"
+run_dump_test "efs"
+run_dump_test "efs2"
+run_dump_test "spe2"
+run_dump_test "spe2-checks"
+run_dump_test "spe"
 
-    if { [istarget powerpc-*-*aix*] } then {
-       run_dump_test "altivec_xcoff"
-       run_dump_test "altivec_xcoff64"
-    } else {
-       run_dump_test "simpshft"
-       run_dump_test "altivec"
-       run_dump_test "altivec2"
-       run_dump_test "altivec3"
-       run_dump_test "altivec_and_spe"
-       run_dump_test "booke"
-       run_dump_test "e500"
-       run_list_test "e500-ill" "-me500"
-       run_list_test "range" "-a32"
-       run_dump_test "ppc750ps"
-       run_dump_test "e500mc"
-       run_dump_test "e6500"
-       run_dump_test "e500mc64_nop"
-       run_dump_test "e5500_nop"
-       run_dump_test "e6500_nop"
-       run_dump_test "cell"
-       run_dump_test "power4_32"
-       run_dump_test "power6"
-       run_dump_test "power7"
-       run_dump_test "power8"
-       run_dump_test "power9"
-       run_dump_test "vsx"
-       run_dump_test "vsx2"
-       run_dump_test "vsx3"
-       run_dump_test "htm"
-       run_dump_test "titan"
-    }
-}
+setup_xfail "*-*-*"
+run_dump_test "spe_ambiguous"
+
+run_dump_test "altivec"
+run_dump_test "altivec2"
+run_dump_test "altivec3"
+run_dump_test "booke"
+run_dump_test "e500"
+run_list_test "e500-ill" "-me500"
+run_dump_test "ppc750ps"
+run_dump_test "e500mc"
+run_dump_test "e6500"
+run_dump_test "e500mc64_nop"
+run_dump_test "e5500_nop"
+run_dump_test "e6500_nop"
+run_dump_test "power4_32"
+run_dump_test "power6"
+run_dump_test "power7"
+run_dump_test "power8"
+run_dump_test "power9"
+run_dump_test "vsx"
+run_dump_test "vsx2"
+run_dump_test "vsx3"
+run_dump_test "htm"
+run_dump_test "titan"
index 9fe7a1310a4e20f923868e32081466954ed2c42d..7a309bb51ec48697049a7aaf361c63dd34250c72 100644 (file)
@@ -1,3 +1,12 @@
+2018-03-07  Alan Modra  <amodra@gmail.com>
+
+       * disassemble.c (disassembler): Use bfd_arch_powerpc entry for
+       bfd_arch_rs6000.
+       * disassemble.h (print_insn_rs6000): Delete.
+       * ppc-dis.c (powerpc_init_dialect): Handle rs6000.
+       (disassemble_init_powerpc): Call powerpc_init_dialect for rs6000.
+       (print_insn_rs6000): Delete.
+
 2018-03-03  Alan Modra  <amodra@gmail.com>
 
        * sysdep.h (opcodes_error_handler): Define.
index 78f09954630418bb0bd369804de09a6c1f6ac3d3..9fbf6032371c96d266142f4691f42a2c17c254a4 100644 (file)
@@ -375,6 +375,11 @@ disassembler (enum bfd_architecture a,
 #endif
 #ifdef ARCH_powerpc
     case bfd_arch_powerpc:
+#endif
+#ifdef ARCH_rs6000
+    case bfd_arch_rs6000:
+#endif
+#if defined ARCH_powerpc || defined ARCH_rs6000
       if (big)
        disassemble = print_insn_big_powerpc;
       else
@@ -391,14 +396,6 @@ disassembler (enum bfd_architecture a,
       disassemble = print_insn_riscv;
       break;
 #endif
-#ifdef ARCH_rs6000
-    case bfd_arch_rs6000:
-      if (mach == bfd_mach_ppc_620)
-       disassemble = print_insn_big_powerpc;
-      else
-       disassemble = print_insn_rs6000;
-      break;
-#endif
 #ifdef ARCH_rl78
     case bfd_arch_rl78:
       disassemble = rl78_get_disassembler (abfd);
index 696870078b34d11e18d3d94d564ebaeea9fbf56e..ee7a9c84987d77dccdc63aa9bdd802cbf9bf4997 100644 (file)
@@ -82,7 +82,6 @@ extern int print_insn_or1k            (bfd_vma, disassemble_info *);
 extern int print_insn_pdp11            (bfd_vma, disassemble_info *);
 extern int print_insn_pj               (bfd_vma, disassemble_info *);
 extern int print_insn_pru              (bfd_vma, disassemble_info *);
-extern int print_insn_rs6000           (bfd_vma, disassemble_info *);
 extern int print_insn_s390             (bfd_vma, disassemble_info *);
 extern int print_insn_sh64             (bfd_vma, disassemble_info *);
 extern int print_insn_spu              (bfd_vma, disassemble_info *);
index a2cfc0b148ed4bf1eb8097cbbf0151a5cf5132b6..efa7898e7121239330572169c75a5b1746b8c3df 100644 (file)
@@ -340,7 +340,10 @@ powerpc_init_dialect (struct disassemble_info *info)
       dialect = ppc_parse_cpu (dialect, &sticky, "vle");
       break;
     default:
-      dialect = ppc_parse_cpu (dialect, &sticky, "power9") | PPC_OPCODE_ANY;
+      if (info->arch == bfd_arch_powerpc)
+       dialect = ppc_parse_cpu (dialect, &sticky, "power9") | PPC_OPCODE_ANY;
+      else
+       dialect = ppc_parse_cpu (dialect, &sticky, "pwr");
       break;
     }
 
@@ -431,8 +434,7 @@ disassemble_init_powerpc (struct disassemble_info *info)
       last = spe2_opcd_indices[i];
     }
 
-  if (info->arch == bfd_arch_powerpc)
-    powerpc_init_dialect (info);
+  powerpc_init_dialect (info);
 }
 
 /* Print a big endian PowerPC instruction.  */
@@ -451,14 +453,6 @@ print_insn_little_powerpc (bfd_vma memaddr, struct disassemble_info *info)
   return print_insn_powerpc (memaddr, info, 0, get_powerpc_dialect (info));
 }
 
-/* Print a POWER (RS/6000) instruction.  */
-
-int
-print_insn_rs6000 (bfd_vma memaddr, struct disassemble_info *info)
-{
-  return print_insn_powerpc (memaddr, info, 1, PPC_OPCODE_POWER);
-}
-
 /* Extract the operand value from the PowerPC or POWER instruction.  */
 
 static int64_t