Coverage Report

Created: 2025-08-25 07:49

/src/keystone/llvm/lib/MC/MCContext.cpp
Line
Count
Source (jump to first uncovered line)
1
//===- lib/MC/MCContext.cpp - Machine Code Context ------------------------===//
2
//
3
//                     The LLVM Compiler Infrastructure
4
//
5
// This file is distributed under the University of Illinois Open Source
6
// License. See LICENSE.TXT for details.
7
//
8
//===----------------------------------------------------------------------===//
9
10
#include "llvm/MC/MCContext.h"
11
#include "llvm/ADT/SmallString.h"
12
#include "llvm/ADT/Twine.h"
13
#include "llvm/MC/MCAssembler.h"
14
#include "llvm/MC/MCAsmInfo.h"
15
#include "llvm/MC/MCCodeView.h"
16
#include "llvm/MC/MCDwarf.h"
17
#include "llvm/MC/MCLabel.h"
18
#include "llvm/MC/MCObjectFileInfo.h"
19
#include "llvm/MC/MCRegisterInfo.h"
20
#include "llvm/MC/MCSectionCOFF.h"
21
#include "llvm/MC/MCSectionELF.h"
22
#include "llvm/MC/MCSectionMachO.h"
23
#include "llvm/MC/MCStreamer.h"
24
#include "llvm/MC/MCSymbolCOFF.h"
25
#include "llvm/MC/MCSymbolELF.h"
26
#include "llvm/MC/MCSymbolMachO.h"
27
#include "llvm/Support/COFF.h"
28
#include "llvm/Support/ELF.h"
29
#include "llvm/Support/ErrorHandling.h"
30
#include "llvm/Support/FileSystem.h"
31
#include "llvm/Support/MemoryBuffer.h"
32
#include "llvm/Support/SourceMgr.h"
33
#include <map>
34
35
using namespace llvm_ks;
36
37
MCContext::MCContext(const MCAsmInfo *mai, const MCRegisterInfo *mri,
38
                     const MCObjectFileInfo *mofi, const SourceMgr *mgr,
39
                     bool DoAutoReset, uint64_t BaseAddr)
40
133k
    : SrcMgr(mgr), MAI(mai), MRI(mri), MOFI(mofi), Allocator(),
41
133k
      Symbols(Allocator), UsedNames(Allocator),
42
133k
      CurrentDwarfLoc(0, 0, 0, DWARF2_FLAG_IS_STMT, 0, 0), DwarfLocSeen(false),
43
133k
      GenDwarfForAssembly(false), GenDwarfFileNumber(0), DwarfVersion(4),
44
133k
      AllowTemporaryLabels(true), DwarfCompileUnitID(0),
45
133k
      AutoReset(DoAutoReset), HadError(false), BaseAddress(BaseAddr) {
46
47
133k
  std::error_code EC = llvm_ks::sys::fs::current_path(CompilationDir);
48
133k
  if (EC)
49
0
    CompilationDir.clear();
50
51
133k
  SecureLogFile = getenv("AS_SECURE_LOG_FILE");
52
133k
  SecureLog = nullptr;
53
133k
  SecureLogUsed = false;
54
55
133k
  if (SrcMgr && SrcMgr->getNumBuffers())
56
0
    MainFileName =
57
0
        SrcMgr->getMemoryBuffer(SrcMgr->getMainFileID())->getBufferIdentifier();
58
133k
}
59
60
133k
MCContext::~MCContext() {
61
133k
  if (AutoReset)
62
133k
    reset();
63
64
  // NOTE: The symbols are all allocated out of a bump pointer allocator,
65
  // we don't need to free them here.
66
133k
}
67
68
//===----------------------------------------------------------------------===//
69
// Module Lifetime Management
70
//===----------------------------------------------------------------------===//
71
72
133k
void MCContext::reset() {
73
  // Call the destructors so the fragments are freed
74
133k
  COFFAllocator.DestroyAll();
75
133k
  ELFAllocator.DestroyAll();
76
133k
  MachOAllocator.DestroyAll();
77
78
133k
  MCSubtargetAllocator.DestroyAll();
79
133k
  UsedNames.clear();
80
133k
  Symbols.clear();
81
133k
  SectionSymbols.clear();
82
133k
  Allocator.Reset();
83
133k
  Instances.clear();
84
133k
  CompilationDir.clear();
85
133k
  MainFileName.clear();
86
133k
  MCDwarfLineTablesCUMap.clear();
87
133k
  SectionsForRanges.clear();
88
133k
  MCGenDwarfLabelEntries.clear();
89
133k
  DwarfDebugFlags = StringRef();
90
133k
  DwarfCompileUnitID = 0;
91
133k
  CurrentDwarfLoc = MCDwarfLoc(0, 0, 0, DWARF2_FLAG_IS_STMT, 0, 0);
92
93
133k
  MachOUniquingMap.clear();
94
133k
  ELFUniquingMap.clear();
95
133k
  COFFUniquingMap.clear();
96
97
133k
  NextID.clear();
98
133k
  AllowTemporaryLabels = true;
99
133k
  DwarfLocSeen = false;
100
133k
  GenDwarfForAssembly = false;
101
133k
  GenDwarfFileNumber = 0;
102
103
133k
  HadError = false;
104
133k
}
105
106
//===----------------------------------------------------------------------===//
107
// Symbol Manipulation
108
//===----------------------------------------------------------------------===//
109
110
1.94M
MCSymbol *MCContext::getOrCreateSymbol(const Twine &Name) {
111
1.94M
  SmallString<128> NameSV;
112
1.94M
  StringRef NameRef = Name.toStringRef(NameSV);
113
114
1.94M
  assert(!NameRef.empty() && "Normal symbols cannot be unnamed!");
115
116
1.94M
  MCSymbol *&Sym = Symbols[NameRef];
117
1.94M
  if (!Sym)
118
139k
    Sym = createSymbol(NameRef, false, false);
119
120
1.94M
  return Sym;
121
1.94M
}
122
123
136k
MCSymbolELF *MCContext::getOrCreateSectionSymbol(const MCSectionELF &Section) {
124
136k
  MCSymbolELF *&Sym = SectionSymbols[&Section];
125
136k
  if (Sym)
126
0
    return Sym;
127
128
136k
  StringRef Name = Section.getSectionName();
129
130
136k
  MCSymbol *&OldSym = Symbols[Name];
131
136k
  if (OldSym && OldSym->isUndefined()) {
132
0
    Sym = cast<MCSymbolELF>(OldSym);
133
0
    return Sym;
134
0
  }
135
136
136k
  auto NameIter = UsedNames.insert(std::make_pair(Name, true)).first;
137
136k
  Sym = new (&*NameIter, *this) MCSymbolELF(&*NameIter, /*isTemporary*/ false);
138
139
136k
  if (!OldSym)
140
135k
    OldSym = Sym;
141
142
136k
  return Sym;
143
136k
}
144
145
MCSymbol *MCContext::getOrCreateFrameAllocSymbol(StringRef FuncName,
146
0
                                                 unsigned Idx) {
147
0
  return getOrCreateSymbol(Twine(MAI->getPrivateGlobalPrefix()) + FuncName +
148
0
                           "$frame_escape_" + Twine(Idx));
149
0
}
150
151
0
MCSymbol *MCContext::getOrCreateParentFrameOffsetSymbol(StringRef FuncName) {
152
0
  return getOrCreateSymbol(Twine(MAI->getPrivateGlobalPrefix()) + FuncName +
153
0
                           "$parent_frame_offset");
154
0
}
155
156
0
MCSymbol *MCContext::getOrCreateLSDASymbol(StringRef FuncName) {
157
0
  return getOrCreateSymbol(Twine(MAI->getPrivateGlobalPrefix()) + "__ehtable$" +
158
0
                           FuncName);
159
0
}
160
161
MCSymbol *MCContext::createSymbolImpl(const StringMapEntry<bool> *Name,
162
2.28M
                                      bool IsTemporary) {
163
2.28M
  if (MOFI) {
164
2.28M
    switch (MOFI->getObjectFileType()) {
165
0
    case MCObjectFileInfo::IsCOFF:
166
0
      return new (Name, *this) MCSymbolCOFF(Name, IsTemporary);
167
2.28M
    case MCObjectFileInfo::IsELF:
168
2.28M
      return new (Name, *this) MCSymbolELF(Name, IsTemporary);
169
0
    case MCObjectFileInfo::IsMachO:
170
0
      return new (Name, *this) MCSymbolMachO(Name, IsTemporary);
171
2.28M
    }
172
2.28M
  }
173
0
  return new (Name, *this) MCSymbol(MCSymbol::SymbolKindUnset, Name,
174
0
                                    IsTemporary);
175
2.28M
}
176
177
MCSymbol *MCContext::createSymbol(StringRef Name, bool AlwaysAddSuffix,
178
2.28M
                                  bool CanBeUnnamed) {
179
2.28M
  if (CanBeUnnamed && !UseNamesOnTempLabels)
180
0
    return createSymbolImpl(nullptr, true);
181
182
  // Determine whether this is an user writter assembler temporary or normal
183
  // label, if used.
184
2.28M
  bool IsTemporary = CanBeUnnamed;
185
2.28M
  if (AllowTemporaryLabels && !IsTemporary)
186
139k
    IsTemporary = Name.startswith(MAI->getPrivateGlobalPrefix());
187
188
2.28M
  SmallString<128> NewName = Name;
189
2.28M
  bool AddSuffix = AlwaysAddSuffix;
190
2.28M
  unsigned &NextUniqueID = NextID[Name];
191
2.28M
  for (;;) {
192
2.28M
    if (AddSuffix) {
193
815k
      NewName.resize(Name.size());
194
815k
      raw_svector_ostream(NewName) << NextUniqueID++;
195
815k
    }
196
2.28M
    auto NameEntry = UsedNames.insert(std::make_pair(NewName, true));
197
2.28M
    if (NameEntry.second) {
198
      // Ok, we found a name. Have the MCSymbol object itself refer to the copy
199
      // of the string that is embedded in the UsedNames entry.
200
2.28M
      return createSymbolImpl(&*NameEntry.first, IsTemporary);
201
2.28M
    }
202
0
    assert(IsTemporary && "Cannot rename non-temporary symbols");
203
0
    AddSuffix = true;
204
0
  }
205
2.28M
  llvm_unreachable("Infinite loop");
206
2.28M
}
207
208
MCSymbol *MCContext::createTempSymbol(const Twine &Name, bool AlwaysAddSuffix,
209
2.14M
                                      bool CanBeUnnamed) {
210
2.14M
  SmallString<128> NameSV;
211
2.14M
  raw_svector_ostream(NameSV) << MAI->getPrivateGlobalPrefix() << Name;
212
2.14M
  return createSymbol(NameSV, AlwaysAddSuffix, CanBeUnnamed);
213
2.14M
}
214
215
0
MCSymbol *MCContext::createLinkerPrivateTempSymbol() {
216
0
  SmallString<128> NameSV;
217
0
  raw_svector_ostream(NameSV) << MAI->getLinkerPrivateGlobalPrefix() << "tmp";
218
0
  return createSymbol(NameSV, true, false);
219
0
}
220
221
815k
MCSymbol *MCContext::createTempSymbol(bool CanBeUnnamed) {
222
815k
  return createTempSymbol("tmp", true, CanBeUnnamed);
223
815k
}
224
225
unsigned MCContext::NextInstance(unsigned LocalLabelVal, bool &valid)
226
379
{
227
379
  if (LocalLabelVal >= Instances.size()) {
228
379
      valid = false;
229
379
      return 0;
230
379
  }
231
0
  MCLabel *&Label = Instances[LocalLabelVal];
232
0
  if (!Label)
233
0
    Label = new (*this) MCLabel(0);
234
0
  return Label->incInstance();
235
379
}
236
237
unsigned MCContext::GetInstance(unsigned LocalLabelVal, bool &valid)
238
4.19k
{
239
4.19k
  if (LocalLabelVal >= Instances.size()) {
240
4.19k
      valid = false;
241
4.19k
      return 0;
242
4.19k
  }
243
0
  MCLabel *&Label = Instances[LocalLabelVal];
244
0
  if (!Label)
245
0
    Label = new (*this) MCLabel(0);
246
0
  return Label->getInstance();
247
4.19k
}
248
249
MCSymbol *MCContext::getOrCreateDirectionalLocalSymbol(unsigned LocalLabelVal,
250
0
                                                       unsigned Instance) {
251
0
  MCSymbol *&Sym = LocalSymbols[std::make_pair(LocalLabelVal, Instance)];
252
0
  if (!Sym)
253
0
    Sym = createTempSymbol(false);
254
0
  return Sym;
255
0
}
256
257
MCSymbol *MCContext::createDirectionalLocalSymbol(unsigned LocalLabelVal, bool &valid)
258
379
{
259
379
  valid = true;
260
379
  unsigned Instance = NextInstance(LocalLabelVal, valid);
261
379
  if (!valid)
262
379
      return nullptr;
263
0
  return getOrCreateDirectionalLocalSymbol(LocalLabelVal, Instance);
264
379
}
265
266
MCSymbol *MCContext::getDirectionalLocalSymbol(unsigned LocalLabelVal,
267
                                               bool Before, bool &valid)
268
4.19k
{
269
4.19k
  valid = true;
270
4.19k
  unsigned Instance = GetInstance(LocalLabelVal, valid);
271
4.19k
  if (!valid)
272
4.19k
      return nullptr;
273
0
  if (!Before)
274
0
    ++Instance;
275
0
  return getOrCreateDirectionalLocalSymbol(LocalLabelVal, Instance);
276
4.19k
}
277
278
905k
MCSymbol *MCContext::lookupSymbol(const Twine &Name) const {
279
905k
  SmallString<128> NameSV;
280
905k
  StringRef NameRef = Name.toStringRef(NameSV);
281
905k
  return Symbols.lookup(NameRef);
282
905k
}
283
284
//===----------------------------------------------------------------------===//
285
// Section Management
286
//===----------------------------------------------------------------------===//
287
288
MCSectionMachO *MCContext::getMachOSection(StringRef Segment, StringRef Section,
289
                                           unsigned TypeAndAttributes,
290
                                           unsigned Reserved2, SectionKind Kind,
291
1.06M
                                           const char *BeginSymName) {
292
293
  // We unique sections by their segment/section pair.  The returned section
294
  // may not have the same flags as the requested section, if so this should be
295
  // diagnosed by the client as an error.
296
297
  // Form the name to look up.
298
1.06M
  SmallString<64> Name;
299
1.06M
  Name += Segment;
300
1.06M
  Name.push_back(',');
301
1.06M
  Name += Section;
302
303
  // Do the lookup, if we have a hit, return it.
304
1.06M
  MCSectionMachO *&Entry = MachOUniquingMap[Name];
305
1.06M
  if (Entry)
306
1.06M
    return Entry;
307
308
2.90k
  MCSymbol *Begin = nullptr;
309
2.90k
  if (BeginSymName)
310
0
    Begin = createTempSymbol(BeginSymName, false);
311
312
  // Otherwise, return a new section.
313
2.90k
  return Entry = new (MachOAllocator.Allocate()) MCSectionMachO(
314
2.90k
             Segment, Section, TypeAndAttributes, Reserved2, Kind, Begin);
315
1.06M
}
316
317
0
void MCContext::renameELFSection(MCSectionELF *Section, StringRef Name) {
318
0
  StringRef GroupName;
319
0
  if (const MCSymbol *Group = Section->getGroup())
320
0
    GroupName = Group->getName();
321
322
0
  unsigned UniqueID = Section->getUniqueID();
323
0
  ELFUniquingMap.erase(
324
0
      ELFSectionKey{Section->getSectionName(), GroupName, UniqueID});
325
0
  auto I = ELFUniquingMap.insert(std::make_pair(
326
0
                                     ELFSectionKey{Name, GroupName, UniqueID},
327
0
                                     Section))
328
0
               .first;
329
0
  StringRef CachedName = I->first.SectionName;
330
0
  const_cast<MCSectionELF *>(Section)->setSectionName(CachedName);
331
0
}
332
333
MCSectionELF *MCContext::createELFRelSection(StringRef Name, unsigned Type,
334
                                             unsigned Flags, unsigned EntrySize,
335
                                             const MCSymbolELF *Group,
336
1.45k
                                             const MCSectionELF *Associated) {
337
1.45k
  StringMap<bool>::iterator I;
338
1.45k
  bool Inserted;
339
1.45k
  std::tie(I, Inserted) = ELFRelSecNames.insert(std::make_pair(Name, true));
340
341
1.45k
  return new (ELFAllocator.Allocate())
342
1.45k
      MCSectionELF(I->getKey(), Type, Flags, SectionKind::getReadOnly(),
343
1.45k
                   EntrySize, Group, true, nullptr, Associated);
344
1.45k
}
345
346
MCSectionELF *MCContext::getELFSection(StringRef Section, unsigned Type,
347
                                       unsigned Flags, unsigned EntrySize,
348
                                       StringRef Group, unsigned UniqueID,
349
5.78M
                                       const char *BeginSymName) {
350
5.78M
  MCSymbolELF *GroupSym = nullptr;
351
5.78M
  if (!Group.empty())
352
0
    GroupSym = cast<MCSymbolELF>(getOrCreateSymbol(Group));
353
354
5.78M
  return getELFSection(Section, Type, Flags, EntrySize, GroupSym, UniqueID,
355
5.78M
                       BeginSymName, nullptr);
356
5.78M
}
357
358
MCSectionELF *MCContext::getELFSection(StringRef Section, unsigned Type,
359
                                       unsigned Flags, unsigned EntrySize,
360
                                       const MCSymbolELF *GroupSym,
361
                                       unsigned UniqueID,
362
                                       const char *BeginSymName,
363
5.78M
                                       const MCSectionELF *Associated) {
364
5.78M
  StringRef Group = "";
365
5.78M
  if (GroupSym)
366
0
    Group = GroupSym->getName();
367
  // Do the lookup, if we have a hit, return it.
368
5.78M
  auto IterBool = ELFUniquingMap.insert(
369
5.78M
      std::make_pair(ELFSectionKey{Section, Group, UniqueID}, nullptr));
370
5.78M
  auto &Entry = *IterBool.first;
371
5.78M
  if (!IterBool.second)
372
431
    return Entry.second;
373
374
5.78M
  StringRef CachedName = Entry.first.SectionName;
375
376
5.78M
  SectionKind Kind;
377
5.78M
  if (Flags & ELF::SHF_EXECINSTR)
378
133k
    Kind = SectionKind::getText();
379
5.65M
  else
380
5.65M
    Kind = SectionKind::getReadOnly();
381
382
5.78M
  MCSymbol *Begin = nullptr;
383
5.78M
  if (BeginSymName)
384
1.33M
    Begin = createTempSymbol(BeginSymName, false);
385
386
5.78M
  MCSectionELF *Result = new (ELFAllocator.Allocate())
387
5.78M
      MCSectionELF(CachedName, Type, Flags, Kind, EntrySize, GroupSym, UniqueID,
388
5.78M
                   Begin, Associated);
389
5.78M
  Entry.second = Result;
390
5.78M
  return Result;
391
5.78M
}
392
393
0
MCSectionELF *MCContext::createELFGroupSection(const MCSymbolELF *Group) {
394
0
  MCSectionELF *Result = new (ELFAllocator.Allocate())
395
0
      MCSectionELF(".group", ELF::SHT_GROUP, 0, SectionKind::getReadOnly(), 4,
396
0
                   Group, ~0, nullptr, nullptr);
397
0
  return Result;
398
0
}
399
400
MCSectionCOFF *MCContext::getCOFFSection(StringRef Section,
401
                                         unsigned Characteristics,
402
                                         SectionKind Kind,
403
                                         StringRef COMDATSymName, int Selection,
404
0
                                         const char *BeginSymName) {
405
0
  MCSymbol *COMDATSymbol = nullptr;
406
0
  if (!COMDATSymName.empty()) {
407
0
    COMDATSymbol = getOrCreateSymbol(COMDATSymName);
408
0
    COMDATSymName = COMDATSymbol->getName();
409
0
  }
410
411
  // Do the lookup, if we have a hit, return it.
412
0
  COFFSectionKey T{Section, COMDATSymName, Selection};
413
0
  auto IterBool = COFFUniquingMap.insert(std::make_pair(T, nullptr));
414
0
  auto Iter = IterBool.first;
415
0
  if (!IterBool.second)
416
0
    return Iter->second;
417
418
0
  MCSymbol *Begin = nullptr;
419
0
  if (BeginSymName)
420
0
    Begin = createTempSymbol(BeginSymName, false);
421
422
0
  StringRef CachedName = Iter->first.SectionName;
423
0
  MCSectionCOFF *Result = new (COFFAllocator.Allocate()) MCSectionCOFF(
424
0
      CachedName, Characteristics, COMDATSymbol, Selection, Kind, Begin);
425
426
0
  Iter->second = Result;
427
0
  return Result;
428
0
}
429
430
MCSectionCOFF *MCContext::getCOFFSection(StringRef Section,
431
                                         unsigned Characteristics,
432
                                         SectionKind Kind,
433
0
                                         const char *BeginSymName) {
434
0
  return getCOFFSection(Section, Characteristics, Kind, "", 0, BeginSymName);
435
0
}
436
437
0
MCSectionCOFF *MCContext::getCOFFSection(StringRef Section) {
438
0
  COFFSectionKey T{Section, "", 0};
439
0
  auto Iter = COFFUniquingMap.find(T);
440
0
  if (Iter == COFFUniquingMap.end())
441
0
    return nullptr;
442
0
  return Iter->second;
443
0
}
444
445
MCSectionCOFF *MCContext::getAssociativeCOFFSection(MCSectionCOFF *Sec,
446
0
                                                    const MCSymbol *KeySym) {
447
  // Return the normal section if we don't have to be associative.
448
0
  if (!KeySym)
449
0
    return Sec;
450
451
  // Make an associative section with the same name and kind as the normal
452
  // section.
453
0
  unsigned Characteristics =
454
0
      Sec->getCharacteristics() | COFF::IMAGE_SCN_LNK_COMDAT;
455
0
  return getCOFFSection(Sec->getSectionName(), Characteristics, Sec->getKind(),
456
0
                        KeySym->getName(),
457
0
                        COFF::IMAGE_COMDAT_SELECT_ASSOCIATIVE);
458
0
}
459
460
150k
MCSubtargetInfo &MCContext::getSubtargetCopy(const MCSubtargetInfo &STI) {
461
150k
  return *new (MCSubtargetAllocator.Allocate()) MCSubtargetInfo(STI);
462
150k
}
463
464
//===----------------------------------------------------------------------===//
465
// Dwarf Management
466
//===----------------------------------------------------------------------===//
467
468
/// getDwarfFile - takes a file name an number to place in the dwarf file and
469
/// directory tables.  If the file number has already been allocated it is an
470
/// error and zero is returned and the client reports the error, else the
471
/// allocated file number is returned.  The file numbers may be in any order.
472
unsigned MCContext::getDwarfFile(StringRef Directory, StringRef FileName,
473
306
                                 unsigned FileNumber, unsigned CUID) {
474
306
  return 0;
475
306
}
476
477
/// isValidDwarfFileNumber - takes a dwarf file number and returns true if it
478
/// currently is assigned and false otherwise.
479
345
bool MCContext::isValidDwarfFileNumber(unsigned FileNumber, unsigned CUID) {
480
345
  const SmallVectorImpl<MCDwarfFile> &MCDwarfFiles = getMCDwarfFiles(CUID);
481
345
  if (FileNumber == 0 || FileNumber >= MCDwarfFiles.size())
482
345
    return false;
483
484
0
  return !MCDwarfFiles[FileNumber].Name.empty();
485
345
}
486
487
/// Remove empty sections from SectionStartEndSyms, to avoid generating
488
/// useless debug info for them.
489
0
void MCContext::finalizeDwarfSections(MCStreamer &MCOS) {
490
0
  SectionsForRanges.remove_if(
491
0
      [&](MCSection *Sec) { return !MCOS.mayHaveInstructions(*Sec); });
492
0
}
493
494
0
unsigned MCContext::getCVFile(StringRef FileName, unsigned FileNumber) {
495
0
  return 0;
496
0
}
497
498
0
bool MCContext::isValidCVFileNumber(unsigned FileNumber) {
499
0
  return true;
500
0
}
501
502
//===----------------------------------------------------------------------===//
503
// Error Reporting
504
//===----------------------------------------------------------------------===//
505
506
70.1k
void MCContext::reportError(SMLoc Loc, const Twine &Msg) {
507
70.1k
  HadError = true;
508
509
  // If we have a source manager use it. Otherwise just use the generic
510
  // report_fatal_error().
511
70.1k
  if (!SrcMgr)
512
0
    report_fatal_error(Msg, false);
513
514
  // Use the source manager to print the message.
515
70.1k
  SrcMgr->PrintMessage(Loc, SourceMgr::DK_Error, Msg);
516
70.1k
}
517
518
0
void MCContext::reportFatalError(SMLoc Loc, const Twine &Msg) {
519
0
  reportError(Loc, Msg);
520
521
  // If we reached here, we are failing ungracefully. Run the interrupt handlers
522
  // to make sure any special cleanups get done, in particular that we remove
523
  // files registered with RemoveFileOnSignal.
524
  // sys::RunInterruptHandlers();
525
0
  exit(1);
526
0
}