This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[commit] SPU i-cache: Fix linker hang with cycles in CFG
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: binutils at sourceware dot org
- Date: Thu, 14 May 2009 19:59:34 +0200 (CEST)
- Subject: [commit] SPU i-cache: Fix linker hang with cycles in CFG
Hello,
if a function is split up into sections, cycles in the control flow
graph may lead to cycles in the set of non-function-call branches
between sections. If this happens, the SPU linker will sometimes
construct cycles in the struct function_info "start" linkage.
This in turn leads to an endless loop in the transfer_calls routine.
The following patch fixes this by never generating such cycles.
Tested on spu-elf with no regressions.
Approved off-line by Alan Modra; committed to mainline.
Bye,
Ulrich
ChangeLog:
* elf32-spu.c (mark_functions_via_relocs): Handle cycles in the
control flow graph between fragments of a function.
diff -urNp src.orig/bfd/elf32-spu.c src/bfd/elf32-spu.c
--- src.orig/bfd/elf32-spu.c 2009-05-11 16:11:11.000000000 +0200
+++ src/bfd/elf32-spu.c 2009-05-11 16:11:21.000000000 +0200
@@ -2779,7 +2779,14 @@ mark_functions_via_relocs (asection *sec
callee->fun->is_func = TRUE;
}
else if (callee->fun->start == NULL)
- callee->fun->start = caller;
+ {
+ struct function_info *caller_start = caller;
+ while (caller_start->start)
+ caller_start = caller_start->start;
+
+ if (caller_start != callee->fun)
+ callee->fun->start = caller_start;
+ }
else
{
struct function_info *callee_start;
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com