diff options
author | Charles Davis <cdavis@mines.edu> | 2011-05-22 04:15:07 +0000 |
---|---|---|
committer | Charles Davis <cdavis@mines.edu> | 2011-05-22 04:15:07 +0000 |
commit | bc2daa0f932c5a63b5932a353a485e6ccf721fa2 (patch) | |
tree | b2bb48f53e254cfdd376d0c367fe76449a3d1ab4 /llvm/lib/MC/MCWin64EH.cpp | |
parent | 1c8bd5ad7ed9aebcec55c06e8ef7924081a57838 (diff) | |
download | bcm5719-llvm-bc2daa0f932c5a63b5932a353a485e6ccf721fa2.tar.gz bcm5719-llvm-bc2daa0f932c5a63b5932a353a485e6ccf721fa2.zip |
Implement emission of all Win64 exception tables. Make the COFF streamer emit
these tables.
llvm-svn: 131833
Diffstat (limited to 'llvm/lib/MC/MCWin64EH.cpp')
-rw-r--r-- | llvm/lib/MC/MCWin64EH.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/llvm/lib/MC/MCWin64EH.cpp b/llvm/lib/MC/MCWin64EH.cpp index 9884f66e5fb..fc394504bfb 100644 --- a/llvm/lib/MC/MCWin64EH.cpp +++ b/llvm/lib/MC/MCWin64EH.cpp @@ -110,7 +110,7 @@ static void EmitUnwindCode(MCStreamer &streamer, MCWin64EHInstruction &inst) { } static void EmitRuntimeFunction(MCStreamer &streamer, - MCWin64EHUnwindInfo *info) { + const MCWin64EHUnwindInfo *info) { MCContext &context = streamer.getContext(); streamer.EmitValue(MCSymbolRefExpr::Create(info->Begin, context), 4); @@ -185,5 +185,20 @@ void MCWin64EHUnwindEmitter::EmitUnwindInfo(MCStreamer &streamer, llvm::EmitUnwindInfo(streamer, info); } +void MCWin64EHUnwindEmitter::Emit(MCStreamer &streamer) { + MCContext &context = streamer.getContext(); + // Emit the unwind info structs first. + const TargetAsmInfo &asmInfo = context.getTargetAsmInfo(); + const MCSection *xdataSect = asmInfo.getWin64EHTableSection(); + streamer.SwitchSection(xdataSect); + for (unsigned i = 0; i < streamer.getNumW64UnwindInfos(); ++i) + llvm::EmitUnwindInfo(streamer, &streamer.getW64UnwindInfo(i)); + // Now emit RUNTIME_FUNCTION entries. + const MCSection *pdataSect = asmInfo.getWin64EHFuncTableSection(); + streamer.SwitchSection(pdataSect); + for (unsigned i = 0; i < streamer.getNumW64UnwindInfos(); ++i) + EmitRuntimeFunction(streamer, &streamer.getW64UnwindInfo(i)); +} + } // End of namespace llvm |