Commit Graph

83 Commits

Author SHA1 Message Date
Ulrich Weigand be3e406de8 * elf32-spu.c (needs_ovl_stub): Respect .brinfo lrlive bits
also for calls.
2009-06-16 13:44:00 +00:00
Alan Modra 74681fc450 * elf32-spu.c (spu_elf_relocate_section): Match overlay number
when looking for soft-icache stubs.
2009-06-06 06:36:52 +00:00
Ulrich Weigand 5ebe285860 * elf32-spu.c (struct call_info): New member broken_cycle.
(remove_cycle): Instead of physically removing call_info structures
	to break call graph cycles, mark them using the broken_cycle flag.
	(mark_overlay_section): Respect broken_cycle flag.
	(unmark_overlay_section): Likewise.
	(collect_lib_sections): Likewise.
	(collect_overlays): Likewise.
	(sum_stack): Likewise.
2009-05-28 10:47:44 +00:00
Ulrich Weigand 34ad4cb0b5 * elf32-spu.c (insert_callee): Accumulate incoming callee->count.
(mark_functions_via_relocs): Initialize callee->count to 1.
	(pasted_function): Likewise.
	(spu_elf_auto_overlay): Honor call counts when determining number
	of stubs required in software i-cache mode.
2009-05-28 10:42:47 +00:00
Alan Modra 6e0b88f1b8 * elf-bfd.h (struct elf_backend_data
<elf_backend_link_output_symbol_hook>): Return an int.
	* elf64-ppc.c (ppc64_elf_output_symbol_hook): Return 2 to drop
	symbols on deleted .opd entries.
	* elflink.c (elf_link_output_sym): Return without outputting sym
	if output_symbol_hook returns 2.
	(elf_link_output_extsym): Don't assign h->indx when symbol discarded.
	Abort if we must not discard sym.
	(elf_link_input_bfd): Similarly, don't set finfo->indices for
	local syms.
	(bfd_elf_final_link): Adjust elf_link_output_sym calls.
	* elf-vxworks.c (elf_vxworks_link_output_symbol_hook): Adjust for
	elf_backend_link_output_symbol_hook return type change.
	* elf32-arm.c (output_arch_syminfo): Likewise.
	(elf32_arm_output_map_sym, elf32_arm_output_stub_sym): Likewise.
	(elf32_arm_output_arch_local_syms): Likewise.
	* elf32-cr16c.c (elf32_cr16c_link_output_symbol_hook): Likewise.
	* elf32-score.c (s3_bfd_score_elf_link_output_symbol_hook): Likewise.
	(bfd_score_elf_link_output_symbol_hook): Likewise.
	* elf32-score.h (s7_bfd_score_elf_link_output_symbol_hook): Likewise.
	* elf32-score7.c (s7_bfd_score_elf_link_output_symbol_hook): Likewise.
	* elf32-sh64.c (sh64_elf_link_output_symbol_hook): Likewise.
	* elf32-spu.c (spu_elf_output_symbol_hook): Likewise.
	* elf32-v850.c (v850_elf_link_output_symbol_hook): Likewise.
	* elf64-hppa.c (elf64_hppa_link_output_symbol_hook): Likewise.
	* elf64-mmix.c (mmix_elf_link_output_symbol_hook): Likewise.
	* elf64-sh64.c (sh64_elf64_link_output_symbol_hook): Likewise.
	* elf64-sparc.c (elf64_sparc_output_arch_syms): Likewise.
	* elfxx-mips.c (_bfd_mips_elf_link_output_symbol_hook): Likewise.
	* elfxx-mips.h (_bfd_mips_elf_link_output_symbol_hook): Likewise.
2009-05-21 14:15:50 +00:00
Ulrich Weigand 335bd8f205 * elf32-spu.c (mark_overlay_section): Move .init and .fini
sections into the software icache.
2009-05-14 17:56:56 +00:00
Ulrich Weigand cdc83fba73 bfd/
* elf32-spu.c (build_stub): Always build "compact" sofware
	i-cache stubs.

ld/
	* emultempl/spuelf.em (PARSE_AND_LIST_ARGS_CASES): Always use
	compact stubs with software i-cache.

ld/testsuite/
	* ld-spu/icache1.d: Update for compact stubs.
2009-05-14 16:56:09 +00:00
Ulrich Weigand 97fc8d845e bfd/
* elf32-spu.c (struct spu_link_hash_table): Add fromelem_size_log2.
	(spu_elf_setup): Initialize it.
	(spu_elf_size_stubs): Move .ovtab into .bss for software i-cache.
	Update to new-sytle cache manager data structures.
	(spu_elf_build_stubs): Generate new-style cache manager data
	structures and symbols.
	(spu_elf_auto_overlay): Update size computation.

ld/testsuite/
	* ld-spu/icache1.d: Update all addresses to accomodate icache
	buffer shifted down 0x800 bytes.
2009-05-14 16:04:02 +00:00
Ulrich Weigand 452de53c12 bfd/
* elf32-spu.c (spu_elf_modify_segment_map): Move all PF_OVERLAY
	segments first amongst the program headers.

ld/testsuite/
	* ld-spu/icache.d: Update file offsets.
	* ld-spu/ovl.d: Likewise.
	* ld-spu/ovl1.d: Likewise.
2009-05-14 15:26:36 +00:00
Ulrich Weigand d342a8b157 * elf32-spu.c (spu_elf_relocate_section): Only encode overlay index
into addresses for relocation types that look at high bits.  Remove
	special handling of relocation overflow warnings.
2009-05-14 14:42:36 +00:00
Ulrich Weigand cc210763ce * elf32-spu.c (mark_functions_via_relocs): Handle cycles in the
control flow graph between fragments of a function.
2009-05-14 14:40:57 +00:00
Ulrich Weigand c1ea05bbe8 * elf32-spu.c (spu_elf_size_stubs): Even in software i-cache mode,
generate only a 16-byte .toe section.
	(spu_elf_build_stubs, spu_elf_auto_overlay): Likewise.
2009-05-14 14:39:04 +00:00
Alan Modra bbb0fc04cc bfd/
* elf32-spu.c (spu_elf_size_stubs): Split out section placement to..
	(spu_elf_place_overlay_data): ..here.  New function.
	* elf32-spu.h (spu_elf_place_overlay_data): Declare.
ld/
	* emultempl/spuelf.em (spu_before_allocation): Call
	spu_elf_place_overlay_data.
ld/testsuite/
	* ld-spu/icache1.d: Update for changed overlay manager placement.
	* ld-spu/ovl.d: Likewise.
	* ld-spu/ovl2.d: Likewise.
2009-05-14 04:30:03 +00:00
Alan Modra 77ae44b0d3 * elf32-spu.c (spu_elf_find_overlays): Don't use .ovl.init lma as
start of overlays.
	(spu_elf_build_stubs): Don't define __icache_tagbase.  Define
	__icache_tag_array and __icache_tag_array_size.
2009-05-11 09:40:52 +00:00
Alan Modra ad2adbc8be bfd/
* elf32-spu.c (spu_elf_find_overlays): Separate error return from
	"no overlays" return.  If there are overlays, create overlay
	manager entry symbols here, so that..
	(spu_elf_build_stubs): ..we don't need to set them up here.
	Simplify entry symbol tests.
	* elf32-spu.h (spu_elf_find_overlays): Update prototype.
ld/
	* emultempl/spuelf.em (spu_before_allocation): Report errors from
	spu_elf_find_overlays.
2009-03-19 07:04:12 +00:00
Alan Modra a7e11ee1d2 bfd/
* elf32-spu.h (struct spu_elf_params): ovly_flavour now only 1 bit.
	Add compact_stub.
	(emum _ovly_flavour): Delete ovly_compact, ovly_none.
	* elf32-spu.c (struct spu_link_hash_table): Replace ovly_load and
	ovly_return fields with ovly_entry[2].  Adjust all users.
	(spu_elf_find_overlays): Set ovly_entry[1] from __icache_call_handler
	when soft-icache.
	(spu_elf_build_stubs): Likewise.
	(ovl_stub_size): Change arg to spu_elf_params pointer.  Adjust for
	ovly_flavour changes.  Update all callers.
	(ovl_stub_size_log2): New function.
	(build_stub): Handle compact icache stubs.  Use different manager
	entry point for stubs in non-icache area.
	(spu_elf_size_stubs): Don't allocate space for indirect branch
	descriptors.
	(spu_elf_build_stubs): And don't built them.
ld/
	* emultempl/spu_icache.S: Add new entry to dummy handler.
	* emultempl/spu_icache.o_c: Regenerate.
	* emultempl/spuelf.em (params): Init new field.
	(no_overlays): New static var.
	(spu_before_allocation): Use it.
	(OPTION_SPU_COMPACT_STUBS): Define.
	(PARSE_AND_LIST_LONGOPTS, PARSE_AND_LIST_OPTIONS): Add compact-stubs.
	(PARSE_AND_LIST_ARGS_CASES): Handle compact-stubs.  Adjust no-overlays
	handling.
ld/testsuite/
	* ld-spu/icache1.d: Update for fixed set_id, new manager entry, and
	reduced data.
2009-03-17 12:46:19 +00:00
Ulrich Weigand a14c90c1e7 * 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 15:15:29 +00:00
Alan Modra 30c665df3f * elf32-spu.c (build_stub): Correct icache set_id.
(spu_elf_relocate_section): Likewise.
2009-03-15 03:28:51 +00:00
Ulrich Weigand 9b175a76d1 * elf32-spu.c (find_function_stack_adjust): Handle sf instruction
used to update stack pointer.
2009-03-11 00:18:02 +00:00
Alan Modra 3209bffac6 * elf32-spu.c (spu_elf_find_overlays): Call bfd_set_error on errors.
(find_function): Likewise.
	(pasted_function): Don't error if no prior function found.
	(discover_functions): Revert 2008-12-10 change.  Extend first
	function range to start of section.
2009-02-09 14:24:41 +00:00
Alan Modra 50e009621f * elf32-spu.c (spu_elf_build_stubs): Define __icache_neg_log2_linesize.
Define __icache_ptr_handler*, not __icache_ptr___icache_bi_handler*.
2009-02-04 02:42:57 +00:00
Alan Modra fb266b8bce 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.
2009-01-21 02:27:13 +00:00
Alan Modra 460e679b12 * elf32-spu.c (spu_elf_build_stubs): Make __icache_base absolute. 2009-01-12 14:13:03 +00:00
Alan Modra 25076afa95 * elf32-spu.c (remove_cycles): Always set call->max_depth. 2009-01-12 13:56:03 +00:00
Alan Modra 37107878d3 * elf32-spu.c (spu_elf_auto_overlay): Correct vma mask. 2009-01-12 04:09:43 +00:00
Alan Modra cd4a7468c9 bfd/
* elf32-spu.c (struct spu_link_hash_table): Add init, line_size_log2,
	num_lines_log2.
	(struct got_entry): Add br_addr.
	(struct call_info): Add priority.
	(struct function_info): Add lr_store and sp_adjust.
	(spu_elf_setup): Init line_size_log2 and num_lines_log2.
	(spu_elf_find_overlays): For soft-icache, mark any section within cache
	area as an overlay, and check that no other overlays exist.  Look up
	icache overlay manager entry sym.
	(BRA_STUBS, BRA, BRASL): Define.
	(enum _stub_type): Replace ovl_stub with call_ovl_stub and br*_ovl_stub.
	(needs_ovl_stub): Adjust for soft-icache.  Return priority encoded
	in branch insn.
	(count_stub, build_stub): Support soft-icache.
	(build_spuear_stubs, process_stubs): Adjust build_stub call.
	(spu_elf_size_stubs): Size soft-icache stubs.
	(overlay_index): New function.
	(spu_elf_build_stubs): Make static.  Support soft-icache.
	(spu_elf_check_vma): Don't turn off auto_overlay if soft-icache.
	(find_function_stack_adjust): Save lr store and stack adjust insn
	offsets.
	(maybe_insert_function): Adjust find_function_stack_adjust call.
	(mark_functions_via_relocs): Retrieve priority.
	(remove_cycles): Only warn about pruned arcs when stack_analysis.
	(sort_calls): Sort by priority first.
	(mark_overlay_section): Ignore .ovl.init.
	(sum_stack): Only print when stack_analysis.
	(print_one_overlay_section): New function, extracted from..
	(spu_elf_auto_overlay): ..here.  Support soft-icache overlays.
	(spu_elf_stack_analysis): Only print when htab->stack_analysis.
	(spu_elf_final_link): Call spu_elf_stack_analysis for lrlive
	analysis.  Call spu_elf_build_stubs.
	(spu_elf_relocate_section): For soft-icache encode overlay index
	into addresses.
	(spu_elf_output_symbol_hook): Support soft-icache.
	(spu_elf_modify_program_headers: Likewise.
	* elf32-spu.h (struct spu_elf_params): Add lrlive_analysis.  Rename
	num_regions to num_lines.  Add line_size and max_branch.
	(enum _ovly_flavour): Add ovly_soft_icache.
	(spu_elf_build_stubs): Delete.
gas/
	* config/tc-spu.c (md_pseudo_table): Add "brinfo".
	(brinfo): New var.
	(md_assemble): Poke brinfo into branch instructions.
	(spu_brinfo): New function.
	(md_apply_fix): Don't assume insn fields start off at zero, mask
	them to remove possible brinfo.
ld/
	* emultempl/spuelf.em (params): Init new fields.
	(num_lines_set, line_size_set, icache_mgr, icache_mgr_stream): New vars.
	(spu_place_special_section): Adjust placement for soft-icache.  Pad
	soft-icache section to a fixed size.  Clear addr_tree.
	(spu_elf_load_ovl_mgr): Support soft-icache.  Map overlay manager
	sections a little more intelligently.
	(gld${EMULATION_NAME}_finish): Don't call spu_elf_build_stubs.
	(OPTION_SPU_NUM_LINES): Rename from OPTION_SPU_NUM_REGIONS.
	(OPTION_SPU_SOFT_ICACHE, OPTION_SPU_LINE_SIZE): Define.
	(OPTION_SPU_LRLIVE): Define.
	(PARSE_AND_LIST_LONGOPTS): Add new soft-icache options.
	(PARSE_AND_LIST_OPTIONS): Likewise.
	(PARSE_AND_LIST_ARGS_CASES): Handle them.
	* emultempl/spu_icache.S: Dummy file.
	* emultempl/spu_icache.o_c: Regenerate.
	* Makefile.am (eelf32_spu.c): Depend on spu_icache.o_c.
	(spu_icache.o_c): Add rule to build.
	(CLEANFILES): Zap temp files.
	(EXTRA_DIST): Add spu_icache.o_c.
	* Makefile.in: Regenerate.
ld/testsuite/
	* ld-spu/ovl.d: Allow for absolute branches in stubs.
	* ld-spu/ovl2.d: Likewise.
2009-01-12 00:23:58 +00:00
Alan Modra a3a219a90a bfd/
* elf32-spu.h (struct spu_elf_params): Add num_regions.
	* elf32-spu.c (spu_elf_auto_overlay): Handle multiple overlay regions.
ld/
	* emultempl/spuelf.em (params): Init new field.
	(OPTION_SPU_NUM_REGIONS): Define.
	(PARSE_AND_LIST_LONGOPTS, PARSE_AND_LIST_OPTIONS): Add --num-regions.
	(PARSE_AND_LIST_ARGS_CASES): Handle --num-regions.
2008-12-10 13:36:41 +00:00
Alan Modra 64615358cc bfd/
* elf32-spu.g (struct spu_elf_params, enum _ovly_flavour): New.
	(spu_elf_setup): Declare.
	(spu_elf_create_sections, spu_elf_size_stubs): Update prototype.
	(spu_elf_build_stubs, spu_elf_check_vma): Likewise.
	* elf32-spu.c (struct spu_link_hash_table): Add "params". Remove
	various other fields now in "params".  Adjust code throughout.
	(struct call_info, struct function_info): Move earlier in file.
	(struct spu_elf_stack_info): Likewise.
	(spu_elf_setup): New function.
	(spu_elf_create_sections): Remove args other than "info".
	(spu_elf_size_stubs, spu_elf_build_stubs, spu_elf_check_vma): Likewise.
	(maybe_needs_stubs): Remove "output_bfd" arg.  Adjust all calls.
	(interesting_section): Similarly with "obfd" arg.
	(needs_ovl_stub): Adjust output_section test.
	(allocate_spuear_stubs): Likewise.
	(OVL_STUB_SIZE): Don't define.
	(ovl_stub_size): New function, use in place of OVL_STUB_SIZE.
	(build_stub): Test params->ovly_flavour rather than OVL_STUB_SIZE.
	(spu_elf_auto_overlay): Remove args other than "info".  Make use
	of size returned from spu_elf_load_ovl_mgr.
	(spu_elf_stack_analysis): Remove args other than "info".
	(spu_elf_relocate_section): Tidy setting of "ea".
ld/
	* emultempl/spuelf.em (params): New var, used instead of various others.
	Adjust use throughout file.
	(spu_after_open): Call spu_elf_setup.
	(spu_place_special_section): Tidy.
	(spu_elf_load_ovl_mgr): Return total size of sections loaded.  Move
	code setting overlay section alignment to..
	(spu_before_allocation): ..here.
2008-12-10 06:32:52 +00:00
Alan Modra b0c4170911 * elf32-spu.c (define_ovtab_symbol): Don't abort on symbols
defined in linker scripts.
	(discover_functions): Consider STT_SECTION symbols too.
	(collect_lib_sections): Don't cut short call tree traversal
	when function size is too large.
2008-12-10 03:49:02 +00:00
Alan Modra 667f3338da * elf32-spu.c (find_function_stack_adjust): Don't limit number
of insns scanned.  Correct sp tests.  Handle "fsmbi" and "andbi".
	(mark_detached_root): New function.
	(build_call_tree): Call it.
	(sort_calls): Don't do void* arithmetic.
2008-12-10 00:37:11 +00:00
Alan Modra 58217f2928 * elflink.c (bfd_elf_final_link): Move code reading relocs to..
* elf32-spu.c (spu_elf_count_relocs): ..here.  Adjust params.
	* elf-bfd.h (struct elf_backend_data): Update elf_backend_count_relocs
	params.
2008-10-20 10:57:33 +00:00
Alan Modra ceae84aacf bfd/
PR 6789
	* elf.c (assign_file_positions_for_load_sections): Call
	_bfd_elf_map_sections_to_segments, not elf_modify_segment_map.
	(get_program_header_size): Protect against NULL info.
	(_bfd_elf_map_sections_to_segments): Likewise.
	* elf32-spu.c (spu_elf_additional_program_headers): Likewise.
ld/testsuite/
	* ld-elf/extract-symbol-1sec.d: Correct section lma.
2008-09-29 14:12:02 +00:00
Alan Modra e5e6a5ff6e * elf32-spu.c (spu_elf_auto_overlay): Use the maximum possible
if --fixed-space request is too large.
2008-08-04 13:01:42 +00:00
Alan Modra 4f0d75bedd * elf32-spu.c (mark_overlay_section): Move code calculating
max_overlay_size to correct block.
	(spu_elf_auto_overlay): Don't use %x in einfo error message.
2008-08-02 06:44:43 +00:00
Alan Modra dc1859a6ef * elf32-spu.c (spu_elf_relocate_section): Expand
RELOC_FOR_GLOBAL_SYMBOL.  Don't warn about undefined symbols for
	R_SPU_PPU32 and R_SPU_PPU64 relocations.
2008-07-21 07:36:25 +00:00
Alan Modra 7c39fb20ea * elf32-spu.c (needs_ovl_stub): Correctly return nonovl_stub for
non-branch insns.
2008-06-19 16:16:58 +00:00
Alan Modra f3c29e8aee * elf32-spu.c (build_stub): Allow wraparound on stub branches.
(allocate_spuear_stubs, build_spuear_stubs): Return value from
	count_stub/build_stub.
	(spu_elf_build_stubs): Correct location of stub reloc error message.
2008-06-19 16:14:15 +00:00
Alan Modra 99302af9a2 bfd/
* elf32-spu.c (struct spu_link_hash_table): Add extra_stack_space.
	(spu_elf_check_vma): Add extra_stack_space param, copy to htab.
	(spu_elf_auto_overlay): Use it.
	(RECURSE_UNMARK): Define as 0.
	(unmark_overlay_section): Heed RECURSE_UNMARK.
	* elf32-spu.h (spu_elf_check_vma): Update prototype.
ld/
	* emultempl/spuelf.em (extra_stack_space): New variable.
	(gld${EMULATION_NAME}_finish): Pass it to spu_elf_check_vma.
	(PARSE_AND_LIST_LONGOPTS, PARSE_AND_LIST_OPTIONS,
	PARSE_AND_LIST_ARGS_CASES): Handle --extra-stack-space.
	* emultempl/spu_ovl.S: Mask interrupts during dma and update of
	overlay manager structures.
	* emultempl/spu_ovl.o: Regenerate.
2008-06-16 16:16:31 +00:00
Alan Modra 6a26771553 * elf32-spu.c (spu_elf_auto_overlay): Add valid area below sp
to stack calculation.
2008-06-07 12:02:47 +00:00
Alan Modra 97407faf3d include/
* bfdlink.h (struct bfd_link_info): Add "path_separator".
bfd/
	* elf32-spu.c (spu_elf_auto_overlay): Relax requirement that
	file names be unique.  Specify archive:path in overlay script.
ld/
	* ldlang.c (name_match): New function.
	(unique_section_p, walk_wild_consider_section): Use it here.
	(walk_wild_section_general): And here.
	(archive_path): New function.
	(walk_wild): Match archive:path filespecs.
	(open_input_bfds): Don't load archive:path files.
	* emultempl/spuelf.em (choose_target): Set path_separator.
	* emulparams/elf32_spu.sh: Add ._ea.* sections to ._ea output.
2008-06-06 06:02:00 +00:00
Alan Modra 1f27ab8de1 * elf32-spu.c (get_sym_h): Don't attempt to read global syms.
(process_stubs): Likewise.
	(discover_functions): Don't used cached symbols.
	(maybe_insert_function): Correct condition under which function
	array is realloc'd.
	(mark_functions_via_relocs): Delete unused variable.
2008-06-04 07:07:19 +00:00
Alan Modra 124b52c6d8 * elf32-spu.c (spu_elf_object_p): New function.
(elf_backend_object_p): Define.
	(build_stub): Correct second word of 8 byte overlay stubs.
	(spu_elf_relocate_section): Formatting.
2008-05-28 08:15:27 +00:00
Alan Modra cc5ca406f9 * elf32-spu.c (spu_elf_relocate_section): Rename is_ea to is_ea_sym. 2008-05-12 12:22:53 +00:00
Alan Modra 8374f9d4b5 bfd/
* elf32-spu.c (spu_elf_special_sections): Add "._ea".
	(spu_elf_relocate_section): Handle relocations against symbols
	defined in ._ea specially.
binutils/
	* embedspu.sh: Take note of R_SPU_PPU32/64 relocs without a symbol,
	and if present, put image in ".data.speelf".  Put program handle
	in ".data.spehandle".
ld/emulparams/
	* elf32_spu.sh (OTHER_SECTIONS): Add "._ea".
	* elf32ppc.sh: If building with spu support, put ".data.spehandle"
	sections at the start of ".data" and provide a symbol to locate
	the directory of embedded spe programs.
ld/testsuite/
	* ld-spu/ear.s: Align various sections.
	* ld-spu/embed.rd: Update.
2008-05-07 14:46:44 +00:00
Alan Modra 2ec9638bda * elf32-spu.c (spu_elf_build_stubs): Correct error message.
(mark_functions_via_relocs): Remove premature init of symtab_hdr.
	(collect_overlays): Commment typo fix.
2008-04-08 05:48:28 +00:00
Alan Modra 9dcc47943c bfd/
* elf32-spu.c: Include libiberty.h.
	(struct spu_link_hash_table): Add local_stire, overlay_fixed, reserved,
	non_ovly_stub, spu_elf_load_ovl_mgr, spu_elf_open_overlay_script,
	spu_elf_relink, auto_overlay fields.
	(AUTO_OVERLAY, AUTO_RELINK, OVERLAY_RODATA): Define.
	(needs_ovl_stub): Flip test so that call to non-function warning
	is emitted during relocate_section rather than earlier.
	(spu_elf_check_vma): Stash --auto-overlay parameters, and clear
	auto_overlay if no section exceeds local store.
	(struct call_info): Add count, max_depth, is_pasted fields.
	(struct function_info): Add rodata, last_caller, call_count,
	depth, new visit flags.
	(insert_callee): Increment call count.
	(copy_callee): New function.
	(mark_functions_via_relocs): Investigate all reloc types to count
	possible function pointer stubs for --auto-overlay.  Track
	last_caller and increment function call_count.
	(pasted_function): Insert a "call" into call info for pasted section.
	(remove_cycles): Track max depth of calls.  Don't emit call graph
	pruning warning for --auto-overlay.
	(build_call_tree): Don't transfer_calls for --auto-overlay.
	Adjust remove_cycles call.
	(sort_calls, sort_lib, sort_bfds): New functions.
	(struct _mos_param, struct _uos_param, struct _cl_param): New.
	(mark_overlay_section, unmark_overlay_section): New functions.
	(collect_lib_sectios, auto_ovl_lib_functions): New functions.
	(collect_overlays, find_pasted_call): New functions.
	(sum_stack): Deal with is_pasted "calls".  Exit before printing
	when --auto-overlay.
	(spu_elf_auto_overlay): New function.
	(spu_elf_final_link): Call spu_elf_auto_overlay.
	* elf32-spu.h (spu_elf_check_vma): Update prototype.
ld/
	* emultempl/spuelf.em (auto_overlay, auto_overlay_file,
	auto_overlay_fixed, auto_overlay_reserved, my_argc, my_argv): New vars.
	(spu_before_allocation): Warn on --auto-overlay and existing overlays.
	(struct tflist, clean_tmp): Move.
	(new_tmp_file): New function, extracted from..
	(embedded_spu_file): ..here.
	(spu_elf_open_overlay_script, spu_elf_relink): New function.
	(gld${EMULATION_NAME}_finish): Pass a bunch of --auto-overlay params.
	Warn on --auto-overlay and zero local store.
	(gld${EMULATION_NAME}_choose_target): New function to stash argv.
	(OPTION_SPU_AUTO_OVERLAY, OPTION_SPU_AUTO_RELINK,
	OPTION_SPU_OVERLAY_RODATA, OPTION_SPU_FIXED_SPACE,
	OPTION_SPU_RESERVED_SPACE, OPTION_SPU_NO_AUTO_OVERLAY): Define.
	(PARSE_AND_LIST_LONGOPTS): Add entries for new options.
	(PARSE_AND_LIST_OPTIONS): Likewise.
	(PARSE_AND_LIST_ARGS_CASES): Likewise.
	(LDEMUL_CHOOSE_TARGET): Define.
2008-04-08 03:26:54 +00:00
Alan Modra 380814a698 * elf32-spu.c (allocate_spuear_stubs): Ensure _SPUEAR_ symbol
is defined in overlay section before creating a stub.
	(build_spuear_stubs): Likewise.
	(spu_elf_size_stubs, spu_elf_build_stubs): Adjust calls.
2008-04-07 13:07:23 +00:00
Alan Modra 055ed83b93 * elf32-spu.c (insert_callee): Reorder call list so most recent
call is always first.
	(interesting_section): Move.
	(mark_functions_via_relocs): Fold interesting_section and
	reloc_count tests in callers to here.  Simplify output section
	owner test.
	(discover_functions): Set "gaps" when no symbols and some
	"interesting_section".  Run pasted_function loop for no symbol
	bfds.
	(for_each_node, transfer_calls): New functions.
	(mark_non_root): Adjust to suit for_each_node.
	(call_graph_traverse): Likewise.  Fix memory leak.  Rename to..
	(remove_cycles): ..this.
	(build_call_tree): Use for_each_node and transfer_calls.
	(struct _sum_stack_param): New.
	(sum_stack): Adjust to suit for_each_node.  Return error on
	malloc failure.  Move code to print root node cumulative stack from..
	(spu_elf_stack_analysis): ..here.  Use for_each_node.
2008-04-01 23:52:00 +00:00
Alan Modra c65be8d78a bfd/
* elf32-spu.c (spu_elf_create_sections): Remove output_bfd parameter.
	(spu_elf_find_overlays, spu_elf_size_stubs): Likewise
	(process_stubs, discover_functions, build_call_tree): Likewise.
	(spu_elf_stack_analysis): Likewise.
	(spu_elf_check_vma): Likewise.  Move.
	(struct call_info): Make "is_tail" a bitfield.
	(insert_callee): Clear fun->start and set fun->is_func if we find
	a non-tail call.
	* elf32-spu.h (spu_elf_create_sections): Update prototype.
	(spu_elf_find_overlays, spu_elf_size_stubs, spu_elf_check_vma): Ditto.
ld/
	* emultempl/spuelf.em: Update calls to elf32-spu.c funcs.
2008-03-20 05:35:10 +00:00
Alan Modra fdba2fcde1 * elf32-spu.c (process_stubs, spu_elf_relocate_section): Move
common code to..
	(maybe_needs_stub): ..here, a new function that also omits stubs
	for .eh_frame, and..
	(needs_ovl_stub): ..here.  Create stubs for labels in code section
	referenced by switch jump table.
	(spu_elf_find_overlays): Set htab->ovly_load and htab->ovly_return.
	(enum _insn_type): Delete.
	(enum _stub_type): New.
	(count_stub, build_stub): Adjust.
	(allocate_spuear_stubs, build_spuear_stubs): Adjust.
2008-03-14 04:42:16 +00:00