summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/DebugInfo/DWARFContext.cpp9
-rw-r--r--llvm/lib/Object/COFFObjectFile.cpp4
2 files changed, 13 insertions, 0 deletions
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);
diff --git a/llvm/lib/Object/COFFObjectFile.cpp b/llvm/lib/Object/COFFObjectFile.cpp
index 7daef06f035..45de4341b3f 100644
--- a/llvm/lib/Object/COFFObjectFile.cpp
+++ b/llvm/lib/Object/COFFObjectFile.cpp
@@ -840,6 +840,10 @@ std::error_code COFFObjectFile::getSectionName(const coff_section *Sec,
std::error_code
COFFObjectFile::getSectionContents(const coff_section *Sec,
ArrayRef<uint8_t> &Res) const {
+ // PointerToRawData and SizeOfRawData won't make sense for BSS sections, don't
+ // do anything interesting for them.
+ assert((Sec->Characteristics & COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA) == 0 &&
+ "BSS sections don't have contents!");
// The only thing that we need to verify is that the contents is contained
// within the file bounds. We don't need to make sure it doesn't cover other
// data, as there's nothing that says that is not allowed.
OpenPOWER on IntegriCloud