Object: BSS/virtual sections don't have contents
[oota-llvm.git] / lib / DebugInfo / DWARFContext.cpp
index 1be0691a1d974bc9689265b51d78096b3f4e7f50..62e3b9ccf6410718290f71b042768ba29ef0e74b 100644 (file)
@@ -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);