opcodes: blackfin: do not force align the PC

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>
This commit is contained in:
Mike Frysinger 2014-07-26 23:44:37 +05:30
parent ba32981791
commit ed2c487956
5 changed files with 22 additions and 10 deletions

View 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.

View 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;
...
\.\.\.

View 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

View 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.

View 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;