aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTamar Christina <tamar.christina@arm.com>2019-03-25 12:08:53 +0000
committerTamar Christina <tamar.christina@arm.com>2019-03-25 15:05:53 +0000
commit53b2f36bf6aa939feab6f82f05d7dad52f82660d (patch)
tree3ea5018d4dee6a17be4eae4bacbcb70f0bbbbb51 /include
parent9a93502fa81734d39f213ccb33b497bc40e1423d (diff)
downloadgdb-53b2f36bf6aa939feab6f82f05d7dad52f82660d.zip
gdb-53b2f36bf6aa939feab6f82f05d7dad52f82660d.tar.gz
gdb-53b2f36bf6aa939feab6f82f05d7dad52f82660d.tar.bz2
AArch64: Fix disassembler bug with out-of-order sections
The AArch64 disassembler has an optimization that it uses to reduce the amount it has to search for mapping symbols during disassembly. This optimization assumes that sections are listed in the section header in monotonic increasing VMAs. However this is not a requirement for the ELF specification. Because of this when such "out of order" sections occur the disassembler would pick the wrong mapping symbol to disassemble the section with. This fixes it by explicitly passing along the stop offset for the current disassembly glob and when this changes compared to the previous one we've seen the optimization won't be performed. In effect this restarts the search from a well defined starting point. Usually the symbol's address. The existing stop_vma can't be used for this as it is allowed to be unset and setting this unconditionally would change the semantics of this field. binutils/ChangeLog: * objdump.c (disassemble_bytes): Pass stop_offset. * testsuite/binutils-all/aarch64/out-of-order.T: New test. * testsuite/binutils-all/aarch64/out-of-order.d: New test. * testsuite/binutils-all/aarch64/out-of-order.s: New test. include/ChangeLog: * dis-asm.h (struct disassemble_info): Add stop_offset. opcodes/ChangeLog: * aarch64-dis.c (last_stop_offset): New. (print_insn_aarch64): Use stop_offset.
Diffstat (limited to 'include')
-rw-r--r--include/ChangeLog4
-rw-r--r--include/dis-asm.h6
2 files changed, 10 insertions, 0 deletions
diff --git a/include/ChangeLog b/include/ChangeLog
index b4a0907..ae79b9f 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,3 +1,7 @@
+2019-03-25 Tamar Christina <tamar.christina@arm.com>
+
+ * dis-asm.h (struct disassemble_info): Add stop_offset.
+
2019-03-13 Sudakshina Das <sudi.das@arm.com>
* elf/aarch64.h (DT_AARCH64_PAC_PLT): New.
diff --git a/include/dis-asm.h b/include/dis-asm.h
index 22c593e..4e1263c 100644
--- a/include/dis-asm.h
+++ b/include/dis-asm.h
@@ -221,6 +221,12 @@ typedef struct disassemble_info
file being disassembled. */
bfd_vma stop_vma;
+ /* The end range of the current range being disassembled. This is required
+ in order to notify the disassembler when it's currently handling a
+ different range than it was before. This prevent unsafe optimizations when
+ disassembling such as the way mapping symbols are found on AArch64. */
+ bfd_vma stop_offset;
+
} disassemble_info;
/* This struct is used to pass information about valid disassembler