1 //===- MCCodeView.h - Machine Code CodeView support -------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // Holds state from .cv_file and .cv_loc directives for later emission.
12 //===----------------------------------------------------------------------===//
14 #include "llvm/MC/MCCodeView.h"
15 #include "llvm/ADT/STLExtras.h"
16 #include "llvm/ADT/StringExtras.h"
17 #include "llvm/DebugInfo/CodeView/CodeView.h"
18 #include "llvm/DebugInfo/CodeView/Line.h"
19 #include "llvm/DebugInfo/CodeView/SymbolRecord.h"
20 #include "llvm/MC/MCAsmLayout.h"
21 #include "llvm/MC/MCContext.h"
22 #include "llvm/MC/MCObjectStreamer.h"
23 #include "llvm/MC/MCValue.h"
24 #include "llvm/Support/EndianStream.h"
27 using namespace llvm::codeview;
29 CodeViewContext::CodeViewContext() {}
31 CodeViewContext::~CodeViewContext() {
32 // If someone inserted strings into the string table but never actually
33 // emitted them somewhere, clean up the fragment.
34 if (!InsertedStrTabFragment)
35 delete StrTabFragment;
38 /// This is a valid number for use with .cv_loc if we've already seen a .cv_file
40 bool CodeViewContext::isValidFileNumber(unsigned FileNumber) const {
41 unsigned Idx = FileNumber - 1;
42 if (Idx < Files.size())
43 return Files[Idx].Assigned;
47 bool CodeViewContext::addFile(MCStreamer &OS, unsigned FileNumber,
49 ArrayRef<uint8_t> ChecksumBytes,
50 uint8_t ChecksumKind) {
51 assert(FileNumber > 0);
52 auto FilenameOffset = addToStringTable(Filename);
53 Filename = FilenameOffset.first;
54 unsigned Idx = FileNumber - 1;
55 if (Idx >= Files.size())
56 Files.resize(Idx + 1);
61 if (Files[Idx].Assigned)
64 FilenameOffset = addToStringTable(Filename);
65 Filename = FilenameOffset.first;
66 unsigned Offset = FilenameOffset.second;
68 auto ChecksumOffsetSymbol =
69 OS.getContext().createTempSymbol("checksum_offset", false);
70 Files[Idx].StringTableOffset = Offset;
71 Files[Idx].ChecksumTableOffset = ChecksumOffsetSymbol;
72 Files[Idx].Assigned = true;
73 Files[Idx].Checksum = ChecksumBytes;
74 Files[Idx].ChecksumKind = ChecksumKind;
79 bool CodeViewContext::recordFunctionId(unsigned FuncId) {
80 if (FuncId >= Functions.size())
81 Functions.resize(FuncId + 1);
83 // Return false if this function info was already allocated.
84 if (!Functions[FuncId].isUnallocatedFunctionInfo())
87 // Mark this as an allocated normal function, and leave the rest alone.
88 Functions[FuncId].ParentFuncIdPlusOne = MCCVFunctionInfo::FunctionSentinel;
92 bool CodeViewContext::recordInlinedCallSiteId(unsigned FuncId, unsigned IAFunc,
93 unsigned IAFile, unsigned IALine,
95 if (FuncId >= Functions.size())
96 Functions.resize(FuncId + 1);
98 // Return false if this function info was already allocated.
99 if (!Functions[FuncId].isUnallocatedFunctionInfo())
102 MCCVFunctionInfo::LineInfo InlinedAt;
103 InlinedAt.File = IAFile;
104 InlinedAt.Line = IALine;
105 InlinedAt.Col = IACol;
107 // Mark this as an inlined call site and record call site line info.
108 MCCVFunctionInfo *Info = &Functions[FuncId];
109 Info->ParentFuncIdPlusOne = IAFunc + 1;
110 Info->InlinedAt = InlinedAt;
112 // Walk up the call chain adding this function id to the InlinedAtMap of all
113 // transitive callers until we hit a real function.
114 while (Info->isInlinedCallSite()) {
115 InlinedAt = Info->InlinedAt;
116 Info = getCVFunctionInfo(Info->getParentFuncId());
117 Info->InlinedAtMap[FuncId] = InlinedAt;
123 MCDataFragment *CodeViewContext::getStringTableFragment() {
124 if (!StrTabFragment) {
125 StrTabFragment = new MCDataFragment();
126 // Start a new string table out with a null byte.
127 StrTabFragment->getContents().push_back('\0');
129 return StrTabFragment;
132 std::pair<StringRef, unsigned> CodeViewContext::addToStringTable(StringRef S) {
133 SmallVectorImpl<char> &Contents = getStringTableFragment()->getContents();
135 StringTable.insert(std::make_pair(S, unsigned(Contents.size())));
136 // Return the string from the table, since it is stable.
137 std::pair<StringRef, unsigned> Ret =
138 std::make_pair(Insertion.first->first(), Insertion.first->second);
139 if (Insertion.second) {
140 // The string map key is always null terminated.
141 Contents.append(Ret.first.begin(), Ret.first.end() + 1);
146 unsigned CodeViewContext::getStringTableOffset(StringRef S) {
147 // A string table offset of zero is always the empty string.
150 auto I = StringTable.find(S);
151 assert(I != StringTable.end());
155 void CodeViewContext::emitStringTable(MCObjectStreamer &OS) {
156 MCContext &Ctx = OS.getContext();
157 MCSymbol *StringBegin = Ctx.createTempSymbol("strtab_begin", false),
158 *StringEnd = Ctx.createTempSymbol("strtab_end", false);
160 OS.EmitIntValue(unsigned(DebugSubsectionKind::StringTable), 4);
161 OS.emitAbsoluteSymbolDiff(StringEnd, StringBegin, 4);
162 OS.EmitLabel(StringBegin);
164 // Put the string table data fragment here, if we haven't already put it
165 // somewhere else. If somebody wants two string tables in their .s file, one
166 // will just be empty.
167 if (!InsertedStrTabFragment) {
168 OS.insert(getStringTableFragment());
169 InsertedStrTabFragment = true;
172 OS.EmitValueToAlignment(4, 0);
174 OS.EmitLabel(StringEnd);
177 void CodeViewContext::emitFileChecksums(MCObjectStreamer &OS) {
178 // Do nothing if there are no file checksums. Microsoft's linker rejects empty
179 // CodeView substreams.
183 MCContext &Ctx = OS.getContext();
184 MCSymbol *FileBegin = Ctx.createTempSymbol("filechecksums_begin", false),
185 *FileEnd = Ctx.createTempSymbol("filechecksums_end", false);
187 OS.EmitIntValue(unsigned(DebugSubsectionKind::FileChecksums), 4);
188 OS.emitAbsoluteSymbolDiff(FileEnd, FileBegin, 4);
189 OS.EmitLabel(FileBegin);
191 unsigned CurrentOffset = 0;
193 // Emit an array of FileChecksum entries. We index into this table using the
194 // user-provided file number. Each entry may be a variable number of bytes
195 // determined by the checksum kind and size.
196 for (auto File : Files) {
197 OS.EmitAssignment(File.ChecksumTableOffset,
198 MCConstantExpr::create(CurrentOffset, Ctx));
199 CurrentOffset += 4; // String table offset.
200 if (!File.ChecksumKind) {
202 4; // One byte each for checksum size and kind, then align to 4 bytes.
204 CurrentOffset += 2; // One byte each for checksum size and kind.
205 CurrentOffset += File.Checksum.size();
206 CurrentOffset = alignTo(CurrentOffset, 4);
209 OS.EmitIntValue(File.StringTableOffset, 4);
211 if (!File.ChecksumKind) {
212 // There is no checksum. Therefore zero the next two fields and align
214 OS.EmitIntValue(0, 4);
217 OS.EmitIntValue(static_cast<uint8_t>(File.Checksum.size()), 1);
218 OS.EmitIntValue(File.ChecksumKind, 1);
219 OS.EmitBytes(toStringRef(File.Checksum));
220 OS.EmitValueToAlignment(4);
223 OS.EmitLabel(FileEnd);
225 ChecksumOffsetsAssigned = true;
228 // Output checksum table offset of the given file number. It is possible that
229 // not all files have been registered yet, and so the offset cannot be
230 // calculated. In this case a symbol representing the offset is emitted, and
231 // the value of this symbol will be fixed up at a later time.
232 void CodeViewContext::emitFileChecksumOffset(MCObjectStreamer &OS,
234 unsigned Idx = FileNo - 1;
236 if (Idx >= Files.size())
237 Files.resize(Idx + 1);
239 if (ChecksumOffsetsAssigned) {
240 OS.EmitSymbolValue(Files[Idx].ChecksumTableOffset, 4);
244 const MCSymbolRefExpr *SRE =
245 MCSymbolRefExpr::create(Files[Idx].ChecksumTableOffset, OS.getContext());
247 OS.EmitValueImpl(SRE, 4);
250 void CodeViewContext::emitLineTableForFunction(MCObjectStreamer &OS,
252 const MCSymbol *FuncBegin,
253 const MCSymbol *FuncEnd) {
254 MCContext &Ctx = OS.getContext();
255 MCSymbol *LineBegin = Ctx.createTempSymbol("linetable_begin", false),
256 *LineEnd = Ctx.createTempSymbol("linetable_end", false);
258 OS.EmitIntValue(unsigned(DebugSubsectionKind::Lines), 4);
259 OS.emitAbsoluteSymbolDiff(LineEnd, LineBegin, 4);
260 OS.EmitLabel(LineBegin);
261 OS.EmitCOFFSecRel32(FuncBegin, /*Offset=*/0);
262 OS.EmitCOFFSectionIndex(FuncBegin);
265 std::vector<MCCVLineEntry> Locs = getFunctionLineEntries(FuncId);
266 bool HaveColumns = any_of(Locs, [](const MCCVLineEntry &LineEntry) {
267 return LineEntry.getColumn() != 0;
269 OS.EmitIntValue(HaveColumns ? int(LF_HaveColumns) : 0, 2);
270 OS.emitAbsoluteSymbolDiff(FuncEnd, FuncBegin, 4);
272 for (auto I = Locs.begin(), E = Locs.end(); I != E;) {
273 // Emit a file segment for the run of locations that share a file id.
274 unsigned CurFileNum = I->getFileNum();
276 std::find_if(I, E, [CurFileNum](const MCCVLineEntry &Loc) {
277 return Loc.getFileNum() != CurFileNum;
279 unsigned EntryCount = FileSegEnd - I;
281 "Segment for file '" +
282 Twine(getStringTableFragment()
283 ->getContents()[Files[CurFileNum - 1].StringTableOffset]) +
285 OS.EmitCVFileChecksumOffsetDirective(CurFileNum);
286 OS.EmitIntValue(EntryCount, 4);
287 uint32_t SegmentSize = 12;
288 SegmentSize += 8 * EntryCount;
290 SegmentSize += 4 * EntryCount;
291 OS.EmitIntValue(SegmentSize, 4);
293 for (auto J = I; J != FileSegEnd; ++J) {
294 OS.emitAbsoluteSymbolDiff(J->getLabel(), FuncBegin, 4);
295 unsigned LineData = J->getLine();
297 LineData |= LineInfo::StatementFlag;
298 OS.EmitIntValue(LineData, 4);
301 for (auto J = I; J != FileSegEnd; ++J) {
302 OS.EmitIntValue(J->getColumn(), 2);
303 OS.EmitIntValue(0, 2);
308 OS.EmitLabel(LineEnd);
311 static bool compressAnnotation(uint32_t Data, SmallVectorImpl<char> &Buffer) {
312 if (isUInt<7>(Data)) {
313 Buffer.push_back(Data);
317 if (isUInt<14>(Data)) {
318 Buffer.push_back((Data >> 8) | 0x80);
319 Buffer.push_back(Data & 0xff);
323 if (isUInt<29>(Data)) {
324 Buffer.push_back((Data >> 24) | 0xC0);
325 Buffer.push_back((Data >> 16) & 0xff);
326 Buffer.push_back((Data >> 8) & 0xff);
327 Buffer.push_back(Data & 0xff);
334 static bool compressAnnotation(BinaryAnnotationsOpCode Annotation,
335 SmallVectorImpl<char> &Buffer) {
336 return compressAnnotation(static_cast<uint32_t>(Annotation), Buffer);
339 static uint32_t encodeSignedNumber(uint32_t Data) {
341 return ((-Data) << 1) | 1;
345 void CodeViewContext::emitInlineLineTableForFunction(MCObjectStreamer &OS,
346 unsigned PrimaryFunctionId,
347 unsigned SourceFileId,
348 unsigned SourceLineNum,
349 const MCSymbol *FnStartSym,
350 const MCSymbol *FnEndSym) {
351 // Create and insert a fragment into the current section that will be encoded
353 new MCCVInlineLineTableFragment(PrimaryFunctionId, SourceFileId,
354 SourceLineNum, FnStartSym, FnEndSym,
355 OS.getCurrentSectionOnly());
358 void CodeViewContext::emitDefRange(
359 MCObjectStreamer &OS,
360 ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,
361 StringRef FixedSizePortion) {
362 // Create and insert a fragment into the current section that will be encoded
364 new MCCVDefRangeFragment(Ranges, FixedSizePortion,
365 OS.getCurrentSectionOnly());
368 static unsigned computeLabelDiff(MCAsmLayout &Layout, const MCSymbol *Begin,
369 const MCSymbol *End) {
370 MCContext &Ctx = Layout.getAssembler().getContext();
371 MCSymbolRefExpr::VariantKind Variant = MCSymbolRefExpr::VK_None;
372 const MCExpr *BeginRef = MCSymbolRefExpr::create(Begin, Variant, Ctx),
373 *EndRef = MCSymbolRefExpr::create(End, Variant, Ctx);
374 const MCExpr *AddrDelta =
375 MCBinaryExpr::create(MCBinaryExpr::Sub, EndRef, BeginRef, Ctx);
377 bool Success = AddrDelta->evaluateKnownAbsolute(Result, Layout);
378 assert(Success && "failed to evaluate label difference as absolute");
380 assert(Result >= 0 && "negative label difference requested");
381 assert(Result < UINT_MAX && "label difference greater than 2GB");
382 return unsigned(Result);
385 void CodeViewContext::encodeInlineLineTable(MCAsmLayout &Layout,
386 MCCVInlineLineTableFragment &Frag) {
389 std::tie(LocBegin, LocEnd) = getLineExtent(Frag.SiteFuncId);
391 // Include all child inline call sites in our .cv_loc extent.
392 MCCVFunctionInfo *SiteInfo = getCVFunctionInfo(Frag.SiteFuncId);
393 for (auto &KV : SiteInfo->InlinedAtMap) {
394 unsigned ChildId = KV.first;
395 auto Extent = getLineExtent(ChildId);
396 LocBegin = std::min(LocBegin, Extent.first);
397 LocEnd = std::max(LocEnd, Extent.second);
400 if (LocBegin >= LocEnd)
402 ArrayRef<MCCVLineEntry> Locs = getLinesForExtent(LocBegin, LocEnd);
406 // Make an artificial start location using the function start and the inlinee
407 // lines start location information. All deltas start relative to this
409 MCCVLineEntry StartLoc(Frag.getFnStartSym(), MCCVLoc(Locs.front()));
410 StartLoc.setFileNum(Frag.StartFileId);
411 StartLoc.setLine(Frag.StartLineNum);
412 bool HaveOpenRange = false;
414 const MCSymbol *LastLabel = Frag.getFnStartSym();
415 MCCVFunctionInfo::LineInfo LastSourceLoc, CurSourceLoc;
416 LastSourceLoc.File = Frag.StartFileId;
417 LastSourceLoc.Line = Frag.StartLineNum;
419 SmallVectorImpl<char> &Buffer = Frag.getContents();
420 Buffer.clear(); // Clear old contents if we went through relaxation.
421 for (const MCCVLineEntry &Loc : Locs) {
422 // Exit early if our line table would produce an oversized InlineSiteSym
423 // record. Account for the ChangeCodeLength annotation emitted after the
425 constexpr uint32_t InlineSiteSize = 12;
426 constexpr uint32_t AnnotationSize = 8;
427 size_t MaxBufferSize = MaxRecordLength - InlineSiteSize - AnnotationSize;
428 if (Buffer.size() >= MaxBufferSize)
431 if (Loc.getFunctionId() == Frag.SiteFuncId) {
432 CurSourceLoc.File = Loc.getFileNum();
433 CurSourceLoc.Line = Loc.getLine();
435 auto I = SiteInfo->InlinedAtMap.find(Loc.getFunctionId());
436 if (I != SiteInfo->InlinedAtMap.end()) {
437 // This .cv_loc is from a child inline call site. Use the source
438 // location of the inlined call site instead of the .cv_loc directive
440 CurSourceLoc = I->second;
442 // We've hit a cv_loc not attributed to this inline call site. Use this
443 // label to end the PC range.
445 unsigned Length = computeLabelDiff(Layout, LastLabel, Loc.getLabel());
446 compressAnnotation(BinaryAnnotationsOpCode::ChangeCodeLength, Buffer);
447 compressAnnotation(Length, Buffer);
448 LastLabel = Loc.getLabel();
450 HaveOpenRange = false;
455 // Skip this .cv_loc if we have an open range and this isn't a meaningful
456 // source location update. The current table format does not support column
457 // info, so we can skip updates for those.
458 if (HaveOpenRange && CurSourceLoc.File == LastSourceLoc.File &&
459 CurSourceLoc.Line == LastSourceLoc.Line)
462 HaveOpenRange = true;
464 if (CurSourceLoc.File != LastSourceLoc.File) {
465 unsigned FileOffset = static_cast<const MCConstantExpr *>(
466 Files[CurSourceLoc.File - 1]
467 .ChecksumTableOffset->getVariableValue())
469 compressAnnotation(BinaryAnnotationsOpCode::ChangeFile, Buffer);
470 compressAnnotation(FileOffset, Buffer);
473 int LineDelta = CurSourceLoc.Line - LastSourceLoc.Line;
474 unsigned EncodedLineDelta = encodeSignedNumber(LineDelta);
475 unsigned CodeDelta = computeLabelDiff(Layout, LastLabel, Loc.getLabel());
476 if (CodeDelta == 0 && LineDelta != 0) {
477 compressAnnotation(BinaryAnnotationsOpCode::ChangeLineOffset, Buffer);
478 compressAnnotation(EncodedLineDelta, Buffer);
479 } else if (EncodedLineDelta < 0x8 && CodeDelta <= 0xf) {
480 // The ChangeCodeOffsetAndLineOffset combination opcode is used when the
481 // encoded line delta uses 3 or fewer set bits and the code offset fits
483 unsigned Operand = (EncodedLineDelta << 4) | CodeDelta;
484 compressAnnotation(BinaryAnnotationsOpCode::ChangeCodeOffsetAndLineOffset,
486 compressAnnotation(Operand, Buffer);
488 // Otherwise use the separate line and code deltas.
489 if (LineDelta != 0) {
490 compressAnnotation(BinaryAnnotationsOpCode::ChangeLineOffset, Buffer);
491 compressAnnotation(EncodedLineDelta, Buffer);
493 compressAnnotation(BinaryAnnotationsOpCode::ChangeCodeOffset, Buffer);
494 compressAnnotation(CodeDelta, Buffer);
497 LastLabel = Loc.getLabel();
498 LastSourceLoc = CurSourceLoc;
501 assert(HaveOpenRange);
503 unsigned EndSymLength =
504 computeLabelDiff(Layout, LastLabel, Frag.getFnEndSym());
505 unsigned LocAfterLength = ~0U;
506 ArrayRef<MCCVLineEntry> LocAfter = getLinesForExtent(LocEnd, LocEnd + 1);
507 if (!LocAfter.empty()) {
508 // Only try to compute this difference if we're in the same section.
509 const MCCVLineEntry &Loc = LocAfter[0];
510 if (&Loc.getLabel()->getSection(false) == &LastLabel->getSection(false))
511 LocAfterLength = computeLabelDiff(Layout, LastLabel, Loc.getLabel());
514 compressAnnotation(BinaryAnnotationsOpCode::ChangeCodeLength, Buffer);
515 compressAnnotation(std::min(EndSymLength, LocAfterLength), Buffer);
518 void CodeViewContext::encodeDefRange(MCAsmLayout &Layout,
519 MCCVDefRangeFragment &Frag) {
520 MCContext &Ctx = Layout.getAssembler().getContext();
521 SmallVectorImpl<char> &Contents = Frag.getContents();
523 SmallVectorImpl<MCFixup> &Fixups = Frag.getFixups();
525 raw_svector_ostream OS(Contents);
527 // Compute all the sizes up front.
528 SmallVector<std::pair<unsigned, unsigned>, 4> GapAndRangeSizes;
529 const MCSymbol *LastLabel = nullptr;
530 for (std::pair<const MCSymbol *, const MCSymbol *> Range : Frag.getRanges()) {
532 LastLabel ? computeLabelDiff(Layout, LastLabel, Range.first) : 0;
533 unsigned RangeSize = computeLabelDiff(Layout, Range.first, Range.second);
534 GapAndRangeSizes.push_back({GapSize, RangeSize});
535 LastLabel = Range.second;
538 // Write down each range where the variable is defined.
539 for (size_t I = 0, E = Frag.getRanges().size(); I != E;) {
540 // If the range size of multiple consecutive ranges is under the max,
541 // combine the ranges and emit some gaps.
542 const MCSymbol *RangeBegin = Frag.getRanges()[I].first;
543 unsigned RangeSize = GapAndRangeSizes[I].second;
545 for (; J != E; ++J) {
546 unsigned GapAndRangeSize = GapAndRangeSizes[J].first + GapAndRangeSizes[J].second;
547 if (RangeSize + GapAndRangeSize > MaxDefRange)
549 RangeSize += GapAndRangeSize;
551 unsigned NumGaps = J - I - 1;
553 support::endian::Writer<support::little> LEWriter(OS);
556 // We must split the range into chunks of MaxDefRange, this is a fundamental
557 // limitation of the file format.
559 uint16_t Chunk = std::min((uint32_t)MaxDefRange, RangeSize);
561 const MCSymbolRefExpr *SRE = MCSymbolRefExpr::create(RangeBegin, Ctx);
562 const MCBinaryExpr *BE =
563 MCBinaryExpr::createAdd(SRE, MCConstantExpr::create(Bias, Ctx), Ctx);
565 BE->evaluateAsRelocatable(Res, &Layout, /*Fixup=*/nullptr);
567 // Each record begins with a 2-byte number indicating how large the record
569 StringRef FixedSizePortion = Frag.getFixedSizePortion();
570 // Our record is a fixed sized prefix and a LocalVariableAddrRange that we
571 // are artificially constructing.
572 size_t RecordSize = FixedSizePortion.size() +
573 sizeof(LocalVariableAddrRange) + 4 * NumGaps;
574 // Write out the record size.
575 LEWriter.write<uint16_t>(RecordSize);
576 // Write out the fixed size prefix.
577 OS << FixedSizePortion;
578 // Make space for a fixup that will eventually have a section relative
579 // relocation pointing at the offset where the variable becomes live.
580 Fixups.push_back(MCFixup::create(Contents.size(), BE, FK_SecRel_4));
581 LEWriter.write<uint32_t>(0); // Fixup for code start.
582 // Make space for a fixup that will record the section index for the code.
583 Fixups.push_back(MCFixup::create(Contents.size(), BE, FK_SecRel_2));
584 LEWriter.write<uint16_t>(0); // Fixup for section index.
585 // Write down the range's extent.
586 LEWriter.write<uint16_t>(Chunk);
588 // Move on to the next range.
591 } while (RangeSize > 0);
593 // Emit the gaps afterwards.
594 assert((NumGaps == 0 || Bias <= MaxDefRange) &&
595 "large ranges should not have gaps");
596 unsigned GapStartOffset = GapAndRangeSizes[I].second;
597 for (++I; I != J; ++I) {
598 unsigned GapSize, RangeSize;
599 assert(I < GapAndRangeSizes.size());
600 std::tie(GapSize, RangeSize) = GapAndRangeSizes[I];
601 LEWriter.write<uint16_t>(GapStartOffset);
602 LEWriter.write<uint16_t>(GapSize);
603 GapStartOffset += GapSize + RangeSize;
609 // This is called when an instruction is assembled into the specified section
610 // and if there is information from the last .cv_loc directive that has yet to have
611 // a line entry made for it is made.
613 void MCCVLineEntry::Make(MCObjectStreamer *MCOS) {
614 CodeViewContext &CVC = MCOS->getContext().getCVContext();
615 if (!CVC.getCVLocSeen())
618 // Create a symbol at in the current section for use in the line entry.
619 MCSymbol *LineSym = MCOS->getContext().createTempSymbol();
620 // Set the value of the symbol to use for the MCCVLineEntry.
621 MCOS->EmitLabel(LineSym);
623 // Get the current .loc info saved in the context.
624 const MCCVLoc &CVLoc = CVC.getCurrentCVLoc();
626 // Create a (local) line entry with the symbol and the current .loc info.
627 MCCVLineEntry LineEntry(LineSym, CVLoc);
629 // clear CVLocSeen saying the current .loc info is now used.
630 CVC.clearCVLocSeen();
632 // Add the line entry to this section's entries.
633 CVC.addLineEntry(LineEntry);