From 52fe4420b771a0f3b4fc7c6535bbd6e9b279f775 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 7 Mar 2018 11:06:15 +1030 Subject: [PATCH] XCOFF disassembler 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 | 5 ++ binutils/configure | 2 +- binutils/configure.ac | 2 +- gas/ChangeLog | 6 ++ gas/testsuite/gas/ppc/aix.exp | 2 +- gas/testsuite/gas/ppc/machine.d | 1 + gas/testsuite/gas/ppc/ppc.exp | 146 ++++++++++++++++---------------- opcodes/ChangeLog | 9 ++ opcodes/disassemble.c | 13 ++- opcodes/disassemble.h | 1 - opcodes/ppc-dis.c | 16 ++-- 11 files changed, 107 insertions(+), 96 deletions(-) diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 8af73448357..3f3a9ddb567 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,8 @@ +2018-03-07 Alan Modra + + * configure.ac: Add objdump_private_desc_xcoff for rs6000. + * configure: Regenerate. + 2018-03-05 H.J. Lu PR binutils/22911 diff --git a/binutils/configure b/binutils/configure index 9ce9f3f8d32..e11c43fc394 100755 --- a/binutils/configure +++ b/binutils/configure @@ -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*) diff --git a/binutils/configure.ac b/binutils/configure.ac index 30898aee557..430192b8011 100644 --- a/binutils/configure.ac +++ b/binutils/configure.ac @@ -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*) diff --git a/gas/ChangeLog b/gas/ChangeLog index d8f58927111..ed7c5cd8426 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,9 @@ +2018-03-07 Alan Modra + + * 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 * config/tc-arm.c (md_begin): Add NULL pointer check before diff --git a/gas/testsuite/gas/ppc/aix.exp b/gas/testsuite/gas/ppc/aix.exp index d92a1b8b7de..c0858eafb2a 100644 --- a/gas/testsuite/gas/ppc/aix.exp +++ b/gas/testsuite/gas/ppc/aix.exp @@ -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 diff --git a/gas/testsuite/gas/ppc/machine.d b/gas/testsuite/gas/ppc/machine.d index 7f9b8b4cd39..b8ec7a3b37d 100644 --- a/gas/testsuite/gas/ppc/machine.d +++ b/gas/testsuite/gas/ppc/machine.d @@ -1,5 +1,6 @@ #objdump: -s -j .text #name: PowerPC .machine test +#not-target: *-*-pe *-*-winnt* *-*-cygwin* .* diff --git a/gas/testsuite/gas/ppc/ppc.exp b/gas/testsuite/gas/ppc/ppc.exp index bdce3dccb61..f3b37de1bf5 100644 --- a/gas/testsuite/gas/ppc/ppc.exp +++ b/gas/testsuite/gas/ppc/ppc.exp @@ -18,8 +18,33 @@ # 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" diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 9fe7a1310a4..7a309bb51ec 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,12 @@ +2018-03-07 Alan Modra + + * 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 * sysdep.h (opcodes_error_handler): Define. diff --git a/opcodes/disassemble.c b/opcodes/disassemble.c index 78f09954630..9fbf6032371 100644 --- a/opcodes/disassemble.c +++ b/opcodes/disassemble.c @@ -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); diff --git a/opcodes/disassemble.h b/opcodes/disassemble.h index 696870078b3..ee7a9c84987 100644 --- a/opcodes/disassemble.h +++ b/opcodes/disassemble.h @@ -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 *); diff --git a/opcodes/ppc-dis.c b/opcodes/ppc-dis.c index a2cfc0b148e..efa7898e712 100644 --- a/opcodes/ppc-dis.c +++ b/opcodes/ppc-dis.c @@ -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 -- 2.30.2