1 //===- lib/MC/MCContext.cpp - Machine Code Context ------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #include "llvm/MC/MCContext.h"
10 #include "llvm/ADT/Optional.h"
11 #include "llvm/ADT/SmallString.h"
12 #include "llvm/ADT/SmallVector.h"
13 #include "llvm/ADT/StringMap.h"
14 #include "llvm/ADT/StringRef.h"
15 #include "llvm/ADT/Twine.h"
16 #include "llvm/BinaryFormat/COFF.h"
17 #include "llvm/BinaryFormat/ELF.h"
18 #include "llvm/MC/MCAsmInfo.h"
19 #include "llvm/MC/MCCodeView.h"
20 #include "llvm/MC/MCDwarf.h"
21 #include "llvm/MC/MCExpr.h"
22 #include "llvm/MC/MCFragment.h"
23 #include "llvm/MC/MCLabel.h"
24 #include "llvm/MC/MCObjectFileInfo.h"
25 #include "llvm/MC/MCSectionCOFF.h"
26 #include "llvm/MC/MCSectionELF.h"
27 #include "llvm/MC/MCSectionMachO.h"
28 #include "llvm/MC/MCSectionWasm.h"
29 #include "llvm/MC/MCStreamer.h"
30 #include "llvm/MC/MCSymbol.h"
31 #include "llvm/MC/MCSymbolCOFF.h"
32 #include "llvm/MC/MCSymbolELF.h"
33 #include "llvm/MC/MCSymbolMachO.h"
34 #include "llvm/MC/MCSymbolWasm.h"
35 #include "llvm/MC/SectionKind.h"
36 #include "llvm/Support/Casting.h"
37 #include "llvm/Support/CommandLine.h"
38 #include "llvm/Support/ErrorHandling.h"
39 #include "llvm/Support/MemoryBuffer.h"
40 #include "llvm/Support/Signals.h"
41 #include "llvm/Support/SourceMgr.h"
42 #include "llvm/Support/raw_ostream.h"
51 AsSecureLogFileName("as-secure-log-file-name",
52 cl::desc("As secure log file name (initialized from "
53 "AS_SECURE_LOG_FILE env variable)"),
54 cl::init(getenv("AS_SECURE_LOG_FILE")), cl::Hidden
);
56 MCContext::MCContext(const MCAsmInfo
*mai
, const MCRegisterInfo
*mri
,
57 const MCObjectFileInfo
*mofi
, const SourceMgr
*mgr
,
59 : SrcMgr(mgr
), InlineSrcMgr(nullptr), MAI(mai
), MRI(mri
), MOFI(mofi
),
60 Symbols(Allocator
), UsedNames(Allocator
),
61 CurrentDwarfLoc(0, 0, 0, DWARF2_FLAG_IS_STMT
, 0, 0),
62 AutoReset(DoAutoReset
) {
63 SecureLogFile
= AsSecureLogFileName
;
65 if (SrcMgr
&& SrcMgr
->getNumBuffers())
67 SrcMgr
->getMemoryBuffer(SrcMgr
->getMainFileID())->getBufferIdentifier();
70 MCContext::~MCContext() {
74 // NOTE: The symbols are all allocated out of a bump pointer allocator,
75 // we don't need to free them here.
78 //===----------------------------------------------------------------------===//
79 // Module Lifetime Management
80 //===----------------------------------------------------------------------===//
82 void MCContext::reset() {
83 // Call the destructors so the fragments are freed
84 COFFAllocator
.DestroyAll();
85 ELFAllocator
.DestroyAll();
86 MachOAllocator
.DestroyAll();
88 MCSubtargetAllocator
.DestroyAll();
93 CompilationDir
.clear();
95 MCDwarfLineTablesCUMap
.clear();
96 SectionsForRanges
.clear();
97 MCGenDwarfLabelEntries
.clear();
98 DwarfDebugFlags
= StringRef();
99 DwarfCompileUnitID
= 0;
100 CurrentDwarfLoc
= MCDwarfLoc(0, 0, 0, DWARF2_FLAG_IS_STMT
, 0, 0);
104 MachOUniquingMap
.clear();
105 ELFUniquingMap
.clear();
106 COFFUniquingMap
.clear();
107 WasmUniquingMap
.clear();
110 AllowTemporaryLabels
= true;
111 DwarfLocSeen
= false;
112 GenDwarfForAssembly
= false;
113 GenDwarfFileNumber
= 0;
118 //===----------------------------------------------------------------------===//
119 // Symbol Manipulation
120 //===----------------------------------------------------------------------===//
122 MCSymbol
*MCContext::getOrCreateSymbol(const Twine
&Name
) {
123 SmallString
<128> NameSV
;
124 StringRef NameRef
= Name
.toStringRef(NameSV
);
126 assert(!NameRef
.empty() && "Normal symbols cannot be unnamed!");
128 MCSymbol
*&Sym
= Symbols
[NameRef
];
130 Sym
= createSymbol(NameRef
, false, false);
135 MCSymbol
*MCContext::getOrCreateFrameAllocSymbol(StringRef FuncName
,
137 return getOrCreateSymbol(Twine(MAI
->getPrivateGlobalPrefix()) + FuncName
+
138 "$frame_escape_" + Twine(Idx
));
141 MCSymbol
*MCContext::getOrCreateParentFrameOffsetSymbol(StringRef FuncName
) {
142 return getOrCreateSymbol(Twine(MAI
->getPrivateGlobalPrefix()) + FuncName
+
143 "$parent_frame_offset");
146 MCSymbol
*MCContext::getOrCreateLSDASymbol(StringRef FuncName
) {
147 return getOrCreateSymbol(Twine(MAI
->getPrivateGlobalPrefix()) + "__ehtable$" +
151 MCSymbol
*MCContext::createSymbolImpl(const StringMapEntry
<bool> *Name
,
154 switch (MOFI
->getObjectFileType()) {
155 case MCObjectFileInfo::IsCOFF
:
156 return new (Name
, *this) MCSymbolCOFF(Name
, IsTemporary
);
157 case MCObjectFileInfo::IsELF
:
158 return new (Name
, *this) MCSymbolELF(Name
, IsTemporary
);
159 case MCObjectFileInfo::IsMachO
:
160 return new (Name
, *this) MCSymbolMachO(Name
, IsTemporary
);
161 case MCObjectFileInfo::IsWasm
:
162 return new (Name
, *this) MCSymbolWasm(Name
, IsTemporary
);
165 return new (Name
, *this) MCSymbol(MCSymbol::SymbolKindUnset
, Name
,
169 MCSymbol
*MCContext::createSymbol(StringRef Name
, bool AlwaysAddSuffix
,
171 if (CanBeUnnamed
&& !UseNamesOnTempLabels
)
172 return createSymbolImpl(nullptr, true);
174 // Determine whether this is a user written assembler temporary or normal
176 bool IsTemporary
= CanBeUnnamed
;
177 if (AllowTemporaryLabels
&& !IsTemporary
)
178 IsTemporary
= Name
.startswith(MAI
->getPrivateGlobalPrefix());
180 SmallString
<128> NewName
= Name
;
181 bool AddSuffix
= AlwaysAddSuffix
;
182 unsigned &NextUniqueID
= NextID
[Name
];
185 NewName
.resize(Name
.size());
186 raw_svector_ostream(NewName
) << NextUniqueID
++;
188 auto NameEntry
= UsedNames
.insert(std::make_pair(NewName
, true));
189 if (NameEntry
.second
|| !NameEntry
.first
->second
) {
190 // Ok, we found a name.
191 // Mark it as used for a non-section symbol.
192 NameEntry
.first
->second
= true;
193 // Have the MCSymbol object itself refer to the copy of the string that is
194 // embedded in the UsedNames entry.
195 return createSymbolImpl(&*NameEntry
.first
, IsTemporary
);
197 assert(IsTemporary
&& "Cannot rename non-temporary symbols");
200 llvm_unreachable("Infinite loop");
203 MCSymbol
*MCContext::createTempSymbol(const Twine
&Name
, bool AlwaysAddSuffix
,
205 SmallString
<128> NameSV
;
206 raw_svector_ostream(NameSV
) << MAI
->getPrivateGlobalPrefix() << Name
;
207 return createSymbol(NameSV
, AlwaysAddSuffix
, CanBeUnnamed
);
210 MCSymbol
*MCContext::createLinkerPrivateTempSymbol() {
211 SmallString
<128> NameSV
;
212 raw_svector_ostream(NameSV
) << MAI
->getLinkerPrivateGlobalPrefix() << "tmp";
213 return createSymbol(NameSV
, true, false);
216 MCSymbol
*MCContext::createTempSymbol(bool CanBeUnnamed
) {
217 return createTempSymbol("tmp", true, CanBeUnnamed
);
220 unsigned MCContext::NextInstance(unsigned LocalLabelVal
) {
221 MCLabel
*&Label
= Instances
[LocalLabelVal
];
223 Label
= new (*this) MCLabel(0);
224 return Label
->incInstance();
227 unsigned MCContext::GetInstance(unsigned LocalLabelVal
) {
228 MCLabel
*&Label
= Instances
[LocalLabelVal
];
230 Label
= new (*this) MCLabel(0);
231 return Label
->getInstance();
234 MCSymbol
*MCContext::getOrCreateDirectionalLocalSymbol(unsigned LocalLabelVal
,
236 MCSymbol
*&Sym
= LocalSymbols
[std::make_pair(LocalLabelVal
, Instance
)];
238 Sym
= createTempSymbol(false);
242 MCSymbol
*MCContext::createDirectionalLocalSymbol(unsigned LocalLabelVal
) {
243 unsigned Instance
= NextInstance(LocalLabelVal
);
244 return getOrCreateDirectionalLocalSymbol(LocalLabelVal
, Instance
);
247 MCSymbol
*MCContext::getDirectionalLocalSymbol(unsigned LocalLabelVal
,
249 unsigned Instance
= GetInstance(LocalLabelVal
);
252 return getOrCreateDirectionalLocalSymbol(LocalLabelVal
, Instance
);
255 MCSymbol
*MCContext::lookupSymbol(const Twine
&Name
) const {
256 SmallString
<128> NameSV
;
257 StringRef NameRef
= Name
.toStringRef(NameSV
);
258 return Symbols
.lookup(NameRef
);
261 void MCContext::setSymbolValue(MCStreamer
&Streamer
,
264 auto Symbol
= getOrCreateSymbol(Sym
);
265 Streamer
.EmitAssignment(Symbol
, MCConstantExpr::create(Val
, *this));
268 //===----------------------------------------------------------------------===//
269 // Section Management
270 //===----------------------------------------------------------------------===//
272 MCSectionMachO
*MCContext::getMachOSection(StringRef Segment
, StringRef Section
,
273 unsigned TypeAndAttributes
,
274 unsigned Reserved2
, SectionKind Kind
,
275 const char *BeginSymName
) {
276 // We unique sections by their segment/section pair. The returned section
277 // may not have the same flags as the requested section, if so this should be
278 // diagnosed by the client as an error.
280 // Form the name to look up.
281 SmallString
<64> Name
;
286 // Do the lookup, if we have a hit, return it.
287 MCSectionMachO
*&Entry
= MachOUniquingMap
[Name
];
291 MCSymbol
*Begin
= nullptr;
293 Begin
= createTempSymbol(BeginSymName
, false);
295 // Otherwise, return a new section.
296 return Entry
= new (MachOAllocator
.Allocate()) MCSectionMachO(
297 Segment
, Section
, TypeAndAttributes
, Reserved2
, Kind
, Begin
);
300 void MCContext::renameELFSection(MCSectionELF
*Section
, StringRef Name
) {
302 if (const MCSymbol
*Group
= Section
->getGroup())
303 GroupName
= Group
->getName();
305 unsigned UniqueID
= Section
->getUniqueID();
306 ELFUniquingMap
.erase(
307 ELFSectionKey
{Section
->getSectionName(), GroupName
, UniqueID
});
308 auto I
= ELFUniquingMap
.insert(std::make_pair(
309 ELFSectionKey
{Name
, GroupName
, UniqueID
},
312 StringRef CachedName
= I
->first
.SectionName
;
313 const_cast<MCSectionELF
*>(Section
)->setSectionName(CachedName
);
316 MCSectionELF
*MCContext::createELFSectionImpl(StringRef Section
, unsigned Type
,
317 unsigned Flags
, SectionKind K
,
319 const MCSymbolELF
*Group
,
321 const MCSymbolELF
*Associated
) {
323 MCSymbol
*&Sym
= Symbols
[Section
];
324 // A section symbol can not redefine regular symbols. There may be multiple
325 // sections with the same name, in which case the first such section wins.
326 if (Sym
&& Sym
->isDefined() &&
327 (!Sym
->isInSection() || Sym
->getSection().getBeginSymbol() != Sym
))
328 reportError(SMLoc(), "invalid symbol redefinition");
329 if (Sym
&& Sym
->isUndefined()) {
330 R
= cast
<MCSymbolELF
>(Sym
);
332 auto NameIter
= UsedNames
.insert(std::make_pair(Section
, false)).first
;
333 R
= new (&*NameIter
, *this) MCSymbolELF(&*NameIter
, /*isTemporary*/ false);
337 R
->setBinding(ELF::STB_LOCAL
);
338 R
->setType(ELF::STT_SECTION
);
340 auto *Ret
= new (ELFAllocator
.Allocate()) MCSectionELF(
341 Section
, Type
, Flags
, K
, EntrySize
, Group
, UniqueID
, R
, Associated
);
343 auto *F
= new MCDataFragment();
344 Ret
->getFragmentList().insert(Ret
->begin(), F
);
351 MCSectionELF
*MCContext::createELFRelSection(const Twine
&Name
, unsigned Type
,
352 unsigned Flags
, unsigned EntrySize
,
353 const MCSymbolELF
*Group
,
354 const MCSectionELF
*RelInfoSection
) {
355 StringMap
<bool>::iterator I
;
357 std::tie(I
, Inserted
) =
358 RelSecNames
.insert(std::make_pair(Name
.str(), true));
360 return createELFSectionImpl(
361 I
->getKey(), Type
, Flags
, SectionKind::getReadOnly(), EntrySize
, Group
,
362 true, cast
<MCSymbolELF
>(RelInfoSection
->getBeginSymbol()));
365 MCSectionELF
*MCContext::getELFNamedSection(const Twine
&Prefix
,
366 const Twine
&Suffix
, unsigned Type
,
368 unsigned EntrySize
) {
369 return getELFSection(Prefix
+ "." + Suffix
, Type
, Flags
, EntrySize
, Suffix
);
372 MCSectionELF
*MCContext::getELFSection(const Twine
&Section
, unsigned Type
,
373 unsigned Flags
, unsigned EntrySize
,
374 const Twine
&Group
, unsigned UniqueID
,
375 const MCSymbolELF
*Associated
) {
376 MCSymbolELF
*GroupSym
= nullptr;
377 if (!Group
.isTriviallyEmpty() && !Group
.str().empty())
378 GroupSym
= cast
<MCSymbolELF
>(getOrCreateSymbol(Group
));
380 return getELFSection(Section
, Type
, Flags
, EntrySize
, GroupSym
, UniqueID
,
384 MCSectionELF
*MCContext::getELFSection(const Twine
&Section
, unsigned Type
,
385 unsigned Flags
, unsigned EntrySize
,
386 const MCSymbolELF
*GroupSym
,
388 const MCSymbolELF
*Associated
) {
389 StringRef Group
= "";
391 Group
= GroupSym
->getName();
392 // Do the lookup, if we have a hit, return it.
393 auto IterBool
= ELFUniquingMap
.insert(
394 std::make_pair(ELFSectionKey
{Section
.str(), Group
, UniqueID
}, nullptr));
395 auto &Entry
= *IterBool
.first
;
396 if (!IterBool
.second
)
399 StringRef CachedName
= Entry
.first
.SectionName
;
402 if (Flags
& ELF::SHF_ARM_PURECODE
)
403 Kind
= SectionKind::getExecuteOnly();
404 else if (Flags
& ELF::SHF_EXECINSTR
)
405 Kind
= SectionKind::getText();
407 Kind
= SectionKind::getReadOnly();
409 MCSectionELF
*Result
= createELFSectionImpl(
410 CachedName
, Type
, Flags
, Kind
, EntrySize
, GroupSym
, UniqueID
, Associated
);
411 Entry
.second
= Result
;
415 MCSectionELF
*MCContext::createELFGroupSection(const MCSymbolELF
*Group
) {
416 return createELFSectionImpl(".group", ELF::SHT_GROUP
, 0,
417 SectionKind::getReadOnly(), 4, Group
, ~0,
421 MCSectionCOFF
*MCContext::getCOFFSection(StringRef Section
,
422 unsigned Characteristics
,
424 StringRef COMDATSymName
, int Selection
,
426 const char *BeginSymName
) {
427 MCSymbol
*COMDATSymbol
= nullptr;
428 if (!COMDATSymName
.empty()) {
429 COMDATSymbol
= getOrCreateSymbol(COMDATSymName
);
430 COMDATSymName
= COMDATSymbol
->getName();
434 // Do the lookup, if we have a hit, return it.
435 COFFSectionKey T
{Section
, COMDATSymName
, Selection
, UniqueID
};
436 auto IterBool
= COFFUniquingMap
.insert(std::make_pair(T
, nullptr));
437 auto Iter
= IterBool
.first
;
438 if (!IterBool
.second
)
441 MCSymbol
*Begin
= nullptr;
443 Begin
= createTempSymbol(BeginSymName
, false);
445 StringRef CachedName
= Iter
->first
.SectionName
;
446 MCSectionCOFF
*Result
= new (COFFAllocator
.Allocate()) MCSectionCOFF(
447 CachedName
, Characteristics
, COMDATSymbol
, Selection
, Kind
, Begin
);
449 Iter
->second
= Result
;
453 MCSectionCOFF
*MCContext::getCOFFSection(StringRef Section
,
454 unsigned Characteristics
,
456 const char *BeginSymName
) {
457 return getCOFFSection(Section
, Characteristics
, Kind
, "", 0, GenericSectionID
,
461 MCSectionCOFF
*MCContext::getCOFFSection(StringRef Section
) {
462 COFFSectionKey T
{Section
, "", 0, GenericSectionID
};
463 auto Iter
= COFFUniquingMap
.find(T
);
464 if (Iter
== COFFUniquingMap
.end())
469 MCSectionCOFF
*MCContext::getAssociativeCOFFSection(MCSectionCOFF
*Sec
,
470 const MCSymbol
*KeySym
,
472 // Return the normal section if we don't have to be associative or unique.
473 if (!KeySym
&& UniqueID
== GenericSectionID
)
476 // If we have a key symbol, make an associative section with the same name and
477 // kind as the normal section.
478 unsigned Characteristics
= Sec
->getCharacteristics();
480 Characteristics
|= COFF::IMAGE_SCN_LNK_COMDAT
;
481 return getCOFFSection(Sec
->getSectionName(), Characteristics
,
482 Sec
->getKind(), KeySym
->getName(),
483 COFF::IMAGE_COMDAT_SELECT_ASSOCIATIVE
, UniqueID
);
486 return getCOFFSection(Sec
->getSectionName(), Characteristics
, Sec
->getKind(),
490 MCSectionWasm
*MCContext::getWasmSection(const Twine
&Section
, SectionKind K
,
491 const Twine
&Group
, unsigned UniqueID
,
492 const char *BeginSymName
) {
493 MCSymbolWasm
*GroupSym
= nullptr;
494 if (!Group
.isTriviallyEmpty() && !Group
.str().empty()) {
495 GroupSym
= cast
<MCSymbolWasm
>(getOrCreateSymbol(Group
));
496 GroupSym
->setComdat(true);
499 return getWasmSection(Section
, K
, GroupSym
, UniqueID
, BeginSymName
);
502 MCSectionWasm
*MCContext::getWasmSection(const Twine
&Section
, SectionKind Kind
,
503 const MCSymbolWasm
*GroupSym
,
505 const char *BeginSymName
) {
506 StringRef Group
= "";
508 Group
= GroupSym
->getName();
509 // Do the lookup, if we have a hit, return it.
510 auto IterBool
= WasmUniquingMap
.insert(
511 std::make_pair(WasmSectionKey
{Section
.str(), Group
, UniqueID
}, nullptr));
512 auto &Entry
= *IterBool
.first
;
513 if (!IterBool
.second
)
516 StringRef CachedName
= Entry
.first
.SectionName
;
518 MCSymbol
*Begin
= createSymbol(CachedName
, false, false);
519 cast
<MCSymbolWasm
>(Begin
)->setType(wasm::WASM_SYMBOL_TYPE_SECTION
);
521 MCSectionWasm
*Result
= new (WasmAllocator
.Allocate())
522 MCSectionWasm(CachedName
, Kind
, GroupSym
, UniqueID
, Begin
);
523 Entry
.second
= Result
;
525 auto *F
= new MCDataFragment();
526 Result
->getFragmentList().insert(Result
->begin(), F
);
527 F
->setParent(Result
);
528 Begin
->setFragment(F
);
533 MCSubtargetInfo
&MCContext::getSubtargetCopy(const MCSubtargetInfo
&STI
) {
534 return *new (MCSubtargetAllocator
.Allocate()) MCSubtargetInfo(STI
);
537 void MCContext::addDebugPrefixMapEntry(const std::string
&From
,
538 const std::string
&To
) {
539 DebugPrefixMap
.insert(std::make_pair(From
, To
));
542 void MCContext::RemapDebugPaths() {
543 const auto &DebugPrefixMap
= this->DebugPrefixMap
;
544 const auto RemapDebugPath
= [&DebugPrefixMap
](std::string
&Path
) {
545 for (const auto &Entry
: DebugPrefixMap
)
546 if (StringRef(Path
).startswith(Entry
.first
)) {
547 std::string RemappedPath
=
548 (Twine(Entry
.second
) + Path
.substr(Entry
.first
.size())).str();
549 Path
.swap(RemappedPath
);
553 // Remap compilation directory.
554 std::string CompDir
= CompilationDir
.str();
555 RemapDebugPath(CompDir
);
556 CompilationDir
= CompDir
;
558 // Remap MCDwarfDirs in all compilation units.
559 for (auto &CUIDTablePair
: MCDwarfLineTablesCUMap
)
560 for (auto &Dir
: CUIDTablePair
.second
.getMCDwarfDirs())
564 //===----------------------------------------------------------------------===//
566 //===----------------------------------------------------------------------===//
568 /// getDwarfFile - takes a file name and number to place in the dwarf file and
569 /// directory tables. If the file number has already been allocated it is an
570 /// error and zero is returned and the client reports the error, else the
571 /// allocated file number is returned. The file numbers may be in any order.
572 Expected
<unsigned> MCContext::getDwarfFile(StringRef Directory
,
575 MD5::MD5Result
*Checksum
,
576 Optional
<StringRef
> Source
,
578 MCDwarfLineTable
&Table
= MCDwarfLineTablesCUMap
[CUID
];
579 return Table
.tryGetFile(Directory
, FileName
, Checksum
, Source
, FileNumber
);
582 /// isValidDwarfFileNumber - takes a dwarf file number and returns true if it
583 /// currently is assigned and false otherwise.
584 bool MCContext::isValidDwarfFileNumber(unsigned FileNumber
, unsigned CUID
) {
585 const MCDwarfLineTable
&LineTable
= getMCDwarfLineTable(CUID
);
587 return getDwarfVersion() >= 5 && LineTable
.hasRootFile();
588 if (FileNumber
>= LineTable
.getMCDwarfFiles().size())
591 return !LineTable
.getMCDwarfFiles()[FileNumber
].Name
.empty();
594 /// Remove empty sections from SectionsForRanges, to avoid generating
595 /// useless debug info for them.
596 void MCContext::finalizeDwarfSections(MCStreamer
&MCOS
) {
597 SectionsForRanges
.remove_if(
598 [&](MCSection
*Sec
) { return !MCOS
.mayHaveInstructions(*Sec
); });
601 CodeViewContext
&MCContext::getCVContext() {
602 if (!CVContext
.get())
603 CVContext
.reset(new CodeViewContext
);
604 return *CVContext
.get();
607 //===----------------------------------------------------------------------===//
609 //===----------------------------------------------------------------------===//
611 void MCContext::reportError(SMLoc Loc
, const Twine
&Msg
) {
614 // If we have a source manager use it. Otherwise, try using the inline source
616 // If that fails, use the generic report_fatal_error().
618 SrcMgr
->PrintMessage(Loc
, SourceMgr::DK_Error
, Msg
);
619 else if (InlineSrcMgr
)
620 InlineSrcMgr
->PrintMessage(Loc
, SourceMgr::DK_Error
, Msg
);
622 report_fatal_error(Msg
, false);
625 void MCContext::reportFatalError(SMLoc Loc
, const Twine
&Msg
) {
626 reportError(Loc
, Msg
);
628 // If we reached here, we are failing ungracefully. Run the interrupt handlers
629 // to make sure any special cleanups get done, in particular that we remove
630 // files registered with RemoveFileOnSignal.
631 sys::RunInterruptHandlers();