From a14c90c1e75ece04307e201c7f0f8fb26f488628 Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Sun, 15 Mar 2009 15:15:29 +0000 Subject: [PATCH] * elf32-spu.c (spu_elf_check_vma): Do not reset auto_overlay parameter just because fixed sections fit into local store. (spu_elf_auto_overlay): Do not declare as "noreturn". Skip generating overlays if fixed sections plus reserved stack and heap space fit into local store. --- bfd/ChangeLog | 8 ++++++++ bfd/elf32-spu.c | 37 ++++++++++++++++++++----------------- 2 files changed, 28 insertions(+), 17 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 33174a3..0aefc61 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,11 @@ +2009-03-15 Ulrich Weigand + + * elf32-spu.c (spu_elf_check_vma): Do not reset auto_overlay + parameter just because fixed sections fit into local store. + (spu_elf_auto_overlay): Do not declare as "noreturn". Skip + generating overlays if fixed sections plus reserved stack + and heap space fit into local store. + 2009-03-15 Alan Modra * elf32-spu.c (build_stub): Correct icache set_id. diff --git a/bfd/elf32-spu.c b/bfd/elf32-spu.c index 72ddccf..58719f5 100644 --- a/bfd/elf32-spu.c +++ b/bfd/elf32-spu.c @@ -2062,9 +2062,6 @@ spu_elf_check_vma (struct bfd_link_info *info) || m->sections[i]->vma + m->sections[i]->size - 1 > hi)) return m->sections[i]; - /* No need for overlays if it all fits. */ - if (htab->params->ovly_flavour != ovly_soft_icache) - htab->params->auto_overlay = 0; return NULL; } @@ -4035,9 +4032,6 @@ print_one_overlay_section (FILE *script, /* Handle --auto-overlay. */ -static void spu_elf_auto_overlay (struct bfd_link_info *) - ATTRIBUTE_NORETURN; - static void spu_elf_auto_overlay (struct bfd_link_info *info) { @@ -4079,11 +4073,30 @@ spu_elf_auto_overlay (struct bfd_link_info *info) if (!build_call_tree (info)) goto err_exit; + htab = spu_hash_table (info); + if (htab->reserved == 0) + { + struct _sum_stack_param sum_stack_param; + + sum_stack_param.emit_stack_syms = 0; + 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->extra_stack_space; + } + + /* No need for overlays if everything already fits. */ + if (fixed_size + htab->reserved <= htab->local_store + && htab->params->ovly_flavour != ovly_soft_icache) + { + htab->params->auto_overlay = 0; + return; + } + uos_param.exclude_input_section = 0; uos_param.exclude_output_section = bfd_get_section_by_name (info->output_bfd, ".interrupt"); - htab = spu_hash_table (info); ovly_mgr_entry = "__ovly_load"; if (htab->params->ovly_flavour == ovly_soft_icache) ovly_mgr_entry = "__icache_br_handler"; @@ -4186,16 +4199,6 @@ spu_elf_auto_overlay (struct bfd_link_info *info) } free (bfd_arr); - if (htab->reserved == 0) - { - struct _sum_stack_param sum_stack_param; - - sum_stack_param.emit_stack_syms = 0; - 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->extra_stack_space; - } fixed_size += htab->reserved; fixed_size += htab->non_ovly_stub * ovl_stub_size (htab->params->ovly_flavour); if (fixed_size + mos_param.max_overlay_size <= htab->local_store) -- 2.7.4