For some reason DwarfWriter hardwires the personality function
as __gxx_personality_v0 (the C++ personality function) even
though the correct one is available from MMI.  This patch fixes
that - helpful for Ada :)

Ciao,

Duncan.
Index: llvm.master/lib/CodeGen/DwarfWriter.cpp
===================================================================
--- llvm.master.orig/lib/CodeGen/DwarfWriter.cpp	2007-05-05 19:05:05.000000000 +0200
+++ llvm.master/lib/CodeGen/DwarfWriter.cpp	2007-05-05 19:07:22.000000000 +0200
@@ -2725,10 +2725,6 @@
   ///
   bool shouldEmit;
   
-  /// FuncCPPPersonality - C++ persoanlity function.
-  ///
-  Function *FuncCPPPersonality;
-
   /// EmitCommonEHFrame - Emit the common eh unwind frame.
   ///
   void EmitCommonEHFrame() {
@@ -2738,7 +2734,7 @@
     
     // If there is a personality present then we need to indicate that
     // in the common eh frame.
-    Function *Personality = FuncCPPPersonality;
+    Function *Personality = MMI->getPersonality();
 
     // Size and sign of stack growth.
     int stackGrowth =
@@ -2818,8 +2814,7 @@
   void EmitEHFrame() {
     // If there is a personality present then we need to indicate that
     // in the common eh frame.
-    Function *Personality = FuncCPPPersonality;
-//    Function *Personality = MMI->getPersonality();
+    Function *Personality = MMI->getPersonality();
     MachineFrameInfo *MFI = MF->getFrameInfo();
 
     Asm->SwitchToTextSection(TAI->getDwarfEHFrameSection());
@@ -3094,7 +3089,6 @@
   : Dwarf(OS, A, T)
   , didInitial(false)
   , shouldEmit(false)
-  , FuncCPPPersonality(NULL)
   {}
   
   virtual ~DwarfException() {}
@@ -3109,7 +3103,6 @@
   /// content.
   void BeginModule(Module *M) {
     this->M = M;
-    FuncCPPPersonality = M->getFunction("__gxx_personality_v0");
   }
 
   /// EndModule - Emit all exception information that should come after the
; RUN: llvm-as < %s | llc -march=x86 -enable-eh -o - | grep zPLR

@error = external global i8		; <i8*> [#uses=2]

define void @_ada_x() {
entry:
	invoke void @raise( )
			to label %eh_then unwind label %unwind

unwind:		; preds = %entry
	%eh_ptr = tail call i8* @llvm.eh.exception( )		; <i8*> [#uses=2]
	%eh_select = tail call i32 (i8*, i8*, ...)* @llvm.eh.selector( i8* %eh_ptr, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), i8* @error )		; <i32> [#uses=1]
	%eh_typeid = tail call i32 @llvm.eh.typeid.for( i8* @error )		; <i32> [#uses=1]
	%tmp2 = icmp eq i32 %eh_select, %eh_typeid		; <i1> [#uses=1]
	br i1 %tmp2, label %eh_then, label %Unwind

eh_then:		; preds = %unwind, %entry
	ret void

Unwind:		; preds = %unwind
	tail call i32 (...)* @_Unwind_Resume( i8* %eh_ptr )		; <i32>:0 [#uses=0]
	unreachable
}

declare void @raise()

declare i8* @llvm.eh.exception()

declare i32 @llvm.eh.selector(i8*, i8*, ...)

declare i32 @llvm.eh.typeid.for(i8*)

declare i32 @__gnat_eh_personality(...)

declare i32 @_Unwind_Resume(...)
_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to