[llvm] r336433 - [dsymutil] Emit label at the begin of a CU

Jonas Devlieghere via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 6 05:49:54 PDT 2018


Author: jdevlieghere
Date: Fri Jul  6 05:49:54 2018
New Revision: 336433

URL: http://llvm.org/viewvc/llvm-project?rev=336433&view=rev
Log:
[dsymutil] Emit label at the begin of a CU

When emitting a CU, store the MCSymbol pointing to the beginning of the
CU. We'll need this information later when emitting the .debug_names
section (DWARF5 accelerator table).

Modified:
    llvm/trunk/tools/dsymutil/CompileUnit.h
    llvm/trunk/tools/dsymutil/DwarfStreamer.cpp

Modified: llvm/trunk/tools/dsymutil/CompileUnit.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/dsymutil/CompileUnit.h?rev=336433&r1=336432&r2=336433&view=diff
==============================================================================
--- llvm/trunk/tools/dsymutil/CompileUnit.h (original)
+++ llvm/trunk/tools/dsymutil/CompileUnit.h Fri Jul  6 05:49:54 2018
@@ -247,11 +247,15 @@ public:
     ResolvedPaths[FileNum] = Path;
   }
 
+  MCSymbol *getLabelBegin() { return LabelBegin; }
+  void setLabelBegin(MCSymbol *S) { LabelBegin = S; }
+
 private:
   DWARFUnit &OrigUnit;
   unsigned ID;
   std::vector<DIEInfo> Info; ///< DIE info indexed by DIE index.
   Optional<BasicDIEUnit> NewUnit;
+  MCSymbol *LabelBegin = nullptr;
 
   uint64_t StartOffset;
   uint64_t NextUnitOffset;

Modified: llvm/trunk/tools/dsymutil/DwarfStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/dsymutil/DwarfStreamer.cpp?rev=336433&r1=336432&r2=336433&view=diff
==============================================================================
--- llvm/trunk/tools/dsymutil/DwarfStreamer.cpp (original)
+++ llvm/trunk/tools/dsymutil/DwarfStreamer.cpp Fri Jul  6 05:49:54 2018
@@ -136,11 +136,16 @@ void DwarfStreamer::emitCompileUnitHeade
   unsigned Version = Unit.getOrigUnit().getVersion();
   switchToDebugInfoSection(Version);
 
+  /// The start of the unit within its section.
+  Unit.setLabelBegin(Asm->createTempSymbol("cu_begin"));
+  Asm->OutStreamer->EmitLabel(Unit.getLabelBegin());
+
   // Emit size of content not including length itself. The size has already
   // been computed in CompileUnit::computeOffsets(). Subtract 4 to that size to
   // account for the length field.
   Asm->emitInt32(Unit.getNextUnitOffset() - Unit.getStartOffset() - 4);
   Asm->emitInt16(Version);
+
   // We share one abbreviations table across all units so it's always at the
   // start of the section.
   Asm->emitInt32(0);




More information about the llvm-commits mailing list