SPU memory corruption with --auto-overlay

Alan Modra amodra@bigpond.net.au
Sat Jun 7 13:56:00 GMT 2008


The SPU ABI allows use of 2000 bytes below the stack pointer.  The
--auto-overlay code wasn't allowing for this space.  In some cases
this led to memory corruption due to the overlay manager using just 48
bytes below sp.

	* elf32-spu.c (spu_elf_auto_overlay): Add valid area below sp
	to stack calculation.

Index: bfd/elf32-spu.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-spu.c,v
retrieving revision 1.44
diff -u -p -r1.44 elf32-spu.c
--- bfd/elf32-spu.c	6 Jun 2008 06:02:00 -0000	1.44
+++ bfd/elf32-spu.c	7 Jun 2008 11:53:31 -0000
@@ -3574,7 +3574,7 @@ spu_elf_auto_overlay (struct bfd_link_in
       sum_stack_param.overall_stack = 0;
       if (!for_each_node (sum_stack, info, &sum_stack_param, TRUE))
 	goto err_exit;
-      htab->reserved = sum_stack_param.overall_stack;
+      htab->reserved = sum_stack_param.overall_stack + 2000;
     }
   fixed_size += htab->reserved;
   fixed_size += htab->non_ovly_stub * OVL_STUB_SIZE;

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list