diff options
Diffstat (limited to 'gnu/llvm/lib/Target/X86/X86WinEHState.cpp')
| -rw-r--r-- | gnu/llvm/lib/Target/X86/X86WinEHState.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gnu/llvm/lib/Target/X86/X86WinEHState.cpp b/gnu/llvm/lib/Target/X86/X86WinEHState.cpp index 0c3b3434147..6d6dedc6073 100644 --- a/gnu/llvm/lib/Target/X86/X86WinEHState.cpp +++ b/gnu/llvm/lib/Target/X86/X86WinEHState.cpp @@ -149,6 +149,12 @@ void WinEHStatePass::getAnalysisUsage(AnalysisUsage &AU) const { } bool WinEHStatePass::runOnFunction(Function &F) { + // Don't insert state stores or exception handler thunks for + // available_externally functions. The handler needs to reference the LSDA, + // which will not be emitted in this case. + if (F.hasAvailableExternallyLinkage()) + return false; + // Check the personality. Do nothing if this personality doesn't use funclets. if (!F.hasPersonalityFn()) return false; @@ -401,6 +407,8 @@ Function *WinEHStatePass::generateLSDAInEAXThunk(Function *ParentFunc) { Twine("__ehhandler$") + GlobalValue::dropLLVMManglingEscape( ParentFunc->getName()), TheModule); + if (auto *C = ParentFunc->getComdat()) + Trampoline->setComdat(C); BasicBlock *EntryBB = BasicBlock::Create(Context, "entry", Trampoline); IRBuilder<> Builder(EntryBB); Value *LSDA = emitEHLSDA(Builder, ParentFunc); |
