From: Alan Modra Date: Wed, 21 Jan 2009 02:27:13 +0000 (+0000) Subject: bfd/ X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fb266b8bce71ad8f875c81a00978578e5ac3874c;p=binutils-gdb.git bfd/ * elf32-spu.h (struct spu_elf_params): Add non_ia_text. * elf32-spu.c (mark_overlay_section): Only include .text.ia.* sections in soft-icache lines unless non_ia_text. Don't add rodata if doing so would exceed line size. ld/ * emultempl/spuelf.em (params): Init new field. (OPTION_SPU_NON_IA_TEXT): Define. (PARSE_AND_LIST_LONGOPTS, PARSE_AND_LIST_OPTIONS): Add --non-ia-text. (PARSE_AND_LIST_ARGS_CASES): Handle OPTION_SPU_NON_IA_TEXT. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 7539164a865..2876ce77d49 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,10 @@ +2009-01-21 Alan Modra + + * elf32-spu.h (struct spu_elf_params): Add non_ia_text. + * elf32-spu.c (mark_overlay_section): Only include .text.ia.* + sections in soft-icache lines unless non_ia_text. Don't add + rodata if doing so would exceed line size. + 2009-01-19 Hans-Peter Nilsson * elf32-cris.c (elf_cris_copy_indirect_symbol): For other symbol diff --git a/bfd/elf32-spu.c b/bfd/elf32-spu.c index 318c5b4deec..94de8fadf59 100644 --- a/bfd/elf32-spu.c +++ b/bfd/elf32-spu.c @@ -3279,12 +3279,16 @@ mark_overlay_section (struct function_info *fun, struct call_info *call; unsigned int count; struct _mos_param *mos_param = param; + struct spu_link_hash_table *htab = spu_hash_table (info); if (fun->visit4) return TRUE; fun->visit4 = TRUE; - if (!fun->sec->linker_mark) + if (!fun->sec->linker_mark + && (htab->params->ovly_flavour != ovly_soft_icache + || htab->params->non_ia_text + || strncmp (fun->sec->name, ".text.ia.", 9) == 0)) { unsigned int size; @@ -3296,7 +3300,8 @@ mark_overlay_section (struct function_info *fun, this flag to differentiate the two overlay section types. */ fun->sec->flags |= SEC_CODE; - if (spu_hash_table (info)->params->auto_overlay & OVERLAY_RODATA) + size = fun->sec->size; + if (htab->params->auto_overlay & OVERLAY_RODATA) { char *name = NULL; @@ -3347,16 +3352,23 @@ mark_overlay_section (struct function_info *fun, fun->rodata = rodata; if (fun->rodata) { - fun->rodata->linker_mark = 1; - fun->rodata->gc_mark = 1; - fun->rodata->flags &= ~SEC_CODE; + size += fun->rodata->size; + if (htab->params->line_size != 0 + && size > htab->params->line_size) + { + size -= fun->rodata->size; + fun->rodata = NULL; + } + else + { + fun->rodata->linker_mark = 1; + fun->rodata->gc_mark = 1; + fun->rodata->flags &= ~SEC_CODE; + } } free (name); } } - size = fun->sec->size; - if (fun->rodata) - size += fun->rodata->size; if (mos_param->max_overlay_size < size) mos_param->max_overlay_size = size; } diff --git a/bfd/elf32-spu.h b/bfd/elf32-spu.h index 0487d5917df..0e69555364c 100644 --- a/bfd/elf32-spu.h +++ b/bfd/elf32-spu.h @@ -1,6 +1,6 @@ /* SPU specific support for 32-bit ELF. - Copyright 2006, 2007, 2008 Free Software Foundation, Inc. + Copyright 2006, 2007, 2008, 2009 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -53,6 +53,9 @@ struct spu_elf_params /* Set if __stack_* syms will be emitted. */ unsigned int emit_stack_syms : 1; + /* Set if non-icache code should be allowed in icache lines. */ + unsigned int non_ia_text : 1; + /* Range of valid addresses for loadable sections. */ bfd_vma local_store_lo; bfd_vma local_store_hi; diff --git a/ld/ChangeLog b/ld/ChangeLog index a73efc55659..b45626af969 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,10 @@ +2009-01-21 Alan Modra + + * emultempl/spuelf.em (params): Init new field. + (OPTION_SPU_NON_IA_TEXT): Define. + (PARSE_AND_LIST_LONGOPTS, PARSE_AND_LIST_OPTIONS): Add --non-ia-text. + (PARSE_AND_LIST_ARGS_CASES): Handle OPTION_SPU_NON_IA_TEXT. + 2009-01-16 H.J. Lu * lexsup.c (option_values): Add OPTION_TTEXT_SEGMENT. diff --git a/ld/emultempl/spuelf.em b/ld/emultempl/spuelf.em index f72690d1783..7c98f714531 100644 --- a/ld/emultempl/spuelf.em +++ b/ld/emultempl/spuelf.em @@ -37,7 +37,7 @@ static struct spu_elf_params params = &spu_elf_load_ovl_mgr, &spu_elf_open_overlay_script, &spu_elf_relink, - 0, ovly_normal, 0, 0, 0, 0, 0, + 0, ovly_normal, 0, 0, 0, 0, 0, 0, 0, 0x3ffff, 1, 0, 16, 0, 0, 2000 }; @@ -594,7 +594,8 @@ PARSE_AND_LIST_PROLOGUE=' #define OPTION_SPU_LINE_SIZE (OPTION_SPU_SOFT_ICACHE + 1) #define OPTION_SPU_NUM_LINES (OPTION_SPU_LINE_SIZE + 1) #define OPTION_SPU_LRLIVE (OPTION_SPU_NUM_LINES + 1) -#define OPTION_SPU_FIXED_SPACE (OPTION_SPU_LRLIVE + 1) +#define OPTION_SPU_NON_IA_TEXT (OPTION_SPU_LRLIVE + 1) +#define OPTION_SPU_FIXED_SPACE (OPTION_SPU_NON_IA_TEXT + 1) #define OPTION_SPU_RESERVED_SPACE (OPTION_SPU_FIXED_SPACE + 1) #define OPTION_SPU_EXTRA_STACK (OPTION_SPU_RESERVED_SPACE + 1) #define OPTION_SPU_NO_AUTO_OVERLAY (OPTION_SPU_EXTRA_STACK + 1) @@ -606,6 +607,7 @@ PARSE_AND_LIST_LONGOPTS=' { "lrlive-analysis", no_argument, NULL, OPTION_SPU_LRLIVE }, { "num-lines", required_argument, NULL, OPTION_SPU_NUM_LINES }, { "line-size", required_argument, NULL, OPTION_SPU_LINE_SIZE }, + { "non-ia-text", no_argument, NULL, OPTION_SPU_NON_IA_TEXT }, { "no-overlays", no_argument, NULL, OPTION_SPU_NO_OVERLAYS }, { "emit-stub-syms", no_argument, NULL, OPTION_SPU_STUB_SYMS }, { "extra-overlay-stubs", no_argument, NULL, OPTION_SPU_NON_OVERLAY_STUBS }, @@ -647,6 +649,7 @@ PARSE_AND_LIST_OPTIONS=' --soft-icache Generate software icache overlays.\n\ --num-lines Number of soft-icache lines (default 32).\n\ --line-size Size of soft-icache lines (default 1k).\n\ + --non-ia-text Allow non-icache code in icache lines.\n\ --lrlive-analysis Scan function prologue for lr liveness.\n" )); ' @@ -725,6 +728,10 @@ PARSE_AND_LIST_ARGS_CASES=' params.lrlive_analysis = 1; break; + case OPTION_SPU_NON_IA_TEXT: + params.non_ia_text = 1; + break; + case OPTION_SPU_NUM_LINES: { char *end;