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: Is it OK to disassemble instructions twice ?


Nick, I think you had the max_reloc_offset_into_insn test around the
wrong way.  csky-linux showed up with a bunch of fails after your
PR24907 patch, maybe due to target bugs.  Does this look like what
you had in mind?

	PR 24907
	* objdump.c (disassemble_bytes): Adjust code to avoid overlong
	lines.  Correct max_reloc_offset_into_insn test.

diff --git a/binutils/objdump.c b/binutils/objdump.c
index 4141c6b4e0..d81366e8da 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -1996,12 +1996,15 @@ disassemble_bytes (struct disassemble_info * inf,
 		{
 		  bfd_signed_vma distance_to_rel;
 		  int insn_size = 0;
+		  int max_reloc_offset
+		    = aux->abfd->arch_info->max_reloc_offset_into_insn;
 
-		  distance_to_rel = (**relppp)->address
-		    - (rel_offset + addr_offset);
+		  distance_to_rel = ((**relppp)->address - rel_offset
+				     - addr_offset);
 
 		  if (distance_to_rel > 0
-		      && aux->abfd->arch_info->max_reloc_offset_into_insn <= distance_to_rel)
+		      && (max_reloc_offset < 0
+			  || distance_to_rel <= max_reloc_offset))
 		    {
 		      /* This reloc *might* apply to the current insn,
 			 starting somewhere inside it.  Discover the length
@@ -2031,7 +2034,7 @@ disassemble_bytes (struct disassemble_info * inf,
 		     the instruction that we are about to disassemble.  */
 		  if (distance_to_rel == 0
 		      || (distance_to_rel > 0
-			  && distance_to_rel < (bfd_signed_vma) (insn_size / opb)))
+			  && distance_to_rel < insn_size / (int) opb))
 		    {
 		      inf->flags |= INSN_HAS_RELOC;
 		      aux->reloc = **relppp;

-- 
Alan Modra
Australia Development Lab, IBM


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