public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] opcodes: blackfin: fix decoding of 32bit addresses on 64bit systems
@ 2010-09-21  9:19 Mike Frysinger
  2010-09-22 21:55 ` Mike Frysinger
  0 siblings, 1 reply; 2+ messages in thread
From: Mike Frysinger @ 2010-09-21  9:19 UTC (permalink / raw)
  To: binutils; +Cc: Robin Getz

From: Robin Getz <robin.getz@analog.com>

The Blackfin ISA is very exact with regards to address truncation when
under/over flowing its 32bit range.  On a 32bit system, things work the
same and so addresses are decoded properly.  On a 64bit system though,
the decoded addresses may include the bits that are supposed to have
been truncated.  So force a 32bit truncation after the address has been
calculated.

Signed-off-by: Robin Getz <robin.getz@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>

2010-09-21  Robin Getz  <robin.getz@analog.com>

	* bfin-dis.c (fmtconst): Cast address to 32bits.
---
 opcodes/bfin-dis.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/opcodes/bfin-dis.c b/opcodes/bfin-dis.c
index b17e055..0aec087 100644
--- a/opcodes/bfin-dis.c
+++ b/opcodes/bfin-dis.c
@@ -138,6 +138,9 @@ fmtconst (const_forms_t cf, TIword x, bfd_vma pc, disassemble_info *outf)
       if (constant_formats[cf].pcrel)
 	ea += pc;
 
+     /* truncate to 32-bits for proper symbol lookup/matching */
+     ea = (bu32)ea;
+
      if (outf->symbol_at_address_func (ea, outf) || !constant_formats[cf].exact)
        {
 	  outf->print_address_func (ea, outf);
-- 
1.7.2

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] opcodes: blackfin: fix decoding of 32bit addresses on 64bit systems
  2010-09-21  9:19 [PATCH] opcodes: blackfin: fix decoding of 32bit addresses on 64bit systems Mike Frysinger
@ 2010-09-22 21:55 ` Mike Frysinger
  0 siblings, 0 replies; 2+ messages in thread
From: Mike Frysinger @ 2010-09-22 21:55 UTC (permalink / raw)
  To: binutils; +Cc: Robin Getz

[-- Attachment #1: Type: Text/Plain, Size: 516 bytes --]

On Tuesday, September 21, 2010 05:19:09 Mike Frysinger wrote:
> From: Robin Getz <robin.getz@analog.com>
> 
> The Blackfin ISA is very exact with regards to address truncation when
> under/over flowing its 32bit range.  On a 32bit system, things work the
> same and so addresses are decoded properly.  On a 64bit system though,
> the decoded addresses may include the bits that are supposed to have
> been truncated.  So force a 32bit truncation after the address has been
> calculated.

committed
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-09-22 21:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-21  9:19 [PATCH] opcodes: blackfin: fix decoding of 32bit addresses on 64bit systems Mike Frysinger
2010-09-22 21:55 ` Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).