From dac39857d6545e32f20f0735a04b934f36b6c1d9 Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Fri, 26 Sep 2014 22:32:16 +0000 Subject: Object: BSS/virtual sections don't have contents Users of getSectionContents shouldn't try to pass in BSS or virtual sections. In all instances, this is a bug in the code calling this routine. N.B. Some COFF implementations (like CL) will mark their BSS sections as taking space on disk. This would confuse COFFObjectFile into thinking the section is larger than the file. llvm-svn: 218549 --- llvm/tools/llvm-readobj/MachODumper.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'llvm/tools/llvm-readobj/MachODumper.cpp') diff --git a/llvm/tools/llvm-readobj/MachODumper.cpp b/llvm/tools/llvm-readobj/MachODumper.cpp index 41a78e762fb..2d09282f11f 100644 --- a/llvm/tools/llvm-readobj/MachODumper.cpp +++ b/llvm/tools/llvm-readobj/MachODumper.cpp @@ -266,11 +266,16 @@ void MachODumper::printSections(const MachOObjectFile *Obj) { } if (opts::SectionData) { - StringRef Data; - if (error(Section.getContents(Data))) + bool IsBSS; + if (error(Section.isBSS(IsBSS))) break; + if (!IsBSS) { + StringRef Data; + if (error(Section.getContents(Data))) + break; - W.printBinaryBlock("SectionData", Data); + W.printBinaryBlock("SectionData", Data); + } } } } -- cgit v1.2.3