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/lib/DebugInfo/DWARFContext.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'llvm/lib/DebugInfo') diff --git a/llvm/lib/DebugInfo/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARFContext.cpp index 1be0691a1d9..62e3b9ccf64 100644 --- a/llvm/lib/DebugInfo/DWARFContext.cpp +++ b/llvm/lib/DebugInfo/DWARFContext.cpp @@ -565,6 +565,15 @@ DWARFContextInMemory::DWARFContextInMemory(object::ObjectFile &Obj) for (const SectionRef &Section : Obj.sections()) { StringRef name; Section.getName(name); + // Skip BSS and Virtual sections, they aren't interesting. + bool IsBSS; + Section.isBSS(IsBSS); + if (IsBSS) + continue; + bool IsVirtual; + Section.isVirtual(IsVirtual); + if (IsVirtual) + continue; StringRef data; Section.getContents(data); -- cgit v1.2.3