diff options
author | Mike Frysinger <vapier@gentoo.org> | 2014-07-26 23:44:37 +0530 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2014-08-13 06:58:34 -0400 |
commit | ed2c4879565a32432f6cbbf7569e0922835475b0 (patch) | |
tree | c60fd67fc13c4c7782b00afb9ec772008dc389ad /opcodes | |
parent | ba32981791a749df5e742abbc4bc2f71a3161d6e (diff) | |
download | binutils-ed2c4879565a32432f6cbbf7569e0922835475b0.zip binutils-ed2c4879565a32432f6cbbf7569e0922835475b0.tar.gz binutils-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')
-rw-r--r-- | opcodes/ChangeLog | 5 | ||||
-rw-r--r-- | opcodes/bfin-dis.c | 10 |
2 files changed, 14 insertions, 1 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index fc1b494..48db533 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,5 +1,10 @@ 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. (_print_insn_bfin, print_insn_bfin): Call new ifetch and return -1 when it errors. 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; |