forked from Imagelibrary/binutils-gdb
* 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.
67 lines
2.2 KiB
C
67 lines
2.2 KiB
C
/* SPU specific support for 32-bit ELF.
|
|
|
|
Copyright 2006, 2007, 2008 Free Software Foundation, Inc.
|
|
|
|
This file is part of BFD, the Binary File Descriptor library.
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to the Free Software Foundation,
|
|
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|
|
|
/* Extra info kept for SPU sections. */
|
|
|
|
struct spu_elf_stack_info;
|
|
|
|
struct _spu_elf_section_data
|
|
{
|
|
struct bfd_elf_section_data elf;
|
|
|
|
union {
|
|
/* Info kept for input sections. */
|
|
struct {
|
|
/* Stack analysis info kept for this section. */
|
|
struct spu_elf_stack_info *stack_info;
|
|
} i;
|
|
|
|
/* Info kept for output sections. */
|
|
struct {
|
|
/* Non-zero for overlay output sections. */
|
|
unsigned int ovl_index;
|
|
unsigned int ovl_buf;
|
|
} o;
|
|
} u;
|
|
};
|
|
|
|
#define spu_elf_section_data(sec) \
|
|
((struct _spu_elf_section_data *) elf_section_data (sec))
|
|
|
|
struct _ovl_stream
|
|
{
|
|
const void *start;
|
|
const void *end;
|
|
};
|
|
|
|
extern void spu_elf_plugin (int);
|
|
extern bfd_boolean spu_elf_open_builtin_lib (bfd **,
|
|
const struct _ovl_stream *);
|
|
extern bfd_boolean spu_elf_create_sections (struct bfd_link_info *, int, int);
|
|
extern bfd_boolean spu_elf_find_overlays (struct bfd_link_info *);
|
|
extern int spu_elf_size_stubs (struct bfd_link_info *,
|
|
void (*) (asection *, asection *, const char *),
|
|
int);
|
|
extern bfd_boolean spu_elf_build_stubs (struct bfd_link_info *, int);
|
|
extern asection *spu_elf_check_vma (struct bfd_link_info *, int,
|
|
unsigned int, unsigned int, unsigned int,
|
|
unsigned int, void (*) (void),
|
|
FILE *(*) (void), void (*) (void));
|