diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2018-07-06 12:49:54 +0000 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2018-07-06 12:49:54 +0000 |
commit | 7f19d0160b0723fa72654f2c190903b6a4e48a4c (patch) | |
tree | fbb8aeda0f1b2b0caf226c465f6472de3bec6fea | |
parent | a3dad801b7392bda9ff66b780bf3f1adb98d5857 (diff) | |
download | bcm5719-llvm-7f19d0160b0723fa72654f2c190903b6a4e48a4c.tar.gz bcm5719-llvm-7f19d0160b0723fa72654f2c190903b6a4e48a4c.zip |
[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).
llvm-svn: 336433
-rw-r--r-- | llvm/tools/dsymutil/CompileUnit.h | 4 | ||||
-rw-r--r-- | llvm/tools/dsymutil/DwarfStreamer.cpp | 5 |
2 files changed, 9 insertions, 0 deletions
diff --git a/llvm/tools/dsymutil/CompileUnit.h b/llvm/tools/dsymutil/CompileUnit.h index d56f298360b..0f5efdd6805 100644 --- a/llvm/tools/dsymutil/CompileUnit.h +++ b/llvm/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/llvm/tools/dsymutil/DwarfStreamer.cpp b/llvm/tools/dsymutil/DwarfStreamer.cpp index 05034673e20..5bf23820dec 100644 --- a/llvm/tools/dsymutil/DwarfStreamer.cpp +++ b/llvm/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); |