1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

Fix really stupid ARM EHABI info generation bug: we should not emit

eh table and handler data if there are no landing pads in the function.
Patch by Logan Chien with some cleanups from me.

llvm-svn: 167945
This commit is contained in:
Anton Korobeynikov 2012-11-14 19:13:30 +00:00
parent 9d8a469c55
commit c8df249529
2 changed files with 32 additions and 11 deletions

View File

@ -69,22 +69,25 @@ void ARMException::EndFunction() {
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("eh_func_end",
Asm->getFunctionNumber()));
// Emit references to personality.
if (const Function * Personality =
MMI->getPersonalities()[MMI->getPersonalityIndex()]) {
MCSymbol *PerSym = Asm->Mang->getSymbol(Personality);
Asm->OutStreamer.EmitSymbolAttribute(PerSym, MCSA_Global);
Asm->OutStreamer.EmitPersonality(PerSym);
}
if (EnableARMEHABIDescriptors) {
// Map all labels and get rid of any dead landing pads.
MMI->TidyLandingPads();
Asm->OutStreamer.EmitHandlerData();
if (!MMI->getLandingPads().empty()) {
// Emit references to personality.
if (const Function * Personality =
MMI->getPersonalities()[MMI->getPersonalityIndex()]) {
MCSymbol *PerSym = Asm->Mang->getSymbol(Personality);
Asm->OutStreamer.EmitSymbolAttribute(PerSym, MCSA_Global);
Asm->OutStreamer.EmitPersonality(PerSym);
}
// Emit actual exception table
EmitExceptionTable();
// Emit .handlerdata directive.
Asm->OutStreamer.EmitHandlerData();
// Emit actual exception table
EmitExceptionTable();
}
}
}

View File

@ -0,0 +1,18 @@
; RUN: llc < %s -mtriple=armv7-unknown-linux-gnueabi \
; RUN: -arm-enable-ehabi -arm-enable-ehabi-descriptors | FileCheck %s
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:64:128-a0:0:64-n32-S64"
target triple = "armv7-unknown-linux-gnueabi"
define void @_Z4testv() {
; CHECK: _Z4testv
; CHECK: .fnstart
; CHECK: .size
; CHECK-NOT: .handlerdata
; CHECK: .fnend
entry:
call void @_Z15throw_exceptionv()
ret void
}
declare void @_Z15throw_exceptionv()