Re: Enhance the disassembler
authorAlan Modra <amodra@gmail.com>
Wed, 11 Sep 2019 08:03:00 +0000 (17:33 +0930)
committerAlan Modra <amodra@gmail.com>
Wed, 11 Sep 2019 12:28:39 +0000 (21:58 +0930)
PR 24907
* objdump.c (disassemble_bytes): Adjust code to avoid overlong
lines.  Correct max_reloc_offset_into_insn test.

binutils/ChangeLog
binutils/objdump.c

index 7ccf842955bf21f6dcd62085111bf21e6698b48a..2e41773d878c32f92c947456d3024bb3875cb744 100644 (file)
@@ -1,3 +1,9 @@
+2019-09-11  Alan Modra  <amodra@gmail.com>
+
+       PR 24907
+       * objdump.c (disassemble_bytes): Adjust code to avoid overlong
+       lines.  Correct max_reloc_offset_into_insn test.
+
 2019-09-10  Nick Clifton  <nickc@redhat.com>
 
        PR 24907
index 2303fe4abf810b3cf9090e3a3ef4349dac809781..00541cbec5ffbca109751d7d851ca0780b86f8eb 100644 (file)
@@ -1994,12 +1994,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
@@ -2029,7 +2032,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;
This page took 0.040777 seconds and 4 git commands to generate.