[llvm] r221078 - Don't bother creating LabelBegin for .dwo units

David Blaikie dblaikie at gmail.com
Sat Nov 1 19:26:25 PDT 2014


Author: dblaikie
Date: Sat Nov  1 21:26:24 2014
New Revision: 221078

URL: http://llvm.org/viewvc/llvm-project?rev=221078&view=rev
Log:
Don't bother creating LabelBegin for .dwo units

This would help catch cases where we might otherwise try to reference a
dwo CU label, which would be weird - because without relocations in the
dwo file it's not generally meaningful to talk about the CU offsets
there (or, if it is, we can do so in absolute terms without using a
relocation to compute it).

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp?rev=221078&r1=221077&r2=221078&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Sat Nov  1 21:26:24 2014
@@ -687,8 +687,9 @@ void DwarfCompileUnit::collectDeadVariab
 }
 
 void DwarfCompileUnit::emitHeader(const MCSymbol *ASectionSym) const {
-  // Emit the compile units header.
-  Asm->OutStreamer.EmitLabel(LabelBegin);
+  // Don't bother labeling the .dwo unit, as its offset isn't used.
+  if (!Skeleton)
+    Asm->OutStreamer.EmitLabel(LabelBegin);
 
   DwarfUnit::emitHeader(ASectionSym);
 }

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h?rev=221078&r1=221077&r2=221078&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h Sat Nov  1 21:26:24 2014
@@ -158,8 +158,11 @@ public:
   void initSection(const MCSection *Section, MCSymbol *SectionSym) {
     DwarfUnit::initSection(Section);
     this->SectionSym = SectionSym;
-    LabelBegin =
-        Asm->GetTempSymbol(Section->getLabelBeginName(), getUniqueID());
+
+    // Don't bother labeling the .dwo unit, as its offset isn't used.
+    if (!Skeleton)
+      LabelBegin =
+          Asm->GetTempSymbol(Section->getLabelBeginName(), getUniqueID());
   }
 
   unsigned getLength() {





More information about the llvm-commits mailing list