]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
opcodes: blackfin: do not force align the PC
authorMike Frysinger <vapier@gentoo.org>
Sat, 26 Jul 2014 18:14:37 +0000 (23:44 +0530)
committerMike Frysinger <vapier@gentoo.org>
Wed, 13 Aug 2014 10:58:34 +0000 (06:58 -0400)
If the user gives us an unaligned PC, then dump an error as such.
Otherwise if you try to disassemble at an odd address, the output
will look weird (it'll read one byte earlier).

This can be seen in one of the gas tests where data is in the middle
of .text, so move the data to .data like it should be in the first place.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
gas/testsuite/ChangeLog
gas/testsuite/gas/bfin/load.d
gas/testsuite/gas/bfin/load.s
opcodes/ChangeLog
opcodes/bfin-dis.c

index 8bf212127c882a0114837517d8541030d28b7e7d..13dd20da6e2c2bdcfd35c37a9e7fd4e9a85279ff 100644 (file)
@@ -1,3 +1,8 @@
+2014-08-13  Mike Frysinger  <vapier@gentoo.org>
+
+       * gas/bfin/load.d: Update output.
+       * gas/bfin/load.s: Add .data section.
+
 2014-08-12  H.J. Lu  <hongjiu.lu@intel.com>
 
        * gas/i386/omit-lock.s: Remove type directive.
index 5d03d8cd0b71c0b3e64fe8be677081d52644fe43..299312837dd6443960c1fb55cff42baecbfc72e2 100644 (file)
@@ -31,7 +31,7 @@ Disassembly of section .text:
   54:  36 e1 ff 7f     M2 = 0x7fff \(X\);.*
   58:  81 60           R1 = 0x10 \(X\);.*
   5a:  3c e1 00 00     L0 = 0x0 \(X\);.*
-  5e:  27 e1 f3 00     R7 = 0xf3 \(X\);.*
+  5e:  27 e1 01 00     R7 = 0x1 \(X\);.*
   62:  00 e1 03 00     R0.L = 0x3;.*
   66:  01 e1 0f 00     R1.L = 0xf;.*
 
@@ -106,11 +106,4 @@ Disassembly of section .text:
   e8:  fb 98           R3 = B\[FP--\] \(X\);
   ea:  b7 e5 00 00     R7 = B\[SP \+ 0x0\] \(X\);
   ee:  be e5 01 80     R6 = B\[FP \+ -0x7fff\] \(X\);
-
-000000f2 <load_data1>:
-       ...
-
-000000f3 <load_data2>:
-  f3:  10 00           IF !CC JUMP 0xf3 <load_data2>;
-  f5:  00 00           NOP;
-       ...
+       \.\.\.
index 96ae1faad19443de5cb3b2d2883fda6c0c20d921..0b785259827b38e53a7f0370c3240403b20e3cb3 100644 (file)
@@ -129,6 +129,7 @@ load_byte_sign_extend:
        r7 = B [ sp+0] (x);
        r6 = b [fp-0x7fff] (X);
 
+       .data
        .global load_data
 load_data1:    .byte 0
 load_data2:    .word 16
index fc1b494e074897da21d79e29f1e369a5e7336d2a..48db533f71b5187bccf5e8044045599883af98fb 100644 (file)
@@ -1,3 +1,8 @@
+2014-08-13  Mike Frysinger  <vapier@gentoo.org>
+
+       * bfin-dis.c (ifetch): Do not align pc to 2 bytes.
+       (_print_insn_bfin): Add check for unaligned pc.
+
 2014-08-13  Mike Frysinger  <vapier@gentoo.org>
 
        * bfin-dis.c (ifetch): New function.
index 69919154c5a0bb9eb2910ac7db095bfebbe61593..8cc4604af821297c5ccd83849afa9dae76371971 100644 (file)
@@ -4645,7 +4645,7 @@ ifetch (bfd_vma pc, disassemble_info *outf, TIword *iw)
   bfd_byte buf[2];
   int status;
 
-  status = (*outf->read_memory_func) (pc & ~0x01, buf, 2, outf);
+  status = (*outf->read_memory_func) (pc, buf, 2, outf);
   if (status != 0)
     {
       (*outf->memory_error_func) (status, pc, outf);
@@ -4663,6 +4663,14 @@ _print_insn_bfin (bfd_vma pc, disassemble_info *outf)
   TIword iw1;
   int rv = 0;
 
+  /* The PC must be 16-bit aligned.  */
+  if (pc & 1)
+    {
+      OUTS (outf, "ILLEGAL (UNALIGNED)");
+      /* For people dumping data, just re-align the return value.  */
+      return 1;
+    }
+
   if (ifetch (pc, outf, &iw0))
     return -1;