binutils-gdb/binutils/testsuite/binutils-all
Tamar Christina 796d6298bb Arm: Fix Arm disassembler mapping symbol search.
Similar to the AArch64 patches the Arm disassembler has the same issues with
out of order sections but also a few short comings.

For one thing there are multiple code blocks to determine mapping symbols, and
they all work slightly different, and neither fully correct.  The first thing
this patch does is centralise the mapping symbols search into one function
mapping_symbol_for_insn.  This function is then updated to perform a search in
a similar way as AArch64.

Their used to be a value has_mapping_symbols which was used to determine the
default disassembly for objects that have no mapping symbols.  The problem with
the approach was that it was determining this value in the same loop that needed
it, which is why this field could take on the states -1, 0, 1 where -1 means
"don't know".  However this means that until you actually find a mapping symbol
or reach the end of the disassembly glob, you don't know if you did the right
action or not, and if you didn't you can't correct it anymore.

This is why the two jump-reloc-veneers-* testcases end up disassembling some
insn as data when they shouldn't.

Out of order here refers to an object file where sections are not listed in a
monotonic increasing VMA order.

The ELF ABI for Arm [1] specifies the following for mapping symbols:

  1) A text section must always have a corresponding mapping symbol at it's
     start.
  2) Data sections do not require any mapping symbols.
  3) The range of a mapping symbol extends from the address it starts on up to
     the next mapping symbol (exclusive) or section end (inclusive).

However there is no defined order between a symbol and it's corresponding
mapping symbol in the symbol table.  This means that while in general we look
up for a corresponding mapping symbol, we have to make at least one check of
the symbol below the address being disassembled.

When disassembling different PCs within the same section, the search for mapping
symbol can be cached somewhat.  We know that the mapping symbol corresponding to
the current PC is either the previous one used, or one at the same address as
the current PC.

However this optimization and mapping symbol search must stop as soon as we
reach the end or start of the section.  Furthermore if we're only disassembling
a part of a section, the search is a allowed to search further than the current
chunk, but is not allowed to search past it (The mapping symbol if there, must
be at the same address, so in practice we usually stop at PC+4).

lastly, since only data sections don't require a mapping symbol the default
mapping type should be DATA and not INSN as previously defined, however if the
binary has had all its symbols stripped than this isn't very useful.  To fix
this we determine the default based on the section flags.  This will allow the
disassembler to be more useful on stripped binaries.  If there is no section
than we assume you to be disassembling INSN.

[1] https://developer.arm.com/docs/ihi0044/latest/elf-for-the-arm-architecture-abi-2018q4-documentation#aaelf32-table4-7

binutils/ChangeLog:

	* testsuite/binutils-all/arm/in-order-all.d: New test.
	* testsuite/binutils-all/arm/in-order.d: New test.
	* testsuite/binutils-all/arm/objdump.exp: Support .d tests.
	* testsuite/binutils-all/arm/out-of-order-all.d: New test.
	* testsuite/binutils-all/arm/out-of-order.T: New test.
	* testsuite/binutils-all/arm/out-of-order.d: New test.
	* testsuite/binutils-all/arm/out-of-order.s: New test.

ld/ChangeLog:

	* testsuite/ld-arm/jump-reloc-veneers-cond-long.d: Update disassembly.
	* testsuite/ld-arm/jump-reloc-veneers-long.d: Update disassembly.

opcodes/ChangeLog:

	* arm-dis.c (struct arm_private_data): Remove has_mapping_symbols.
	(mapping_symbol_for_insn): Implement new algorithm.
	(print_insn): Remove duplicate code.
2019-03-25 15:05:53 +00:00
..
aarch64 AArch64: Have -D override mapping symbol as documented. 2019-03-25 15:05:53 +00:00
arc Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
arm Arm: Fix Arm disassembler mapping symbol search. 2019-03-25 15:05:53 +00:00
bfin Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
hppa Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
i386 Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
m68k Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
mips Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
nfp Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
vax Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
wasm32 Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
windres Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
x86-64 Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
add-empty-section.d Consolidate run_dump_test 2018-09-15 16:56:55 +09:30
add-section.d Consolidate run_dump_test 2018-09-15 16:56:55 +09:30
add-symbol.d Consolidate run_dump_test 2018-09-15 16:56:55 +09:30
alias-2.def
alias.def
ar.exp Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
bintest.s Enhance objdump's --disassemble switch so that it can now take an optional parameter, specifying the starting symbol for disassembly. Disassembly will continue from this symbol up to the next symbol. 2018-11-07 18:07:36 +00:00
common-1.s
common-1a.d
common-1b.d
common-1c.d
common-1d.d
common-1e.d
common-1f.d
common-2.s
common-2a.d
common-2b.d
common-2c.d
common-2d.d
common-2e.d
common-2f.d
compress.exp Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
copy-1.d
copy-1.s
copy-2.d binutils run_dump_test rename not-target and not-skip 2018-09-15 16:24:18 +09:30
copy-3.d binutils run_dump_test rename not-target and not-skip 2018-09-15 16:24:18 +09:30
copy-4.d binutils run_dump_test rename not-target and not-skip 2018-09-15 16:24:18 +09:30
copy-5.d Prevent the --keep-global-symbol and --globalize-symbol options from being used together. 2018-10-11 11:38:10 +01:00
copy-6.d Add testcase for PR/24065. 2019-01-08 14:58:03 +00:00
copytest.s
cxxfilt.exp cxxfilt test failures 2019-01-09 11:22:50 +10:30
data-sections.s
debug_str.d
debug_str.s
debuglink.s Extend objdump's --dwarf=follow-links option so that separate debug info files will also be affected by other dump function, and symbol tables from separate debug info files will be used when disassembling the main file. 2019-02-25 12:15:41 +00:00
disasm.s Update objdump's --disassemble=<symbol> feature so that if <symbol> is a function, the entire function will be disassembled, regardless of the presence of interveening symbols. 2019-01-17 15:29:43 +00:00
dlltool.exp Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
dumptest.s
dw2-1.S Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
dw2-1.W readelf ngettext fixes 2017-11-07 17:01:16 +10:30
dw2-2.S Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
dw2-3.rS Handle ELF compressed header alignment correctly by setting up the section alignment correctly for the Elf32_Chdr or Elf64_Chdr type and respect the ch_addralign field when decompressing the section data. 2018-11-27 11:59:10 +00:00
dw2-3.rt Handle ELF compressed header alignment correctly by setting up the section alignment correctly for the Elf32_Chdr or Elf64_Chdr type and respect the ch_addralign field when decompressing the section data. 2018-11-27 11:59:10 +00:00
dw2-3.S Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
dw2-3.W readelf ngettext fixes 2017-11-07 17:01:16 +10:30
dw2-3gabi.W readelf ngettext fixes 2017-11-07 17:01:16 +10:30
dw2-compressed.S Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
dw2-decodedline-1.S
dw2-decodedline.S
dw2-empty.S
dw2-ranges.S Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
dw2-ranges.W
dw5.S Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
dw5.W binutils --dwarf=decodedline: Add display of is_stmt flag 2018-09-20 19:02:50 +02:00
dwarf-attributes.S Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
dwarf-attributes.W Display more information when decoding DW_AT_endianity, DW_AT_decimal_sign, DW_AT_defaulted and DW_AT_discr_list DWARF attributes. 2017-10-11 12:02:51 +01:00
dwo.s Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
elfedit-1.d binutils run_dump_test rename not-target and not-skip 2018-09-15 16:24:18 +09:30
elfedit-2.d [ARM] FDPIC: Update testsuite so that many tests pass with arm*-uclinuxfdpiceabi. 2018-04-25 21:13:14 +00:00
elfedit-3.d [ARM] FDPIC: Update testsuite so that many tests pass with arm*-uclinuxfdpiceabi. 2018-04-25 21:13:14 +00:00
elfedit-4.d
elfedit-5.d
elfedit.exp Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
empty
empty-file
empty.s
exclude-1.s
exclude-1a.d
exclude-1b.d
fastcall.def
group-2.s
group-3.s
group-4.s
group-5.d Andes Technology has good news for you, we plan to update the nds32 port of binutils on upstream! 2018-09-20 13:32:58 +01:00
group-5.s
group-6.d
group-6.s
group-7.s PR22836, "-r -s" doesn't work with -g3 using GCC 7 2018-02-13 22:55:49 +10:30
group-7a.d Remove run_dump_test support for objcopy as a dump program 2018-09-15 16:24:18 +09:30
group-7b.d Remove run_dump_test support for objcopy as a dump program 2018-09-15 16:24:18 +09:30
group-7c.d Remove run_dump_test support for objcopy as a dump program 2018-09-15 16:24:18 +09:30
group.s
libdw2-compressed.out
libdw2-compressedgabi.out readelf ngettext fixes 2017-11-07 17:01:16 +10:30
libdw2.out
link-order.s
linkdebug.s Extend objdump's --dwarf=follow-links option so that separate debug info files will also be affected by other dump function, and symbol tables from separate debug info files will be used when disassembling the main file. 2019-02-25 12:15:41 +00:00
localize-hidden-1.d
localize-hidden-1.s
localize-hidden-2.d
localize-hidden-2.s
locview-1.s LVU: dump loclists with locviews 2017-09-22 17:05:51 -03:00
locview-2.s LVU: dump loclists with locviews 2017-09-22 17:05:51 -03:00
mbind1.s
needed-by-reloc.s
nm-1.s
nm-elf-1.s
nm-ver.s
nm.exp Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
note-1.d Consolidate run_dump_test 2018-09-15 16:56:55 +09:30
note-2-32.d Add support for v3 binary annotation notes. 2018-01-03 10:30:07 +00:00
note-2-32.s Add support for v3 binary annotation notes. 2018-01-03 10:30:07 +00:00
note-2-64.d binutils run_dump_test rename not-target and not-skip 2018-09-15 16:24:18 +09:30
note-2-64.s Add support for v3 binary annotation notes. 2018-01-03 10:30:07 +00:00
note-3-32.d Add support for v3 binary annotation notes. 2018-01-03 10:30:07 +00:00
note-3-32.s Add support for v3 binary annotation notes. 2018-01-03 10:30:07 +00:00
note-3-64.d Add support for v3 binary annotation notes. 2018-01-03 10:30:07 +00:00
note-3-64.s Add support for v3 binary annotation notes. 2018-01-03 10:30:07 +00:00
note-3.32.s Add test of V2 GNU build attribute notes. 2017-08-17 14:51:31 +01:00
note-4-32.d Improve readelf's selection of a file start symbol when displaying a gnu build attribute. 2018-03-23 12:20:03 +00:00
note-4-32.s Improve readelf's selection of a file start symbol when displaying a gnu build attribute. 2018-03-23 12:20:03 +00:00
note-4-64.d Add support for v3 binary annotation notes. 2018-01-03 10:30:07 +00:00
note-4-64.s Improve readelf's selection of a file start symbol when displaying a gnu build attribute. 2018-03-23 12:20:03 +00:00
note-5.d Extend the assembler so that it can automatically generate GNU Build attribute notes if none are present in the input files. 2018-04-26 15:12:42 +01:00
note-5.s Extend the assembler so that it can automatically generate GNU Build attribute notes if none are present in the input files. 2018-04-26 15:12:42 +01:00
objcopy.exp Add testcase for PR/24065. 2019-01-08 14:58:03 +00:00
objdump.exp Extend objdump's --dwarf=follow-links option so that separate debug info files will also be affected by other dump function, and symbol tables from separate debug info files will be used when disassembling the main file. 2019-02-25 12:15:41 +00:00
objdump.s
objdump.W readelf ngettext fixes 2017-11-07 17:01:16 +10:30
objdump.Wk Add support to readelf and objdump for following links to separate debug information files. 2017-11-15 11:34:03 +00:00
objdump.WK2 Extend objdump's --dwarf=follow-links option so that separate debug info files will also be affected by other dump function, and symbol tables from separate debug info files will be used when disassembling the main file. 2019-02-25 12:15:41 +00:00
objdump.WK3 Extend objdump's --dwarf=follow-links option so that separate debug info files will also be affected by other dump function, and symbol tables from separate debug info files will be used when disassembling the main file. 2019-02-25 12:15:41 +00:00
objdump.WL binutils --dwarf=decodedline: Add display of is_stmt flag 2018-09-20 19:02:50 +02:00
only-section-01.d
pr18374.s
pr19020.in
pr19020a.d
pr19020b.d
pr19547.c
pr23633.d Consolidate run_dump_test 2018-09-15 16:56:55 +09:30
pr23633.list Add a testcase for PR binutils/23633 2018-09-13 09:09:15 -07:00
pr23633.s Add a testcase for PR binutils/23633 2018-09-13 09:09:15 -07:00
readelf.exp Extend objdump's --dwarf=follow-links option so that separate debug info files will also be affected by other dump function, and symbol tables from separate debug info files will be used when disassembling the main file. 2019-02-25 12:15:41 +00:00
readelf.h
readelf.k Add support to readelf and objdump for following links to separate debug information files. 2017-11-15 11:34:03 +00:00
readelf.k2 Extend readelf and objdump so that they will display and follow multiple links to separate debug information files. 2019-02-22 10:36:24 +00:00
readelf.locview-1 LVU: dump loclists with locviews 2017-09-22 17:05:51 -03:00
readelf.locview-2 LVU: dump loclists with locviews 2017-09-22 17:05:51 -03:00
readelf.n
readelf.pr18374
readelf.r readelf ngettext fixes 2017-11-07 17:01:16 +10:30
readelf.r-64 readelf ngettext fixes 2017-11-07 17:01:16 +10:30
readelf.s Enhance objdump's --disassemble switch so that it can now take an optional parameter, specifying the starting symbol for disassembly. Disassembly will continue from this symbol up to the next symbol. 2018-11-07 18:07:36 +00:00
readelf.s-64 binutils: Adjusted tests for .note.gnu.property section 2018-08-31 04:38:25 -07:00
readelf.ss Enhance objdump's --disassemble switch so that it can now take an optional parameter, specifying the starting symbol for disassembly. Disassembly will continue from this symbol up to the next symbol. 2018-11-07 18:07:36 +00:00
readelf.ss-64 Enhance objdump's --disassemble switch so that it can now take an optional parameter, specifying the starting symbol for disassembly. Disassembly will continue from this symbol up to the next symbol. 2018-11-07 18:07:36 +00:00
readelf.ss-mips Enhance objdump's --disassemble switch so that it can now take an optional parameter, specifying the starting symbol for disassembly. Disassembly will continue from this symbol up to the next symbol. 2018-11-07 18:07:36 +00:00
readelf.ss-tmips Enhance objdump's --disassemble switch so that it can now take an optional parameter, specifying the starting symbol for disassembly. Disassembly will continue from this symbol up to the next symbol. 2018-11-07 18:07:36 +00:00
readelf.wa
readelf.wKis Extend objdump's --dwarf=follow-links option so that separate debug info files will also be affected by other dump function, and symbol tables from separate debug info files will be used when disassembling the main file. 2019-02-25 12:15:41 +00:00
readelf.z
remove-relocs-01.d Support objcopy --remove-section=.relaFOO 2018-09-17 23:31:18 +09:30
remove-relocs-01.s
remove-relocs-02.d
remove-relocs-03.d
remove-relocs-04.d Support objcopy --remove-section=.relaFOO 2018-09-17 23:31:18 +09:30
remove-relocs-05.d Support objcopy --remove-section=.relaFOO 2018-09-17 23:31:18 +09:30
remove-relocs-06.d Support objcopy --remove-section=.relaFOO 2018-09-17 23:31:18 +09:30
remove-relocs-07.d Support objcopy --remove-section=.relaFOO 2018-09-17 23:31:18 +09:30
remove-relocs-07.s Support objcopy --remove-section=.relaFOO 2018-09-17 23:31:18 +09:30
remove-relocs-08.d Support objcopy --remove-section=.relaFOO 2018-09-17 23:31:18 +09:30
remove-section-01.d
size.exp binutils: Add new GNU format mode to size utility 2019-02-08 11:07:24 +00:00
strings-1.bin Enhance the strings program so that it can display multibyte strings. 2018-11-09 12:48:23 +00:00
strings.exp Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
strip-1.d
strip-2.d Andes Technology has good news for you, we plan to update the nds32 port of binutils on upstream! 2018-09-20 13:32:58 +01:00
strip-3.d RISC-V: Support ELF attribute for gas and readelf. 2019-01-16 13:14:59 -08:00
strip-4.d
strip-5.d Andes Technology has good news for you, we plan to update the nds32 port of binutils on upstream! 2018-09-20 13:32:58 +01:00
strip-6.d
strip-7.d Andes Technology has good news for you, we plan to update the nds32 port of binutils on upstream! 2018-09-20 13:32:58 +01:00
strip-8.d
strip-9.d Andes Technology has good news for you, we plan to update the nds32 port of binutils on upstream! 2018-09-20 13:32:58 +01:00
strip-10.d
strip-11.d binutils run_dump_test rename not-target and not-skip 2018-09-15 16:24:18 +09:30
strip-12.d
strip-12.s
strip-13.d binutils run_dump_test rename not-target and not-skip 2018-09-15 16:24:18 +09:30
strip-13mips64.s Adjust some strip testcases to silence h8300 warnings 2018-09-17 23:16:48 +09:30
strip-13rel.s Adjust some strip testcases to silence h8300 warnings 2018-09-17 23:16:48 +09:30
strip-13rela.s Adjust some strip testcases to silence h8300 warnings 2018-09-17 23:16:48 +09:30
strip-14.d binutils run_dump_test rename not-target and not-skip 2018-09-15 16:24:18 +09:30
strip-14mips64.s Adjust some strip testcases to silence h8300 warnings 2018-09-17 23:16:48 +09:30
strip-14rel.s Adjust some strip testcases to silence h8300 warnings 2018-09-17 23:16:48 +09:30
strip-14rela.s Adjust some strip testcases to silence h8300 warnings 2018-09-17 23:16:48 +09:30
strip-15.d Fix some strip test fails on nds32 and pru 2018-04-10 09:41:25 +09:30
strip-15mips64.s Adjust some strip testcases to silence h8300 warnings 2018-09-17 23:16:48 +09:30
strip-15rel.s Adjust some strip testcases to silence h8300 warnings 2018-09-17 23:16:48 +09:30
strip-15rela.s Adjust some strip testcases to silence h8300 warnings 2018-09-17 23:16:48 +09:30
symbols-1.d Consolidate run_dump_test 2018-09-15 16:56:55 +09:30
symbols-2.d Consolidate run_dump_test 2018-09-15 16:56:55 +09:30
symbols-3.d Consolidate run_dump_test 2018-09-15 16:56:55 +09:30
symbols-4.d Consolidate run_dump_test 2018-09-15 16:56:55 +09:30
symbols.s
testprog.c
testranges-ia64.d
testranges-ia64.s
testranges.d binutils run_dump_test rename not-target and not-skip 2018-09-15 16:24:18 +09:30
testranges.s
unique.s
unknown.s
update-1.s
update-2.s
update-3.s
update-4.s
update-section.exp Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
version.def
version.s
z.s