summaryrefslogtreecommitdiff
path: root/tools/dsymutil
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2018-07-06 12:49:54 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2018-07-06 12:49:54 +0000
commit55b2eb047f3c8837d14f5e6765dc515c41bdef10 (patch)
treea2fb0d95f895865fce481c0430cb301030cd3c76 /tools/dsymutil
parentd1a03350b87964aea895a1bbb60a69678eca1fbb (diff)
[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). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336433 91177308-0d34-0410-b5e6-96231b3b80d8
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);