This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH, SPU] Handle "sf" instruction in prologue analysis
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: binutils at sourceware dot org
- Cc: amodra at bigpond dot net dot au
- Date: Tue, 10 Mar 2009 21:41:56 +0100 (CET)
- Subject: [PATCH, SPU] Handle "sf" instruction in prologue analysis
Hello,
I've noticed problems when using --auto-overlay with the SDK 3.1 spu-gcc
compiler. This turned out to be caused by that compiler using in some
special cases an "sf" instruction to update the stack pointer in the
function prologue. (Mainline GCC never does this.)
This in turn was not handled by the stack analysis code in the linker,
causing the stack consumption to be underestimated.
This patch fixes the problem by handling "sf" in find_function_stack_adjust.
Tested on spu-elf with no regressions.
OK for mainline?
Bye,
Ulrich
ChangeLog:
* elf32-spu.c (find_function_stack_adjust): Handle sf instruction
used to update stack pointer.
Index: bfd/elf32-spu.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-spu.c,v
retrieving revision 1.64
diff -u -p -r1.64 elf32-spu.c
--- bfd/elf32-spu.c 9 Feb 2009 14:24:41 -0000 1.64
+++ bfd/elf32-spu.c 10 Mar 2009 20:32:25 -0000
@@ -2133,6 +2133,19 @@ find_function_stack_adjust (asection *se
return reg[rt];
}
}
+ else if (buf[0] == 0x08 && (buf[1] & 0xe0) == 0 /* sf */)
+ {
+ int rb = ((buf[1] & 0x1f) << 2) | ((buf[2] & 0xc0) >> 6);
+
+ reg[rt] = reg[rb] - reg[ra];
+ if (rt == 1)
+ {
+ if (reg[rt] > 0)
+ break;
+ *sp_adjust = offset;
+ return reg[rt];
+ }
+ }
else if ((buf[0] & 0xfc) == 0x40 /* il, ilh, ilhu, ila */)
{
if (buf[0] >= 0x42 /* ila */)
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com