From 2bc93ca84606399da5ae5ac68c2140d5d2855adb Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Wed, 10 Jun 2015 01:02:30 +0000 Subject: [WinEH] Emit .safeseh directives for all 32-bit exception handlers Use a "safeseh" string attribute to do this. You would think we chould just accumulate the set of personalities like we do on dwarf, but this fails to account for the LSDA-loading thunks we use for __CxxFrameHandler3. Each of those needs to make it into .sxdata as well. The string attribute seemed like the most straightforward approach. llvm-svn: 239448 --- llvm/lib/CodeGen/AsmPrinter/WinException.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'llvm/lib/CodeGen/AsmPrinter') diff --git a/llvm/lib/CodeGen/AsmPrinter/WinException.cpp b/llvm/lib/CodeGen/AsmPrinter/WinException.cpp index 7e3a6d5a76f..ffa0ceb1a60 100644 --- a/llvm/lib/CodeGen/AsmPrinter/WinException.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/WinException.cpp @@ -50,6 +50,14 @@ WinException::~WinException() {} /// endModule - Emit all exception information that should come after the /// content. void WinException::endModule() { + auto &OS = *Asm->OutStreamer; + const Module *M = MMI->getModule(); + for (const Function &F : *M) { + if (F.hasFnAttribute("safeseh")) { + llvm::errs() << ".safeseh " << F.getName() << "\n"; + OS.EmitCOFFSafeSEH(Asm->getSymbol(&F)); + } + } } void WinException::beginFunction(const MachineFunction *MF) { -- cgit v1.2.3