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/MC | |
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/MC')
-rw-r--r-- | llvm/lib/MC/WinCOFFStreamer.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/llvm/lib/MC/WinCOFFStreamer.cpp b/llvm/lib/MC/WinCOFFStreamer.cpp index 41fc8e4681e..36dd691f07b 100644 --- a/llvm/lib/MC/WinCOFFStreamer.cpp +++ b/llvm/lib/MC/WinCOFFStreamer.cpp @@ -164,7 +164,8 @@ void MCWinCOFFStreamer::EmitCOFFSafeSEH(MCSymbol const *Symbol) { Triple::x86) return; - if (cast<MCSymbolCOFF>(Symbol)->isSafeSEH()) + const MCSymbolCOFF *CSymbol = cast<MCSymbolCOFF>(Symbol); + if (CSymbol->isSafeSEH()) return; MCSection *SXData = getContext().getObjectFileInfo()->getSXDataSection(); @@ -175,7 +176,12 @@ void MCWinCOFFStreamer::EmitCOFFSafeSEH(MCSymbol const *Symbol) { new MCSafeSEHFragment(Symbol, SXData); getAssembler().registerSymbol(*Symbol); - cast<MCSymbolCOFF>(Symbol)->setIsSafeSEH(); + CSymbol->setIsSafeSEH(); + + // The Microsoft linker requires that the symbol type of a handler be + // function. Go ahead and oblige it here. + CSymbol->setType(COFF::IMAGE_SYM_DTYPE_FUNCTION + << COFF::SCT_COMPLEX_TYPE_SHIFT); } void MCWinCOFFStreamer::EmitCOFFSectionIndex(MCSymbol const *Symbol) { |