Commit | Line | Data |
---|---|---|
e9f53129 AM |
1 | /* SPU specific support for 32-bit ELF. |
2 | ||
b90efa5b | 3 | Copyright (C) 2006-2015 Free Software Foundation, Inc. |
e9f53129 AM |
4 | |
5 | This file is part of BFD, the Binary File Descriptor library. | |
6 | ||
7 | This program is free software; you can redistribute it and/or modify | |
8 | it under the terms of the GNU General Public License as published by | |
cd123cb7 | 9 | the Free Software Foundation; either version 3 of the License, or |
e9f53129 AM |
10 | (at your option) any later version. |
11 | ||
12 | This program is distributed in the hope that it will be useful, | |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
18 | along with this program; if not, write to the Free Software Foundation, | |
19 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | |
20 | ||
64615358 AM |
21 | struct spu_elf_params |
22 | { | |
23 | /* Stash various callbacks for --auto-overlay. */ | |
24 | void (*place_spu_section) (asection *, asection *, const char *); | |
25 | bfd_size_type (*spu_elf_load_ovl_mgr) (void); | |
26 | FILE *(*spu_elf_open_overlay_script) (void); | |
27 | void (*spu_elf_relink) (void); | |
28 | ||
29 | /* Bit 0 set if --auto-overlay. | |
30 | Bit 1 set if --auto-relink. | |
31 | Bit 2 set if --overlay-rodata. */ | |
32 | unsigned int auto_overlay : 3; | |
33 | #define AUTO_OVERLAY 1 | |
34 | #define AUTO_RELINK 2 | |
35 | #define OVERLAY_RODATA 4 | |
36 | ||
37 | /* Type of overlays, enum _ovly_flavour. */ | |
a7e11ee1 AM |
38 | unsigned int ovly_flavour : 1; |
39 | unsigned int compact_stub : 1; | |
64615358 AM |
40 | |
41 | /* Set if we should emit symbols for stubs. */ | |
42 | unsigned int emit_stub_syms : 1; | |
43 | ||
44 | /* Set if we want stubs on calls out of overlay regions to | |
45 | non-overlay regions. */ | |
46 | unsigned int non_overlay_stubs : 1; | |
47 | ||
cd4a7468 AM |
48 | /* Set if lr liveness analysis should be done. */ |
49 | unsigned int lrlive_analysis : 1; | |
50 | ||
64615358 AM |
51 | /* Set if stack size analysis should be done. */ |
52 | unsigned int stack_analysis : 1; | |
53 | ||
54 | /* Set if __stack_* syms will be emitted. */ | |
55 | unsigned int emit_stack_syms : 1; | |
56 | ||
fb266b8b AM |
57 | /* Set if non-icache code should be allowed in icache lines. */ |
58 | unsigned int non_ia_text : 1; | |
59 | ||
9cc305ec TS |
60 | /* Set when the .fixup section should be generated. */ |
61 | unsigned int emit_fixups : 1; | |
62 | ||
64615358 AM |
63 | /* Range of valid addresses for loadable sections. */ |
64 | bfd_vma local_store_lo; | |
65 | bfd_vma local_store_hi; | |
66 | ||
67 | /* Control --auto-overlay feature. */ | |
cd4a7468 AM |
68 | unsigned int num_lines; |
69 | unsigned int line_size; | |
70 | unsigned int max_branch; | |
64615358 AM |
71 | unsigned int auto_overlay_fixed; |
72 | unsigned int auto_overlay_reserved; | |
73 | int extra_stack_space; | |
74 | }; | |
75 | ||
e9f53129 AM |
76 | /* Extra info kept for SPU sections. */ |
77 | ||
49fa1e15 AM |
78 | struct spu_elf_stack_info; |
79 | ||
e9f53129 AM |
80 | struct _spu_elf_section_data |
81 | { | |
82 | struct bfd_elf_section_data elf; | |
83 | ||
47f6dab9 AM |
84 | union { |
85 | /* Info kept for input sections. */ | |
86 | struct { | |
87 | /* Stack analysis info kept for this section. */ | |
88 | struct spu_elf_stack_info *stack_info; | |
89 | } i; | |
49fa1e15 | 90 | |
47f6dab9 AM |
91 | /* Info kept for output sections. */ |
92 | struct { | |
93 | /* Non-zero for overlay output sections. */ | |
94 | unsigned int ovl_index; | |
95 | unsigned int ovl_buf; | |
96 | } o; | |
97 | } u; | |
e9f53129 AM |
98 | }; |
99 | ||
100 | #define spu_elf_section_data(sec) \ | |
101 | ((struct _spu_elf_section_data *) elf_section_data (sec)) | |
102 | ||
64615358 AM |
103 | enum _ovly_flavour |
104 | { | |
64615358 | 105 | ovly_normal, |
a7e11ee1 | 106 | ovly_soft_icache |
64615358 AM |
107 | }; |
108 | ||
e9f53129 AM |
109 | struct _ovl_stream |
110 | { | |
7a8757b3 AM |
111 | const void *start; |
112 | const void *end; | |
e9f53129 AM |
113 | }; |
114 | ||
64615358 | 115 | extern void spu_elf_setup (struct bfd_link_info *, struct spu_elf_params *); |
e9f53129 AM |
116 | extern void spu_elf_plugin (int); |
117 | extern bfd_boolean spu_elf_open_builtin_lib (bfd **, | |
118 | const struct _ovl_stream *); | |
64615358 | 119 | extern bfd_boolean spu_elf_create_sections (struct bfd_link_info *); |
9cc305ec | 120 | extern bfd_boolean spu_elf_size_sections (bfd *, struct bfd_link_info *); |
ad2adbc8 | 121 | extern int spu_elf_find_overlays (struct bfd_link_info *); |
64615358 | 122 | extern int spu_elf_size_stubs (struct bfd_link_info *); |
bbb0fc04 | 123 | extern void spu_elf_place_overlay_data (struct bfd_link_info *); |
64615358 | 124 | extern asection *spu_elf_check_vma (struct bfd_link_info *); |