[PATCH] D130358: [llvm-objdump,ARM] Add PrettyPrinters for Arm and AArch64.
David Spickett via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 25 04:17:59 PDT 2022
DavidSpickett added a comment.
Are there existing tests that check this works for a big endian object file?
================
Comment at: llvm/tools/llvm-objdump/llvm-objdump.cpp:688
+ size_t Pos = 0, End = Bytes.size();
+ if (STI.checkFeatures("+thumb-mode")) {
+ for (; Pos + 2 <= End; Pos += 2)
----------------
You could write this as:
```
size_t insn_bytes = STI.checkFeatures("+thumb-mode") ? 2 : 4;
for (; Pos + insn_bytes <= End; Pos += insn_bytes)
OS << ' '
<< format_hex_no_prefix(
llvm::support::endian::read<uint16_t>(
Bytes.data() + Pos, llvm::support::little),
insn_bytes*2);
}
```
================
Comment at: llvm/tools/llvm-objdump/llvm-objdump.cpp:693
+ llvm::support::endian::read<uint16_t>(
+ Bytes.data() + Pos, llvm::support::little),
+ 4);
----------------
Does the endian here have to match the endian of the object file?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D130358/new/
https://reviews.llvm.org/D130358
More information about the llvm-commits
mailing list