]>
Commit | Line | Data |
---|---|---|
fd0198f0 | 1 | /* BFD back-end data structures for ELF files. |
d6bfcdb5 | 2 | Copyright (C) 1992, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. |
fd0198f0 ILT |
3 | Written by Cygnus Support. |
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 | |
9 | the Free Software Foundation; either version 2 of the License, or | |
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 | |
19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | |
20 | ||
21 | #ifndef _LIBELF_H_ | |
22 | #define _LIBELF_H_ 1 | |
23 | ||
24 | #include "elf/common.h" | |
25 | #include "elf/internal.h" | |
26 | #include "elf/external.h" | |
27 | #include "bfdlink.h" | |
28 | ||
29 | /* If size isn't specified as 64 or 32, NAME macro should fail. */ | |
30 | #ifndef NAME | |
31 | #if ARCH_SIZE==64 | |
32 | #define NAME(x,y) CAT4(x,64,_,y) | |
33 | #endif | |
34 | #if ARCH_SIZE==32 | |
35 | #define NAME(x,y) CAT4(x,32,_,y) | |
36 | #endif | |
37 | #endif | |
38 | ||
39 | #ifndef NAME | |
40 | #define NAME(x,y) CAT4(x,NOSIZE,_,y) | |
41 | #endif | |
42 | ||
43 | #define ElfNAME(X) NAME(Elf,X) | |
44 | #define elfNAME(X) NAME(elf,X) | |
45 | ||
46 | /* Information held for an ELF symbol. The first field is the | |
47 | corresponding asymbol. Every symbol is an ELF file is actually a | |
48 | pointer to this structure, although it is often handled as a | |
49 | pointer to an asymbol. */ | |
50 | ||
51 | typedef struct | |
52 | { | |
53 | /* The BFD symbol. */ | |
54 | asymbol symbol; | |
55 | /* ELF symbol information. */ | |
56 | Elf_Internal_Sym internal_elf_sym; | |
57 | /* Backend specific information. */ | |
58 | union | |
59 | { | |
60 | unsigned int hppa_arg_reloc; | |
61 | PTR mips_extr; | |
62 | PTR any; | |
63 | } | |
64 | tc_data; | |
d6bfcdb5 ILT |
65 | |
66 | /* Version information. This is from an Elf_Internal_Versym | |
67 | structure in a SHT_GNU_versym section. It is zero if there is no | |
68 | version information. */ | |
69 | unsigned short version; | |
70 | ||
fd0198f0 ILT |
71 | } elf_symbol_type; |
72 | \f | |
73 | /* ELF linker hash table entries. */ | |
74 | ||
75 | struct elf_link_hash_entry | |
76 | { | |
77 | struct bfd_link_hash_entry root; | |
78 | ||
79 | /* Symbol index in output file. This is initialized to -1. It is | |
80 | set to -2 if the symbol is used by a reloc. */ | |
81 | long indx; | |
82 | ||
83 | /* Symbol size. */ | |
84 | bfd_size_type size; | |
85 | ||
86 | /* Symbol index as a dynamic symbol. Initialized to -1, and remains | |
87 | -1 if this is not a dynamic symbol. */ | |
88 | long dynindx; | |
89 | ||
90 | /* String table index in .dynstr if this is a dynamic symbol. */ | |
91 | unsigned long dynstr_index; | |
92 | ||
93 | /* If this is a weak defined symbol from a dynamic object, this | |
94 | field points to a defined symbol with the same value, if there is | |
95 | one. Otherwise it is NULL. */ | |
96 | struct elf_link_hash_entry *weakdef; | |
97 | ||
98 | /* If this symbol requires an entry in the global offset table, the | |
99 | processor specific backend uses this field to hold the offset | |
100 | into the .got section. If this field is -1, then the symbol does | |
101 | not require a global offset table entry. */ | |
102 | bfd_vma got_offset; | |
103 | ||
104 | /* If this symbol requires an entry in the procedure linkage table, | |
105 | the processor specific backend uses these two fields to hold the | |
106 | offset into the procedure linkage section and the offset into the | |
107 | .got section. If plt_offset is -1, then the symbol does not | |
108 | require an entry in the procedure linkage table. */ | |
109 | bfd_vma plt_offset; | |
110 | ||
86aac8ea ILT |
111 | /* If this symbol is used in the linker created sections, the processor |
112 | specific backend uses this field to map the field into the offset | |
113 | from the beginning of the section. */ | |
114 | struct elf_linker_section_pointers *linker_section_pointer; | |
115 | ||
d6bfcdb5 ILT |
116 | /* Version information. */ |
117 | union | |
118 | { | |
119 | /* This field is used for a symbol which is not defined in a | |
120 | regular object. It points to the version information read in | |
121 | from the dynamic object. */ | |
122 | Elf_Internal_Verdef *verdef; | |
123 | /* This field is used for a symbol which is defined in a regular | |
124 | object. It is set up in size_dynamic_sections. It points to | |
125 | the version information we should write out for this symbol. */ | |
126 | struct bfd_elf_version_tree *vertree; | |
127 | } verinfo; | |
128 | ||
fd0198f0 ILT |
129 | /* Symbol type (STT_NOTYPE, STT_OBJECT, etc.). */ |
130 | char type; | |
131 | ||
e35765a9 ILT |
132 | /* Symbol st_other value. */ |
133 | unsigned char other; | |
134 | ||
fd0198f0 | 135 | /* Some flags; legal values follow. */ |
d6bfcdb5 | 136 | unsigned short elf_link_hash_flags; |
fd0198f0 ILT |
137 | /* Symbol is referenced by a non-shared object. */ |
138 | #define ELF_LINK_HASH_REF_REGULAR 01 | |
139 | /* Symbol is defined by a non-shared object. */ | |
140 | #define ELF_LINK_HASH_DEF_REGULAR 02 | |
141 | /* Symbol is referenced by a shared object. */ | |
142 | #define ELF_LINK_HASH_REF_DYNAMIC 04 | |
143 | /* Symbol is defined by a shared object. */ | |
144 | #define ELF_LINK_HASH_DEF_DYNAMIC 010 | |
145 | /* Dynamic symbol has been adjustd. */ | |
146 | #define ELF_LINK_HASH_DYNAMIC_ADJUSTED 020 | |
147 | /* Symbol needs a copy reloc. */ | |
148 | #define ELF_LINK_HASH_NEEDS_COPY 040 | |
149 | /* Symbol needs a procedure linkage table entry. */ | |
150 | #define ELF_LINK_HASH_NEEDS_PLT 0100 | |
19bfbcbe ILT |
151 | /* Symbol appears in a non-ELF input file. */ |
152 | #define ELF_LINK_NON_ELF 0200 | |
d6bfcdb5 ILT |
153 | /* Symbol should be marked as hidden in the version information. */ |
154 | #define ELF_LINK_HIDDEN 0400 | |
fd0198f0 ILT |
155 | }; |
156 | ||
157 | /* ELF linker hash table. */ | |
158 | ||
159 | struct elf_link_hash_table | |
160 | { | |
161 | struct bfd_link_hash_table root; | |
162 | /* Whether we have created the special dynamic sections required | |
163 | when linking against or generating a shared object. */ | |
164 | boolean dynamic_sections_created; | |
165 | /* The BFD used to hold special sections created by the linker. | |
166 | This will be the first BFD found which requires these sections to | |
167 | be created. */ | |
168 | bfd *dynobj; | |
169 | /* The number of symbols found in the link which must be put into | |
170 | the .dynsym section. */ | |
171 | bfd_size_type dynsymcount; | |
172 | /* The string table of dynamic symbols, which becomes the .dynstr | |
173 | section. */ | |
174 | struct bfd_strtab_hash *dynstr; | |
175 | /* The number of buckets in the hash table in the .hash section. | |
176 | This is based on the number of dynamic symbols. */ | |
177 | bfd_size_type bucketcount; | |
178 | /* A linked list of DT_NEEDED names found in dynamic objects | |
179 | included in the link. */ | |
180 | struct bfd_link_needed_list *needed; | |
19bfbcbe ILT |
181 | /* The _GLOBAL_OFFSET_TABLE_ symbol. */ |
182 | struct elf_link_hash_entry *hgot; | |
d1bf45aa ILT |
183 | /* A pointer to information used to link stabs in sections. */ |
184 | PTR stab_info; | |
fd0198f0 ILT |
185 | }; |
186 | ||
187 | /* Look up an entry in an ELF linker hash table. */ | |
188 | ||
189 | #define elf_link_hash_lookup(table, string, create, copy, follow) \ | |
190 | ((struct elf_link_hash_entry *) \ | |
191 | bfd_link_hash_lookup (&(table)->root, (string), (create), \ | |
192 | (copy), (follow))) | |
193 | ||
194 | /* Traverse an ELF linker hash table. */ | |
195 | ||
196 | #define elf_link_hash_traverse(table, func, info) \ | |
197 | (bfd_link_hash_traverse \ | |
198 | (&(table)->root, \ | |
199 | (boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \ | |
200 | (info))) | |
201 | ||
202 | /* Get the ELF linker hash table from a link_info structure. */ | |
203 | ||
204 | #define elf_hash_table(p) ((struct elf_link_hash_table *) ((p)->hash)) | |
205 | \f | |
206 | /* Constant information held for an ELF backend. */ | |
207 | ||
208 | struct elf_size_info { | |
209 | unsigned char sizeof_ehdr, sizeof_phdr, sizeof_shdr; | |
210 | unsigned char sizeof_rel, sizeof_rela, sizeof_sym, sizeof_dyn, sizeof_note; | |
211 | ||
212 | unsigned char arch_size, file_align; | |
213 | unsigned char elfclass, ev_current; | |
d1bf45aa | 214 | int (*write_out_phdrs) PARAMS ((bfd *, const Elf_Internal_Phdr *, int)); |
fd0198f0 ILT |
215 | boolean (*write_shdrs_and_ehdr) PARAMS ((bfd *)); |
216 | void (*write_relocs) PARAMS ((bfd *, asection *, PTR)); | |
d1bf45aa | 217 | void (*swap_symbol_out) PARAMS ((bfd *, const Elf_Internal_Sym *, PTR)); |
e35765a9 ILT |
218 | boolean (*slurp_reloc_table) |
219 | PARAMS ((bfd *, asection *, asymbol **, boolean)); | |
fd0198f0 | 220 | long (*slurp_symbol_table) PARAMS ((bfd *, asymbol **, boolean)); |
02fcd126 | 221 | void (*swap_dyn_in) PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *)); |
fd0198f0 ILT |
222 | }; |
223 | ||
224 | #define elf_symbol_from(ABFD,S) \ | |
225 | (((S)->the_bfd->xvec->flavour == bfd_target_elf_flavour \ | |
226 | && (S)->the_bfd->tdata.elf_obj_data != 0) \ | |
227 | ? (elf_symbol_type *) (S) \ | |
228 | : 0) | |
229 | ||
230 | struct elf_backend_data | |
231 | { | |
232 | /* Whether the backend uses REL or RELA relocations. FIXME: some | |
233 | ELF backends use both. When we need to support one, this whole | |
234 | approach will need to be changed. */ | |
235 | int use_rela_p; | |
236 | ||
237 | /* The architecture for this backend. */ | |
238 | enum bfd_architecture arch; | |
239 | ||
240 | /* The ELF machine code (EM_xxxx) for this backend. */ | |
241 | int elf_machine_code; | |
242 | ||
243 | /* The maximum page size for this backend. */ | |
244 | bfd_vma maxpagesize; | |
245 | ||
246 | /* This is true if the linker should act like collect and gather | |
247 | global constructors and destructors by name. This is true for | |
248 | MIPS ELF because the Irix 5 tools can not handle the .init | |
249 | section. */ | |
250 | boolean collect; | |
251 | ||
5b3b9ff6 ILT |
252 | /* This is true if the linker should ignore changes to the type of a |
253 | symbol. This is true for MIPS ELF because some Irix 5 objects | |
254 | record undefined functions as STT_OBJECT although the definitions | |
255 | are STT_FUNC. */ | |
256 | boolean type_change_ok; | |
257 | ||
fd0198f0 ILT |
258 | /* A function to translate an ELF RELA relocation to a BFD arelent |
259 | structure. */ | |
260 | void (*elf_info_to_howto) PARAMS ((bfd *, arelent *, | |
261 | Elf_Internal_Rela *)); | |
262 | ||
263 | /* A function to translate an ELF REL relocation to a BFD arelent | |
264 | structure. */ | |
265 | void (*elf_info_to_howto_rel) PARAMS ((bfd *, arelent *, | |
266 | Elf_Internal_Rel *)); | |
267 | ||
268 | /* A function to determine whether a symbol is global when | |
269 | partitioning the symbol table into local and global symbols. | |
270 | This should be NULL for most targets, in which case the correct | |
271 | thing will be done. MIPS ELF, at least on the Irix 5, has | |
272 | special requirements. */ | |
273 | boolean (*elf_backend_sym_is_global) PARAMS ((bfd *, asymbol *)); | |
274 | ||
275 | /* The remaining functions are hooks which are called only if they | |
276 | are not NULL. */ | |
277 | ||
278 | /* A function to permit a backend specific check on whether a | |
279 | particular BFD format is relevant for an object file, and to | |
280 | permit the backend to set any global information it wishes. When | |
281 | this is called elf_elfheader is set, but anything else should be | |
282 | used with caution. If this returns false, the check_format | |
283 | routine will return a bfd_error_wrong_format error. */ | |
284 | boolean (*elf_backend_object_p) PARAMS ((bfd *)); | |
285 | ||
286 | /* A function to do additional symbol processing when reading the | |
287 | ELF symbol table. This is where any processor-specific special | |
288 | section indices are handled. */ | |
289 | void (*elf_backend_symbol_processing) PARAMS ((bfd *, asymbol *)); | |
290 | ||
291 | /* A function to do additional symbol processing after reading the | |
292 | entire ELF symbol table. */ | |
293 | boolean (*elf_backend_symbol_table_processing) PARAMS ((bfd *, | |
294 | elf_symbol_type *, | |
295 | unsigned int)); | |
296 | ||
297 | /* A function to do additional processing on the ELF section header | |
298 | just before writing it out. This is used to set the flags and | |
299 | type fields for some sections, or to actually write out data for | |
300 | unusual sections. */ | |
301 | boolean (*elf_backend_section_processing) PARAMS ((bfd *, | |
302 | Elf32_Internal_Shdr *)); | |
303 | ||
304 | /* A function to handle unusual section types when creating BFD | |
305 | sections from ELF sections. */ | |
306 | boolean (*elf_backend_section_from_shdr) PARAMS ((bfd *, | |
307 | Elf32_Internal_Shdr *, | |
308 | char *)); | |
309 | ||
310 | /* A function to set up the ELF section header for a BFD section in | |
311 | preparation for writing it out. This is where the flags and type | |
312 | fields are set for unusual sections. */ | |
313 | boolean (*elf_backend_fake_sections) PARAMS ((bfd *, Elf32_Internal_Shdr *, | |
314 | asection *)); | |
315 | ||
316 | /* A function to get the ELF section index for a BFD section. If | |
317 | this returns true, the section was found. If it is a normal ELF | |
318 | section, *RETVAL should be left unchanged. If it is not a normal | |
319 | ELF section *RETVAL should be set to the SHN_xxxx index. */ | |
320 | boolean (*elf_backend_section_from_bfd_section) | |
321 | PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *, int *retval)); | |
322 | ||
323 | /* If this field is not NULL, it is called by the add_symbols phase | |
324 | of a link just before adding a symbol to the global linker hash | |
325 | table. It may modify any of the fields as it wishes. If *NAME | |
326 | is set to NULL, the symbol will be skipped rather than being | |
327 | added to the hash table. This function is responsible for | |
328 | handling all processor dependent symbol bindings and section | |
329 | indices, and must set at least *FLAGS and *SEC for each processor | |
330 | dependent case; failure to do so will cause a link error. */ | |
331 | boolean (*elf_add_symbol_hook) | |
332 | PARAMS ((bfd *abfd, struct bfd_link_info *info, | |
333 | const Elf_Internal_Sym *, const char **name, | |
334 | flagword *flags, asection **sec, bfd_vma *value)); | |
335 | ||
336 | /* If this field is not NULL, it is called by the elf_link_output_sym | |
337 | phase of a link for each symbol which will appear in the object file. */ | |
338 | boolean (*elf_backend_link_output_symbol_hook) | |
339 | PARAMS ((bfd *, struct bfd_link_info *info, const char *, | |
340 | Elf_Internal_Sym *, asection *)); | |
341 | ||
342 | /* The CREATE_DYNAMIC_SECTIONS function is called by the ELF backend | |
343 | linker the first time it encounters a dynamic object in the link. | |
344 | This function must create any sections required for dynamic | |
345 | linking. The ABFD argument is a dynamic object. The .interp, | |
346 | .dynamic, .dynsym, .dynstr, and .hash functions have already been | |
347 | created, and this function may modify the section flags if | |
348 | desired. This function will normally create the .got and .plt | |
349 | sections, but different backends have different requirements. */ | |
350 | boolean (*elf_backend_create_dynamic_sections) | |
351 | PARAMS ((bfd *abfd, struct bfd_link_info *info)); | |
352 | ||
353 | /* The CHECK_RELOCS function is called by the add_symbols phase of | |
354 | the ELF backend linker. It is called once for each section with | |
355 | relocs of an object file, just after the symbols for the object | |
356 | file have been added to the global linker hash table. The | |
357 | function must look through the relocs and do any special handling | |
358 | required. This generally means allocating space in the global | |
359 | offset table, and perhaps allocating space for a reloc. The | |
360 | relocs are always passed as Rela structures; if the section | |
361 | actually uses Rel structures, the r_addend field will always be | |
362 | zero. */ | |
363 | boolean (*check_relocs) | |
364 | PARAMS ((bfd *abfd, struct bfd_link_info *info, asection *o, | |
365 | const Elf_Internal_Rela *relocs)); | |
366 | ||
367 | /* The ADJUST_DYNAMIC_SYMBOL function is called by the ELF backend | |
368 | linker for every symbol which is defined by a dynamic object and | |
369 | referenced by a regular object. This is called after all the | |
370 | input files have been seen, but before the SIZE_DYNAMIC_SECTIONS | |
371 | function has been called. The hash table entry should be | |
372 | bfd_link_hash_defined ore bfd_link_hash_defweak, and it should be | |
373 | defined in a section from a dynamic object. Dynamic object | |
374 | sections are not included in the final link, and this function is | |
375 | responsible for changing the value to something which the rest of | |
376 | the link can deal with. This will normally involve adding an | |
377 | entry to the .plt or .got or some such section, and setting the | |
378 | symbol to point to that. */ | |
379 | boolean (*elf_backend_adjust_dynamic_symbol) | |
380 | PARAMS ((struct bfd_link_info *info, struct elf_link_hash_entry *h)); | |
381 | ||
ff12f303 ILT |
382 | /* The ALWAYS_SIZE_SECTIONS function is called by the backend linker |
383 | after all the linker input files have been seen but before the | |
384 | section sizes have been set. This is called after | |
385 | ADJUST_DYNAMIC_SYMBOL, but before SIZE_DYNAMIC_SECTIONS. */ | |
386 | boolean (*elf_backend_always_size_sections) | |
387 | PARAMS ((bfd *output_bfd, struct bfd_link_info *info)); | |
388 | ||
fd0198f0 ILT |
389 | /* The SIZE_DYNAMIC_SECTIONS function is called by the ELF backend |
390 | linker after all the linker input files have been seen but before | |
391 | the sections sizes have been set. This is called after | |
392 | ADJUST_DYNAMIC_SYMBOL has been called on all appropriate symbols. | |
393 | It is only called when linking against a dynamic object. It must | |
394 | set the sizes of the dynamic sections, and may fill in their | |
395 | contents as well. The generic ELF linker can handle the .dynsym, | |
396 | .dynstr and .hash sections. This function must handle the | |
397 | .interp section and any sections created by the | |
398 | CREATE_DYNAMIC_SECTIONS entry point. */ | |
399 | boolean (*elf_backend_size_dynamic_sections) | |
400 | PARAMS ((bfd *output_bfd, struct bfd_link_info *info)); | |
401 | ||
402 | /* The RELOCATE_SECTION function is called by the ELF backend linker | |
403 | to handle the relocations for a section. | |
404 | ||
405 | The relocs are always passed as Rela structures; if the section | |
406 | actually uses Rel structures, the r_addend field will always be | |
407 | zero. | |
408 | ||
409 | This function is responsible for adjust the section contents as | |
410 | necessary, and (if using Rela relocs and generating a | |
411 | relocateable output file) adjusting the reloc addend as | |
412 | necessary. | |
413 | ||
414 | This function does not have to worry about setting the reloc | |
415 | address or the reloc symbol index. | |
416 | ||
417 | LOCAL_SYMS is a pointer to the swapped in local symbols. | |
418 | ||
419 | LOCAL_SECTIONS is an array giving the section in the input file | |
420 | corresponding to the st_shndx field of each local symbol. | |
421 | ||
422 | The global hash table entry for the global symbols can be found | |
423 | via elf_sym_hashes (input_bfd). | |
424 | ||
425 | When generating relocateable output, this function must handle | |
426 | STB_LOCAL/STT_SECTION symbols specially. The output symbol is | |
427 | going to be the section symbol corresponding to the output | |
428 | section, which means that the addend must be adjusted | |
429 | accordingly. */ | |
430 | boolean (*elf_backend_relocate_section) | |
431 | PARAMS ((bfd *output_bfd, struct bfd_link_info *info, | |
432 | bfd *input_bfd, asection *input_section, bfd_byte *contents, | |
433 | Elf_Internal_Rela *relocs, Elf_Internal_Sym *local_syms, | |
434 | asection **local_sections)); | |
435 | ||
436 | /* The FINISH_DYNAMIC_SYMBOL function is called by the ELF backend | |
437 | linker just before it writes a symbol out to the .dynsym section. | |
438 | The processor backend may make any required adjustment to the | |
439 | symbol. It may also take the opportunity to set contents of the | |
440 | dynamic sections. Note that FINISH_DYNAMIC_SYMBOL is called on | |
441 | all .dynsym symbols, while ADJUST_DYNAMIC_SYMBOL is only called | |
442 | on those symbols which are defined by a dynamic object. */ | |
443 | boolean (*elf_backend_finish_dynamic_symbol) | |
444 | PARAMS ((bfd *output_bfd, struct bfd_link_info *info, | |
445 | struct elf_link_hash_entry *h, Elf_Internal_Sym *sym)); | |
446 | ||
447 | /* The FINISH_DYNAMIC_SECTIONS function is called by the ELF backend | |
448 | linker just before it writes all the dynamic sections out to the | |
449 | output file. The FINISH_DYNAMIC_SYMBOL will have been called on | |
450 | all dynamic symbols. */ | |
451 | boolean (*elf_backend_finish_dynamic_sections) | |
452 | PARAMS ((bfd *output_bfd, struct bfd_link_info *info)); | |
453 | ||
454 | /* A function to do any beginning processing needed for the ELF file | |
455 | before building the ELF headers and computing file positions. */ | |
456 | void (*elf_backend_begin_write_processing) | |
457 | PARAMS ((bfd *, struct bfd_link_info *)); | |
458 | ||
459 | /* A function to do any final processing needed for the ELF file | |
460 | before writing it out. The LINKER argument is true if this BFD | |
461 | was created by the ELF backend linker. */ | |
462 | void (*elf_backend_final_write_processing) | |
463 | PARAMS ((bfd *, boolean linker)); | |
464 | ||
5b3b9ff6 ILT |
465 | /* This function is called by get_program_header_size. It should |
466 | return the number of additional program segments which this BFD | |
467 | will need. It should return -1 on error. */ | |
468 | int (*elf_backend_additional_program_headers) PARAMS ((bfd *)); | |
469 | ||
470 | /* This function is called to modify an existing segment map in a | |
471 | backend specific fashion. */ | |
472 | boolean (*elf_backend_modify_segment_map) PARAMS ((bfd *)); | |
fd0198f0 ILT |
473 | |
474 | /* The swapping table to use when dealing with ECOFF information. | |
475 | Used for the MIPS ELF .mdebug section. */ | |
476 | const struct ecoff_debug_swap *elf_backend_ecoff_debug_swap; | |
477 | ||
478 | /* Alternate EM_xxxx machine codes for this backend. */ | |
479 | int elf_machine_alt1; | |
480 | int elf_machine_alt2; | |
481 | ||
482 | const struct elf_size_info *s; | |
483 | ||
484 | unsigned want_got_plt : 1; | |
485 | unsigned plt_readonly : 1; | |
486 | unsigned want_plt_sym : 1; | |
fd0198f0 ILT |
487 | }; |
488 | ||
489 | /* Information stored for each BFD section in an ELF file. This | |
490 | structure is allocated by elf_new_section_hook. */ | |
491 | ||
761f377f ILT |
492 | struct bfd_elf_section_data |
493 | { | |
fd0198f0 ILT |
494 | /* The ELF header for this section. */ |
495 | Elf_Internal_Shdr this_hdr; | |
496 | /* The ELF header for the reloc section associated with this | |
497 | section, if any. */ | |
498 | Elf_Internal_Shdr rel_hdr; | |
d1bf45aa ILT |
499 | /* If there is a second reloc section associated with this section, |
500 | as can happen on Irix 6, this field points to the header. */ | |
501 | Elf_Internal_Shdr *rel_hdr2; | |
fd0198f0 ILT |
502 | /* The ELF section number of this section. Only used for an output |
503 | file. */ | |
504 | int this_idx; | |
505 | /* The ELF section number of the reloc section associated with this | |
506 | section, if any. Only used for an output file. */ | |
507 | int rel_idx; | |
508 | /* Used by the backend linker to store the symbol hash table entries | |
509 | associated with relocs against global symbols. */ | |
510 | struct elf_link_hash_entry **rel_hashes; | |
511 | /* A pointer to the swapped relocs. If the section uses REL relocs, | |
512 | rather than RELA, all the r_addend fields will be zero. This | |
513 | pointer may be NULL. It is used by the backend linker. */ | |
514 | Elf_Internal_Rela *relocs; | |
515 | /* Used by the backend linker when generating a shared library to | |
516 | record the dynamic symbol index for a section symbol | |
517 | corresponding to this section. */ | |
518 | long dynindx; | |
d1bf45aa ILT |
519 | /* A pointer used for .stab linking optimizations. */ |
520 | PTR stab_info; | |
761f377f ILT |
521 | /* A pointer available for the processor specific ELF backend. */ |
522 | PTR tdata; | |
fd0198f0 ILT |
523 | }; |
524 | ||
525 | #define elf_section_data(sec) ((struct bfd_elf_section_data*)sec->used_by_bfd) | |
526 | ||
527 | #define get_elf_backend_data(abfd) \ | |
528 | ((struct elf_backend_data *) (abfd)->xvec->backend_data) | |
529 | ||
86aac8ea ILT |
530 | /* Enumeration to specify the special section. */ |
531 | typedef enum elf_linker_section_enum | |
532 | { | |
533 | LINKER_SECTION_UNKNOWN, /* not used */ | |
534 | LINKER_SECTION_GOT, /* .got section for global offset pointers */ | |
535 | LINKER_SECTION_PLT, /* .plt section for generated procedure stubs */ | |
536 | LINKER_SECTION_SDATA, /* .sdata/.sbss section for PowerPC */ | |
537 | LINKER_SECTION_SDATA2, /* .sdata2/.sbss2 section for PowerPC */ | |
538 | LINKER_SECTION_MAX /* # of linker sections */ | |
539 | } elf_linker_section_enum_t; | |
540 | ||
541 | /* Sections created by the linker. */ | |
542 | ||
543 | typedef struct elf_linker_section | |
544 | { | |
545 | char *name; /* name of the section */ | |
546 | char *rel_name; /* name of the associated .rel{,a}. section */ | |
547 | char *bss_name; /* name of a related .bss section */ | |
548 | char *sym_name; /* name of symbol to reference this section */ | |
549 | asection *section; /* pointer to the section */ | |
550 | asection *bss_section; /* pointer to the bss section associated with this */ | |
551 | asection *rel_section; /* pointer to the relocations needed for this section */ | |
552 | struct elf_link_hash_entry *sym_hash; /* pointer to the created symbol hash value */ | |
553 | bfd_vma initial_size; /* initial size before any linker generated allocations */ | |
554 | bfd_vma sym_offset; /* offset of symbol from beginning of section */ | |
555 | bfd_vma hole_size; /* size of reserved address hole in allocation */ | |
556 | bfd_vma hole_offset; /* current offset for the hole */ | |
557 | bfd_vma max_hole_offset; /* maximum offset for the hole */ | |
558 | elf_linker_section_enum_t which; /* which section this is */ | |
559 | boolean hole_written_p; /* whether the hole has been initialized */ | |
560 | int alignment; /* alignment for the section */ | |
561 | flagword flags; /* flags to use to create the section */ | |
562 | } elf_linker_section_t; | |
563 | ||
564 | /* Linked list of allocated pointer entries. This hangs off of the symbol lists, and | |
565 | provides allows us to return different pointers, based on different addend's. */ | |
566 | ||
567 | typedef struct elf_linker_section_pointers | |
568 | { | |
569 | struct elf_linker_section_pointers *next; /* next allocated pointer for this symbol */ | |
570 | bfd_vma offset; /* offset of pointer from beginning of section */ | |
571 | bfd_signed_vma addend; /* addend used */ | |
572 | elf_linker_section_enum_t which; /* which linker section this is */ | |
573 | boolean written_address_p; /* whether address was written yet */ | |
574 | } elf_linker_section_pointers_t; | |
575 | ||
fd0198f0 ILT |
576 | /* Some private data is stashed away for future use using the tdata pointer |
577 | in the bfd structure. */ | |
578 | ||
579 | struct elf_obj_tdata | |
580 | { | |
581 | Elf_Internal_Ehdr elf_header[1]; /* Actual data, but ref like ptr */ | |
582 | Elf_Internal_Shdr **elf_sect_ptr; | |
583 | Elf_Internal_Phdr *phdr; | |
584 | struct elf_segment_map *segment_map; | |
585 | struct bfd_strtab_hash *strtab_ptr; | |
586 | int num_locals; | |
587 | int num_globals; | |
86aac8ea | 588 | asymbol **section_syms; /* STT_SECTION symbols for each section */ |
fd0198f0 ILT |
589 | Elf_Internal_Shdr symtab_hdr; |
590 | Elf_Internal_Shdr shstrtab_hdr; | |
591 | Elf_Internal_Shdr strtab_hdr; | |
592 | Elf_Internal_Shdr dynsymtab_hdr; | |
593 | Elf_Internal_Shdr dynstrtab_hdr; | |
d6bfcdb5 ILT |
594 | Elf_Internal_Shdr dynversym_hdr; |
595 | Elf_Internal_Shdr dynverref_hdr; | |
596 | Elf_Internal_Shdr dynverdef_hdr; | |
fd0198f0 ILT |
597 | unsigned int symtab_section, shstrtab_section; |
598 | unsigned int strtab_section, dynsymtab_section; | |
d6bfcdb5 | 599 | unsigned int dynversym_section, dynverdef_section, dynverref_section; |
fd0198f0 | 600 | file_ptr next_file_pos; |
86aac8ea ILT |
601 | void *prstatus; /* The raw /proc prstatus structure */ |
602 | void *prpsinfo; /* The raw /proc prpsinfo structure */ | |
603 | bfd_vma gp; /* The gp value (MIPS only, for now) */ | |
604 | unsigned int gp_size; /* The gp size (MIPS only, for now) */ | |
fd0198f0 ILT |
605 | |
606 | /* This is set to true if the object was created by the backend | |
607 | linker. */ | |
608 | boolean linker; | |
609 | ||
610 | /* A mapping from external symbols to entries in the linker hash | |
611 | table, used when linking. This is indexed by the symbol index | |
612 | minus the sh_info field of the symbol table header. */ | |
613 | struct elf_link_hash_entry **sym_hashes; | |
614 | ||
615 | /* A mapping from local symbols to offsets into the global offset | |
616 | table, used when linking. This is indexed by the symbol index. */ | |
617 | bfd_vma *local_got_offsets; | |
618 | ||
86aac8ea ILT |
619 | /* A mapping from local symbols to offsets into the various linker |
620 | sections added. This is index by the symbol index. */ | |
621 | elf_linker_section_pointers_t **linker_section_pointers; | |
622 | ||
fd0198f0 ILT |
623 | /* The linker ELF emulation code needs to let the backend ELF linker |
624 | know what filename should be used for a dynamic object if the | |
19bfbcbe ILT |
625 | dynamic object is found using a search. The emulation code then |
626 | sometimes needs to know what name was actually used. Until the | |
627 | file has been added to the linker symbol table, this field holds | |
628 | the name the linker wants. After it has been added, it holds the | |
629 | name actually used, which will be the DT_SONAME entry if there is | |
630 | one. */ | |
631 | const char *dt_name; | |
fd0198f0 ILT |
632 | |
633 | /* Irix 5 often screws up the symbol table, sorting local symbols | |
634 | after global symbols. This flag is set if the symbol table in | |
635 | this BFD appears to be screwed up. If it is, we ignore the | |
636 | sh_info field in the symbol table header, and always read all the | |
637 | symbols. */ | |
638 | boolean bad_symtab; | |
639 | ||
640 | /* Records the result of `get_program_header_size'. */ | |
641 | bfd_size_type program_header_size; | |
642 | ||
86aac8ea ILT |
643 | /* Used by find_nearest_line entry point. */ |
644 | PTR line_info; | |
645 | ||
fd0198f0 ILT |
646 | /* Used by MIPS ELF find_nearest_line entry point. The structure |
647 | could be included directly in this one, but there's no point to | |
648 | wasting the memory just for the infrequently called | |
649 | find_nearest_line. */ | |
650 | struct mips_elf_find_line *find_line_info; | |
651 | ||
d6bfcdb5 ILT |
652 | /* An array of stub sections indexed by symbol number, used by the |
653 | MIPS ELF linker. FIXME: We should figure out some way to only | |
654 | include this field for a MIPS ELF target. */ | |
655 | asection **local_stubs; | |
656 | ||
761f377f ILT |
657 | /* Used to determine if the e_flags field has been initialized */ |
658 | boolean flags_init; | |
86aac8ea | 659 | |
d6bfcdb5 ILT |
660 | /* Number of symbol version definitions we are about to emit. */ |
661 | int cverdefs; | |
662 | ||
663 | /* Number of symbol version references we are about to emit. */ | |
664 | int cverrefs; | |
665 | ||
666 | /* Symbol version definitions in external objects. */ | |
667 | Elf_Internal_Verdef *verdef; | |
668 | ||
669 | /* Symbol version references to external objects. */ | |
670 | Elf_Internal_Verneed *verref; | |
671 | ||
86aac8ea ILT |
672 | /* Linker sections that we are interested in. */ |
673 | struct elf_linker_section *linker_section[ (int)LINKER_SECTION_MAX ]; | |
fd0198f0 ILT |
674 | }; |
675 | ||
676 | #define elf_tdata(bfd) ((bfd) -> tdata.elf_obj_data) | |
677 | #define elf_elfheader(bfd) (elf_tdata(bfd) -> elf_header) | |
678 | #define elf_elfsections(bfd) (elf_tdata(bfd) -> elf_sect_ptr) | |
679 | #define elf_shstrtab(bfd) (elf_tdata(bfd) -> strtab_ptr) | |
680 | #define elf_onesymtab(bfd) (elf_tdata(bfd) -> symtab_section) | |
681 | #define elf_dynsymtab(bfd) (elf_tdata(bfd) -> dynsymtab_section) | |
d6bfcdb5 ILT |
682 | #define elf_dynversym(bfd) (elf_tdata(bfd) -> dynversym_section) |
683 | #define elf_dynverdef(bfd) (elf_tdata(bfd) -> dynverdef_section) | |
684 | #define elf_dynverref(bfd) (elf_tdata(bfd) -> dynverref_section) | |
fd0198f0 ILT |
685 | #define elf_num_locals(bfd) (elf_tdata(bfd) -> num_locals) |
686 | #define elf_num_globals(bfd) (elf_tdata(bfd) -> num_globals) | |
687 | #define elf_section_syms(bfd) (elf_tdata(bfd) -> section_syms) | |
688 | #define core_prpsinfo(bfd) (elf_tdata(bfd) -> prpsinfo) | |
689 | #define core_prstatus(bfd) (elf_tdata(bfd) -> prstatus) | |
690 | #define elf_gp(bfd) (elf_tdata(bfd) -> gp) | |
691 | #define elf_gp_size(bfd) (elf_tdata(bfd) -> gp_size) | |
692 | #define elf_sym_hashes(bfd) (elf_tdata(bfd) -> sym_hashes) | |
693 | #define elf_local_got_offsets(bfd) (elf_tdata(bfd) -> local_got_offsets) | |
86aac8ea | 694 | #define elf_local_ptr_offsets(bfd) (elf_tdata(bfd) -> linker_section_pointers) |
19bfbcbe | 695 | #define elf_dt_name(bfd) (elf_tdata(bfd) -> dt_name) |
fd0198f0 | 696 | #define elf_bad_symtab(bfd) (elf_tdata(bfd) -> bad_symtab) |
761f377f | 697 | #define elf_flags_init(bfd) (elf_tdata(bfd) -> flags_init) |
86aac8ea | 698 | #define elf_linker_section(bfd,n) (elf_tdata(bfd) -> linker_section[(int)n]) |
fd0198f0 | 699 | \f |
d6bfcdb5 ILT |
700 | extern void _bfd_elf_swap_verdef_in |
701 | PARAMS ((bfd *, const Elf_External_Verdef *, Elf_Internal_Verdef *)); | |
702 | extern void _bfd_elf_swap_verdef_out | |
703 | PARAMS ((bfd *, const Elf_Internal_Verdef *, Elf_External_Verdef *)); | |
704 | extern void _bfd_elf_swap_verdaux_in | |
705 | PARAMS ((bfd *, const Elf_External_Verdaux *, Elf_Internal_Verdaux *)); | |
706 | extern void _bfd_elf_swap_verdaux_out | |
707 | PARAMS ((bfd *, const Elf_Internal_Verdaux *, Elf_External_Verdaux *)); | |
708 | extern void _bfd_elf_swap_verneed_in | |
709 | PARAMS ((bfd *, const Elf_External_Verneed *, Elf_Internal_Verneed *)); | |
710 | extern void _bfd_elf_swap_verneed_out | |
711 | PARAMS ((bfd *, const Elf_Internal_Verneed *, Elf_External_Verneed *)); | |
712 | extern void _bfd_elf_swap_vernaux_in | |
713 | PARAMS ((bfd *, const Elf_External_Vernaux *, Elf_Internal_Vernaux *)); | |
714 | extern void _bfd_elf_swap_vernaux_out | |
715 | PARAMS ((bfd *, const Elf_Internal_Vernaux *, Elf_External_Vernaux *)); | |
716 | extern void _bfd_elf_swap_versym_in | |
717 | PARAMS ((bfd *, const Elf_External_Versym *, Elf_Internal_Versym *)); | |
718 | extern void _bfd_elf_swap_versym_out | |
719 | PARAMS ((bfd *, const Elf_Internal_Versym *, Elf_External_Versym *)); | |
720 | ||
98bb57ad ILT |
721 | extern int _bfd_elf_section_from_bfd_section PARAMS ((bfd *, asection *)); |
722 | extern char *bfd_elf_string_from_elf_section | |
723 | PARAMS ((bfd *, unsigned, unsigned)); | |
724 | extern char *bfd_elf_get_str_section PARAMS ((bfd *, unsigned)); | |
fd0198f0 | 725 | |
761f377f | 726 | extern boolean _bfd_elf_print_private_bfd_data PARAMS ((bfd *, PTR)); |
fd0198f0 ILT |
727 | extern void bfd_elf_print_symbol PARAMS ((bfd *, PTR, asymbol *, |
728 | bfd_print_symbol_type)); | |
729 | #define elf_string_from_elf_strtab(abfd,strindex) \ | |
730 | bfd_elf_string_from_elf_section(abfd,elf_elfheader(abfd)->e_shstrndx,strindex) | |
731 | ||
732 | #define bfd_elf32_print_symbol bfd_elf_print_symbol | |
733 | #define bfd_elf64_print_symbol bfd_elf_print_symbol | |
fd0198f0 ILT |
734 | |
735 | extern unsigned long bfd_elf_hash PARAMS ((CONST unsigned char *)); | |
736 | ||
737 | extern bfd_reloc_status_type bfd_elf_generic_reloc PARAMS ((bfd *, | |
738 | arelent *, | |
739 | asymbol *, | |
740 | PTR, | |
741 | asection *, | |
742 | bfd *, | |
743 | char **)); | |
744 | extern boolean bfd_elf_mkobject PARAMS ((bfd *)); | |
745 | extern Elf_Internal_Shdr *bfd_elf_find_section PARAMS ((bfd *, char *)); | |
746 | extern boolean _bfd_elf_make_section_from_shdr | |
747 | PARAMS ((bfd *abfd, Elf_Internal_Shdr *hdr, const char *name)); | |
748 | extern struct bfd_hash_entry *_bfd_elf_link_hash_newfunc | |
749 | PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); | |
750 | extern struct bfd_link_hash_table *_bfd_elf_link_hash_table_create | |
751 | PARAMS ((bfd *)); | |
752 | extern boolean _bfd_elf_link_hash_table_init | |
753 | PARAMS ((struct elf_link_hash_table *, bfd *, | |
754 | struct bfd_hash_entry *(*) (struct bfd_hash_entry *, | |
755 | struct bfd_hash_table *, | |
756 | const char *))); | |
d6bfcdb5 | 757 | extern boolean _bfd_elf_slurp_version_tables PARAMS ((bfd *)); |
fd0198f0 ILT |
758 | |
759 | extern boolean _bfd_elf_copy_private_symbol_data | |
760 | PARAMS ((bfd *, asymbol *, bfd *, asymbol *)); | |
761 | extern boolean _bfd_elf_copy_private_section_data | |
762 | PARAMS ((bfd *, asection *, bfd *, asection *)); | |
763 | extern boolean _bfd_elf_write_object_contents PARAMS ((bfd *)); | |
764 | extern boolean _bfd_elf_set_section_contents PARAMS ((bfd *, sec_ptr, PTR, | |
765 | file_ptr, | |
766 | bfd_size_type)); | |
767 | extern long _bfd_elf_get_symtab_upper_bound PARAMS ((bfd *)); | |
768 | extern long _bfd_elf_get_symtab PARAMS ((bfd *, asymbol **)); | |
769 | extern long _bfd_elf_get_dynamic_symtab_upper_bound PARAMS ((bfd *)); | |
770 | extern long _bfd_elf_canonicalize_dynamic_symtab PARAMS ((bfd *, asymbol **)); | |
771 | extern long _bfd_elf_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr)); | |
772 | extern long _bfd_elf_canonicalize_reloc PARAMS ((bfd *, sec_ptr, | |
773 | arelent **, asymbol **)); | |
e35765a9 ILT |
774 | extern long _bfd_elf_get_dynamic_reloc_upper_bound PARAMS ((bfd *)); |
775 | extern long _bfd_elf_canonicalize_dynamic_reloc PARAMS ((bfd *, arelent **, | |
776 | asymbol **)); | |
fd0198f0 ILT |
777 | extern asymbol *_bfd_elf_make_empty_symbol PARAMS ((bfd *)); |
778 | extern void _bfd_elf_get_symbol_info PARAMS ((bfd *, asymbol *, | |
779 | symbol_info *)); | |
d6bfcdb5 | 780 | extern boolean _bfd_elf_is_local_label_name PARAMS ((bfd *, const char *)); |
fd0198f0 ILT |
781 | extern alent *_bfd_elf_get_lineno PARAMS ((bfd *, asymbol *)); |
782 | extern boolean _bfd_elf_set_arch_mach PARAMS ((bfd *, enum bfd_architecture, | |
783 | unsigned long)); | |
784 | extern boolean _bfd_elf_find_nearest_line PARAMS ((bfd *, asection *, | |
785 | asymbol **, | |
786 | bfd_vma, CONST char **, | |
787 | CONST char **, | |
788 | unsigned int *)); | |
789 | #define _bfd_elf_read_minisymbols _bfd_generic_read_minisymbols | |
790 | #define _bfd_elf_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol | |
791 | extern int _bfd_elf_sizeof_headers PARAMS ((bfd *, boolean)); | |
792 | extern boolean _bfd_elf_new_section_hook PARAMS ((bfd *, asection *)); | |
793 | ||
794 | /* If the target doesn't have reloc handling written yet: */ | |
795 | extern void _bfd_elf_no_info_to_howto PARAMS ((bfd *, arelent *, | |
796 | Elf_Internal_Rela *)); | |
797 | ||
00176555 | 798 | extern boolean bfd_section_from_shdr PARAMS ((bfd *, unsigned int shindex)); |
e35765a9 | 799 | extern boolean bfd_section_from_phdr PARAMS ((bfd *, Elf_Internal_Phdr *, int)); |
00176555 ILT |
800 | |
801 | extern int _bfd_elf_symbol_from_bfd_symbol PARAMS ((bfd *, asymbol **)); | |
802 | ||
fd0198f0 ILT |
803 | asection *bfd_section_from_elf_index PARAMS ((bfd *, unsigned int)); |
804 | boolean _bfd_elf_create_dynamic_sections PARAMS ((bfd *, | |
805 | struct bfd_link_info *)); | |
806 | struct bfd_strtab_hash *_bfd_elf_stringtab_init PARAMS ((void)); | |
807 | boolean | |
808 | _bfd_elf_link_record_dynamic_symbol PARAMS ((struct bfd_link_info *, | |
809 | struct elf_link_hash_entry *)); | |
810 | boolean | |
811 | _bfd_elf_compute_section_file_positions PARAMS ((bfd *, | |
812 | struct bfd_link_info *)); | |
813 | void _bfd_elf_assign_file_positions_for_relocs PARAMS ((bfd *)); | |
814 | file_ptr _bfd_elf_assign_file_position_for_section PARAMS ((Elf_Internal_Shdr *, | |
815 | file_ptr, | |
816 | boolean)); | |
817 | ||
00176555 ILT |
818 | extern boolean _bfd_elf_validate_reloc PARAMS ((bfd *, arelent *)); |
819 | ||
fd0198f0 ILT |
820 | boolean _bfd_elf_create_dynamic_sections PARAMS ((bfd *, |
821 | struct bfd_link_info *)); | |
822 | boolean _bfd_elf_create_got_section PARAMS ((bfd *, | |
823 | struct bfd_link_info *)); | |
824 | ||
86aac8ea ILT |
825 | elf_linker_section_t *_bfd_elf_create_linker_section |
826 | PARAMS ((bfd *abfd, | |
827 | struct bfd_link_info *info, | |
828 | enum elf_linker_section_enum, | |
829 | elf_linker_section_t *defaults)); | |
830 | ||
831 | elf_linker_section_pointers_t *_bfd_elf_find_pointer_linker_section | |
832 | PARAMS ((elf_linker_section_pointers_t *linker_pointers, | |
833 | bfd_signed_vma addend, | |
834 | elf_linker_section_enum_t which)); | |
835 | ||
836 | boolean bfd_elf32_create_pointer_linker_section | |
837 | PARAMS ((bfd *abfd, | |
838 | struct bfd_link_info *info, | |
839 | elf_linker_section_t *lsect, | |
840 | struct elf_link_hash_entry *h, | |
841 | const Elf32_Internal_Rela *rel)); | |
842 | ||
843 | bfd_vma bfd_elf32_finish_pointer_linker_section | |
844 | PARAMS ((bfd *output_abfd, | |
845 | bfd *input_bfd, | |
846 | struct bfd_link_info *info, | |
847 | elf_linker_section_t *lsect, | |
848 | struct elf_link_hash_entry *h, | |
849 | bfd_vma relocation, | |
850 | const Elf32_Internal_Rela *rel, | |
851 | int relative_reloc)); | |
852 | ||
853 | boolean bfd_elf64_create_pointer_linker_section | |
854 | PARAMS ((bfd *abfd, | |
855 | struct bfd_link_info *info, | |
856 | elf_linker_section_t *lsect, | |
857 | struct elf_link_hash_entry *h, | |
858 | const Elf64_Internal_Rela *rel)); | |
859 | ||
860 | bfd_vma bfd_elf64_finish_pointer_linker_section | |
861 | PARAMS ((bfd *output_abfd, | |
862 | bfd *input_bfd, | |
863 | struct bfd_link_info *info, | |
864 | elf_linker_section_t *lsect, | |
865 | struct elf_link_hash_entry *h, | |
866 | bfd_vma relocation, | |
867 | const Elf64_Internal_Rela *rel, | |
868 | int relative_reloc)); | |
869 | ||
870 | boolean _bfd_elf_make_linker_section_rela | |
871 | PARAMS ((bfd *dynobj, | |
872 | elf_linker_section_t *lsect, | |
873 | int alignment)); | |
874 | ||
fd0198f0 ILT |
875 | extern const bfd_target *bfd_elf32_object_p PARAMS ((bfd *)); |
876 | extern const bfd_target *bfd_elf32_core_file_p PARAMS ((bfd *)); | |
877 | extern char *bfd_elf32_core_file_failing_command PARAMS ((bfd *)); | |
878 | extern int bfd_elf32_core_file_failing_signal PARAMS ((bfd *)); | |
879 | extern boolean bfd_elf32_core_file_matches_executable_p PARAMS ((bfd *, | |
880 | bfd *)); | |
881 | ||
882 | extern boolean bfd_elf32_bfd_link_add_symbols | |
883 | PARAMS ((bfd *, struct bfd_link_info *)); | |
884 | extern boolean bfd_elf32_bfd_final_link | |
885 | PARAMS ((bfd *, struct bfd_link_info *)); | |
886 | ||
887 | extern void bfd_elf32_swap_symbol_in | |
d1bf45aa | 888 | PARAMS ((bfd *, const Elf32_External_Sym *, Elf_Internal_Sym *)); |
fd0198f0 | 889 | extern void bfd_elf32_swap_symbol_out |
d1bf45aa | 890 | PARAMS ((bfd *, const Elf_Internal_Sym *, PTR)); |
fd0198f0 | 891 | extern void bfd_elf32_swap_reloc_in |
d1bf45aa | 892 | PARAMS ((bfd *, const Elf32_External_Rel *, Elf_Internal_Rel *)); |
fd0198f0 | 893 | extern void bfd_elf32_swap_reloc_out |
d1bf45aa | 894 | PARAMS ((bfd *, const Elf_Internal_Rel *, Elf32_External_Rel *)); |
fd0198f0 | 895 | extern void bfd_elf32_swap_reloca_in |
d1bf45aa | 896 | PARAMS ((bfd *, const Elf32_External_Rela *, Elf_Internal_Rela *)); |
fd0198f0 | 897 | extern void bfd_elf32_swap_reloca_out |
d1bf45aa | 898 | PARAMS ((bfd *, const Elf_Internal_Rela *, Elf32_External_Rela *)); |
fd0198f0 | 899 | extern void bfd_elf32_swap_phdr_in |
d1bf45aa | 900 | PARAMS ((bfd *, const Elf32_External_Phdr *, Elf_Internal_Phdr *)); |
fd0198f0 | 901 | extern void bfd_elf32_swap_phdr_out |
d1bf45aa | 902 | PARAMS ((bfd *, const Elf_Internal_Phdr *, Elf32_External_Phdr *)); |
fd0198f0 | 903 | extern void bfd_elf32_swap_dyn_in |
02fcd126 | 904 | PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *)); |
fd0198f0 ILT |
905 | extern void bfd_elf32_swap_dyn_out |
906 | PARAMS ((bfd *, const Elf_Internal_Dyn *, Elf32_External_Dyn *)); | |
d1bf45aa ILT |
907 | extern long bfd_elf32_slurp_symbol_table |
908 | PARAMS ((bfd *, asymbol **, boolean)); | |
909 | extern boolean bfd_elf32_write_shdrs_and_ehdr PARAMS ((bfd *)); | |
910 | extern int bfd_elf32_write_out_phdrs | |
911 | PARAMS ((bfd *, const Elf_Internal_Phdr *, int)); | |
fd0198f0 ILT |
912 | extern boolean bfd_elf32_add_dynamic_entry |
913 | PARAMS ((struct bfd_link_info *, bfd_vma, bfd_vma)); | |
914 | extern boolean bfd_elf32_link_create_dynamic_sections | |
915 | PARAMS ((bfd *, struct bfd_link_info *)); | |
e35765a9 ILT |
916 | extern Elf_Internal_Rela *_bfd_elf32_link_read_relocs |
917 | PARAMS ((bfd *, asection *, PTR, Elf_Internal_Rela *, boolean)); | |
fd0198f0 ILT |
918 | |
919 | extern const bfd_target *bfd_elf64_object_p PARAMS ((bfd *)); | |
920 | extern const bfd_target *bfd_elf64_core_file_p PARAMS ((bfd *)); | |
921 | extern char *bfd_elf64_core_file_failing_command PARAMS ((bfd *)); | |
922 | extern int bfd_elf64_core_file_failing_signal PARAMS ((bfd *)); | |
923 | extern boolean bfd_elf64_core_file_matches_executable_p PARAMS ((bfd *, | |
924 | bfd *)); | |
925 | extern boolean bfd_elf64_bfd_link_add_symbols | |
926 | PARAMS ((bfd *, struct bfd_link_info *)); | |
927 | extern boolean bfd_elf64_bfd_final_link | |
928 | PARAMS ((bfd *, struct bfd_link_info *)); | |
929 | ||
930 | extern void bfd_elf64_swap_symbol_in | |
d1bf45aa | 931 | PARAMS ((bfd *, const Elf64_External_Sym *, Elf_Internal_Sym *)); |
fd0198f0 | 932 | extern void bfd_elf64_swap_symbol_out |
d1bf45aa | 933 | PARAMS ((bfd *, const Elf_Internal_Sym *, PTR)); |
fd0198f0 | 934 | extern void bfd_elf64_swap_reloc_in |
d1bf45aa | 935 | PARAMS ((bfd *, const Elf64_External_Rel *, Elf_Internal_Rel *)); |
fd0198f0 | 936 | extern void bfd_elf64_swap_reloc_out |
d1bf45aa | 937 | PARAMS ((bfd *, const Elf_Internal_Rel *, Elf64_External_Rel *)); |
fd0198f0 | 938 | extern void bfd_elf64_swap_reloca_in |
d1bf45aa | 939 | PARAMS ((bfd *, const Elf64_External_Rela *, Elf_Internal_Rela *)); |
fd0198f0 | 940 | extern void bfd_elf64_swap_reloca_out |
d1bf45aa | 941 | PARAMS ((bfd *, const Elf_Internal_Rela *, Elf64_External_Rela *)); |
fd0198f0 | 942 | extern void bfd_elf64_swap_phdr_in |
d1bf45aa | 943 | PARAMS ((bfd *, const Elf64_External_Phdr *, Elf_Internal_Phdr *)); |
fd0198f0 | 944 | extern void bfd_elf64_swap_phdr_out |
d1bf45aa | 945 | PARAMS ((bfd *, const Elf_Internal_Phdr *, Elf64_External_Phdr *)); |
fd0198f0 | 946 | extern void bfd_elf64_swap_dyn_in |
02fcd126 | 947 | PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *)); |
fd0198f0 ILT |
948 | extern void bfd_elf64_swap_dyn_out |
949 | PARAMS ((bfd *, const Elf_Internal_Dyn *, Elf64_External_Dyn *)); | |
d1bf45aa ILT |
950 | extern long bfd_elf64_slurp_symbol_table |
951 | PARAMS ((bfd *, asymbol **, boolean)); | |
952 | extern boolean bfd_elf64_write_shdrs_and_ehdr PARAMS ((bfd *)); | |
953 | extern int bfd_elf64_write_out_phdrs | |
954 | PARAMS ((bfd *, const Elf_Internal_Phdr *, int)); | |
fd0198f0 ILT |
955 | extern boolean bfd_elf64_add_dynamic_entry |
956 | PARAMS ((struct bfd_link_info *, bfd_vma, bfd_vma)); | |
957 | extern boolean bfd_elf64_link_create_dynamic_sections | |
958 | PARAMS ((bfd *, struct bfd_link_info *)); | |
e35765a9 ILT |
959 | extern Elf_Internal_Rela *_bfd_elf64_link_read_relocs |
960 | PARAMS ((bfd *, asection *, PTR, Elf_Internal_Rela *, boolean)); | |
fd0198f0 ILT |
961 | |
962 | #define bfd_elf32_link_record_dynamic_symbol _bfd_elf_link_record_dynamic_symbol | |
963 | #define bfd_elf64_link_record_dynamic_symbol _bfd_elf_link_record_dynamic_symbol | |
964 | ||
d1bf45aa ILT |
965 | /* MIPS ELF specific routines. */ |
966 | ||
00176555 | 967 | extern boolean _bfd_mips_elf_object_p PARAMS ((bfd *)); |
d1bf45aa ILT |
968 | extern boolean _bfd_mips_elf_section_from_shdr |
969 | PARAMS ((bfd *, Elf_Internal_Shdr *, const char *)); | |
00176555 ILT |
970 | extern boolean _bfd_mips_elf_fake_sections |
971 | PARAMS ((bfd *, Elf_Internal_Shdr *, asection *)); | |
972 | extern boolean _bfd_mips_elf_section_from_bfd_section | |
973 | PARAMS ((bfd *, Elf_Internal_Shdr *, asection *, int *)); | |
974 | extern boolean _bfd_mips_elf_section_processing | |
975 | PARAMS ((bfd *, Elf_Internal_Shdr *)); | |
976 | extern void _bfd_mips_elf_symbol_processing PARAMS ((bfd *, asymbol *)); | |
977 | extern boolean _bfd_mips_elf_read_ecoff_info | |
978 | PARAMS ((bfd *, asection *, struct ecoff_debug_info *)); | |
979 | extern void _bfd_mips_elf_final_write_processing PARAMS ((bfd *, boolean)); | |
e35765a9 ILT |
980 | extern bfd_reloc_status_type _bfd_mips_elf_hi16_reloc |
981 | PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); | |
982 | extern bfd_reloc_status_type _bfd_mips_elf_lo16_reloc | |
983 | PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); | |
984 | extern bfd_reloc_status_type _bfd_mips_elf_gprel16_reloc | |
985 | PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); | |
986 | extern bfd_reloc_status_type _bfd_mips_elf_got16_reloc | |
987 | PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); | |
988 | extern bfd_reloc_status_type _bfd_mips_elf_gprel32_reloc | |
989 | PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); | |
990 | extern boolean _bfd_mips_elf_set_private_flags PARAMS ((bfd *, flagword)); | |
991 | extern boolean _bfd_mips_elf_copy_private_bfd_data PARAMS ((bfd *, bfd *)); | |
992 | extern boolean _bfd_mips_elf_merge_private_bfd_data PARAMS ((bfd *, bfd *)); | |
993 | extern boolean _bfd_mips_elf_find_nearest_line | |
994 | PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **, | |
995 | const char **, unsigned int *)); | |
996 | extern boolean _bfd_mips_elf_set_section_contents | |
997 | PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type)); | |
d1bf45aa | 998 | |
fd0198f0 | 999 | #endif /* _LIBELF_H_ */ |