aboutsummaryrefslogtreecommitdiff
path: root/opcodes/bfin-dis.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2014-07-26 23:44:37 +0530
committerMike Frysinger <vapier@gentoo.org>2014-08-13 06:58:34 -0400
commited2c4879565a32432f6cbbf7569e0922835475b0 (patch)
treec60fd67fc13c4c7782b00afb9ec772008dc389ad /opcodes/bfin-dis.c
parentba32981791a749df5e742abbc4bc2f71a3161d6e (diff)
downloadfsf-binutils-gdb-ed2c4879565a32432f6cbbf7569e0922835475b0.zip
fsf-binutils-gdb-ed2c4879565a32432f6cbbf7569e0922835475b0.tar.gz
fsf-binutils-gdb-ed2c4879565a32432f6cbbf7569e0922835475b0.tar.bz2
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>
Diffstat (limited to 'opcodes/bfin-dis.c')
-rw-r--r--opcodes/bfin-dis.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/opcodes/bfin-dis.c b/opcodes/bfin-dis.c
index 6991915..8cc4604 100644
--- a/opcodes/bfin-dis.c
+++ b/opcodes/bfin-dis.c
@@ -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;