add some assertions to EmitSectionOffset.
authorChris Lattner <sabre@nondot.org>
Sun, 4 Apr 2010 23:06:31 +0000 (23:06 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 4 Apr 2010 23:06:31 +0000 (23:06 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100364 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AsmPrinter/DwarfPrinter.cpp

index 71bdd52762f1b1b765d4e152cecb69753411dd7a..7de6109967142adf6ff93463499efa0a5ccce2bc 100644 (file)
@@ -54,6 +54,14 @@ void DwarfPrinter::EmitSectionOffset(const MCSymbol *Label,
     Asm->OutStreamer.EmitRawText(SecOffDir + Twine(Label->getName()));
     return;
   }
+
+  // Get the section that we're referring to, based on SectionLabel.
+  const MCSection &Section = SectionLabel->getSection();
+  
+  // If Label has already been emitted, verify that it is in the same section as
+  // section label for sanity.
+  assert((!Label->isInSection() || &Label->getSection() == &Section) &&
+         "Section offset using wrong section base for label"); (void)Section;
   
   // If the section in question will end up with an address of 0 anyway, we can
   // just emit an absolute reference to save a relocation.