summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorLogan Chien <tzuhsiang.chien@gmail.com>2014-05-14 16:38:30 +0000
committerLogan Chien <tzuhsiang.chien@gmail.com>2014-05-14 16:38:30 +0000
commit95188b9092fe1d6db9321f691b940e0327abfa44 (patch)
treed84b4c0d514448c38068fa056d125a8bb730ea4a /llvm/lib
parentba1b6951c3f5c8f8837a4c9fcc2a49d3fac39e9e (diff)
downloadbcm5719-llvm-95188b9092fe1d6db9321f691b940e0327abfa44.tar.gz
bcm5719-llvm-95188b9092fe1d6db9321f691b940e0327abfa44.zip
Fix ARM EHABI when function has landingpad and nounwind.
If the function has the landingpad instruction, then the handlerdata should be emitted even if the function has nouwnind attribute. Otherwise, following code will not work: void test1() noexcept { try { throw_exception(); } catch (...) { log_unexpected_exception(); } } Since the cantunwind was incorrectly emitted and the LSDA is not available. llvm-svn: 208791
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/ARMException.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/ARMException.cpp b/llvm/lib/CodeGen/AsmPrinter/ARMException.cpp
index 97b288f1947..1cb0159d10f 100644
--- a/llvm/lib/CodeGen/AsmPrinter/ARMException.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/ARMException.cpp
@@ -59,9 +59,8 @@ void ARMException::endModule() {
void ARMException::beginFunction(const MachineFunction *MF) {
if (Asm->MAI->getExceptionHandlingType() == ExceptionHandling::ARM)
getTargetStreamer().emitFnStart();
- if (Asm->MF->getFunction()->needsUnwindTableEntry())
- Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("eh_func_begin",
- Asm->getFunctionNumber()));
+ Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("eh_func_begin",
+ Asm->getFunctionNumber()));
// See if we need call frame info.
AsmPrinter::CFIMoveType MoveType = Asm->needsCFIMoves();
assert(MoveType != AsmPrinter::CFI_M_EH &&
@@ -78,16 +77,16 @@ void ARMException::endFunction(const MachineFunction *) {
if (shouldEmitCFI)
Asm->OutStreamer.EmitCFIEndProc();
+ // Map all labels and get rid of any dead landing pads.
+ MMI->TidyLandingPads();
+
ARMTargetStreamer &ATS = getTargetStreamer();
- if (!Asm->MF->getFunction()->needsUnwindTableEntry())
+ if (!Asm->MF->getFunction()->needsUnwindTableEntry() &&
+ MMI->getLandingPads().empty())
ATS.emitCantUnwind();
else {
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("eh_func_end",
Asm->getFunctionNumber()));
-
- // Map all labels and get rid of any dead landing pads.
- MMI->TidyLandingPads();
-
if (!MMI->getLandingPads().empty()) {
// Emit references to personality.
if (const Function * Personality =
OpenPOWER on IntegriCloud