This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

spu overlay manager infinite loop


Fixes an infinite loop in the overlay manager.  The overlay manager
munges lr so that overlay functions return via __ovly_return.  If we
make a tail call from an overlay function, then the tail call pops a
frame off the stack, setting lr to the __ovly_return value.  If the
tail call is to another overlay, the overlay manager will munge lr
as usual so we go via __ovly_return to, you guessed it, __ovly_return.

	* emultempl/spu_ovl.S: Don't trash lr on tail call from one
	overlay to another.
	* emultempl/spu_ovl.o: Regenerate.

Index: ld/emultempl/spu_ovl.S
===================================================================
RCS file: /cvs/src/src/ld/emultempl/spu_ovl.S,v
retrieving revision 1.4
diff -u -p -r1.4 spu_ovl.S
--- ld/emultempl/spu_ovl.S	29 May 2007 12:54:29 -0000	1.4
+++ ld/emultempl/spu_ovl.S	14 Jun 2007 08:15:11 -0000
@@ -166,7 +166,12 @@ __ovly_backchain_loop:
 	shufb		rv2, retval, lnkr, rv1
 	shufb		rv3, $lr, $78, rv1
 	fsmbi		rv1, 0xff
-	selb		$lr, rv2, rv3, rv1
+	selb		rv2, rv2, rv3, rv1
+/* If we have a tail call from one overlay function to another overlay,
+   then lr is already set up.  Don't change it.  */
+	ceq		rv1, $lr, retval
+	fsmb		rv1, rv1
+	selb		$lr, rv2, $lr, rv1
 
 /* Branch to $79 if non-overlay */
 	brz		$78, __ovly_load_restore

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]