This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: objdump.c sign_adjust patch


Hi,
  Here is the patch to fix the problem that I mentioned in the previous
email.  Is it ok?
  Thanks!

Regards,
Chao-ying

2009-02-17  Chao-ying Fu  <fu@mips.com>

    * objdump.c (disassemble_section): Fix addr, only when it is not
sign-extended correctly.

Index: binutils/objdump.c
===================================================================
RCS file: /cvs/src/src/binutils/objdump.c,v
retrieving revision 1.154
diff -u -p -r1.154 objdump.c
--- binutils/objdump.c 9 Feb 2009 09:14:15 -0000 1.154
+++ binutils/objdump.c 17 Feb 2009 22:48:47 -0000
@@ -1898,7 +1898,10 @@ disassemble_section (bfd *abfd, asection
       bfd_boolean insns;

       addr = section->vma + addr_offset;
-      addr = (addr ^ sign_adjust) - sign_adjust;
+      /* If addr is not sign-extended correctly, we fix it.  */
+      if (sign_adjust == 0x80000000
+   && (addr < 0xffffffff80000000LL && addr > 0x7fffffff))
+ addr = (addr ^ sign_adjust) - sign_adjust;

       if (sym != NULL && bfd_asymbol_value (sym) <= addr)
  {


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]