summaryrefslogtreecommitdiffstats
path: root/llvm/tools/dsymutil/DwarfStreamer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/tools/dsymutil/DwarfStreamer.cpp')
-rw-r--r--llvm/tools/dsymutil/DwarfStreamer.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/llvm/tools/dsymutil/DwarfStreamer.cpp b/llvm/tools/dsymutil/DwarfStreamer.cpp
index 79442f3588d..7350d19e17b 100644
--- a/llvm/tools/dsymutil/DwarfStreamer.cpp
+++ b/llvm/tools/dsymutil/DwarfStreamer.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
#include "DwarfStreamer.h"
+#include "CompileUnit.h"
#include "LinkUtils.h"
#include "MachOUtils.h"
#include "llvm/ADT/Triple.h"
@@ -165,6 +166,9 @@ void DwarfStreamer::emitCompileUnitHeader(CompileUnit &Unit) {
// start of the section.
Asm->emitInt32(0);
Asm->emitInt8(Unit.getOrigUnit().getAddressByteSize());
+
+ // Remember this CU.
+ EmittedUnits.push_back({Unit.getUniqueID(), Unit.getLabelBegin()});
}
/// Emit the \p Abbrevs array as the shared abbreviation table
@@ -197,6 +201,29 @@ void DwarfStreamer::emitStrings(const NonRelocatableStringpool &Pool) {
}
}
+void DwarfStreamer::emitDebugNames(
+ AccelTable<DWARF5AccelTableStaticData> &Table) {
+ if (EmittedUnits.empty())
+ return;
+
+ // Build up data structures needed to emit this section.
+ std::vector<MCSymbol *> CompUnits;
+ DenseMap<unsigned, size_t> UniqueIdToCuMap;
+ unsigned Id = 0;
+ for (auto &CU : EmittedUnits) {
+ CompUnits.push_back(CU.LabelBegin);
+ // We might be omitting CUs, so we need to remap them.
+ UniqueIdToCuMap[CU.ID] = Id++;
+ }
+
+ Asm->OutStreamer->SwitchSection(MOFI->getDwarfDebugNamesSection());
+ emitDWARF5AccelTable(
+ Asm.get(), Table, CompUnits,
+ [&UniqueIdToCuMap](const DWARF5AccelTableStaticData &Entry) {
+ return UniqueIdToCuMap[Entry.getCUIndex()];
+ });
+}
+
void DwarfStreamer::emitAppleNamespaces(
AccelTable<AppleAccelTableStaticOffsetData> &Table) {
Asm->OutStreamer->SwitchSection(MOFI->getDwarfAccelNamespaceSection());
OpenPOWER on IntegriCloud