opcodes/
authorMaciej W. Rozycki <macro@linux-mips.org>
Wed, 13 Feb 2013 17:09:09 +0000 (17:09 +0000)
committerMaciej W. Rozycki <macro@linux-mips.org>
Wed, 13 Feb 2013 17:09:09 +0000 (17:09 +0000)
* mips-dis.c (is_compressed_mode_p): Only match symbols from the
section disassembled.

binutils/testsuite/
* binutils-all/mips/mixed-micromips.d: New test.
* binutils-all/mips/mixed-mips16.d: New test.
* binutils-all/mips/mixed-micromips.s: New test source.
* binutils-all/mips/mixed-mips16.s: New test source.
* binutils-all/mips/mips.exp: New file.

binutils/testsuite/ChangeLog
binutils/testsuite/binutils-all/mips/mips.exp [new file with mode: 0644]
binutils/testsuite/binutils-all/mips/mixed-micromips.d [new file with mode: 0644]
binutils/testsuite/binutils-all/mips/mixed-micromips.s [new file with mode: 0644]
binutils/testsuite/binutils-all/mips/mixed-mips16.d [new file with mode: 0644]
binutils/testsuite/binutils-all/mips/mixed-mips16.s [new file with mode: 0644]
opcodes/ChangeLog
opcodes/mips-dis.c

index b3d9c42a7435a6c903fc92cbacc3ddf9173d344c..0b42ef2515285c0a2d2adf71e12b284df11092bd 100644 (file)
@@ -1,3 +1,11 @@
+2013-02-12  Maciej W. Rozycki  <macro@codesourcery.com>
+
+       * binutils-all/mips/mixed-micromips.d: New test.
+       * binutils-all/mips/mixed-mips16.d: New test.
+       * binutils-all/mips/mixed-micromips.s: New test source.
+       * binutils-all/mips/mixed-mips16.s: New test source.
+       * binutils-all/mips/mips.exp: New file.
+
 2012-12-17  Nick Clifton  <nickc@redhat.com>
 
        * binutils-all/windres/README: Add copyright notice.
diff --git a/binutils/testsuite/binutils-all/mips/mips.exp b/binutils/testsuite/binutils-all/mips/mips.exp
new file mode 100644 (file)
index 0000000..eba8868
--- /dev/null
@@ -0,0 +1,26 @@
+# Copyright 2013
+# Free Software Foundation, Inc.
+
+# 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.
+
+if ![istarget mips*-*-*] {
+    return
+}
+
+if [is_elf_format] {
+    run_dump_test "mixed-mips16"
+    run_dump_test "mixed-micromips"
+}
diff --git a/binutils/testsuite/binutils-all/mips/mixed-micromips.d b/binutils/testsuite/binutils-all/mips/mixed-micromips.d
new file mode 100644 (file)
index 0000000..0bc9e41
--- /dev/null
@@ -0,0 +1,30 @@
+#PROG: objcopy
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: Mixed MIPS and microMIPS disassembly
+#as: -32 -mips2
+
+# Test mixed-mode disassembly in overlapping sections.
+
+.*: +file format .*mips.*
+
+Disassembly of section \.text\.foo:
+[0-9a-f]+ <[^>]*> 27bdffe0     addiu   sp,sp,-32
+[0-9a-f]+ <[^>]*> afbf001c     sw      ra,28\(sp\)
+[0-9a-f]+ <[^>]*> 0c000000     jal     00000000 <.*>
+[      ]*[0-9a-f]+: R_MIPS_26  baz
+[0-9a-f]+ <[^>]*> 00000000     nop
+[0-9a-f]+ <[^>]*> 8fbf001c     lw      ra,28\(sp\)
+[0-9a-f]+ <[^>]*> 03e00008     jr      ra
+[0-9a-f]+ <[^>]*> 27bd0020     addiu   sp,sp,32
+       \.\.\.
+
+Disassembly of section \.text\.bar:
+[0-9a-f]+ <[^>]*> 4ff1         addiu   sp,sp,-32
+[0-9a-f]+ <[^>]*> cbe7         sw      ra,28\(sp\)
+[0-9a-f]+ <[^>]*> 7400 0000    jals    00000000 <.*>
+[      ]*[0-9a-f]+: R_MICROMIPS_26_S1  baz
+[0-9a-f]+ <[^>]*> 0c00         nop
+[0-9a-f]+ <[^>]*> 4be7         lw      ra,28\(sp\)
+[0-9a-f]+ <[^>]*> 4708         jraddiusp       32
+[0-9a-f]+ <[^>]*> 0c00         nop
+       \.\.\.
diff --git a/binutils/testsuite/binutils-all/mips/mixed-micromips.s b/binutils/testsuite/binutils-all/mips/mixed-micromips.s
new file mode 100644 (file)
index 0000000..0528c90
--- /dev/null
@@ -0,0 +1,33 @@
+       .section .text.foo, "ax", @progbits
+       .set    nomicromips
+       .globl  foo
+       .ent    foo
+foo:
+       addiu   $sp, $sp, -32
+       sw      $ra, 28($sp)
+       jal     baz
+       lw      $ra, 28($sp)
+       addiu   $sp, $sp, 32
+       jr      $ra
+       .end    foo
+
+# Force at least 8 (non-delay-slot) zero bytes, to make 'objdump' print ...
+       .align  2
+       .space  8
+
+
+       .section .text.bar, "ax", @progbits
+       .set    micromips
+       .globl  bar
+       .ent    bar
+bar:
+       addiu   $sp, $sp, -32
+       sw      $ra, 28($sp)
+       jals    baz
+       lw      $ra, 28($sp)
+       jraddiusp 32
+       .end    bar
+
+# Force at least 8 (non-delay-slot) zero bytes, to make 'objdump' print ...
+       .align  2
+       .space  8
diff --git a/binutils/testsuite/binutils-all/mips/mixed-mips16.d b/binutils/testsuite/binutils-all/mips/mixed-mips16.d
new file mode 100644 (file)
index 0000000..1f76c52
--- /dev/null
@@ -0,0 +1,30 @@
+#PROG: objcopy
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: Mixed MIPS and MIPS16 disassembly
+#as: -32 -mips2
+
+# Test mixed-mode disassembly in overlapping sections.
+
+.*: +file format .*mips.*
+
+Disassembly of section \.text\.foo:
+[0-9a-f]+ <[^>]*> 27bdffe0     addiu   sp,sp,-32
+[0-9a-f]+ <[^>]*> afbf001c     sw      ra,28\(sp\)
+[0-9a-f]+ <[^>]*> 0c000000     jal     00000000 <.*>
+[      ]*[0-9a-f]+: R_MIPS_26  baz
+[0-9a-f]+ <[^>]*> 00000000     nop
+[0-9a-f]+ <[^>]*> 8fbf001c     lw      ra,28\(sp\)
+[0-9a-f]+ <[^>]*> 03e00008     jr      ra
+[0-9a-f]+ <[^>]*> 27bd0020     addiu   sp,sp,32
+       \.\.\.
+
+Disassembly of section \.text\.bar:
+[0-9a-f]+ <[^>]*> 63fc         addiu   sp,-32
+[0-9a-f]+ <[^>]*> 6207         sw      ra,28\(sp\)
+[0-9a-f]+ <[^>]*> 1800 0000    jal     00000000 <.*>
+[      ]*[0-9a-f]+: R_MIPS16_26        baz
+[0-9a-f]+ <[^>]*> 6500         nop
+[0-9a-f]+ <[^>]*> 9707         lw      a3,28\(sp\)
+[0-9a-f]+ <[^>]*> ef00         jr      a3
+[0-9a-f]+ <[^>]*> 6500         nop
+       \.\.\.
diff --git a/binutils/testsuite/binutils-all/mips/mixed-mips16.s b/binutils/testsuite/binutils-all/mips/mixed-mips16.s
new file mode 100644 (file)
index 0000000..189f4ae
--- /dev/null
@@ -0,0 +1,33 @@
+       .section .text.foo, "ax", @progbits
+       .set    nomips16
+       .globl  foo
+       .ent    foo
+foo:
+       addiu   $sp, $sp, -32
+       sw      $ra, 28($sp)
+       jal     baz
+       lw      $ra, 28($sp)
+       addiu   $sp, $sp, 32
+       jr      $ra
+       .end    foo
+
+# Force at least 8 (non-delay-slot) zero bytes, to make 'objdump' print ...
+       .align  2
+       .space  8
+
+
+       .section .text.bar, "ax", @progbits
+       .set    mips16
+       .globl  bar
+       .ent    bar
+bar:
+       addiu   $sp, -32
+       sw      $ra, 28($sp)
+       jal     baz
+       lw      $a3, 28($sp)
+       jr      $a3
+       .end    bar
+
+# Force at least 8 (non-delay-slot) zero bytes, to make 'objdump' print ...
+       .align  2
+       .space  8
index bd75dfb05147955f884fed71021bf68e411dde1f..be40a2b0e897d703a069157ce2bf4d4519761d55 100644 (file)
@@ -1,3 +1,8 @@
+2013-02-12  Maciej W. Rozycki  <macro@codesourcery.com>
+
+       * mips-dis.c (is_compressed_mode_p): Only match symbols from the
+       section disassembled.
+
 2013-02-11  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
 
        * arm-dis.c: Update strht pattern.
index 0bd5fef00d8a57e0928e5bcab2a7db71a06ea07c..9c9112b3f59110b3e0064913701307a2743bb88c 100644 (file)
@@ -2940,6 +2940,9 @@ is_compressed_mode_p (struct disassemble_info *info)
       if (bfd_asymbol_flavour (info->symtab[pos]) != bfd_target_elf_flavour)
        continue;
 
+      if (info->symtab[pos]->section != info->section)
+       continue;
+
       symbol = (elf_symbol_type *) info->symtab[pos];
       if ((!micromips_ase
           && ELF_ST_IS_MIPS16 (symbol->internal_elf_sym.st_other))