1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 20:23:11 +01:00

Emit the handler's data area. For GCC-style exceptions under Win64, the

handler's data area starts with a 4-byte reference to the personality
function, followed by the DWARF LSDA.

llvm-svn: 132302
This commit is contained in:
Charles Davis 2011-05-30 00:13:34 +00:00
parent 939fb6f738
commit 52d44a8a21

View File

@ -83,6 +83,9 @@ void Win64Exception::BeginFunction(const MachineFunction *MF) {
MCSymbol *GCCHandlerSym = MCSymbol *GCCHandlerSym =
Asm->GetExternalSymbolSymbol("_GCC_specific_handler"); Asm->GetExternalSymbolSymbol("_GCC_specific_handler");
Asm->OutStreamer.EmitWin64EHHandler(GCCHandlerSym, true, true); Asm->OutStreamer.EmitWin64EHHandler(GCCHandlerSym, true, true);
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("eh_func_begin",
Asm->getFunctionNumber()));
} }
/// EndFunction - Gather and emit post-function exception information. /// EndFunction - Gather and emit post-function exception information.
@ -91,5 +94,23 @@ void Win64Exception::EndFunction() {
if (!shouldEmitPersonality && !shouldEmitMoves) if (!shouldEmitPersonality && !shouldEmitMoves)
return; return;
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("eh_func_end",
Asm->getFunctionNumber()));
// Map all labels and get rid of any dead landing pads.
MMI->TidyLandingPads();
if (shouldEmitPersonality) {
const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering();
const Function *Per = MMI->getPersonalities()[MMI->getPersonalityIndex()];
const MCSymbol *Sym = TLOF.getCFIPersonalitySymbol(Per, Asm->Mang, MMI);
Asm->OutStreamer.PushSection();
Asm->OutStreamer.EmitWin64EHHandlerData();
Asm->OutStreamer.EmitValue(MCSymbolRefExpr::Create(Sym, Asm->OutContext),
4);
EmitExceptionTable();
Asm->OutStreamer.PopSection();
}
Asm->OutStreamer.EmitWin64EHEndProc(); Asm->OutStreamer.EmitWin64EHEndProc();
} }