aboutsummaryrefslogtreecommitdiff
path: root/binutils/objdump.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-09-11 17:33:00 +0930
committerAlan Modra <amodra@gmail.com>2019-09-11 21:58:39 +0930
commit0a4632b5637fa63ea4dc7651cdbae21e8b7005cd (patch)
treeda6b685dc76e3c67ef578e73c9749ec0d87676ac /binutils/objdump.c
parent075a2b89c71796f1f0f38f51b0f60d4048c49410 (diff)
downloadgdb-0a4632b5637fa63ea4dc7651cdbae21e8b7005cd.zip
gdb-0a4632b5637fa63ea4dc7651cdbae21e8b7005cd.tar.gz
gdb-0a4632b5637fa63ea4dc7651cdbae21e8b7005cd.tar.bz2
Re: Enhance the disassembler
PR 24907 * objdump.c (disassemble_bytes): Adjust code to avoid overlong lines. Correct max_reloc_offset_into_insn test.
Diffstat (limited to 'binutils/objdump.c')
-rw-r--r--binutils/objdump.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/binutils/objdump.c b/binutils/objdump.c
index 2303fe4..00541cb 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -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;