diff options
author | Reid Kleckner <reid@kleckner.net> | 2015-06-10 01:02:30 +0000 |
---|---|---|
committer | Reid Kleckner <reid@kleckner.net> | 2015-06-10 01:02:30 +0000 |
commit | 2bc93ca84606399da5ae5ac68c2140d5d2855adb (patch) | |
tree | fdb91ed61f6631483898fad400f79cc6d077bf32 /llvm/lib/CodeGen/AsmPrinter | |
parent | 1469b9196ce4394486371b39e9fa5d44975d3a29 (diff) | |
download | bcm5719-llvm-2bc93ca84606399da5ae5ac68c2140d5d2855adb.tar.gz bcm5719-llvm-2bc93ca84606399da5ae5ac68c2140d5d2855adb.zip |
[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
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/WinException.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
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) { |