aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-objdump/llvm-objdump.cpp
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2024-09-25 10:32:40 -0700
committerGitHub <noreply@github.com>2024-09-25 10:32:40 -0700
commitabe0dd195a3b2630afdc5c1c233eb2a068b2d72f (patch)
tree17b462f55d4e185ade83d93325fc90f0f48b9b99 /llvm/tools/llvm-objdump/llvm-objdump.cpp
parent3c348bf5435896bea70f613d9bdcc542201075b4 (diff)
downloadllvm-abe0dd195a3b2630afdc5c1c233eb2a068b2d72f.zip
llvm-abe0dd195a3b2630afdc5c1c233eb2a068b2d72f.tar.gz
llvm-abe0dd195a3b2630afdc5c1c233eb2a068b2d72f.tar.bz2
[llvm-objdump] Print ... even if a data mapping symbol is active
Swap `!DisassembleZeroes` and `if (DumpARMELFData)` conditions so that in the false DisassembleZeroes case (default), `...` will be printed for long consecutive zeroes, even when a data mapping symbol is active. This is especially useful for certain lld tests that insert a huge padding within a code section. Without `...` the output will be huge. Pull Request: https://github.com/llvm/llvm-project/pull/109553
Diffstat (limited to 'llvm/tools/llvm-objdump/llvm-objdump.cpp')
-rw-r--r--llvm/tools/llvm-objdump/llvm-objdump.cpp35
1 files changed, 18 insertions, 17 deletions
diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp
index b69d14b..8073c89 100644
--- a/llvm/tools/llvm-objdump/llvm-objdump.cpp
+++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp
@@ -2244,27 +2244,28 @@ disassembleObject(ObjectFile &Obj, const ObjectFile &DbgObj,
return false;
};
+ // When -z or --disassemble-zeroes are given we always dissasemble
+ // them. Otherwise we might want to skip zero bytes we see.
+ if (!DisassembleZeroes) {
+ uint64_t MaxOffset = End - Index;
+ // For --reloc: print zero blocks patched by relocations, so that
+ // relocations can be shown in the dump.
+ if (InlineRelocs && RelCur != RelEnd)
+ MaxOffset = std::min(RelCur->getOffset() - RelAdjustment - Index,
+ MaxOffset);
+
+ if (size_t N =
+ countSkippableZeroBytes(Bytes.slice(Index, MaxOffset))) {
+ FOS << "\t\t..." << '\n';
+ Index += N;
+ continue;
+ }
+ }
+
if (DumpARMELFData) {
Size = dumpARMELFData(SectionAddr, Index, End, Obj, Bytes,
MappingSymbols, *DT->SubtargetInfo, FOS);
} else {
- // When -z or --disassemble-zeroes are given we always dissasemble
- // them. Otherwise we might want to skip zero bytes we see.
- if (!DisassembleZeroes) {
- uint64_t MaxOffset = End - Index;
- // For --reloc: print zero blocks patched by relocations, so that
- // relocations can be shown in the dump.
- if (InlineRelocs && RelCur != RelEnd)
- MaxOffset = std::min(RelCur->getOffset() - RelAdjustment - Index,
- MaxOffset);
-
- if (size_t N =
- countSkippableZeroBytes(Bytes.slice(Index, MaxOffset))) {
- FOS << "\t\t..." << '\n';
- Index += N;
- continue;
- }
- }
if (DumpTracebackTableForXCOFFFunction &&
doesXCOFFTracebackTableBegin(Bytes.slice(Index, 4))) {