Debug Info: code clean up.
authorManman Ren <manman.ren@gmail.com>
Tue, 29 Oct 2013 23:14:15 +0000 (23:14 +0000)
committerManman Ren <manman.ren@gmail.com>
Tue, 29 Oct 2013 23:14:15 +0000 (23:14 +0000)
Use EmitLabelOffsetDifference for handling on darwin platform when
non-darwin platforms use EmitLabelPlusOffset.

Also fix a bug in EmitLabelOffsetDifference where the size is hard-coded
to 4 even though Size is passed in as an argument.

llvm-svn: 193660

llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp

index 37df936..41d83be 100644 (file)
@@ -1423,12 +1423,12 @@ void AsmPrinter::EmitLabelOffsetDifference(const MCSymbol *Hi, uint64_t Offset,
                             OutContext);
 
   if (!MAI->hasSetDirective())
-    OutStreamer.EmitValue(Diff, 4);
+    OutStreamer.EmitValue(Diff, Size);
   else {
     // Otherwise, emit with .set (aka assignment).
     MCSymbol *SetLabel = GetTempSymbol("set", SetCounter++);
     OutStreamer.EmitAssignment(SetLabel, Diff);
-    OutStreamer.EmitSymbolValue(SetLabel, 4);
+    OutStreamer.EmitSymbolValue(SetLabel, Size);
   }
 }
 
index 722dd32..6713df8 100644 (file)
@@ -2082,7 +2082,9 @@ void DwarfDebug::emitDIE(DIE *Die, std::vector<DIEAbbrev *> *Abbrevs) {
           Asm->EmitLabelPlusOffset(DwarfInfoSectionSym, Addr,
                                    DIEEntry::getRefAddrSize(Asm));
         else
-          Asm->OutStreamer.EmitIntValue(Addr, DIEEntry::getRefAddrSize(Asm));
+          Asm->EmitLabelOffsetDifference(DwarfInfoSectionSym, Addr,
+                                         DwarfInfoSectionSym,
+                                         DIEEntry::getRefAddrSize(Asm));
       } else {
         Asm->EmitInt32(Addr);
       }