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: RFC: Tweak the fix for PR9774


Alan Modra <amodra@bigpond.net.au> writes:
> On Sun, Sep 20, 2009 at 12:10:57PM +0100, Richard Sandiford wrote:
>> 	* objdump.c (disassemble_section): Use bfd_get_arch_size
>> 	instead of assuming that the address size is 32 bits.
>
> Looks fine to me, although I'd probably write bed->s->arch_size
> rather than bfd_get_arch_size.

Good point.  Here's what I installed to branch and trunk after testing
on mips64-linux-gnu.

Richard


binutils/
	* objdump.c (disassemble_section): Use bfd_get_arch_size
	instead of assuming that the address size is 32 bits.

Index: binutils/objdump.c
===================================================================
--- binutils/objdump.c	2009-09-22 19:11:22.000000000 +0100
+++ binutils/objdump.c	2009-09-22 19:12:35.000000000 +0100
@@ -1891,13 +1891,13 @@ disassemble_section (bfd *abfd, asection
                                              &place);
   paux->require_sec = FALSE;
 
-  /* PR 9774: If the target used signed 32-bit addresses then we must make
-     sure that we sign extend the value that we calculate for 'addr' in the
-     loop below.  */
+  /* PR 9774: If the target used signed addresses then we must make
+     sure that we sign extend the value that we calculate for 'addr'
+     in the loop below.  */
   if (bfd_get_flavour (abfd) == bfd_target_elf_flavour
       && (bed = get_elf_backend_data (abfd)) != NULL
       && bed->sign_extend_vma)
-    sign_adjust = 0x80000000;
+    sign_adjust = (bfd_vma) 1 << (bed->s->arch_size - 1);
 
   /* Disassemble a block of instructions up to the address associated with
      the symbol we have just found.  Then print the symbol and find the


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