On Tue, 2009-10-27, Martin Schaller wrote in private E-mail :
> I have encountered a bug when compiling with profiling
> support (-pg).
> When the first profiled function is called, the program crashes.
> Reason is that in src/profile/profile/profile.h, function
> _mcount the lr register gets overwritten which is not
> expected by the compiler. Instead of returning to the
> calling function then _mcount returns to the return address
> of mcount_internal, creating an endless loop and finally
> crashing when the stack gets out of range.
> 
> As a fix add lr to the register list in stmdb and ldmia.

This is what you mean ?

        Danny


-- 
Danny Backx ; danny.backx - at - scarlet.be ; http://danny.backx.info
Index: profile.h
===================================================================
--- profile.h	(revision 1225)
+++ profile.h	(working copy)
@@ -89,7 +89,7 @@
 #define MCOUNT								\
 void _mcount (void)							\
 {									\
-	  __asm__("stmdb	sp!, {r0, r1, r2, r3};"			\
+	  __asm__("stmdb	sp!, {r0, r1, r2, r3, lr};"		\
 		  "movs		fp, fp;"			      	\
 		  "moveq	r1, #0;"				\
 		  "ldrne	r1, [fp, $-4];"				\
@@ -98,7 +98,7 @@
 		  "ldrne	r0, [r0, $-4];"				\
 		  "movs		r0, r0;"				\
 		  "blne		mcount_internal;"			\
-		  "ldmia	sp!, {r0, r1, r2, r3}");		\
+		  "ldmia	sp!, {r0, r1, r2, r3, lr}");		\
 }
 #else
 /***************************************************************************
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Cegcc-devel mailing list
Cegcc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cegcc-devel

Reply via email to