summaryrefslogtreecommitdiff
path: root/lib/MC/MCWin64EH.cpp
diff options
context:
space:
mode:
authorCharles Davis <cdavis@mines.edu>2011-05-22 04:15:07 +0000
committerCharles Davis <cdavis@mines.edu>2011-05-22 04:15:07 +0000
commit38ea9eecd7c810e11f96c8306b241f9db88fc62f (patch)
tree8d4409866e32dd64a0c491676229e9a5ded79e54 /lib/MC/MCWin64EH.cpp
parent3185f5c35322cbd10040ab20f265042d477efe62 (diff)
downloadllvm-38ea9eecd7c810e11f96c8306b241f9db88fc62f.tar.gz
llvm-38ea9eecd7c810e11f96c8306b241f9db88fc62f.tar.bz2
llvm-38ea9eecd7c810e11f96c8306b241f9db88fc62f.tar.xz
Implement emission of all Win64 exception tables. Make the COFF streamer emit
these tables. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131833 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MCWin64EH.cpp')
-rw-r--r--lib/MC/MCWin64EH.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/MC/MCWin64EH.cpp b/lib/MC/MCWin64EH.cpp
index 9884f66e5f..fc394504bf 100644
--- a/lib/MC/MCWin64EH.cpp
+++ b/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