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