diff options
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/MC/MCStreamer.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/MC/MCWin64EH.cpp | 14 |
2 files changed, 13 insertions, 3 deletions
diff --git a/llvm/lib/MC/MCStreamer.cpp b/llvm/lib/MC/MCStreamer.cpp index df08c34..995828b 100644 --- a/llvm/lib/MC/MCStreamer.cpp +++ b/llvm/lib/MC/MCStreamer.cpp @@ -692,6 +692,8 @@ void MCStreamer::EmitWinCFIEndProc(SMLoc Loc) { MCSymbol *Label = emitCFILabel(); CurFrame->End = Label; + if (!CurFrame->FuncletOrFuncEnd) + CurFrame->FuncletOrFuncEnd = CurFrame->End; } void MCStreamer::EmitWinCFIFuncletOrFuncEnd(SMLoc Loc) { diff --git a/llvm/lib/MC/MCWin64EH.cpp b/llvm/lib/MC/MCWin64EH.cpp index 76c82cd..d816872 100644 --- a/llvm/lib/MC/MCWin64EH.cpp +++ b/llvm/lib/MC/MCWin64EH.cpp @@ -525,9 +525,7 @@ static void ARM64EmitUnwindInfo(MCStreamer &streamer, WinEH::FrameInfo *info) { int64_t RawFuncLength; if (!info->FuncletOrFuncEnd) { - // FIXME: This is very wrong; we emit SEH data which covers zero bytes - // of code. But otherwise test/MC/AArch64/seh.s crashes. - RawFuncLength = 0; + report_fatal_error("FuncletOrFuncEnd not set"); } else { // FIXME: GetAbsDifference tries to compute the length of the function // immediately, before the whole file is emitted, but in general @@ -702,6 +700,16 @@ void llvm::Win64EH::ARM64UnwindEmitter::Emit(MCStreamer &Streamer) const { void llvm::Win64EH::ARM64UnwindEmitter::EmitUnwindInfo( MCStreamer &Streamer, WinEH::FrameInfo *info) const { + // Called if there's an .seh_handlerdata directive before the end of the + // function. This forces writing the xdata record already here - and + // in this case, the function isn't actually ended already, but the xdata + // record needs to know the function length. In these cases, if the funclet + // end hasn't been marked yet, the xdata function length won't cover the + // whole function, only up to this point. + if (!info->FuncletOrFuncEnd) { + Streamer.SwitchSection(info->TextSection); + info->FuncletOrFuncEnd = Streamer.emitCFILabel(); + } // Switch sections (the static function above is meant to be called from // here and from Emit(). MCSection *XData = Streamer.getAssociatedXDataSection(info->TextSection); |