[PATCH][Binutils][AArch64] Fix disassembler bug with out-of-order sections

Tamar Christina Tamar.Christina@arm.com
Fri Feb 22 09:10:00 GMT 2019


Hi All,

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.

build on native hardware and regtested on
  aarch64-none-elf, aarch64-none-elf (32 bit host),
  aarch64-none-linux-gnu, aarch64-none-linux-gnu (32 bit host)

Cross-compiled and regtested on
  aarch64-none-linux-gnu, aarch64_be-none-linux-gnu

and no issues.

Ok for master? and for backport to binutils-2.32?

Thanks,
Tamar

binutils/ChangeLog:

2019-02-22  Tamar Christina  <tamar.christina@arm.com>

	* 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:

2019-02-22  Tamar Christina  <tamar.christina@arm.com>

	* dis-asm.h (struct disassemble_info): Add stop_offset.

opcodes/ChangeLog:

2019-02-22  Tamar Christina  <tamar.christina@arm.com>

	* aarch64-dis.c (last_stop_offset): New.
	(print_insn_aarch64): Use stop_offset.

-- 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rb10710.patch
Type: text/x-diff
Size: 5057 bytes
Desc: rb10710.patch
URL: <https://sourceware.org/pipermail/binutils/attachments/20190222/28fe2059/attachment.bin>


More information about the Binutils mailing list