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