summaryrefslogtreecommitdiff
path: root/tools/dsymutil
diff options
context:
space:
mode:
Diffstat (limited to 'tools/dsymutil')
-rw-r--r--tools/dsymutil/CompileUnit.h4
-rw-r--r--tools/dsymutil/DwarfStreamer.cpp5
2 files changed, 9 insertions, 0 deletions
diff --git a/tools/dsymutil/CompileUnit.h b/tools/dsymutil/CompileUnit.h
index d56f298360b..0f5efdd6805 100644
--- a/tools/dsymutil/CompileUnit.h
+++ b/tools/dsymutil/CompileUnit.h
@@ -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;
diff --git a/tools/dsymutil/DwarfStreamer.cpp b/tools/dsymutil/DwarfStreamer.cpp
index 05034673e20..5bf23820dec 100644
--- a/tools/dsymutil/DwarfStreamer.cpp
+++ b/tools/dsymutil/DwarfStreamer.cpp
@@ -136,11 +136,16 @@ void DwarfStreamer::emitCompileUnitHeader(CompileUnit &Unit) {
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);