Commit | Line | Data |
---|---|---|
252b5132 | 1 | /* BFD back-end data structures for ELF files. |
e5094212 | 2 | Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, |
f0abc2a1 | 3 | 2002, 2003 Free Software Foundation, Inc. |
252b5132 RH |
4 | Written by Cygnus Support. |
5 | ||
5e8d7549 | 6 | This file is part of BFD, the Binary File Descriptor library. |
252b5132 | 7 | |
5e8d7549 NC |
8 | This program is free software; you can redistribute it and/or modify |
9 | it under the terms of the GNU General Public License as published by | |
10 | the Free Software Foundation; either version 2 of the License, or | |
11 | (at your option) any later version. | |
252b5132 | 12 | |
5e8d7549 NC |
13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | GNU General Public License for more details. | |
252b5132 | 17 | |
5e8d7549 NC |
18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software | |
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | |
252b5132 RH |
21 | |
22 | #ifndef _LIBELF_H_ | |
23 | #define _LIBELF_H_ 1 | |
24 | ||
25 | #include "elf/common.h" | |
26 | #include "elf/internal.h" | |
27 | #include "elf/external.h" | |
28 | #include "bfdlink.h" | |
29 | ||
d9bc7a44 | 30 | /* The number of entries in a section is its size divided by the size |
51b64d56 | 31 | of a single entry. This is normally only applicable to reloc and |
d9bc7a44 NC |
32 | symbol table sections. */ |
33 | #define NUM_SHDR_ENTRIES(shdr) ((shdr)->sh_size / (shdr)->sh_entsize) | |
34 | ||
252b5132 | 35 | /* If size isn't specified as 64 or 32, NAME macro should fail. */ |
e43d48cc AM |
36 | /* Do not "beautify" the CONCAT* macro args. Traditional C will not |
37 | remove whitespace added here, and thus will fail to concatenate | |
38 | the tokens. */ | |
252b5132 RH |
39 | #ifndef NAME |
40 | #if ARCH_SIZE==64 | |
e43d48cc | 41 | #define NAME(x,y) CONCAT4 (x,64,_,y) |
252b5132 RH |
42 | #endif |
43 | #if ARCH_SIZE==32 | |
e43d48cc | 44 | #define NAME(x,y) CONCAT4 (x,32,_,y) |
252b5132 RH |
45 | #endif |
46 | #endif | |
47 | ||
48 | #ifndef NAME | |
e43d48cc | 49 | #define NAME(x,y) CONCAT4 (x,NOSIZE,_,y) |
252b5132 RH |
50 | #endif |
51 | ||
52 | #define ElfNAME(X) NAME(Elf,X) | |
53 | #define elfNAME(X) NAME(elf,X) | |
54 | ||
55 | /* Information held for an ELF symbol. The first field is the | |
56 | corresponding asymbol. Every symbol is an ELF file is actually a | |
57 | pointer to this structure, although it is often handled as a | |
58 | pointer to an asymbol. */ | |
59 | ||
60 | typedef struct | |
61 | { | |
62 | /* The BFD symbol. */ | |
63 | asymbol symbol; | |
64 | /* ELF symbol information. */ | |
65 | Elf_Internal_Sym internal_elf_sym; | |
66 | /* Backend specific information. */ | |
67 | union | |
68 | { | |
69 | unsigned int hppa_arg_reloc; | |
70 | PTR mips_extr; | |
71 | PTR any; | |
72 | } | |
73 | tc_data; | |
74 | ||
75 | /* Version information. This is from an Elf_Internal_Versym | |
76 | structure in a SHT_GNU_versym section. It is zero if there is no | |
77 | version information. */ | |
78 | unsigned short version; | |
79 | ||
80 | } elf_symbol_type; | |
81 | \f | |
2b0f7ef9 | 82 | struct elf_strtab_hash; |
5cab59f6 AM |
83 | struct got_entry; |
84 | struct plt_entry; | |
2b0f7ef9 | 85 | |
252b5132 RH |
86 | /* ELF linker hash table entries. */ |
87 | ||
88 | struct elf_link_hash_entry | |
89 | { | |
90 | struct bfd_link_hash_entry root; | |
91 | ||
92 | /* Symbol index in output file. This is initialized to -1. It is | |
93 | set to -2 if the symbol is used by a reloc. */ | |
94 | long indx; | |
95 | ||
252b5132 RH |
96 | /* Symbol index as a dynamic symbol. Initialized to -1, and remains |
97 | -1 if this is not a dynamic symbol. */ | |
30b30c21 RH |
98 | /* ??? Note that this is consistently used as a synonym for tests |
99 | against whether we can perform various simplifying transformations | |
100 | to the code. (E.g. changing a pc-relative jump to a PLT entry | |
101 | into a pc-relative jump to the target function.) That test, which | |
102 | is often relatively complex, and someplaces wrong or incomplete, | |
103 | should really be replaced by a predicate in elflink.c. | |
104 | ||
105 | End result: this field -1 does not indicate that the symbol is | |
106 | not in the dynamic symbol table, but rather that the symbol is | |
107 | not visible outside this DSO. */ | |
252b5132 RH |
108 | long dynindx; |
109 | ||
110 | /* String table index in .dynstr if this is a dynamic symbol. */ | |
111 | unsigned long dynstr_index; | |
112 | ||
a90b9fca AM |
113 | /* Hash value of the name computed using the ELF hash function. */ |
114 | unsigned long elf_hash_value; | |
115 | ||
252b5132 RH |
116 | /* If this is a weak defined symbol from a dynamic object, this |
117 | field points to a defined symbol with the same value, if there is | |
118 | one. Otherwise it is NULL. */ | |
119 | struct elf_link_hash_entry *weakdef; | |
120 | ||
252b5132 RH |
121 | /* If this symbol is used in the linker created sections, the processor |
122 | specific backend uses this field to map the field into the offset | |
123 | from the beginning of the section. */ | |
124 | struct elf_linker_section_pointers *linker_section_pointer; | |
125 | ||
126 | /* Version information. */ | |
127 | union | |
128 | { | |
129 | /* This field is used for a symbol which is not defined in a | |
130 | regular object. It points to the version information read in | |
131 | from the dynamic object. */ | |
132 | Elf_Internal_Verdef *verdef; | |
133 | /* This field is used for a symbol which is defined in a regular | |
134 | object. It is set up in size_dynamic_sections. It points to | |
135 | the version information we should write out for this symbol. */ | |
136 | struct bfd_elf_version_tree *vertree; | |
137 | } verinfo; | |
138 | ||
139 | /* Virtual table entry use information. This array is nominally of size | |
140 | size/sizeof(target_void_pointer), though we have to be able to assume | |
141 | and track a size while the symbol is still undefined. It is indexed | |
142 | via offset/sizeof(target_void_pointer). */ | |
143 | size_t vtable_entries_size; | |
b34976b6 | 144 | bfd_boolean *vtable_entries_used; |
252b5132 RH |
145 | |
146 | /* Virtual table derivation info. */ | |
147 | struct elf_link_hash_entry *vtable_parent; | |
148 | ||
a90b9fca AM |
149 | /* If this symbol requires an entry in the global offset table, the |
150 | processor specific backend uses this field to track usage and | |
5cab59f6 AM |
151 | final offset. Two schemes are supported: The first assumes that |
152 | a symbol may only have one GOT entry, and uses REFCOUNT until | |
153 | size_dynamic_sections, at which point the contents of the .got is | |
154 | fixed. Afterward, if OFFSET is -1, then the symbol does not | |
155 | require a global offset table entry. The second scheme allows | |
156 | multiple GOT entries per symbol, managed via a linked list | |
157 | pointed to by GLIST. */ | |
158 | union gotplt_union | |
a90b9fca AM |
159 | { |
160 | bfd_signed_vma refcount; | |
161 | bfd_vma offset; | |
5cab59f6 AM |
162 | struct got_entry *glist; |
163 | struct plt_entry *plist; | |
a90b9fca AM |
164 | } got; |
165 | ||
166 | /* Same, but tracks a procedure linkage table entry. */ | |
5cab59f6 | 167 | union gotplt_union plt; |
a90b9fca AM |
168 | |
169 | /* Symbol size. */ | |
170 | bfd_size_type size; | |
171 | ||
252b5132 RH |
172 | /* Symbol type (STT_NOTYPE, STT_OBJECT, etc.). */ |
173 | char type; | |
174 | ||
9b234ee9 | 175 | /* Symbol st_other value, symbol visibility. */ |
252b5132 RH |
176 | unsigned char other; |
177 | ||
252b5132 RH |
178 | /* Some flags; legal values follow. */ |
179 | unsigned short elf_link_hash_flags; | |
180 | /* Symbol is referenced by a non-shared object. */ | |
181 | #define ELF_LINK_HASH_REF_REGULAR 01 | |
182 | /* Symbol is defined by a non-shared object. */ | |
183 | #define ELF_LINK_HASH_DEF_REGULAR 02 | |
184 | /* Symbol is referenced by a shared object. */ | |
185 | #define ELF_LINK_HASH_REF_DYNAMIC 04 | |
186 | /* Symbol is defined by a shared object. */ | |
187 | #define ELF_LINK_HASH_DEF_DYNAMIC 010 | |
188 | /* Symbol has a non-weak reference from a non-shared object. */ | |
189 | #define ELF_LINK_HASH_REF_REGULAR_NONWEAK 020 | |
190 | /* Dynamic symbol has been adjustd. */ | |
191 | #define ELF_LINK_HASH_DYNAMIC_ADJUSTED 040 | |
192 | /* Symbol needs a copy reloc. */ | |
193 | #define ELF_LINK_HASH_NEEDS_COPY 0100 | |
194 | /* Symbol needs a procedure linkage table entry. */ | |
195 | #define ELF_LINK_HASH_NEEDS_PLT 0200 | |
196 | /* Symbol appears in a non-ELF input file. */ | |
197 | #define ELF_LINK_NON_ELF 0400 | |
198 | /* Symbol should be marked as hidden in the version information. */ | |
199 | #define ELF_LINK_HIDDEN 01000 | |
200 | /* Symbol was forced to local scope due to a version script file. */ | |
201 | #define ELF_LINK_FORCED_LOCAL 02000 | |
202 | /* Symbol was marked during garbage collection. */ | |
203 | #define ELF_LINK_HASH_MARK 04000 | |
7843f00e ILT |
204 | /* Symbol is referenced by a non-GOT/non-PLT relocation. This is |
205 | not currently set by all the backends. */ | |
206 | #define ELF_LINK_NON_GOT_REF 010000 | |
1b1fe8fe L |
207 | /* Symbol has a definition in a shared object. */ |
208 | #define ELF_LINK_DYNAMIC_DEF 020000 | |
209 | /* Symbol is weak in all shared objects. */ | |
210 | #define ELF_LINK_DYNAMIC_WEAK 040000 | |
252b5132 RH |
211 | }; |
212 | ||
586119b3 AM |
213 | /* Will references to this symbol always reference the symbol |
214 | in this object? STV_PROTECTED is excluded from the visibility test | |
215 | here so that function pointer comparisons work properly. Since | |
216 | function symbols not defined in an app are set to their .plt entry, | |
217 | it's necessary for shared libs to also reference the .plt even | |
218 | though the symbol is really local to the shared lib. */ | |
219 | #define SYMBOL_REFERENCES_LOCAL(INFO, H) \ | |
220 | ((! (INFO)->shared \ | |
221 | || (INFO)->symbolic \ | |
222 | || (H)->dynindx == -1 \ | |
223 | || ELF_ST_VISIBILITY ((H)->other) == STV_INTERNAL \ | |
224 | || ELF_ST_VISIBILITY ((H)->other) == STV_HIDDEN \ | |
225 | || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0) \ | |
226 | && ((H)->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0) | |
227 | ||
228 | /* Will _calls_ to this symbol always call the version in this object? */ | |
229 | #define SYMBOL_CALLS_LOCAL(INFO, H) \ | |
230 | ((! (INFO)->shared \ | |
231 | || (INFO)->symbolic \ | |
232 | || (H)->dynindx == -1 \ | |
233 | || ELF_ST_VISIBILITY ((H)->other) != STV_DEFAULT \ | |
234 | || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0) \ | |
235 | && ((H)->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0) | |
236 | ||
30b30c21 RH |
237 | /* Records local symbols to be emitted in the dynamic symbol table. */ |
238 | ||
239 | struct elf_link_local_dynamic_entry | |
240 | { | |
241 | struct elf_link_local_dynamic_entry *next; | |
242 | ||
243 | /* The input bfd this symbol came from. */ | |
244 | bfd *input_bfd; | |
245 | ||
246 | /* The index of the local symbol being copied. */ | |
247 | long input_indx; | |
248 | ||
249 | /* The index in the outgoing dynamic symbol table. */ | |
250 | long dynindx; | |
3e932841 | 251 | |
30b30c21 RH |
252 | /* A copy of the input symbol. */ |
253 | Elf_Internal_Sym isym; | |
254 | }; | |
255 | ||
f5d44ba0 AM |
256 | struct elf_link_loaded_list |
257 | { | |
258 | struct elf_link_loaded_list *next; | |
259 | bfd *abfd; | |
260 | }; | |
261 | ||
126495ed AM |
262 | /* Structures used by the eh_frame optimization code. */ |
263 | struct cie_header | |
264 | { | |
265 | unsigned int length; | |
266 | unsigned int id; | |
267 | }; | |
268 | ||
269 | struct cie | |
270 | { | |
271 | struct cie_header hdr; | |
272 | unsigned char version; | |
273 | unsigned char augmentation[20]; | |
274 | unsigned int code_align; | |
275 | int data_align; | |
276 | unsigned int ra_column; | |
277 | unsigned int augmentation_size; | |
278 | struct elf_link_hash_entry *personality; | |
279 | unsigned char per_encoding; | |
280 | unsigned char lsda_encoding; | |
281 | unsigned char fde_encoding; | |
282 | unsigned char initial_insn_length; | |
283 | unsigned char make_relative; | |
284 | unsigned char make_lsda_relative; | |
285 | unsigned char initial_instructions[50]; | |
286 | }; | |
287 | ||
288 | struct eh_cie_fde | |
289 | { | |
290 | unsigned int offset; | |
291 | unsigned int size; | |
292 | asection *sec; | |
293 | unsigned int new_offset; | |
294 | unsigned char fde_encoding; | |
295 | unsigned char lsda_encoding; | |
296 | unsigned char lsda_offset; | |
297 | unsigned char cie : 1; | |
298 | unsigned char removed : 1; | |
299 | unsigned char make_relative : 1; | |
300 | unsigned char make_lsda_relative : 1; | |
301 | unsigned char per_encoding_relative : 1; | |
302 | }; | |
303 | ||
304 | struct eh_frame_sec_info | |
305 | { | |
306 | unsigned int count; | |
307 | unsigned int alloced; | |
308 | struct eh_cie_fde entry[1]; | |
309 | }; | |
310 | ||
311 | struct eh_frame_array_ent | |
312 | { | |
313 | bfd_vma initial_loc; | |
314 | bfd_vma fde; | |
315 | }; | |
316 | ||
317 | struct eh_frame_hdr_info | |
318 | { | |
319 | struct cie last_cie; | |
320 | asection *last_cie_sec; | |
321 | asection *hdr_sec; | |
322 | unsigned int last_cie_offset; | |
323 | unsigned int fde_count, array_count; | |
324 | struct eh_frame_array_ent *array; | |
325 | /* TRUE if .eh_frame_hdr should contain the sorted search table. | |
326 | We build it if we successfully read all .eh_frame input sections | |
327 | and recognize them. */ | |
b34976b6 | 328 | bfd_boolean table; |
126495ed AM |
329 | }; |
330 | ||
13ae64f3 JJ |
331 | /* Cached start, size and alignment of PT_TLS segment. */ |
332 | struct elf_link_tls_segment | |
333 | { | |
334 | bfd_vma start; | |
335 | bfd_size_type size; | |
336 | unsigned int align; | |
337 | }; | |
338 | ||
252b5132 RH |
339 | /* ELF linker hash table. */ |
340 | ||
341 | struct elf_link_hash_table | |
342 | { | |
343 | struct bfd_link_hash_table root; | |
51b64d56 | 344 | |
252b5132 RH |
345 | /* Whether we have created the special dynamic sections required |
346 | when linking against or generating a shared object. */ | |
b34976b6 | 347 | bfd_boolean dynamic_sections_created; |
51b64d56 | 348 | |
252b5132 RH |
349 | /* The BFD used to hold special sections created by the linker. |
350 | This will be the first BFD found which requires these sections to | |
351 | be created. */ | |
352 | bfd *dynobj; | |
51b64d56 AM |
353 | |
354 | /* The value to use when initialising got.refcount/offset and | |
355 | plt.refcount/offset in an elf_link_hash_entry. Set to zero when | |
5cab59f6 AM |
356 | the values are refcounts. Set to init_offset in |
357 | size_dynamic_sections when the values may be offsets. */ | |
358 | union gotplt_union init_refcount; | |
359 | ||
360 | /* The value to use for got.refcount/offset and plt.refcount/offset | |
361 | when the values may be offsets. Normally (bfd_vma) -1. */ | |
362 | union gotplt_union init_offset; | |
51b64d56 | 363 | |
252b5132 RH |
364 | /* The number of symbols found in the link which must be put into |
365 | the .dynsym section. */ | |
366 | bfd_size_type dynsymcount; | |
51b64d56 | 367 | |
252b5132 RH |
368 | /* The string table of dynamic symbols, which becomes the .dynstr |
369 | section. */ | |
2b0f7ef9 | 370 | struct elf_strtab_hash *dynstr; |
51b64d56 | 371 | |
252b5132 RH |
372 | /* The number of buckets in the hash table in the .hash section. |
373 | This is based on the number of dynamic symbols. */ | |
374 | bfd_size_type bucketcount; | |
51b64d56 | 375 | |
252b5132 RH |
376 | /* A linked list of DT_NEEDED names found in dynamic objects |
377 | included in the link. */ | |
378 | struct bfd_link_needed_list *needed; | |
51b64d56 | 379 | |
252b5132 RH |
380 | /* The _GLOBAL_OFFSET_TABLE_ symbol. */ |
381 | struct elf_link_hash_entry *hgot; | |
51b64d56 | 382 | |
252b5132 RH |
383 | /* A pointer to information used to link stabs in sections. */ |
384 | PTR stab_info; | |
51b64d56 | 385 | |
f5fa8ca2 JJ |
386 | /* A pointer to information used to merge SEC_MERGE sections. */ |
387 | PTR merge_info; | |
51b64d56 | 388 | |
126495ed AM |
389 | /* Used by eh_frame code when editing .eh_frame. */ |
390 | struct eh_frame_hdr_info eh_info; | |
391 | ||
30b30c21 RH |
392 | /* A linked list of local symbols to be added to .dynsym. */ |
393 | struct elf_link_local_dynamic_entry *dynlocal; | |
51b64d56 | 394 | |
a963dc6a L |
395 | /* A linked list of DT_RPATH/DT_RUNPATH names found in dynamic |
396 | objects included in the link. */ | |
397 | struct bfd_link_needed_list *runpath; | |
13ae64f3 JJ |
398 | |
399 | /* Cached start, size and alignment of PT_TLS segment. */ | |
400 | struct elf_link_tls_segment *tls_segment; | |
f5d44ba0 AM |
401 | |
402 | /* A linked list of BFD's loaded in the link. */ | |
403 | struct elf_link_loaded_list *loaded; | |
252b5132 RH |
404 | }; |
405 | ||
406 | /* Look up an entry in an ELF linker hash table. */ | |
407 | ||
408 | #define elf_link_hash_lookup(table, string, create, copy, follow) \ | |
409 | ((struct elf_link_hash_entry *) \ | |
410 | bfd_link_hash_lookup (&(table)->root, (string), (create), \ | |
411 | (copy), (follow))) | |
412 | ||
413 | /* Traverse an ELF linker hash table. */ | |
414 | ||
415 | #define elf_link_hash_traverse(table, func, info) \ | |
416 | (bfd_link_hash_traverse \ | |
417 | (&(table)->root, \ | |
b34976b6 | 418 | (bfd_boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \ |
252b5132 RH |
419 | (info))) |
420 | ||
421 | /* Get the ELF linker hash table from a link_info structure. */ | |
422 | ||
423 | #define elf_hash_table(p) ((struct elf_link_hash_table *) ((p)->hash)) | |
8ea2e4bd | 424 | |
b34976b6 | 425 | /* Returns TRUE if the hash table is a struct elf_link_hash_table. */ |
8ea2e4bd NC |
426 | #define is_elf_hash_table(p) \ |
427 | ((p)->hash->type == bfd_link_elf_hash_table) | |
ec338859 AM |
428 | |
429 | /* Used by bfd_section_from_r_symndx to cache a small number of local | |
430 | symbol to section mappings. */ | |
431 | #define LOCAL_SYM_CACHE_SIZE 32 | |
432 | struct sym_sec_cache | |
433 | { | |
434 | bfd *abfd; | |
435 | unsigned long indx[LOCAL_SYM_CACHE_SIZE]; | |
436 | asection *sec[LOCAL_SYM_CACHE_SIZE]; | |
437 | }; | |
252b5132 RH |
438 | \f |
439 | /* Constant information held for an ELF backend. */ | |
440 | ||
441 | struct elf_size_info { | |
442 | unsigned char sizeof_ehdr, sizeof_phdr, sizeof_shdr; | |
443 | unsigned char sizeof_rel, sizeof_rela, sizeof_sym, sizeof_dyn, sizeof_note; | |
444 | ||
c7ac6ff8 MM |
445 | /* The size of entries in the .hash section. */ |
446 | unsigned char sizeof_hash_entry; | |
447 | ||
448 | /* The number of internal relocations to allocate per external | |
449 | relocation entry. */ | |
450 | unsigned char int_rels_per_ext_rel; | |
947216bf AM |
451 | /* We use some fixed size arrays. This should be large enough to |
452 | handle all back-ends. */ | |
453 | #define MAX_INT_RELS_PER_EXT_REL 3 | |
c7ac6ff8 | 454 | |
45d6a902 | 455 | unsigned char arch_size, log_file_align; |
252b5132 | 456 | unsigned char elfclass, ev_current; |
dc810e39 AM |
457 | int (*write_out_phdrs) |
458 | PARAMS ((bfd *, const Elf_Internal_Phdr *, unsigned int)); | |
b34976b6 | 459 | bfd_boolean (*write_shdrs_and_ehdr) |
dc810e39 AM |
460 | PARAMS ((bfd *)); |
461 | void (*write_relocs) | |
462 | PARAMS ((bfd *, asection *, PTR)); | |
73ff0d56 | 463 | void (*swap_symbol_in) |
f8ecb12b | 464 | PARAMS ((bfd *, const PTR, const PTR, Elf_Internal_Sym *)); |
dc810e39 | 465 | void (*swap_symbol_out) |
9ad5cbcf | 466 | PARAMS ((bfd *, const Elf_Internal_Sym *, PTR, PTR)); |
b34976b6 AM |
467 | bfd_boolean (*slurp_reloc_table) |
468 | PARAMS ((bfd *, asection *, asymbol **, bfd_boolean)); | |
dc810e39 | 469 | long (*slurp_symbol_table) |
b34976b6 | 470 | PARAMS ((bfd *, asymbol **, bfd_boolean)); |
dc810e39 AM |
471 | void (*swap_dyn_in) |
472 | PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *)); | |
473 | void (*swap_dyn_out) | |
474 | PARAMS ((bfd *, const Elf_Internal_Dyn *, PTR)); | |
c7ac6ff8 | 475 | |
947216bf AM |
476 | /* This function is called to swap in a REL relocation. If an |
477 | external relocation corresponds to more than one internal | |
478 | relocation, then all relocations are swapped in at once. */ | |
c7ac6ff8 | 479 | void (*swap_reloc_in) |
947216bf | 480 | PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rela *)); |
c7ac6ff8 | 481 | |
947216bf | 482 | /* This function is called to swap out a REL relocation. */ |
c7ac6ff8 | 483 | void (*swap_reloc_out) |
947216bf | 484 | PARAMS ((bfd *, const Elf_Internal_Rela *, bfd_byte *)); |
c7ac6ff8 | 485 | |
947216bf AM |
486 | /* This function is called to swap in a RELA relocation. If an |
487 | external relocation corresponds to more than one internal | |
488 | relocation, then all relocations are swapped in at once. */ | |
c7ac6ff8 MM |
489 | void (*swap_reloca_in) |
490 | PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rela *)); | |
491 | ||
947216bf | 492 | /* This function is called to swap out a RELA relocation. */ |
c7ac6ff8 MM |
493 | void (*swap_reloca_out) |
494 | PARAMS ((bfd *, const Elf_Internal_Rela *, bfd_byte *)); | |
252b5132 RH |
495 | }; |
496 | ||
497 | #define elf_symbol_from(ABFD,S) \ | |
498 | (((S)->the_bfd->xvec->flavour == bfd_target_elf_flavour \ | |
499 | && (S)->the_bfd->tdata.elf_obj_data != 0) \ | |
500 | ? (elf_symbol_type *) (S) \ | |
501 | : 0) | |
502 | ||
db6751f2 JJ |
503 | enum elf_reloc_type_class { |
504 | reloc_class_normal, | |
505 | reloc_class_relative, | |
506 | reloc_class_plt, | |
507 | reloc_class_copy | |
508 | }; | |
509 | ||
73d074b4 DJ |
510 | struct elf_reloc_cookie |
511 | { | |
512 | Elf_Internal_Rela *rels, *rel, *relend; | |
6cdc0ccc | 513 | Elf_Internal_Sym *locsyms; |
73d074b4 DJ |
514 | bfd *abfd; |
515 | size_t locsymcount; | |
516 | size_t extsymoff; | |
517 | struct elf_link_hash_entry **sym_hashes; | |
b34976b6 | 518 | bfd_boolean bad_symtab; |
73d074b4 DJ |
519 | }; |
520 | ||
c6e90b02 TS |
521 | /* The level of IRIX compatibility we're striving for. */ |
522 | ||
523 | typedef enum { | |
524 | ict_none, | |
525 | ict_irix5, | |
526 | ict_irix6 | |
527 | } irix_compat_t; | |
528 | ||
252b5132 RH |
529 | struct elf_backend_data |
530 | { | |
252b5132 RH |
531 | /* The architecture for this backend. */ |
532 | enum bfd_architecture arch; | |
533 | ||
534 | /* The ELF machine code (EM_xxxx) for this backend. */ | |
535 | int elf_machine_code; | |
536 | ||
537 | /* The maximum page size for this backend. */ | |
538 | bfd_vma maxpagesize; | |
539 | ||
252b5132 RH |
540 | /* A function to translate an ELF RELA relocation to a BFD arelent |
541 | structure. */ | |
dc810e39 AM |
542 | void (*elf_info_to_howto) |
543 | PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); | |
252b5132 RH |
544 | |
545 | /* A function to translate an ELF REL relocation to a BFD arelent | |
546 | structure. */ | |
dc810e39 | 547 | void (*elf_info_to_howto_rel) |
947216bf | 548 | PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); |
252b5132 RH |
549 | |
550 | /* A function to determine whether a symbol is global when | |
551 | partitioning the symbol table into local and global symbols. | |
552 | This should be NULL for most targets, in which case the correct | |
553 | thing will be done. MIPS ELF, at least on the Irix 5, has | |
554 | special requirements. */ | |
b34976b6 | 555 | bfd_boolean (*elf_backend_sym_is_global) |
dc810e39 | 556 | PARAMS ((bfd *, asymbol *)); |
252b5132 RH |
557 | |
558 | /* The remaining functions are hooks which are called only if they | |
559 | are not NULL. */ | |
560 | ||
561 | /* A function to permit a backend specific check on whether a | |
562 | particular BFD format is relevant for an object file, and to | |
563 | permit the backend to set any global information it wishes. When | |
564 | this is called elf_elfheader is set, but anything else should be | |
b34976b6 | 565 | used with caution. If this returns FALSE, the check_format |
252b5132 | 566 | routine will return a bfd_error_wrong_format error. */ |
b34976b6 | 567 | bfd_boolean (*elf_backend_object_p) |
dc810e39 | 568 | PARAMS ((bfd *)); |
252b5132 RH |
569 | |
570 | /* A function to do additional symbol processing when reading the | |
571 | ELF symbol table. This is where any processor-specific special | |
572 | section indices are handled. */ | |
dc810e39 AM |
573 | void (*elf_backend_symbol_processing) |
574 | PARAMS ((bfd *, asymbol *)); | |
252b5132 RH |
575 | |
576 | /* A function to do additional symbol processing after reading the | |
577 | entire ELF symbol table. */ | |
b34976b6 | 578 | bfd_boolean (*elf_backend_symbol_table_processing) |
dc810e39 | 579 | PARAMS ((bfd *, elf_symbol_type *, unsigned int)); |
252b5132 RH |
580 | |
581 | /* A function to set the type of the info field. Processor-specific | |
3e932841 | 582 | types should be handled here. */ |
dc810e39 AM |
583 | int (*elf_backend_get_symbol_type) |
584 | PARAMS (( Elf_Internal_Sym *, int)); | |
60bcf0fa | 585 | |
252b5132 RH |
586 | /* A function to do additional processing on the ELF section header |
587 | just before writing it out. This is used to set the flags and | |
588 | type fields for some sections, or to actually write out data for | |
589 | unusual sections. */ | |
b34976b6 | 590 | bfd_boolean (*elf_backend_section_processing) |
947216bf | 591 | PARAMS ((bfd *, Elf_Internal_Shdr *)); |
252b5132 RH |
592 | |
593 | /* A function to handle unusual section types when creating BFD | |
594 | sections from ELF sections. */ | |
b34976b6 | 595 | bfd_boolean (*elf_backend_section_from_shdr) |
947216bf | 596 | PARAMS ((bfd *, Elf_Internal_Shdr *, const char *)); |
252b5132 | 597 | |
fa152c49 JW |
598 | /* A function to convert machine dependent section header flags to |
599 | BFD internal section header flags. */ | |
b34976b6 | 600 | bfd_boolean (*elf_backend_section_flags) |
947216bf | 601 | PARAMS ((flagword *, Elf_Internal_Shdr *)); |
fa152c49 | 602 | |
20cfcaae | 603 | /* A function to handle unusual program segment types when creating BFD |
3e932841 | 604 | sections from ELF program segments. */ |
b34976b6 | 605 | bfd_boolean (*elf_backend_section_from_phdr) |
947216bf | 606 | PARAMS ((bfd *, Elf_Internal_Phdr *, int)); |
20cfcaae | 607 | |
252b5132 RH |
608 | /* A function to set up the ELF section header for a BFD section in |
609 | preparation for writing it out. This is where the flags and type | |
610 | fields are set for unusual sections. */ | |
b34976b6 | 611 | bfd_boolean (*elf_backend_fake_sections) |
947216bf | 612 | PARAMS ((bfd *, Elf_Internal_Shdr *, asection *)); |
252b5132 RH |
613 | |
614 | /* A function to get the ELF section index for a BFD section. If | |
b34976b6 | 615 | this returns TRUE, the section was found. If it is a normal ELF |
252b5132 RH |
616 | section, *RETVAL should be left unchanged. If it is not a normal |
617 | ELF section *RETVAL should be set to the SHN_xxxx index. */ | |
b34976b6 | 618 | bfd_boolean (*elf_backend_section_from_bfd_section) |
af746e92 | 619 | PARAMS ((bfd *, asection *, int *retval)); |
252b5132 RH |
620 | |
621 | /* If this field is not NULL, it is called by the add_symbols phase | |
622 | of a link just before adding a symbol to the global linker hash | |
623 | table. It may modify any of the fields as it wishes. If *NAME | |
624 | is set to NULL, the symbol will be skipped rather than being | |
625 | added to the hash table. This function is responsible for | |
626 | handling all processor dependent symbol bindings and section | |
627 | indices, and must set at least *FLAGS and *SEC for each processor | |
628 | dependent case; failure to do so will cause a link error. */ | |
b34976b6 | 629 | bfd_boolean (*elf_add_symbol_hook) |
252b5132 RH |
630 | PARAMS ((bfd *abfd, struct bfd_link_info *info, |
631 | const Elf_Internal_Sym *, const char **name, | |
632 | flagword *flags, asection **sec, bfd_vma *value)); | |
633 | ||
634 | /* If this field is not NULL, it is called by the elf_link_output_sym | |
635 | phase of a link for each symbol which will appear in the object file. */ | |
b34976b6 | 636 | bfd_boolean (*elf_backend_link_output_symbol_hook) |
252b5132 RH |
637 | PARAMS ((bfd *, struct bfd_link_info *info, const char *, |
638 | Elf_Internal_Sym *, asection *)); | |
639 | ||
640 | /* The CREATE_DYNAMIC_SECTIONS function is called by the ELF backend | |
641 | linker the first time it encounters a dynamic object in the link. | |
642 | This function must create any sections required for dynamic | |
643 | linking. The ABFD argument is a dynamic object. The .interp, | |
644 | .dynamic, .dynsym, .dynstr, and .hash functions have already been | |
645 | created, and this function may modify the section flags if | |
646 | desired. This function will normally create the .got and .plt | |
647 | sections, but different backends have different requirements. */ | |
b34976b6 | 648 | bfd_boolean (*elf_backend_create_dynamic_sections) |
252b5132 RH |
649 | PARAMS ((bfd *abfd, struct bfd_link_info *info)); |
650 | ||
651 | /* The CHECK_RELOCS function is called by the add_symbols phase of | |
652 | the ELF backend linker. It is called once for each section with | |
653 | relocs of an object file, just after the symbols for the object | |
654 | file have been added to the global linker hash table. The | |
655 | function must look through the relocs and do any special handling | |
656 | required. This generally means allocating space in the global | |
657 | offset table, and perhaps allocating space for a reloc. The | |
658 | relocs are always passed as Rela structures; if the section | |
659 | actually uses Rel structures, the r_addend field will always be | |
660 | zero. */ | |
b34976b6 | 661 | bfd_boolean (*check_relocs) |
252b5132 RH |
662 | PARAMS ((bfd *abfd, struct bfd_link_info *info, asection *o, |
663 | const Elf_Internal_Rela *relocs)); | |
664 | ||
665 | /* The ADJUST_DYNAMIC_SYMBOL function is called by the ELF backend | |
666 | linker for every symbol which is defined by a dynamic object and | |
667 | referenced by a regular object. This is called after all the | |
668 | input files have been seen, but before the SIZE_DYNAMIC_SECTIONS | |
669 | function has been called. The hash table entry should be | |
670 | bfd_link_hash_defined ore bfd_link_hash_defweak, and it should be | |
671 | defined in a section from a dynamic object. Dynamic object | |
672 | sections are not included in the final link, and this function is | |
673 | responsible for changing the value to something which the rest of | |
674 | the link can deal with. This will normally involve adding an | |
675 | entry to the .plt or .got or some such section, and setting the | |
676 | symbol to point to that. */ | |
b34976b6 | 677 | bfd_boolean (*elf_backend_adjust_dynamic_symbol) |
252b5132 RH |
678 | PARAMS ((struct bfd_link_info *info, struct elf_link_hash_entry *h)); |
679 | ||
680 | /* The ALWAYS_SIZE_SECTIONS function is called by the backend linker | |
681 | after all the linker input files have been seen but before the | |
682 | section sizes have been set. This is called after | |
683 | ADJUST_DYNAMIC_SYMBOL, but before SIZE_DYNAMIC_SECTIONS. */ | |
b34976b6 | 684 | bfd_boolean (*elf_backend_always_size_sections) |
252b5132 RH |
685 | PARAMS ((bfd *output_bfd, struct bfd_link_info *info)); |
686 | ||
687 | /* The SIZE_DYNAMIC_SECTIONS function is called by the ELF backend | |
688 | linker after all the linker input files have been seen but before | |
689 | the sections sizes have been set. This is called after | |
690 | ADJUST_DYNAMIC_SYMBOL has been called on all appropriate symbols. | |
691 | It is only called when linking against a dynamic object. It must | |
692 | set the sizes of the dynamic sections, and may fill in their | |
693 | contents as well. The generic ELF linker can handle the .dynsym, | |
694 | .dynstr and .hash sections. This function must handle the | |
695 | .interp section and any sections created by the | |
696 | CREATE_DYNAMIC_SECTIONS entry point. */ | |
b34976b6 | 697 | bfd_boolean (*elf_backend_size_dynamic_sections) |
252b5132 RH |
698 | PARAMS ((bfd *output_bfd, struct bfd_link_info *info)); |
699 | ||
700 | /* The RELOCATE_SECTION function is called by the ELF backend linker | |
701 | to handle the relocations for a section. | |
702 | ||
703 | The relocs are always passed as Rela structures; if the section | |
704 | actually uses Rel structures, the r_addend field will always be | |
705 | zero. | |
706 | ||
707 | This function is responsible for adjust the section contents as | |
708 | necessary, and (if using Rela relocs and generating a | |
709 | relocateable output file) adjusting the reloc addend as | |
710 | necessary. | |
711 | ||
712 | This function does not have to worry about setting the reloc | |
713 | address or the reloc symbol index. | |
714 | ||
715 | LOCAL_SYMS is a pointer to the swapped in local symbols. | |
716 | ||
717 | LOCAL_SECTIONS is an array giving the section in the input file | |
718 | corresponding to the st_shndx field of each local symbol. | |
719 | ||
720 | The global hash table entry for the global symbols can be found | |
721 | via elf_sym_hashes (input_bfd). | |
722 | ||
723 | When generating relocateable output, this function must handle | |
724 | STB_LOCAL/STT_SECTION symbols specially. The output symbol is | |
725 | going to be the section symbol corresponding to the output | |
726 | section, which means that the addend must be adjusted | |
727 | accordingly. */ | |
b34976b6 | 728 | bfd_boolean (*elf_backend_relocate_section) |
252b5132 RH |
729 | PARAMS ((bfd *output_bfd, struct bfd_link_info *info, |
730 | bfd *input_bfd, asection *input_section, bfd_byte *contents, | |
731 | Elf_Internal_Rela *relocs, Elf_Internal_Sym *local_syms, | |
732 | asection **local_sections)); | |
733 | ||
734 | /* The FINISH_DYNAMIC_SYMBOL function is called by the ELF backend | |
735 | linker just before it writes a symbol out to the .dynsym section. | |
736 | The processor backend may make any required adjustment to the | |
737 | symbol. It may also take the opportunity to set contents of the | |
738 | dynamic sections. Note that FINISH_DYNAMIC_SYMBOL is called on | |
739 | all .dynsym symbols, while ADJUST_DYNAMIC_SYMBOL is only called | |
740 | on those symbols which are defined by a dynamic object. */ | |
b34976b6 | 741 | bfd_boolean (*elf_backend_finish_dynamic_symbol) |
252b5132 RH |
742 | PARAMS ((bfd *output_bfd, struct bfd_link_info *info, |
743 | struct elf_link_hash_entry *h, Elf_Internal_Sym *sym)); | |
744 | ||
745 | /* The FINISH_DYNAMIC_SECTIONS function is called by the ELF backend | |
746 | linker just before it writes all the dynamic sections out to the | |
747 | output file. The FINISH_DYNAMIC_SYMBOL will have been called on | |
748 | all dynamic symbols. */ | |
b34976b6 | 749 | bfd_boolean (*elf_backend_finish_dynamic_sections) |
252b5132 RH |
750 | PARAMS ((bfd *output_bfd, struct bfd_link_info *info)); |
751 | ||
752 | /* A function to do any beginning processing needed for the ELF file | |
753 | before building the ELF headers and computing file positions. */ | |
754 | void (*elf_backend_begin_write_processing) | |
755 | PARAMS ((bfd *, struct bfd_link_info *)); | |
756 | ||
757 | /* A function to do any final processing needed for the ELF file | |
b34976b6 | 758 | before writing it out. The LINKER argument is TRUE if this BFD |
252b5132 RH |
759 | was created by the ELF backend linker. */ |
760 | void (*elf_backend_final_write_processing) | |
b34976b6 | 761 | PARAMS ((bfd *, bfd_boolean linker)); |
252b5132 RH |
762 | |
763 | /* This function is called by get_program_header_size. It should | |
764 | return the number of additional program segments which this BFD | |
765 | will need. It should return -1 on error. */ | |
dc810e39 AM |
766 | int (*elf_backend_additional_program_headers) |
767 | PARAMS ((bfd *)); | |
252b5132 RH |
768 | |
769 | /* This function is called to modify an existing segment map in a | |
770 | backend specific fashion. */ | |
b34976b6 | 771 | bfd_boolean (*elf_backend_modify_segment_map) |
dc810e39 | 772 | PARAMS ((bfd *)); |
252b5132 RH |
773 | |
774 | /* This function is called during section gc to discover the section a | |
1e2f5b6e | 775 | particular relocation refers to. */ |
252b5132 | 776 | asection * (*gc_mark_hook) |
1e2f5b6e | 777 | PARAMS ((asection *sec, struct bfd_link_info *, Elf_Internal_Rela *, |
252b5132 RH |
778 | struct elf_link_hash_entry *h, Elf_Internal_Sym *)); |
779 | ||
780 | /* This function, if defined, is called during the sweep phase of gc | |
781 | in order that a backend might update any data structures it might | |
782 | be maintaining. */ | |
b34976b6 | 783 | bfd_boolean (*gc_sweep_hook) |
252b5132 RH |
784 | PARAMS ((bfd *abfd, struct bfd_link_info *info, asection *o, |
785 | const Elf_Internal_Rela *relocs)); | |
786 | ||
e6c51ed4 NC |
787 | /* This function, if defined, is called after the ELF headers have |
788 | been created. This allows for things like the OS and ABI versions | |
789 | to be changed. */ | |
790 | void (*elf_backend_post_process_headers) | |
791 | PARAMS ((bfd *, struct bfd_link_info *)); | |
792 | ||
587ff49e RH |
793 | /* This function, if defined, prints a symbol to file and returns the |
794 | name of the symbol to be printed. It should return NULL to fall | |
795 | back to default symbol printing. */ | |
796 | const char *(*elf_backend_print_symbol_all) | |
797 | PARAMS ((bfd *, PTR, asymbol *)); | |
798 | ||
799 | /* This function, if defined, is called after all local symbols and | |
800 | global symbols converted to locals are emited into the symtab | |
801 | section. It allows the backend to emit special global symbols | |
802 | not handled in the hash table. */ | |
b34976b6 | 803 | bfd_boolean (*elf_backend_output_arch_syms) |
587ff49e | 804 | PARAMS ((bfd *, struct bfd_link_info *, PTR, |
b34976b6 | 805 | bfd_boolean (*) (PTR, const char *, Elf_Internal_Sym *, asection *))); |
587ff49e | 806 | |
d4c88bbb | 807 | /* Copy any information related to dynamic linking from a pre-existing |
0a991dfe AM |
808 | symbol to a newly created symbol. Also called to copy flags and |
809 | other back-end info to a weakdef, in which case the symbol is not | |
810 | newly created and plt/got refcounts and dynamic indices should not | |
811 | be copied. */ | |
c61b8717 | 812 | void (*elf_backend_copy_indirect_symbol) |
b48fa14c AM |
813 | PARAMS ((struct elf_backend_data *, struct elf_link_hash_entry *, |
814 | struct elf_link_hash_entry *)); | |
c61b8717 RH |
815 | |
816 | /* Modify any information related to dynamic linking such that the | |
817 | symbol is not exported. */ | |
818 | void (*elf_backend_hide_symbol) | |
b34976b6 | 819 | PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *, bfd_boolean)); |
c61b8717 | 820 | |
9317eacc CM |
821 | /* Emit relocations. Overrides default routine for emitting relocs, |
822 | except during a relocatable link, or if all relocs are being emitted. */ | |
b34976b6 | 823 | bfd_boolean (*elf_backend_emit_relocs) |
9317eacc CM |
824 | PARAMS ((bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *)); |
825 | ||
826 | /* Count relocations. Not called for relocatable links | |
827 | or if all relocs are being preserved in the output. */ | |
828 | unsigned int (*elf_backend_count_relocs) | |
829 | PARAMS ((asection *, Elf_Internal_Rela *)); | |
830 | ||
bb0082d6 AM |
831 | /* This function, if defined, is called when an NT_PRSTATUS note is found |
832 | in a core file. */ | |
b34976b6 | 833 | bfd_boolean (*elf_backend_grok_prstatus) |
dc810e39 | 834 | PARAMS ((bfd *, Elf_Internal_Note *)); |
bb0082d6 AM |
835 | |
836 | /* This function, if defined, is called when an NT_PSINFO or NT_PRPSINFO | |
837 | note is found in a core file. */ | |
b34976b6 | 838 | bfd_boolean (*elf_backend_grok_psinfo) |
dc810e39 | 839 | PARAMS ((bfd *, Elf_Internal_Note *)); |
bb0082d6 | 840 | |
db6751f2 | 841 | /* Functions to print VMAs. Special code to handle 64 bit ELF files. */ |
dc810e39 AM |
842 | void (* elf_backend_sprintf_vma) |
843 | PARAMS ((bfd *, char *, bfd_vma)); | |
844 | void (* elf_backend_fprintf_vma) | |
845 | PARAMS ((bfd *, PTR, bfd_vma)); | |
4e771d61 | 846 | |
db6751f2 | 847 | /* This function returns class of a reloc type. */ |
f51e552e AM |
848 | enum elf_reloc_type_class (*elf_backend_reloc_type_class) |
849 | PARAMS ((const Elf_Internal_Rela *)); | |
db6751f2 | 850 | |
73d074b4 DJ |
851 | /* This function, if defined, removes information about discarded functions |
852 | from other sections which mention them. */ | |
b34976b6 | 853 | bfd_boolean (*elf_backend_discard_info) |
73d074b4 DJ |
854 | PARAMS ((bfd *, struct elf_reloc_cookie *, struct bfd_link_info *)); |
855 | ||
856 | /* This function, if defined, signals that the function above has removed | |
857 | the discarded relocations for this section. */ | |
b34976b6 | 858 | bfd_boolean (*elf_backend_ignore_discarded_relocs) |
73d074b4 DJ |
859 | PARAMS ((asection *)); |
860 | ||
861 | /* This function, if defined, may write out the given section. | |
b34976b6 AM |
862 | Returns TRUE if it did so and FALSE if the caller should. */ |
863 | bfd_boolean (*elf_backend_write_section) | |
73d074b4 DJ |
864 | PARAMS ((bfd *, asection *, bfd_byte *)); |
865 | ||
c6e90b02 TS |
866 | /* The level of IRIX compatibility we're striving for. |
867 | MIPS ELF specific function. */ | |
868 | irix_compat_t (*elf_backend_mips_irix_compat) | |
869 | PARAMS ((bfd *)); | |
870 | ||
871 | reloc_howto_type *(*elf_backend_mips_rtype_to_howto) | |
b34976b6 | 872 | PARAMS ((unsigned int, bfd_boolean)); |
c6e90b02 | 873 | |
252b5132 RH |
874 | /* The swapping table to use when dealing with ECOFF information. |
875 | Used for the MIPS ELF .mdebug section. */ | |
876 | const struct ecoff_debug_swap *elf_backend_ecoff_debug_swap; | |
877 | ||
8d6337fe RM |
878 | /* This function implements `bfd_elf_bfd_from_remote_memory'; |
879 | see elf.c, elfcode.h. */ | |
880 | bfd *(*elf_backend_bfd_from_remote_memory) | |
881 | PARAMS ((bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep, | |
882 | int (*target_read_memory) (bfd_vma vma, char *myaddr, int len))); | |
883 | ||
252b5132 RH |
884 | /* Alternate EM_xxxx machine codes for this backend. */ |
885 | int elf_machine_alt1; | |
886 | int elf_machine_alt2; | |
887 | ||
888 | const struct elf_size_info *s; | |
889 | ||
890 | /* offset of the _GLOBAL_OFFSET_TABLE_ symbol from the start of the | |
891 | .got section */ | |
892 | bfd_vma got_symbol_offset; | |
893 | ||
894 | /* The size in bytes of the headers for the GOT and PLT. This includes | |
895 | the so-called reserved entries on some systems. */ | |
896 | bfd_vma got_header_size; | |
897 | bfd_vma plt_header_size; | |
898 | ||
b34976b6 AM |
899 | /* This is TRUE if the linker should act like collect and gather |
900 | global constructors and destructors by name. This is TRUE for | |
86dc0f79 RH |
901 | MIPS ELF because the Irix 5 tools can not handle the .init |
902 | section. */ | |
903 | unsigned collect : 1; | |
904 | ||
b34976b6 AM |
905 | /* This is TRUE if the linker should ignore changes to the type of a |
906 | symbol. This is TRUE for MIPS ELF because some Irix 5 objects | |
86dc0f79 RH |
907 | record undefined functions as STT_OBJECT although the definitions |
908 | are STT_FUNC. */ | |
909 | unsigned type_change_ok : 1; | |
910 | ||
bf572ba0 MM |
911 | /* Whether the backend may use REL relocations. (Some backends use |
912 | both REL and RELA relocations, and this flag is set for those | |
913 | backends.) */ | |
914 | unsigned may_use_rel_p : 1; | |
60bcf0fa | 915 | |
bf572ba0 MM |
916 | /* Whether the backend may use RELA relocations. (Some backends use |
917 | both REL and RELA relocations, and this flag is set for those | |
918 | backends.) */ | |
919 | unsigned may_use_rela_p : 1; | |
920 | ||
921 | /* Whether the default relocation type is RELA. If a backend with | |
922 | this flag set wants REL relocations for a particular section, | |
923 | it must note that explicitly. Similarly, if this flag is clear, | |
60bcf0fa NC |
924 | and the backend wants RELA relocations for a particular |
925 | section. */ | |
bf572ba0 MM |
926 | unsigned default_use_rela_p : 1; |
927 | ||
b491616a AM |
928 | /* Set if RELA relocations for a relocatable link can be handled by |
929 | generic code. Backends that set this flag need do nothing in the | |
930 | backend relocate_section routine for relocatable linking. */ | |
931 | unsigned rela_normal : 1; | |
932 | ||
b34976b6 | 933 | /* TRUE if addresses "naturally" sign extend. This is used when |
86dc0f79 RH |
934 | swapping in from Elf32 when BFD64. */ |
935 | unsigned sign_extend_vma : 1; | |
936 | ||
252b5132 RH |
937 | unsigned want_got_plt : 1; |
938 | unsigned plt_readonly : 1; | |
939 | unsigned want_plt_sym : 1; | |
940 | unsigned plt_not_loaded : 1; | |
941 | unsigned plt_alignment : 4; | |
942 | unsigned can_gc_sections : 1; | |
51b64d56 | 943 | unsigned can_refcount : 1; |
2517a57f | 944 | unsigned want_got_sym : 1; |
3018b441 | 945 | unsigned want_dynbss : 1; |
5e8d7549 NC |
946 | /* Targets which do not support physical addressing often require |
947 | that the p_paddr field in the section header to be set to zero. | |
948 | This field indicates whether this behavior is required. */ | |
949 | unsigned want_p_paddr_set_to_zero : 1; | |
252b5132 RH |
950 | }; |
951 | ||
952 | /* Information stored for each BFD section in an ELF file. This | |
953 | structure is allocated by elf_new_section_hook. */ | |
954 | ||
955 | struct bfd_elf_section_data | |
956 | { | |
957 | /* The ELF header for this section. */ | |
958 | Elf_Internal_Shdr this_hdr; | |
0c715baa | 959 | |
252b5132 RH |
960 | /* The ELF header for the reloc section associated with this |
961 | section, if any. */ | |
962 | Elf_Internal_Shdr rel_hdr; | |
0c715baa | 963 | |
252b5132 RH |
964 | /* If there is a second reloc section associated with this section, |
965 | as can happen on Irix 6, this field points to the header. */ | |
966 | Elf_Internal_Shdr *rel_hdr2; | |
0c715baa | 967 | |
23bc299b MM |
968 | /* The number of relocations currently assigned to REL_HDR. */ |
969 | unsigned int rel_count; | |
0c715baa | 970 | |
23bc299b MM |
971 | /* The number of relocations currently assigned to REL_HDR2. */ |
972 | unsigned int rel_count2; | |
0c715baa | 973 | |
252b5132 RH |
974 | /* The ELF section number of this section. Only used for an output |
975 | file. */ | |
976 | int this_idx; | |
0c715baa | 977 | |
23bc299b MM |
978 | /* The ELF section number of the reloc section indicated by |
979 | REL_HDR if any. Only used for an output file. */ | |
252b5132 | 980 | int rel_idx; |
0c715baa | 981 | |
23bc299b MM |
982 | /* The ELF section number of the reloc section indicated by |
983 | REL_HDR2 if any. Only used for an output file. */ | |
984 | int rel_idx2; | |
0c715baa | 985 | |
f0abc2a1 AM |
986 | /* Used by the backend linker when generating a shared library to |
987 | record the dynamic symbol index for a section symbol | |
988 | corresponding to this section. A value of 0 means that there is | |
989 | no dynamic symbol for this section. */ | |
990 | int dynindx; | |
991 | ||
252b5132 RH |
992 | /* Used by the backend linker to store the symbol hash table entries |
993 | associated with relocs against global symbols. */ | |
994 | struct elf_link_hash_entry **rel_hashes; | |
0c715baa | 995 | |
252b5132 RH |
996 | /* A pointer to the swapped relocs. If the section uses REL relocs, |
997 | rather than RELA, all the r_addend fields will be zero. This | |
998 | pointer may be NULL. It is used by the backend linker. */ | |
999 | Elf_Internal_Rela *relocs; | |
0c715baa | 1000 | |
f0abc2a1 AM |
1001 | /* A pointer to a linked list tracking dynamic relocs copied for |
1002 | local symbols. */ | |
1003 | PTR local_dynrel; | |
0c715baa | 1004 | |
f0abc2a1 AM |
1005 | /* A pointer to the bfd section used for dynamic relocs. */ |
1006 | asection *sreloc; | |
0c715baa | 1007 | |
1126897b AM |
1008 | union { |
1009 | /* Group name, if this section is a member of a group. */ | |
1010 | const char *name; | |
1011 | ||
1012 | /* Group signature sym, if this is the SHT_GROUP section. */ | |
1013 | struct symbol_cache_entry *id; | |
1014 | } group; | |
dbb410c3 AM |
1015 | |
1016 | /* A linked list of sections in the group. Circular when used by | |
1017 | the linker. */ | |
1018 | asection *next_in_group; | |
1019 | ||
f0abc2a1 AM |
1020 | /* A pointer used for various section optimizations. */ |
1021 | PTR sec_info; | |
252b5132 RH |
1022 | }; |
1023 | ||
1024 | #define elf_section_data(sec) ((struct bfd_elf_section_data*)sec->used_by_bfd) | |
1126897b AM |
1025 | #define elf_group_name(sec) (elf_section_data(sec)->group.name) |
1026 | #define elf_group_id(sec) (elf_section_data(sec)->group.id) | |
945906ff | 1027 | #define elf_next_in_group(sec) (elf_section_data(sec)->next_in_group) |
252b5132 | 1028 | |
b34976b6 | 1029 | /* Return TRUE if section has been discarded. */ |
68bfbfcc AM |
1030 | #define elf_discarded_section(sec) \ |
1031 | (!bfd_is_abs_section (sec) \ | |
1032 | && bfd_is_abs_section ((sec)->output_section) \ | |
1033 | && sec->sec_info_type != ELF_INFO_TYPE_MERGE \ | |
1034 | && sec->sec_info_type != ELF_INFO_TYPE_JUST_SYMS) | |
ed4de5e2 | 1035 | |
252b5132 RH |
1036 | #define get_elf_backend_data(abfd) \ |
1037 | ((struct elf_backend_data *) (abfd)->xvec->backend_data) | |
1038 | ||
1039 | /* Enumeration to specify the special section. */ | |
1040 | typedef enum elf_linker_section_enum | |
1041 | { | |
1042 | LINKER_SECTION_UNKNOWN, /* not used */ | |
1043 | LINKER_SECTION_GOT, /* .got section for global offset pointers */ | |
1044 | LINKER_SECTION_PLT, /* .plt section for generated procedure stubs */ | |
1045 | LINKER_SECTION_SDATA, /* .sdata/.sbss section for PowerPC */ | |
1046 | LINKER_SECTION_SDATA2, /* .sdata2/.sbss2 section for PowerPC */ | |
1047 | LINKER_SECTION_MAX /* # of linker sections */ | |
1048 | } elf_linker_section_enum_t; | |
1049 | ||
1050 | /* Sections created by the linker. */ | |
1051 | ||
1052 | typedef struct elf_linker_section | |
1053 | { | |
1054 | char *name; /* name of the section */ | |
1055 | char *rel_name; /* name of the associated .rel{,a}. section */ | |
1056 | char *bss_name; /* name of a related .bss section */ | |
1057 | char *sym_name; /* name of symbol to reference this section */ | |
1058 | asection *section; /* pointer to the section */ | |
1059 | asection *bss_section; /* pointer to the bss section associated with this */ | |
1060 | asection *rel_section; /* pointer to the relocations needed for this section */ | |
1061 | struct elf_link_hash_entry *sym_hash; /* pointer to the created symbol hash value */ | |
1062 | bfd_vma initial_size; /* initial size before any linker generated allocations */ | |
1063 | bfd_vma sym_offset; /* offset of symbol from beginning of section */ | |
1064 | bfd_vma hole_size; /* size of reserved address hole in allocation */ | |
1065 | bfd_vma hole_offset; /* current offset for the hole */ | |
1066 | bfd_vma max_hole_offset; /* maximum offset for the hole */ | |
1067 | elf_linker_section_enum_t which; /* which section this is */ | |
b34976b6 | 1068 | bfd_boolean hole_written_p; /* whether the hole has been initialized */ |
252b5132 RH |
1069 | unsigned int alignment; /* alignment for the section */ |
1070 | flagword flags; /* flags to use to create the section */ | |
1071 | } elf_linker_section_t; | |
1072 | ||
1073 | /* Linked list of allocated pointer entries. This hangs off of the symbol lists, and | |
1074 | provides allows us to return different pointers, based on different addend's. */ | |
1075 | ||
1076 | typedef struct elf_linker_section_pointers | |
1077 | { | |
1078 | struct elf_linker_section_pointers *next; /* next allocated pointer for this symbol */ | |
1079 | bfd_vma offset; /* offset of pointer from beginning of section */ | |
dc810e39 | 1080 | bfd_vma addend; /* addend used */ |
252b5132 | 1081 | elf_linker_section_enum_t which; /* which linker section this is */ |
b34976b6 | 1082 | bfd_boolean written_address_p; /* whether address was written yet */ |
252b5132 RH |
1083 | } elf_linker_section_pointers_t; |
1084 | ||
45d6a902 AM |
1085 | /* This struct is used to pass information to routines called via |
1086 | elf_link_hash_traverse which must return failure. */ | |
1087 | ||
1088 | struct elf_info_failed | |
1089 | { | |
1090 | bfd_boolean failed; | |
1091 | struct bfd_link_info *info; | |
1092 | struct bfd_elf_version_tree *verdefs; | |
1093 | }; | |
1094 | ||
1095 | /* This structure is used to pass information to | |
1096 | _bfd_elf_link_assign_sym_version. */ | |
1097 | ||
1098 | struct elf_assign_sym_version_info | |
1099 | { | |
1100 | /* Output BFD. */ | |
1101 | bfd *output_bfd; | |
1102 | /* General link information. */ | |
1103 | struct bfd_link_info *info; | |
1104 | /* Version tree. */ | |
1105 | struct bfd_elf_version_tree *verdefs; | |
1106 | /* Whether we had a failure. */ | |
1107 | bfd_boolean failed; | |
1108 | }; | |
1109 | ||
1110 | /* This structure is used to pass information to | |
1111 | _bfd_elf_link_find_version_dependencies. */ | |
1112 | ||
1113 | struct elf_find_verdep_info | |
1114 | { | |
1115 | /* Output BFD. */ | |
1116 | bfd *output_bfd; | |
1117 | /* General link information. */ | |
1118 | struct bfd_link_info *info; | |
1119 | /* The number of dependencies. */ | |
1120 | unsigned int vers; | |
1121 | /* Whether we had a failure. */ | |
1122 | bfd_boolean failed; | |
1123 | }; | |
1124 | ||
252b5132 RH |
1125 | /* Some private data is stashed away for future use using the tdata pointer |
1126 | in the bfd structure. */ | |
1127 | ||
1128 | struct elf_obj_tdata | |
1129 | { | |
1130 | Elf_Internal_Ehdr elf_header[1]; /* Actual data, but ref like ptr */ | |
1131 | Elf_Internal_Shdr **elf_sect_ptr; | |
1132 | Elf_Internal_Phdr *phdr; | |
1133 | struct elf_segment_map *segment_map; | |
2b0f7ef9 | 1134 | struct elf_strtab_hash *strtab_ptr; |
252b5132 RH |
1135 | int num_locals; |
1136 | int num_globals; | |
9ad5cbcf | 1137 | unsigned int num_elf_sections; /* elf_sect_ptr size */ |
4e89ac30 | 1138 | int num_section_syms; |
252b5132 RH |
1139 | asymbol **section_syms; /* STT_SECTION symbols for each section */ |
1140 | Elf_Internal_Shdr symtab_hdr; | |
1141 | Elf_Internal_Shdr shstrtab_hdr; | |
1142 | Elf_Internal_Shdr strtab_hdr; | |
1143 | Elf_Internal_Shdr dynsymtab_hdr; | |
1144 | Elf_Internal_Shdr dynstrtab_hdr; | |
1145 | Elf_Internal_Shdr dynversym_hdr; | |
1146 | Elf_Internal_Shdr dynverref_hdr; | |
1147 | Elf_Internal_Shdr dynverdef_hdr; | |
9ad5cbcf | 1148 | Elf_Internal_Shdr symtab_shndx_hdr; |
252b5132 RH |
1149 | unsigned int symtab_section, shstrtab_section; |
1150 | unsigned int strtab_section, dynsymtab_section; | |
9ad5cbcf | 1151 | unsigned int symtab_shndx_section; |
252b5132 RH |
1152 | unsigned int dynversym_section, dynverdef_section, dynverref_section; |
1153 | file_ptr next_file_pos; | |
1154 | #if 0 | |
1155 | /* we don't need these inside bfd anymore, and I think | |
3e932841 | 1156 | these weren't used outside bfd. */ |
252b5132 RH |
1157 | void *prstatus; /* The raw /proc prstatus structure */ |
1158 | void *prpsinfo; /* The raw /proc prpsinfo structure */ | |
1159 | #endif | |
dbb410c3 AM |
1160 | bfd_vma gp; /* The gp value */ |
1161 | unsigned int gp_size; /* The gp size */ | |
1162 | ||
1163 | Elf_Internal_Shdr **group_sect_ptr; | |
1164 | int num_group; | |
252b5132 | 1165 | |
3e932841 | 1166 | /* Information grabbed from an elf core file. */ |
252b5132 RH |
1167 | int core_signal; |
1168 | int core_pid; | |
1169 | int core_lwpid; | |
1170 | char* core_program; | |
1171 | char* core_command; | |
1172 | ||
b34976b6 | 1173 | /* This is set to TRUE if the object was created by the backend |
252b5132 | 1174 | linker. */ |
b34976b6 | 1175 | bfd_boolean linker; |
252b5132 RH |
1176 | |
1177 | /* A mapping from external symbols to entries in the linker hash | |
1178 | table, used when linking. This is indexed by the symbol index | |
1179 | minus the sh_info field of the symbol table header. */ | |
1180 | struct elf_link_hash_entry **sym_hashes; | |
1181 | ||
5cab59f6 AM |
1182 | /* Track usage and final offsets of GOT entries for local symbols. |
1183 | This array is indexed by symbol index. Elements are used | |
1184 | identically to "got" in struct elf_link_hash_entry. */ | |
252b5132 RH |
1185 | union |
1186 | { | |
1187 | bfd_signed_vma *refcounts; | |
1188 | bfd_vma *offsets; | |
5cab59f6 | 1189 | struct got_entry **ents; |
252b5132 RH |
1190 | } local_got; |
1191 | ||
1192 | /* A mapping from local symbols to offsets into the various linker | |
1193 | sections added. This is index by the symbol index. */ | |
1194 | elf_linker_section_pointers_t **linker_section_pointers; | |
1195 | ||
1196 | /* The linker ELF emulation code needs to let the backend ELF linker | |
1197 | know what filename should be used for a dynamic object if the | |
1198 | dynamic object is found using a search. The emulation code then | |
1199 | sometimes needs to know what name was actually used. Until the | |
1200 | file has been added to the linker symbol table, this field holds | |
1201 | the name the linker wants. After it has been added, it holds the | |
1202 | name actually used, which will be the DT_SONAME entry if there is | |
1203 | one. */ | |
1204 | const char *dt_name; | |
1205 | ||
74816898 L |
1206 | /* When a reference in a regular object is resolved by a shared |
1207 | object is loaded into via the DT_NEEDED entries by the linker | |
1208 | ELF emulation code, we need to add the shared object to the | |
1209 | DT_NEEDED list of the resulting binary to indicate the dependency | |
1210 | as if the -l option is passed to the linker. This field holds the | |
3e932841 | 1211 | name of the loaded shared object. */ |
74816898 L |
1212 | const char *dt_soname; |
1213 | ||
252b5132 RH |
1214 | /* Irix 5 often screws up the symbol table, sorting local symbols |
1215 | after global symbols. This flag is set if the symbol table in | |
1216 | this BFD appears to be screwed up. If it is, we ignore the | |
1217 | sh_info field in the symbol table header, and always read all the | |
1218 | symbols. */ | |
b34976b6 | 1219 | bfd_boolean bad_symtab; |
252b5132 RH |
1220 | |
1221 | /* Records the result of `get_program_header_size'. */ | |
1222 | bfd_size_type program_header_size; | |
1223 | ||
1224 | /* Used by find_nearest_line entry point. */ | |
1225 | PTR line_info; | |
1226 | ||
1227 | /* Used by MIPS ELF find_nearest_line entry point. The structure | |
1228 | could be included directly in this one, but there's no point to | |
1229 | wasting the memory just for the infrequently called | |
1230 | find_nearest_line. */ | |
1231 | struct mips_elf_find_line *find_line_info; | |
1232 | ||
3e932841 | 1233 | /* A place to stash dwarf1 info for this bfd. */ |
252b5132 RH |
1234 | struct dwarf1_debug *dwarf1_find_line_info; |
1235 | ||
3e932841 | 1236 | /* A place to stash dwarf2 info for this bfd. */ |
51db3708 | 1237 | PTR dwarf2_find_line_info; |
252b5132 RH |
1238 | |
1239 | /* An array of stub sections indexed by symbol number, used by the | |
1240 | MIPS ELF linker. FIXME: We should figure out some way to only | |
1241 | include this field for a MIPS ELF target. */ | |
1242 | asection **local_stubs; | |
1243 | ||
65765700 JJ |
1244 | /* Used to determine if PT_GNU_EH_FRAME segment header should be |
1245 | created. */ | |
126495ed AM |
1246 | asection *eh_frame_hdr; |
1247 | ||
1248 | /* Used to determine if the e_flags field has been initialized */ | |
b34976b6 | 1249 | bfd_boolean flags_init; |
65765700 | 1250 | |
252b5132 RH |
1251 | /* Number of symbol version definitions we are about to emit. */ |
1252 | unsigned int cverdefs; | |
1253 | ||
1254 | /* Number of symbol version references we are about to emit. */ | |
1255 | unsigned int cverrefs; | |
1256 | ||
1257 | /* Symbol version definitions in external objects. */ | |
1258 | Elf_Internal_Verdef *verdef; | |
1259 | ||
1260 | /* Symbol version references to external objects. */ | |
1261 | Elf_Internal_Verneed *verref; | |
1262 | ||
1263 | /* Linker sections that we are interested in. */ | |
1264 | struct elf_linker_section *linker_section[ (int)LINKER_SECTION_MAX ]; | |
b305ef96 UC |
1265 | |
1266 | /* The Irix 5 support uses two virtual sections, which represent | |
1267 | text/data symbols defined in dynamic objects. */ | |
1268 | asymbol *elf_data_symbol; | |
1269 | asymbol *elf_text_symbol; | |
1270 | asection *elf_data_section; | |
1271 | asection *elf_text_section; | |
252b5132 RH |
1272 | }; |
1273 | ||
1274 | #define elf_tdata(bfd) ((bfd) -> tdata.elf_obj_data) | |
1275 | #define elf_elfheader(bfd) (elf_tdata(bfd) -> elf_header) | |
1276 | #define elf_elfsections(bfd) (elf_tdata(bfd) -> elf_sect_ptr) | |
9ad5cbcf | 1277 | #define elf_numsections(bfd) (elf_tdata(bfd) -> num_elf_sections) |
252b5132 RH |
1278 | #define elf_shstrtab(bfd) (elf_tdata(bfd) -> strtab_ptr) |
1279 | #define elf_onesymtab(bfd) (elf_tdata(bfd) -> symtab_section) | |
9ad5cbcf | 1280 | #define elf_symtab_shndx(bfd) (elf_tdata(bfd) -> symtab_shndx_section) |
252b5132 RH |
1281 | #define elf_dynsymtab(bfd) (elf_tdata(bfd) -> dynsymtab_section) |
1282 | #define elf_dynversym(bfd) (elf_tdata(bfd) -> dynversym_section) | |
1283 | #define elf_dynverdef(bfd) (elf_tdata(bfd) -> dynverdef_section) | |
1284 | #define elf_dynverref(bfd) (elf_tdata(bfd) -> dynverref_section) | |
1285 | #define elf_num_locals(bfd) (elf_tdata(bfd) -> num_locals) | |
1286 | #define elf_num_globals(bfd) (elf_tdata(bfd) -> num_globals) | |
1287 | #define elf_section_syms(bfd) (elf_tdata(bfd) -> section_syms) | |
4e89ac30 | 1288 | #define elf_num_section_syms(bfd) (elf_tdata(bfd) -> num_section_syms) |
252b5132 RH |
1289 | #define core_prpsinfo(bfd) (elf_tdata(bfd) -> prpsinfo) |
1290 | #define core_prstatus(bfd) (elf_tdata(bfd) -> prstatus) | |
1291 | #define elf_gp(bfd) (elf_tdata(bfd) -> gp) | |
1292 | #define elf_gp_size(bfd) (elf_tdata(bfd) -> gp_size) | |
1293 | #define elf_sym_hashes(bfd) (elf_tdata(bfd) -> sym_hashes) | |
1294 | #define elf_local_got_refcounts(bfd) (elf_tdata(bfd) -> local_got.refcounts) | |
1295 | #define elf_local_got_offsets(bfd) (elf_tdata(bfd) -> local_got.offsets) | |
5cab59f6 | 1296 | #define elf_local_got_ents(bfd) (elf_tdata(bfd) -> local_got.ents) |
252b5132 RH |
1297 | #define elf_local_ptr_offsets(bfd) (elf_tdata(bfd) -> linker_section_pointers) |
1298 | #define elf_dt_name(bfd) (elf_tdata(bfd) -> dt_name) | |
74816898 | 1299 | #define elf_dt_soname(bfd) (elf_tdata(bfd) -> dt_soname) |
252b5132 RH |
1300 | #define elf_bad_symtab(bfd) (elf_tdata(bfd) -> bad_symtab) |
1301 | #define elf_flags_init(bfd) (elf_tdata(bfd) -> flags_init) | |
1302 | #define elf_linker_section(bfd,n) (elf_tdata(bfd) -> linker_section[(int)n]) | |
1303 | \f | |
1304 | extern void _bfd_elf_swap_verdef_in | |
1305 | PARAMS ((bfd *, const Elf_External_Verdef *, Elf_Internal_Verdef *)); | |
1306 | extern void _bfd_elf_swap_verdef_out | |
1307 | PARAMS ((bfd *, const Elf_Internal_Verdef *, Elf_External_Verdef *)); | |
1308 | extern void _bfd_elf_swap_verdaux_in | |
1309 | PARAMS ((bfd *, const Elf_External_Verdaux *, Elf_Internal_Verdaux *)); | |
1310 | extern void _bfd_elf_swap_verdaux_out | |
1311 | PARAMS ((bfd *, const Elf_Internal_Verdaux *, Elf_External_Verdaux *)); | |
1312 | extern void _bfd_elf_swap_verneed_in | |
1313 | PARAMS ((bfd *, const Elf_External_Verneed *, Elf_Internal_Verneed *)); | |
1314 | extern void _bfd_elf_swap_verneed_out | |
1315 | PARAMS ((bfd *, const Elf_Internal_Verneed *, Elf_External_Verneed *)); | |
1316 | extern void _bfd_elf_swap_vernaux_in | |
1317 | PARAMS ((bfd *, const Elf_External_Vernaux *, Elf_Internal_Vernaux *)); | |
1318 | extern void _bfd_elf_swap_vernaux_out | |
1319 | PARAMS ((bfd *, const Elf_Internal_Vernaux *, Elf_External_Vernaux *)); | |
1320 | extern void _bfd_elf_swap_versym_in | |
1321 | PARAMS ((bfd *, const Elf_External_Versym *, Elf_Internal_Versym *)); | |
1322 | extern void _bfd_elf_swap_versym_out | |
1323 | PARAMS ((bfd *, const Elf_Internal_Versym *, Elf_External_Versym *)); | |
1324 | ||
dc810e39 AM |
1325 | extern int _bfd_elf_section_from_bfd_section |
1326 | PARAMS ((bfd *, asection *)); | |
252b5132 RH |
1327 | extern char *bfd_elf_string_from_elf_section |
1328 | PARAMS ((bfd *, unsigned, unsigned)); | |
dc810e39 AM |
1329 | extern char *bfd_elf_get_str_section |
1330 | PARAMS ((bfd *, unsigned)); | |
6cdc0ccc AM |
1331 | extern Elf_Internal_Sym *bfd_elf_get_elf_syms |
1332 | PARAMS ((bfd *, Elf_Internal_Shdr *, size_t, size_t, | |
1333 | Elf_Internal_Sym *, PTR, Elf_External_Sym_Shndx *)); | |
5cab59f6 AM |
1334 | extern const char *bfd_elf_local_sym_name |
1335 | PARAMS ((bfd *, Elf_Internal_Sym *)); | |
252b5132 | 1336 | |
b34976b6 | 1337 | extern bfd_boolean _bfd_elf_copy_private_bfd_data |
2d502050 | 1338 | PARAMS ((bfd *, bfd *)); |
b34976b6 | 1339 | extern bfd_boolean _bfd_elf_print_private_bfd_data |
dc810e39 AM |
1340 | PARAMS ((bfd *, PTR)); |
1341 | extern void bfd_elf_print_symbol | |
1342 | PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type)); | |
1343 | ||
1344 | #define elf_string_from_elf_strtab(abfd, strindex) \ | |
1345 | bfd_elf_string_from_elf_section(abfd, elf_elfheader(abfd)->e_shstrndx, \ | |
1346 | strindex) | |
252b5132 RH |
1347 | |
1348 | #define bfd_elf32_print_symbol bfd_elf_print_symbol | |
1349 | #define bfd_elf64_print_symbol bfd_elf_print_symbol | |
1350 | ||
dc810e39 AM |
1351 | extern void _bfd_elf_sprintf_vma |
1352 | PARAMS ((bfd *, char *, bfd_vma)); | |
1353 | extern void _bfd_elf_fprintf_vma | |
1354 | PARAMS ((bfd *, PTR, bfd_vma)); | |
d69bb69b | 1355 | |
dc810e39 | 1356 | extern enum elf_reloc_type_class _bfd_elf_reloc_type_class |
f51e552e | 1357 | PARAMS ((const Elf_Internal_Rela *)); |
f8df10f4 JJ |
1358 | extern bfd_vma _bfd_elf_rela_local_sym |
1359 | PARAMS ((bfd *, Elf_Internal_Sym *, asection *, Elf_Internal_Rela *)); | |
c629eae0 JJ |
1360 | extern bfd_vma _bfd_elf_rel_local_sym |
1361 | PARAMS ((bfd *, Elf_Internal_Sym *, asection **, bfd_vma)); | |
1362 | extern bfd_vma _bfd_elf_section_offset | |
1363 | PARAMS ((bfd *, struct bfd_link_info *, asection *, bfd_vma)); | |
db6751f2 | 1364 | |
dc810e39 AM |
1365 | extern unsigned long bfd_elf_hash |
1366 | PARAMS ((const char *)); | |
252b5132 | 1367 | |
dc810e39 AM |
1368 | extern bfd_reloc_status_type bfd_elf_generic_reloc |
1369 | PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); | |
b34976b6 | 1370 | extern bfd_boolean bfd_elf_mkobject |
dc810e39 | 1371 | PARAMS ((bfd *)); |
b34976b6 | 1372 | extern bfd_boolean bfd_elf_mkcorefile |
dc810e39 AM |
1373 | PARAMS ((bfd *)); |
1374 | extern Elf_Internal_Shdr *bfd_elf_find_section | |
1375 | PARAMS ((bfd *, char *)); | |
b34976b6 | 1376 | extern bfd_boolean _bfd_elf_make_section_from_shdr |
dc810e39 | 1377 | PARAMS ((bfd *, Elf_Internal_Shdr *, const char *)); |
b34976b6 | 1378 | extern bfd_boolean _bfd_elf_make_section_from_phdr |
dc810e39 | 1379 | PARAMS ((bfd *, Elf_Internal_Phdr *, int, const char *)); |
252b5132 RH |
1380 | extern struct bfd_hash_entry *_bfd_elf_link_hash_newfunc |
1381 | PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); | |
1382 | extern struct bfd_link_hash_table *_bfd_elf_link_hash_table_create | |
1383 | PARAMS ((bfd *)); | |
c61b8717 | 1384 | extern void _bfd_elf_link_hash_copy_indirect |
b48fa14c AM |
1385 | PARAMS ((struct elf_backend_data *, struct elf_link_hash_entry *, |
1386 | struct elf_link_hash_entry *)); | |
c61b8717 | 1387 | extern void _bfd_elf_link_hash_hide_symbol |
b34976b6 AM |
1388 | PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *, bfd_boolean)); |
1389 | extern bfd_boolean _bfd_elf_link_hash_table_init | |
252b5132 RH |
1390 | PARAMS ((struct elf_link_hash_table *, bfd *, |
1391 | struct bfd_hash_entry *(*) (struct bfd_hash_entry *, | |
1392 | struct bfd_hash_table *, | |
1393 | const char *))); | |
b34976b6 | 1394 | extern bfd_boolean _bfd_elf_slurp_version_tables |
dc810e39 | 1395 | PARAMS ((bfd *)); |
b34976b6 | 1396 | extern bfd_boolean _bfd_elf_merge_sections |
8550eb6e | 1397 | PARAMS ((bfd *, struct bfd_link_info *)); |
b34976b6 | 1398 | extern bfd_boolean bfd_elf_discard_group |
e61463e1 | 1399 | PARAMS ((bfd *, struct sec *)); |
1126897b AM |
1400 | extern void bfd_elf_set_group_contents |
1401 | PARAMS ((bfd *, asection *, PTR)); | |
2d653fc7 AM |
1402 | extern void _bfd_elf_link_just_syms |
1403 | PARAMS ((asection *, struct bfd_link_info *)); | |
b34976b6 | 1404 | extern bfd_boolean _bfd_elf_copy_private_symbol_data |
252b5132 | 1405 | PARAMS ((bfd *, asymbol *, bfd *, asymbol *)); |
b34976b6 | 1406 | extern bfd_boolean _bfd_elf_copy_private_section_data |
252b5132 | 1407 | PARAMS ((bfd *, asection *, bfd *, asection *)); |
b34976b6 | 1408 | extern bfd_boolean _bfd_elf_write_object_contents |
dc810e39 | 1409 | PARAMS ((bfd *)); |
b34976b6 | 1410 | extern bfd_boolean _bfd_elf_write_corefile_contents |
dc810e39 | 1411 | PARAMS ((bfd *)); |
b34976b6 | 1412 | extern bfd_boolean _bfd_elf_set_section_contents |
dc810e39 AM |
1413 | PARAMS ((bfd *, sec_ptr, PTR, file_ptr, bfd_size_type)); |
1414 | extern long _bfd_elf_get_symtab_upper_bound | |
1415 | PARAMS ((bfd *)); | |
1416 | extern long _bfd_elf_get_symtab | |
1417 | PARAMS ((bfd *, asymbol **)); | |
1418 | extern long _bfd_elf_get_dynamic_symtab_upper_bound | |
1419 | PARAMS ((bfd *)); | |
1420 | extern long _bfd_elf_canonicalize_dynamic_symtab | |
1421 | PARAMS ((bfd *, asymbol **)); | |
1422 | extern long _bfd_elf_get_reloc_upper_bound | |
1423 | PARAMS ((bfd *, sec_ptr)); | |
1424 | extern long _bfd_elf_canonicalize_reloc | |
1425 | PARAMS ((bfd *, sec_ptr, arelent **, asymbol **)); | |
1426 | extern long _bfd_elf_get_dynamic_reloc_upper_bound | |
1427 | PARAMS ((bfd *)); | |
1428 | extern long _bfd_elf_canonicalize_dynamic_reloc | |
1429 | PARAMS ((bfd *, arelent **, asymbol **)); | |
1430 | extern asymbol *_bfd_elf_make_empty_symbol | |
1431 | PARAMS ((bfd *)); | |
1432 | extern void _bfd_elf_get_symbol_info | |
1433 | PARAMS ((bfd *, asymbol *, symbol_info *)); | |
b34976b6 | 1434 | extern bfd_boolean _bfd_elf_is_local_label_name |
dc810e39 AM |
1435 | PARAMS ((bfd *, const char *)); |
1436 | extern alent *_bfd_elf_get_lineno | |
1437 | PARAMS ((bfd *, asymbol *)); | |
b34976b6 | 1438 | extern bfd_boolean _bfd_elf_set_arch_mach |
dc810e39 | 1439 | PARAMS ((bfd *, enum bfd_architecture, unsigned long)); |
b34976b6 | 1440 | extern bfd_boolean _bfd_elf_find_nearest_line |
dc810e39 AM |
1441 | PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **, |
1442 | const char **, unsigned int *)); | |
252b5132 RH |
1443 | #define _bfd_elf_read_minisymbols _bfd_generic_read_minisymbols |
1444 | #define _bfd_elf_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol | |
dc810e39 | 1445 | extern int _bfd_elf_sizeof_headers |
b34976b6 AM |
1446 | PARAMS ((bfd *, bfd_boolean)); |
1447 | extern bfd_boolean _bfd_elf_new_section_hook | |
dc810e39 | 1448 | PARAMS ((bfd *, asection *)); |
b34976b6 AM |
1449 | extern bfd_boolean _bfd_elf_init_reloc_shdr |
1450 | PARAMS ((bfd *, Elf_Internal_Shdr *, asection *, bfd_boolean)); | |
252b5132 RH |
1451 | |
1452 | /* If the target doesn't have reloc handling written yet: */ | |
dc810e39 AM |
1453 | extern void _bfd_elf_no_info_to_howto |
1454 | PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); | |
1455 | ||
b34976b6 | 1456 | extern bfd_boolean bfd_section_from_shdr |
dc810e39 | 1457 | PARAMS ((bfd *, unsigned int shindex)); |
b34976b6 | 1458 | extern bfd_boolean bfd_section_from_phdr |
dc810e39 AM |
1459 | PARAMS ((bfd *, Elf_Internal_Phdr *, int)); |
1460 | ||
1461 | extern int _bfd_elf_symbol_from_bfd_symbol | |
1462 | PARAMS ((bfd *, asymbol **)); | |
1463 | ||
ec338859 AM |
1464 | extern asection *bfd_section_from_r_symndx |
1465 | PARAMS ((bfd *, struct sym_sec_cache *, asection *, unsigned long)); | |
dc810e39 AM |
1466 | extern asection *bfd_section_from_elf_index |
1467 | PARAMS ((bfd *, unsigned int)); | |
dc810e39 AM |
1468 | extern struct bfd_strtab_hash *_bfd_elf_stringtab_init |
1469 | PARAMS ((void)); | |
2b0f7ef9 JJ |
1470 | |
1471 | extern struct elf_strtab_hash * _bfd_elf_strtab_init | |
1472 | PARAMS ((void)); | |
1473 | extern void _bfd_elf_strtab_free | |
1474 | PARAMS ((struct elf_strtab_hash *)); | |
1475 | extern bfd_size_type _bfd_elf_strtab_add | |
b34976b6 | 1476 | PARAMS ((struct elf_strtab_hash *, const char *, bfd_boolean)); |
2b0f7ef9 JJ |
1477 | extern void _bfd_elf_strtab_addref |
1478 | PARAMS ((struct elf_strtab_hash *, bfd_size_type)); | |
1479 | extern void _bfd_elf_strtab_delref | |
1480 | PARAMS ((struct elf_strtab_hash *, bfd_size_type)); | |
1481 | extern void _bfd_elf_strtab_clear_all_refs | |
1482 | PARAMS ((struct elf_strtab_hash *)); | |
1483 | extern bfd_size_type _bfd_elf_strtab_size | |
1484 | PARAMS ((struct elf_strtab_hash *)); | |
1485 | extern bfd_size_type _bfd_elf_strtab_offset | |
1486 | PARAMS ((struct elf_strtab_hash *, bfd_size_type)); | |
b34976b6 | 1487 | extern bfd_boolean _bfd_elf_strtab_emit |
2b0f7ef9 JJ |
1488 | PARAMS ((bfd *, struct elf_strtab_hash *)); |
1489 | extern void _bfd_elf_strtab_finalize | |
1490 | PARAMS ((struct elf_strtab_hash *)); | |
1491 | ||
b34976b6 | 1492 | extern bfd_boolean _bfd_elf_discard_section_eh_frame |
126495ed | 1493 | PARAMS ((bfd *, struct bfd_link_info *, asection *, |
b34976b6 AM |
1494 | bfd_boolean (*) (bfd_vma, PTR), struct elf_reloc_cookie *)); |
1495 | extern bfd_boolean _bfd_elf_discard_section_eh_frame_hdr | |
126495ed | 1496 | PARAMS ((bfd *, struct bfd_link_info *)); |
65765700 JJ |
1497 | extern bfd_vma _bfd_elf_eh_frame_section_offset |
1498 | PARAMS ((bfd *, asection *, bfd_vma)); | |
b34976b6 | 1499 | extern bfd_boolean _bfd_elf_write_section_eh_frame |
126495ed | 1500 | PARAMS ((bfd *, struct bfd_link_info *, asection *, bfd_byte *)); |
b34976b6 | 1501 | extern bfd_boolean _bfd_elf_write_section_eh_frame_hdr |
126495ed | 1502 | PARAMS ((bfd *, struct bfd_link_info *)); |
b34976b6 | 1503 | extern bfd_boolean _bfd_elf_maybe_strip_eh_frame_hdr |
68f69152 | 1504 | PARAMS ((struct bfd_link_info *)); |
65765700 | 1505 | |
45d6a902 AM |
1506 | extern bfd_boolean _bfd_elf_merge_symbol |
1507 | PARAMS ((bfd *, struct bfd_link_info *, const char *, | |
1508 | Elf_Internal_Sym *, asection **, bfd_vma *, | |
1509 | struct elf_link_hash_entry **, bfd_boolean *, bfd_boolean *, | |
1510 | bfd_boolean *, bfd_boolean *, bfd_boolean)); | |
1511 | ||
1512 | extern bfd_boolean _bfd_elf_add_default_symbol | |
1513 | PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, | |
1514 | const char *, Elf_Internal_Sym *, asection **, bfd_vma *, | |
1515 | bfd_boolean *, bfd_boolean, bfd_boolean)); | |
1516 | ||
1517 | extern bfd_boolean _bfd_elf_export_symbol | |
1518 | PARAMS ((struct elf_link_hash_entry *, PTR)); | |
1519 | ||
1520 | extern bfd_boolean _bfd_elf_link_find_version_dependencies | |
1521 | PARAMS ((struct elf_link_hash_entry *, PTR)); | |
1522 | ||
1523 | extern bfd_boolean _bfd_elf_link_assign_sym_version | |
1524 | PARAMS ((struct elf_link_hash_entry *, PTR)); | |
1525 | ||
b34976b6 | 1526 | extern bfd_boolean _bfd_elf_link_record_dynamic_symbol |
dc810e39 AM |
1527 | PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *)); |
1528 | extern long _bfd_elf_link_lookup_local_dynindx | |
1529 | PARAMS ((struct bfd_link_info *, bfd *, long)); | |
b34976b6 | 1530 | extern bfd_boolean _bfd_elf_compute_section_file_positions |
dc810e39 AM |
1531 | PARAMS ((bfd *, struct bfd_link_info *)); |
1532 | extern void _bfd_elf_assign_file_positions_for_relocs | |
1533 | PARAMS ((bfd *)); | |
1534 | extern file_ptr _bfd_elf_assign_file_position_for_section | |
b34976b6 | 1535 | PARAMS ((Elf_Internal_Shdr *, file_ptr, bfd_boolean)); |
dc810e39 | 1536 | |
b34976b6 | 1537 | extern bfd_boolean _bfd_elf_validate_reloc |
dc810e39 AM |
1538 | PARAMS ((bfd *, arelent *)); |
1539 | ||
45d6a902 AM |
1540 | extern bfd_boolean _bfd_elf_link_create_dynamic_sections |
1541 | PARAMS ((bfd *, struct bfd_link_info *)); | |
b34976b6 | 1542 | extern bfd_boolean _bfd_elf_create_dynamic_sections |
dc810e39 | 1543 | PARAMS ((bfd *, struct bfd_link_info *)); |
b34976b6 | 1544 | extern bfd_boolean _bfd_elf_create_got_section |
dc810e39 AM |
1545 | PARAMS ((bfd *, struct bfd_link_info *)); |
1546 | extern unsigned long _bfd_elf_link_renumber_dynsyms | |
1547 | PARAMS ((bfd *, struct bfd_link_info *)); | |
1548 | ||
b34976b6 | 1549 | extern bfd_boolean _bfd_elfcore_make_pseudosection |
dc810e39 AM |
1550 | PARAMS ((bfd *, char *, size_t, ufile_ptr)); |
1551 | extern char *_bfd_elfcore_strndup | |
1552 | PARAMS ((bfd *, char *, size_t)); | |
1553 | ||
1554 | extern elf_linker_section_t *_bfd_elf_create_linker_section | |
1555 | PARAMS ((bfd *, struct bfd_link_info *, enum elf_linker_section_enum, | |
1556 | elf_linker_section_t *)); | |
1557 | ||
1558 | extern elf_linker_section_pointers_t *_bfd_elf_find_pointer_linker_section | |
1559 | PARAMS ((elf_linker_section_pointers_t *, bfd_vma, | |
1560 | elf_linker_section_enum_t)); | |
1561 | ||
b34976b6 | 1562 | extern bfd_boolean bfd_elf32_create_pointer_linker_section |
dc810e39 | 1563 | PARAMS ((bfd *, struct bfd_link_info *, elf_linker_section_t *, |
947216bf | 1564 | struct elf_link_hash_entry *, const Elf_Internal_Rela *)); |
dc810e39 AM |
1565 | |
1566 | extern bfd_vma bfd_elf32_finish_pointer_linker_section | |
1567 | PARAMS ((bfd *, bfd *, struct bfd_link_info *, elf_linker_section_t *, | |
1568 | struct elf_link_hash_entry *, bfd_vma, | |
947216bf | 1569 | const Elf_Internal_Rela *, int)); |
dc810e39 | 1570 | |
b34976b6 | 1571 | extern bfd_boolean bfd_elf64_create_pointer_linker_section |
dc810e39 | 1572 | PARAMS ((bfd *, struct bfd_link_info *, elf_linker_section_t *, |
947216bf | 1573 | struct elf_link_hash_entry *, const Elf_Internal_Rela *)); |
dc810e39 AM |
1574 | |
1575 | extern bfd_vma bfd_elf64_finish_pointer_linker_section | |
1576 | PARAMS ((bfd *, bfd *, struct bfd_link_info *, elf_linker_section_t *, | |
1577 | struct elf_link_hash_entry *, bfd_vma, | |
947216bf | 1578 | const Elf_Internal_Rela *, int)); |
dc810e39 | 1579 | |
b34976b6 | 1580 | extern bfd_boolean _bfd_elf_make_linker_section_rela |
dc810e39 AM |
1581 | PARAMS ((bfd *, elf_linker_section_t *, int)); |
1582 | ||
45d6a902 AM |
1583 | extern Elf_Internal_Rela *_bfd_elf_link_read_relocs |
1584 | PARAMS ((bfd *, asection *, PTR, Elf_Internal_Rela *, bfd_boolean)); | |
1585 | ||
1586 | extern bfd_boolean _bfd_elf_link_size_reloc_section | |
1587 | PARAMS ((bfd *, Elf_Internal_Shdr *, asection *)); | |
1588 | ||
1589 | extern bfd_boolean _bfd_elf_link_output_relocs | |
1590 | PARAMS ((bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *)); | |
1591 | ||
1592 | extern bfd_boolean _bfd_elf_fix_symbol_flags | |
1593 | PARAMS ((struct elf_link_hash_entry *, struct elf_info_failed *)); | |
1594 | ||
1595 | extern bfd_boolean _bfd_elf_adjust_dynamic_symbol | |
1596 | PARAMS ((struct elf_link_hash_entry *, PTR)); | |
1597 | ||
1598 | extern bfd_boolean _bfd_elf_link_sec_merge_syms | |
1599 | PARAMS ((struct elf_link_hash_entry *, PTR)); | |
1600 | ||
dc810e39 AM |
1601 | extern const bfd_target *bfd_elf32_object_p |
1602 | PARAMS ((bfd *)); | |
1603 | extern const bfd_target *bfd_elf32_core_file_p | |
1604 | PARAMS ((bfd *)); | |
1605 | extern char *bfd_elf32_core_file_failing_command | |
1606 | PARAMS ((bfd *)); | |
1607 | extern int bfd_elf32_core_file_failing_signal | |
1608 | PARAMS ((bfd *)); | |
b34976b6 | 1609 | extern bfd_boolean bfd_elf32_core_file_matches_executable_p |
dc810e39 | 1610 | PARAMS ((bfd *, bfd *)); |
252b5132 | 1611 | |
b34976b6 | 1612 | extern bfd_boolean bfd_elf32_bfd_link_add_symbols |
252b5132 | 1613 | PARAMS ((bfd *, struct bfd_link_info *)); |
b34976b6 | 1614 | extern bfd_boolean bfd_elf32_bfd_final_link |
252b5132 RH |
1615 | PARAMS ((bfd *, struct bfd_link_info *)); |
1616 | ||
1617 | extern void bfd_elf32_swap_symbol_in | |
f8ecb12b | 1618 | PARAMS ((bfd *, const PTR, const PTR, Elf_Internal_Sym *)); |
252b5132 | 1619 | extern void bfd_elf32_swap_symbol_out |
9ad5cbcf | 1620 | PARAMS ((bfd *, const Elf_Internal_Sym *, PTR, PTR)); |
252b5132 | 1621 | extern void bfd_elf32_swap_reloc_in |
947216bf | 1622 | PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rela *)); |
252b5132 | 1623 | extern void bfd_elf32_swap_reloc_out |
947216bf | 1624 | PARAMS ((bfd *, const Elf_Internal_Rela *, bfd_byte *)); |
252b5132 | 1625 | extern void bfd_elf32_swap_reloca_in |
947216bf | 1626 | PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rela *)); |
252b5132 | 1627 | extern void bfd_elf32_swap_reloca_out |
947216bf | 1628 | PARAMS ((bfd *, const Elf_Internal_Rela *, bfd_byte *)); |
252b5132 RH |
1629 | extern void bfd_elf32_swap_phdr_in |
1630 | PARAMS ((bfd *, const Elf32_External_Phdr *, Elf_Internal_Phdr *)); | |
1631 | extern void bfd_elf32_swap_phdr_out | |
1632 | PARAMS ((bfd *, const Elf_Internal_Phdr *, Elf32_External_Phdr *)); | |
1633 | extern void bfd_elf32_swap_dyn_in | |
1634 | PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *)); | |
1635 | extern void bfd_elf32_swap_dyn_out | |
c7ac6ff8 | 1636 | PARAMS ((bfd *, const Elf_Internal_Dyn *, PTR)); |
252b5132 | 1637 | extern long bfd_elf32_slurp_symbol_table |
b34976b6 AM |
1638 | PARAMS ((bfd *, asymbol **, bfd_boolean)); |
1639 | extern bfd_boolean bfd_elf32_write_shdrs_and_ehdr | |
dc810e39 | 1640 | PARAMS ((bfd *)); |
252b5132 | 1641 | extern int bfd_elf32_write_out_phdrs |
dc810e39 | 1642 | PARAMS ((bfd *, const Elf_Internal_Phdr *, unsigned int)); |
b9f66672 JL |
1643 | extern void bfd_elf32_write_relocs |
1644 | PARAMS ((bfd *, asection *, PTR)); | |
b34976b6 AM |
1645 | extern bfd_boolean bfd_elf32_slurp_reloc_table |
1646 | PARAMS ((bfd *, asection *, asymbol **, bfd_boolean)); | |
1647 | extern bfd_boolean bfd_elf32_add_dynamic_entry | |
252b5132 | 1648 | PARAMS ((struct bfd_link_info *, bfd_vma, bfd_vma)); |
252b5132 | 1649 | |
dc810e39 AM |
1650 | extern const bfd_target *bfd_elf64_object_p |
1651 | PARAMS ((bfd *)); | |
1652 | extern const bfd_target *bfd_elf64_core_file_p | |
1653 | PARAMS ((bfd *)); | |
1654 | extern char *bfd_elf64_core_file_failing_command | |
1655 | PARAMS ((bfd *)); | |
1656 | extern int bfd_elf64_core_file_failing_signal | |
1657 | PARAMS ((bfd *)); | |
b34976b6 | 1658 | extern bfd_boolean bfd_elf64_core_file_matches_executable_p |
dc810e39 | 1659 | PARAMS ((bfd *, bfd *)); |
b34976b6 | 1660 | extern bfd_boolean bfd_elf64_bfd_link_add_symbols |
252b5132 | 1661 | PARAMS ((bfd *, struct bfd_link_info *)); |
b34976b6 | 1662 | extern bfd_boolean bfd_elf64_bfd_final_link |
252b5132 RH |
1663 | PARAMS ((bfd *, struct bfd_link_info *)); |
1664 | ||
1665 | extern void bfd_elf64_swap_symbol_in | |
f8ecb12b | 1666 | PARAMS ((bfd *, const PTR, const PTR, Elf_Internal_Sym *)); |
252b5132 | 1667 | extern void bfd_elf64_swap_symbol_out |
9ad5cbcf | 1668 | PARAMS ((bfd *, const Elf_Internal_Sym *, PTR, PTR)); |
252b5132 | 1669 | extern void bfd_elf64_swap_reloc_in |
947216bf | 1670 | PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rela *)); |
252b5132 | 1671 | extern void bfd_elf64_swap_reloc_out |
947216bf | 1672 | PARAMS ((bfd *, const Elf_Internal_Rela *, bfd_byte *)); |
252b5132 | 1673 | extern void bfd_elf64_swap_reloca_in |
947216bf | 1674 | PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rela *)); |
252b5132 | 1675 | extern void bfd_elf64_swap_reloca_out |
947216bf | 1676 | PARAMS ((bfd *, const Elf_Internal_Rela *, bfd_byte *)); |
252b5132 RH |
1677 | extern void bfd_elf64_swap_phdr_in |
1678 | PARAMS ((bfd *, const Elf64_External_Phdr *, Elf_Internal_Phdr *)); | |
1679 | extern void bfd_elf64_swap_phdr_out | |
1680 | PARAMS ((bfd *, const Elf_Internal_Phdr *, Elf64_External_Phdr *)); | |
1681 | extern void bfd_elf64_swap_dyn_in | |
1682 | PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *)); | |
1683 | extern void bfd_elf64_swap_dyn_out | |
c7ac6ff8 | 1684 | PARAMS ((bfd *, const Elf_Internal_Dyn *, PTR)); |
252b5132 | 1685 | extern long bfd_elf64_slurp_symbol_table |
b34976b6 AM |
1686 | PARAMS ((bfd *, asymbol **, bfd_boolean)); |
1687 | extern bfd_boolean bfd_elf64_write_shdrs_and_ehdr | |
dc810e39 | 1688 | PARAMS ((bfd *)); |
252b5132 | 1689 | extern int bfd_elf64_write_out_phdrs |
dc810e39 | 1690 | PARAMS ((bfd *, const Elf_Internal_Phdr *, unsigned int)); |
b9f66672 JL |
1691 | extern void bfd_elf64_write_relocs |
1692 | PARAMS ((bfd *, asection *, PTR)); | |
b34976b6 AM |
1693 | extern bfd_boolean bfd_elf64_slurp_reloc_table |
1694 | PARAMS ((bfd *, asection *, asymbol **, bfd_boolean)); | |
1695 | extern bfd_boolean bfd_elf64_add_dynamic_entry | |
252b5132 | 1696 | PARAMS ((struct bfd_link_info *, bfd_vma, bfd_vma)); |
252b5132 | 1697 | |
30b30c21 RH |
1698 | #define bfd_elf32_link_record_dynamic_symbol \ |
1699 | _bfd_elf_link_record_dynamic_symbol | |
1700 | #define bfd_elf64_link_record_dynamic_symbol \ | |
1701 | _bfd_elf_link_record_dynamic_symbol | |
1702 | ||
8c58d23b | 1703 | extern int elf_link_record_local_dynamic_symbol |
30b30c21 | 1704 | PARAMS ((struct bfd_link_info *, bfd *, long)); |
8c58d23b AM |
1705 | #define _bfd_elf32_link_record_local_dynamic_symbol \ |
1706 | elf_link_record_local_dynamic_symbol | |
1707 | #define _bfd_elf64_link_record_local_dynamic_symbol \ | |
1708 | elf_link_record_local_dynamic_symbol | |
252b5132 | 1709 | |
b34976b6 | 1710 | extern bfd_boolean _bfd_elf_close_and_cleanup |
dc810e39 | 1711 | PARAMS ((bfd *)); |
252b5132 RH |
1712 | extern bfd_reloc_status_type _bfd_elf_rel_vtable_reloc_fn |
1713 | PARAMS ((bfd *, arelent *, struct symbol_cache_entry *, PTR, | |
1714 | asection *, bfd *, char **)); | |
1715 | ||
b34976b6 | 1716 | extern bfd_boolean _bfd_elf32_gc_sections |
dc810e39 | 1717 | PARAMS ((bfd *, struct bfd_link_info *)); |
b34976b6 | 1718 | extern bfd_boolean _bfd_elf32_gc_common_finalize_got_offsets |
dc810e39 | 1719 | PARAMS ((bfd *, struct bfd_link_info *)); |
b34976b6 | 1720 | extern bfd_boolean _bfd_elf32_gc_common_final_link |
252b5132 | 1721 | PARAMS ((bfd *, struct bfd_link_info *)); |
b34976b6 | 1722 | extern bfd_boolean _bfd_elf32_gc_record_vtinherit |
252b5132 | 1723 | PARAMS ((bfd *, asection *, struct elf_link_hash_entry *, bfd_vma)); |
b34976b6 | 1724 | extern bfd_boolean _bfd_elf32_gc_record_vtentry |
252b5132 RH |
1725 | PARAMS ((bfd *, asection *, struct elf_link_hash_entry *, bfd_vma)); |
1726 | ||
b34976b6 | 1727 | extern bfd_boolean _bfd_elf64_gc_sections |
252b5132 | 1728 | PARAMS ((bfd *, struct bfd_link_info *)); |
b34976b6 | 1729 | extern bfd_boolean _bfd_elf64_gc_common_finalize_got_offsets |
dc810e39 | 1730 | PARAMS ((bfd *, struct bfd_link_info *)); |
b34976b6 | 1731 | extern bfd_boolean _bfd_elf64_gc_common_final_link |
dc810e39 | 1732 | PARAMS ((bfd *, struct bfd_link_info *)); |
b34976b6 | 1733 | extern bfd_boolean _bfd_elf64_gc_record_vtinherit |
252b5132 | 1734 | PARAMS ((bfd *, asection *, struct elf_link_hash_entry *, bfd_vma)); |
b34976b6 | 1735 | extern bfd_boolean _bfd_elf64_gc_record_vtentry |
252b5132 RH |
1736 | PARAMS ((bfd *, asection *, struct elf_link_hash_entry *, bfd_vma)); |
1737 | ||
b34976b6 | 1738 | extern bfd_boolean _bfd_elf32_reloc_symbol_deleted_p |
73d074b4 | 1739 | PARAMS ((bfd_vma, PTR)); |
b34976b6 | 1740 | extern bfd_boolean _bfd_elf64_reloc_symbol_deleted_p |
73d074b4 DJ |
1741 | PARAMS ((bfd_vma, PTR)); |
1742 | ||
7c76fa91 | 1743 | /* Exported interface for writing elf corefile notes. */ |
d4c88bbb AM |
1744 | extern char *elfcore_write_note |
1745 | PARAMS ((bfd *, char *, int *, const char *, int, const PTR, int)); | |
1746 | extern char *elfcore_write_prpsinfo | |
1747 | PARAMS ((bfd *, char *, int *, const char *, const char *)); | |
1748 | extern char *elfcore_write_prstatus | |
1749 | PARAMS ((bfd *, char *, int *, long, int, const PTR)); | |
1750 | extern char * elfcore_write_pstatus | |
1751 | PARAMS ((bfd *, char *, int *, long, int, const PTR)); | |
1752 | extern char *elfcore_write_prfpreg | |
1753 | PARAMS ((bfd *, char *, int *, const PTR, int)); | |
1754 | extern char *elfcore_write_prxfpreg | |
1755 | PARAMS ((bfd *, char *, int *, const PTR, int)); | |
1756 | extern char *elfcore_write_lwpstatus | |
1757 | PARAMS ((bfd *, char *, int *, long, int, const PTR)); | |
7c76fa91 | 1758 | |
8d6337fe RM |
1759 | extern bfd *_bfd_elf32_bfd_from_remote_memory |
1760 | PARAMS ((bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep, | |
1761 | int (*target_read_memory) (bfd_vma, char *, int))); | |
1762 | extern bfd *_bfd_elf64_bfd_from_remote_memory | |
1763 | PARAMS ((bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep, | |
1764 | int (*target_read_memory) (bfd_vma, char *, int))); | |
1765 | ||
d4845d57 JR |
1766 | /* SH ELF specific routine. */ |
1767 | ||
b34976b6 | 1768 | extern bfd_boolean _sh_elf_set_mach_from_flags |
dc810e39 | 1769 | PARAMS ((bfd *)); |
d4845d57 | 1770 | |
252b5132 | 1771 | #endif /* _LIBELF_H_ */ |