Index: lib/Object/MachOObjectFile.cpp =================================================================== --- lib/Object/MachOObjectFile.cpp +++ lib/Object/MachOObjectFile.cpp @@ -1968,8 +1968,10 @@ } 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 { Index: test/tools/llvm-objdump/macho-zerofill.test =================================================================== --- /dev/null +++ test/tools/llvm-objdump/macho-zerofill.test @@ -0,0 +1,7 @@ +# RUN: llvm-objdump -D %p/Inputs/zerofill.macho-x86_64.o 2>/dev/null | FileCheck %s + +# Check that we don't print garbage when we dump zerofill sections. + +# CHECK: Disassembly of section __DATA,__common: +# CHECK: ltmp1: +# CHECK-NEXT: ... Index: tools/llvm-objdump/llvm-objdump.cpp =================================================================== --- tools/llvm-objdump/llvm-objdump.cpp +++ tools/llvm-objdump/llvm-objdump.cpp @@ -1494,6 +1494,11 @@ outs() << '\n' << std::get<1>(Symbols[si]) << ":\n"; + if (Section.isVirtual()) { + outs() << "...\n"; + continue; + } + #ifndef NDEBUG raw_ostream &DebugOut = DebugFlag ? dbgs() : nulls(); #else