[all-commits] [llvm/llvm-project] 8e29f3: [llvm-objdump] Handle multiple syms at same addr i...
Simon Tatham via All-commits
all-commits at lists.llvm.org
Wed Aug 24 07:08:38 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 8e29f3f1c35a88f00a0290b0280468d04932eeb5
https://github.com/llvm/llvm-project/commit/8e29f3f1c35a88f00a0290b0280468d04932eeb5
Author: Simon Tatham <simon.tatham at arm.com>
Date: 2022-08-24 (Wed, 24 Aug 2022)
Changed paths:
A llvm/test/tools/llvm-objdump/ELF/ARM/disassemble-all-mapping-symbols.s
A llvm/test/tools/llvm-objdump/ELF/data-vs-code-priority.s
A llvm/test/tools/llvm-objdump/multiple-symbols-mangling.s
A llvm/test/tools/llvm-objdump/multiple-symbols.s
M llvm/tools/llvm-objdump/ObjdumpOpts.td
M llvm/tools/llvm-objdump/llvm-objdump.cpp
Log Message:
-----------
[llvm-objdump] Handle multiple syms at same addr in disassembly.
The main disassembly loop in llvm-objdump works by iterating through
the symbols in a code section, and for each one, dumping the range of
the section from that symbol to the next. If there's another symbol
defined at the same location, then that range will have length 0, and
llvm-objdump will skip over the symbol entirely.
As a result, llvm-objdump will only show the last of the symbols
defined at that address. Not only that, but the other symbols won't
even be checked against the `--disassemble-symbol` list. So if you
have two symbols `foo` and `bar` defined in the same place, then one
of `--disassemble-symbol=foo` and `--disassemble-symbol=bar` will
generate an error message and no disassembly.
I think a better approach in that situation is to prioritise display
of the symbol the user actually asked for. Also, if the user
specifically asks for disassembly of //both// of two symbols defined
at the same address, the best response I can think of is to
disassemble the code once, preceded by both symbol names.
This involves teaching llvm-objdump to be able to display more than
one symbol name at the head of a disassembled section, which also
makes it possible to implement a `--show-all-symbols` option to
display //every// symbol defined in the code, not just the most
preferred one at each address.
This change also turns out to fix a bug in which `--disassemble-all`
on a mixed Arm/Thumb ELF file would fail to switch disassembly states
between Arm and Thumb functions, because the mapping symbols were
accidentally ignored.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D131589
More information about the All-commits
mailing list