This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
SPU --auto-overlay instability
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: binutils at sourceware dot org
- Date: Tue, 13 Jan 2009 00:25:18 +1030
- Subject: SPU --auto-overlay instability
I noticed some instability in --auto-overlay generated scripts today,
and tracked it down to leaving a field in the call graph structure
uninitialised. This patch fixes the problem, and cures some nastiness
in the testsuite too.
bfd/
* elf32-spu.c (remove_cycles): Always set call->max_depth.
ld/
* emultempl/spu_icache.o_c: Regenerate.
ld/testsuite/
* ld-elf/elf.exp: Save and restore LDFLAGS.
* ld-scripts/default-script.exp: Likewise.
* ld-scripts/empty-orphan.exp: Likewise, and add to LDFLAGS rather
than replacing.
* ld-scripts/include.exp: Set --local-store for SPU.
Index: bfd/elf32-spu.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-spu.c,v
retrieving revision 1.59
diff -u -p -r1.59 elf32-spu.c
--- bfd/elf32-spu.c 12 Jan 2009 04:09:43 -0000 1.59
+++ bfd/elf32-spu.c 12 Jan 2009 13:18:58 -0000
@@ -3140,9 +3140,9 @@ remove_cycles (struct function_info *fun
callp = &fun->call_list;
while ((call = *callp) != NULL)
{
+ call->max_depth = depth + !call->is_pasted;
if (!call->fun->visit2)
{
- call->max_depth = depth + !call->is_pasted;
if (!remove_cycles (call->fun, info, &call->max_depth))
return FALSE;
if (max_depth < call->max_depth)
Index: ld/emultempl/spu_icache.o_c
===================================================================
RCS file: /cvs/src/src/ld/emultempl/spu_icache.o_c,v
retrieving revision 1.1
diff -u -p -r1.1 spu_icache.o_c
--- ld/emultempl/spu_icache.o_c 12 Jan 2009 00:23:57 -0000 1.1
+++ ld/emultempl/spu_icache.o_c 12 Jan 2009 13:19:03 -0000
@@ -0,0 +1,31 @@
+0x7f,0x45,0x4c,0x46,0x01,0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x01,0x00,0x17,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x64,0x00,0x00,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0x00,0x00,0x28,
+0x00,0x07,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x2e,0x73,0x79,0x6d,0x74,0x61,0x62,
+0x00,0x2e,0x73,0x74,0x72,0x74,0x61,0x62,0x00,0x2e,0x73,0x68,0x73,0x74,0x72,0x74,
+0x61,0x62,0x00,0x2e,0x74,0x65,0x78,0x74,0x00,0x2e,0x64,0x61,0x74,0x61,0x00,0x2e,
+0x62,0x73,0x73,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1b,
+0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x34,
+0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x21,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x03,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x27,
+0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x11,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
+0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x7c,
+0x00,0x00,0x00,0x50,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x04,
+0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xcc,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x01,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x02,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x03,0x00,0x00,0x00,0x01,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x01,0x00,0x5f,0x5f,0x69,
+0x63,0x61,0x63,0x68,0x65,0x5f,0x62,0x72,0x5f,0x68,0x61,0x6e,0x64,0x6c,0x65,0x72,
+0x00,
Index: ld/testsuite/ld-elf/elf.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-elf/elf.exp,v
retrieving revision 1.13
diff -u -p -r1.13 elf.exp
--- ld/testsuite/ld-elf/elf.exp 20 Nov 2007 15:08:23 -0000 1.13
+++ ld/testsuite/ld-elf/elf.exp 12 Jan 2009 13:19:04 -0000
@@ -25,6 +25,7 @@ if ![is_elf_format] {
return
}
+set old_ldflags $LDFLAGS
if { [istarget spu*-*-*] } {
set LDFLAGS "$LDFLAGS --local-store 0:0"
}
@@ -60,6 +61,8 @@ if { [check_gc_sections_available] } {
}
}
+set LDFLAGS $old_ldflags
+
# The following tests require running the executable generated by ld.
if ![isnative] {
return
Index: ld/testsuite/ld-scripts/default-script.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-scripts/default-script.exp,v
retrieving revision 1.3
diff -u -p -r1.3 default-script.exp
--- ld/testsuite/ld-scripts/default-script.exp 6 Jul 2007 14:09:45 -0000 1.3
+++ ld/testsuite/ld-scripts/default-script.exp 12 Jan 2009 13:19:05 -0000
@@ -19,6 +19,7 @@
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
# MA 02110-1301, USA.
+set old_ldflags $LDFLAGS
if { [istarget spu*-*-*] } {
set LDFLAGS "$LDFLAGS --local-store 0:0"
}
@@ -30,3 +31,4 @@ foreach t $test_list {
run_dump_test [file rootname $t]
}
+set LDFLAGS $old_ldflags
Index: ld/testsuite/ld-scripts/empty-orphan.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-scripts/empty-orphan.exp,v
retrieving revision 1.4
diff -u -p -r1.4 empty-orphan.exp
--- ld/testsuite/ld-scripts/empty-orphan.exp 6 Jul 2007 14:09:45 -0000 1.4
+++ ld/testsuite/ld-scripts/empty-orphan.exp 12 Jan 2009 13:19:05 -0000
@@ -25,10 +25,13 @@ if ![is_elf_format] {
return
}
+set old_ldflags $LDFLAGS
if { [istarget spu*-*-*] } {
- set LDFLAGS "--local-store 0:0"
+ set LDFLAGS "$LDFLAGS --local-store 0:0"
}
set testname "empty-orphan"
run_dump_test empty-orphan
+
+set LDFLAGS $old_ldflags
Index: ld/testsuite/ld-scripts/include.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-scripts/include.exp,v
retrieving revision 1.2
diff -u -p -r1.2 include.exp
--- ld/testsuite/ld-scripts/include.exp 26 Jul 2008 01:23:37 -0000 1.2
+++ ld/testsuite/ld-scripts/include.exp 12 Jan 2009 13:19:05 -0000
@@ -26,7 +26,7 @@ if [is_aout_format] {
set old_ldflags $LDFLAGS
if { [istarget spu*-*-*] } {
- set LDFLAGS "$LDFLAGS --no-overlays"
+ set LDFLAGS "$LDFLAGS --local-store 0:0 --no-overlays"
}
set test_list [lsort [glob -nocomplain $srcdir/$subdir/include*.d]]
@@ -36,4 +36,5 @@ foreach test_file $test_list {
verbose $test_name
run_dump_test $test_name
}
+
set LDFLAGS $old_ldflags
--
Alan Modra
Australia Development Lab, IBM