mirror of
https://github.com/RPCS3/llvm.git
synced 2025-02-15 16:28:48 +00:00
[llvm-objdump] Print "..." instead of random data for virtual sections
When disassembling with -D, skip virtual sections by printing "..." for each symbol. This patch also implements `MachOObjectFile::isSectionVirtual`. Test case comes from: ``` .zerofill __DATA,__common,_data64unsigned,472,3 ``` Differential Revision: https://reviews.llvm.org/D45824 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330342 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
3e0bad65f9
commit
7effcbd254
@ -1968,8 +1968,10 @@ unsigned MachOObjectFile::getSectionID(SectionRef Sec) const {
|
||||
}
|
||||
|
||||
bool MachOObjectFile::isSectionVirtual(DataRefImpl Sec) const {
|
||||
// FIXME: Unimplemented.
|
||||
return false;
|
||||
uint32_t Flags = getSectionFlags(*this, Sec);
|
||||
unsigned SectionType = Flags & MachO::SECTION_TYPE;
|
||||
return SectionType == MachO::S_ZEROFILL ||
|
||||
SectionType == MachO::S_GB_ZEROFILL;
|
||||
}
|
||||
|
||||
bool MachOObjectFile::isSectionBitcode(DataRefImpl Sec) const {
|
||||
|
9
test/tools/llvm-objdump/AArch64/macho-zerofill.s
Normal file
9
test/tools/llvm-objdump/AArch64/macho-zerofill.s
Normal file
@ -0,0 +1,9 @@
|
||||
// RUN: llvm-mc < %s -triple aarch64-macho -filetype=obj | llvm-objdump -triple=aarch64-- -D - | FileCheck %s
|
||||
|
||||
|
||||
// Check that we don't print garbage when we dump zerofill sections.
|
||||
|
||||
.zerofill __DATA,__common,_data64unsigned,472,3
|
||||
// CHECK: Disassembly of section __DATA,__common:
|
||||
// CHECK: ltmp1:
|
||||
// CHECK-NEXT: ...
|
BIN
test/tools/llvm-objdump/Inputs/zerofill.macho-x86_64.o
Normal file
BIN
test/tools/llvm-objdump/Inputs/zerofill.macho-x86_64.o
Normal file
Binary file not shown.
@ -1494,6 +1494,13 @@ static void DisassembleObject(const ObjectFile *Obj, bool InlineRelocs) {
|
||||
|
||||
outs() << '\n' << std::get<1>(Symbols[si]) << ":\n";
|
||||
|
||||
// Don't print raw contents of a virtual section. A virtual section
|
||||
// doesn't have any contents in the file.
|
||||
if (Section.isVirtual()) {
|
||||
outs() << "...\n";
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
raw_ostream &DebugOut = DebugFlag ? dbgs() : nulls();
|
||||
#else
|
||||
|
Loading…
x
Reference in New Issue
Block a user