Peter Targett's backwards compatibility and other arc fixes.
[binutils.git] / bfd / elf-bfd.h
blobfd3f347aef458f01ca5f2ac76fb1b20d4f26e062
1 /* BFD back-end data structures for ELF files.
2 Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
3 Free Software 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 /* ??? Note that this is consistently used as a synonym for tests
90 against whether we can perform various simplifying transformations
91 to the code. (E.g. changing a pc-relative jump to a PLT entry
92 into a pc-relative jump to the target function.) That test, which
93 is often relatively complex, and someplaces wrong or incomplete,
94 should really be replaced by a predicate in elflink.c.
96 End result: this field -1 does not indicate that the symbol is
97 not in the dynamic symbol table, but rather that the symbol is
98 not visible outside this DSO. */
99 long dynindx;
101 /* String table index in .dynstr if this is a dynamic symbol. */
102 unsigned long dynstr_index;
104 /* If this is a weak defined symbol from a dynamic object, this
105 field points to a defined symbol with the same value, if there is
106 one. Otherwise it is NULL. */
107 struct elf_link_hash_entry *weakdef;
109 /* If this symbol requires an entry in the global offset table, the
110 processor specific backend uses this field to track usage and
111 final offset. We use a union and two names primarily to document
112 the intent of any particular piece of code. The field should be
113 used as a count until size_dynamic_sections, at which point the
114 contents of the .got is fixed. Afterward, if this field is -1,
115 then the symbol does not require a global offset table entry. */
116 union
118 bfd_signed_vma refcount;
119 bfd_vma offset;
120 } got;
122 /* Same, but tracks a procedure linkage table entry. */
123 union
125 bfd_signed_vma refcount;
126 bfd_vma offset;
127 } plt;
129 /* If this symbol is used in the linker created sections, the processor
130 specific backend uses this field to map the field into the offset
131 from the beginning of the section. */
132 struct elf_linker_section_pointers *linker_section_pointer;
134 /* Version information. */
135 union
137 /* This field is used for a symbol which is not defined in a
138 regular object. It points to the version information read in
139 from the dynamic object. */
140 Elf_Internal_Verdef *verdef;
141 /* This field is used for a symbol which is defined in a regular
142 object. It is set up in size_dynamic_sections. It points to
143 the version information we should write out for this symbol. */
144 struct bfd_elf_version_tree *vertree;
145 } verinfo;
147 /* Virtual table entry use information. This array is nominally of size
148 size/sizeof(target_void_pointer), though we have to be able to assume
149 and track a size while the symbol is still undefined. It is indexed
150 via offset/sizeof(target_void_pointer). */
151 size_t vtable_entries_size;
152 boolean *vtable_entries_used;
154 /* Virtual table derivation info. */
155 struct elf_link_hash_entry *vtable_parent;
157 /* Symbol type (STT_NOTYPE, STT_OBJECT, etc.). */
158 char type;
160 /* Symbol st_other value, symbol visibility. */
161 unsigned char other;
163 /* Hash value of the name computed using the ELF hash function. */
164 unsigned long elf_hash_value;
166 /* Some flags; legal values follow. */
167 unsigned short elf_link_hash_flags;
168 /* Symbol is referenced by a non-shared object. */
169 #define ELF_LINK_HASH_REF_REGULAR 01
170 /* Symbol is defined by a non-shared object. */
171 #define ELF_LINK_HASH_DEF_REGULAR 02
172 /* Symbol is referenced by a shared object. */
173 #define ELF_LINK_HASH_REF_DYNAMIC 04
174 /* Symbol is defined by a shared object. */
175 #define ELF_LINK_HASH_DEF_DYNAMIC 010
176 /* Symbol has a non-weak reference from a non-shared object. */
177 #define ELF_LINK_HASH_REF_REGULAR_NONWEAK 020
178 /* Dynamic symbol has been adjustd. */
179 #define ELF_LINK_HASH_DYNAMIC_ADJUSTED 040
180 /* Symbol needs a copy reloc. */
181 #define ELF_LINK_HASH_NEEDS_COPY 0100
182 /* Symbol needs a procedure linkage table entry. */
183 #define ELF_LINK_HASH_NEEDS_PLT 0200
184 /* Symbol appears in a non-ELF input file. */
185 #define ELF_LINK_NON_ELF 0400
186 /* Symbol should be marked as hidden in the version information. */
187 #define ELF_LINK_HIDDEN 01000
188 /* Symbol was forced to local scope due to a version script file. */
189 #define ELF_LINK_FORCED_LOCAL 02000
190 /* Symbol was marked during garbage collection. */
191 #define ELF_LINK_HASH_MARK 04000
192 /* Symbol is referenced by a non-GOT/non-PLT relocation. This is
193 not currently set by all the backends. */
194 #define ELF_LINK_NON_GOT_REF 010000
197 /* Records local symbols to be emitted in the dynamic symbol table. */
199 struct elf_link_local_dynamic_entry
201 struct elf_link_local_dynamic_entry *next;
203 /* The input bfd this symbol came from. */
204 bfd *input_bfd;
206 /* The index of the local symbol being copied. */
207 long input_indx;
209 /* The index in the outgoing dynamic symbol table. */
210 long dynindx;
212 /* A copy of the input symbol. */
213 Elf_Internal_Sym isym;
216 /* ELF linker hash table. */
218 struct elf_link_hash_table
220 struct bfd_link_hash_table root;
221 /* Whether we have created the special dynamic sections required
222 when linking against or generating a shared object. */
223 boolean dynamic_sections_created;
224 /* The BFD used to hold special sections created by the linker.
225 This will be the first BFD found which requires these sections to
226 be created. */
227 bfd *dynobj;
228 /* The number of symbols found in the link which must be put into
229 the .dynsym section. */
230 bfd_size_type dynsymcount;
231 /* The string table of dynamic symbols, which becomes the .dynstr
232 section. */
233 struct bfd_strtab_hash *dynstr;
234 /* The number of buckets in the hash table in the .hash section.
235 This is based on the number of dynamic symbols. */
236 bfd_size_type bucketcount;
237 /* A linked list of DT_NEEDED names found in dynamic objects
238 included in the link. */
239 struct bfd_link_needed_list *needed;
240 /* The _GLOBAL_OFFSET_TABLE_ symbol. */
241 struct elf_link_hash_entry *hgot;
242 /* A pointer to information used to link stabs in sections. */
243 PTR stab_info;
244 /* A pointer to information used to merge SEC_MERGE sections. */
245 PTR merge_info;
246 /* A linked list of local symbols to be added to .dynsym. */
247 struct elf_link_local_dynamic_entry *dynlocal;
248 /* A linked list of DT_RPATH/DT_RUNPATH names found in dynamic
249 objects included in the link. */
250 struct bfd_link_needed_list *runpath;
253 /* Look up an entry in an ELF linker hash table. */
255 #define elf_link_hash_lookup(table, string, create, copy, follow) \
256 ((struct elf_link_hash_entry *) \
257 bfd_link_hash_lookup (&(table)->root, (string), (create), \
258 (copy), (follow)))
260 /* Traverse an ELF linker hash table. */
262 #define elf_link_hash_traverse(table, func, info) \
263 (bfd_link_hash_traverse \
264 (&(table)->root, \
265 (boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \
266 (info)))
268 /* Get the ELF linker hash table from a link_info structure. */
270 #define elf_hash_table(p) ((struct elf_link_hash_table *) ((p)->hash))
272 /* Constant information held for an ELF backend. */
274 struct elf_size_info {
275 unsigned char sizeof_ehdr, sizeof_phdr, sizeof_shdr;
276 unsigned char sizeof_rel, sizeof_rela, sizeof_sym, sizeof_dyn, sizeof_note;
278 /* The size of entries in the .hash section. */
279 unsigned char sizeof_hash_entry;
281 /* The number of internal relocations to allocate per external
282 relocation entry. */
283 unsigned char int_rels_per_ext_rel;
285 unsigned char arch_size, file_align;
286 unsigned char elfclass, ev_current;
287 int (*write_out_phdrs) PARAMS ((bfd *, const Elf_Internal_Phdr *, int));
288 boolean (*write_shdrs_and_ehdr) PARAMS ((bfd *));
289 void (*write_relocs) PARAMS ((bfd *, asection *, PTR));
290 void (*swap_symbol_out) PARAMS ((bfd *, const Elf_Internal_Sym *, PTR));
291 boolean (*slurp_reloc_table)
292 PARAMS ((bfd *, asection *, asymbol **, boolean));
293 long (*slurp_symbol_table) PARAMS ((bfd *, asymbol **, boolean));
294 void (*swap_dyn_in) PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *));
295 void (*swap_dyn_out) PARAMS ((bfd *, const Elf_Internal_Dyn *, PTR));
297 /* This function, if defined, is called to swap in a REL
298 relocation. If an external relocation corresponds to more than
299 one internal relocation, then all relocations are swapped in at
300 once. */
301 void (*swap_reloc_in)
302 PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rel *));
304 /* This function, if defined, is called to swap out a REL
305 relocation. */
306 void (*swap_reloc_out)
307 PARAMS ((bfd *, const Elf_Internal_Rel *, bfd_byte *));
309 /* This function, if defined, is called to swap in a RELA
310 relocation. If an external relocation corresponds to more than
311 one internal relocation, then all relocations are swapped in at
312 once. */
313 void (*swap_reloca_in)
314 PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rela *));
316 /* This function, if defined, is called to swap out a RELA
317 relocation. */
318 void (*swap_reloca_out)
319 PARAMS ((bfd *, const Elf_Internal_Rela *, bfd_byte *));
323 #define elf_symbol_from(ABFD,S) \
324 (((S)->the_bfd->xvec->flavour == bfd_target_elf_flavour \
325 && (S)->the_bfd->tdata.elf_obj_data != 0) \
326 ? (elf_symbol_type *) (S) \
327 : 0)
329 struct elf_backend_data
331 /* The architecture for this backend. */
332 enum bfd_architecture arch;
334 /* The ELF machine code (EM_xxxx) for this backend. */
335 int elf_machine_code;
337 /* The maximum page size for this backend. */
338 bfd_vma maxpagesize;
340 /* A function to translate an ELF RELA relocation to a BFD arelent
341 structure. */
342 void (*elf_info_to_howto) PARAMS ((bfd *, arelent *,
343 Elf_Internal_Rela *));
345 /* A function to translate an ELF REL relocation to a BFD arelent
346 structure. */
347 void (*elf_info_to_howto_rel) PARAMS ((bfd *, arelent *,
348 Elf_Internal_Rel *));
350 /* A function to determine whether a symbol is global when
351 partitioning the symbol table into local and global symbols.
352 This should be NULL for most targets, in which case the correct
353 thing will be done. MIPS ELF, at least on the Irix 5, has
354 special requirements. */
355 boolean (*elf_backend_sym_is_global) PARAMS ((bfd *, asymbol *));
357 /* The remaining functions are hooks which are called only if they
358 are not NULL. */
360 /* A function to permit a backend specific check on whether a
361 particular BFD format is relevant for an object file, and to
362 permit the backend to set any global information it wishes. When
363 this is called elf_elfheader is set, but anything else should be
364 used with caution. If this returns false, the check_format
365 routine will return a bfd_error_wrong_format error. */
366 boolean (*elf_backend_object_p) PARAMS ((bfd *));
368 /* A function to do additional symbol processing when reading the
369 ELF symbol table. This is where any processor-specific special
370 section indices are handled. */
371 void (*elf_backend_symbol_processing) PARAMS ((bfd *, asymbol *));
373 /* A function to do additional symbol processing after reading the
374 entire ELF symbol table. */
375 boolean (*elf_backend_symbol_table_processing) PARAMS ((bfd *,
376 elf_symbol_type *,
377 unsigned int));
379 /* A function to set the type of the info field. Processor-specific
380 types should be handled here. */
381 int (*elf_backend_get_symbol_type) PARAMS (( Elf_Internal_Sym *, int));
383 /* A function to do additional processing on the ELF section header
384 just before writing it out. This is used to set the flags and
385 type fields for some sections, or to actually write out data for
386 unusual sections. */
387 boolean (*elf_backend_section_processing) PARAMS ((bfd *,
388 Elf32_Internal_Shdr *));
390 /* A function to handle unusual section types when creating BFD
391 sections from ELF sections. */
392 boolean (*elf_backend_section_from_shdr) PARAMS ((bfd *,
393 Elf32_Internal_Shdr *,
394 char *));
396 /* A function to convert machine dependent section header flags to
397 BFD internal section header flags. */
398 boolean (*elf_backend_section_flags) PARAMS ((flagword *,
399 Elf32_Internal_Shdr *));
401 /* A function to handle unusual program segment types when creating BFD
402 sections from ELF program segments. */
403 boolean (*elf_backend_section_from_phdr) PARAMS ((bfd *,
404 Elf32_Internal_Phdr *,
405 int));
407 /* A function to set up the ELF section header for a BFD section in
408 preparation for writing it out. This is where the flags and type
409 fields are set for unusual sections. */
410 boolean (*elf_backend_fake_sections) PARAMS ((bfd *, Elf32_Internal_Shdr *,
411 asection *));
413 /* A function to get the ELF section index for a BFD section. If
414 this returns true, the section was found. If it is a normal ELF
415 section, *RETVAL should be left unchanged. If it is not a normal
416 ELF section *RETVAL should be set to the SHN_xxxx index. */
417 boolean (*elf_backend_section_from_bfd_section)
418 PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *, int *retval));
420 /* If this field is not NULL, it is called by the add_symbols phase
421 of a link just before adding a symbol to the global linker hash
422 table. It may modify any of the fields as it wishes. If *NAME
423 is set to NULL, the symbol will be skipped rather than being
424 added to the hash table. This function is responsible for
425 handling all processor dependent symbol bindings and section
426 indices, and must set at least *FLAGS and *SEC for each processor
427 dependent case; failure to do so will cause a link error. */
428 boolean (*elf_add_symbol_hook)
429 PARAMS ((bfd *abfd, struct bfd_link_info *info,
430 const Elf_Internal_Sym *, const char **name,
431 flagword *flags, asection **sec, bfd_vma *value));
433 /* If this field is not NULL, it is called by the elf_link_output_sym
434 phase of a link for each symbol which will appear in the object file. */
435 boolean (*elf_backend_link_output_symbol_hook)
436 PARAMS ((bfd *, struct bfd_link_info *info, const char *,
437 Elf_Internal_Sym *, asection *));
439 /* The CREATE_DYNAMIC_SECTIONS function is called by the ELF backend
440 linker the first time it encounters a dynamic object in the link.
441 This function must create any sections required for dynamic
442 linking. The ABFD argument is a dynamic object. The .interp,
443 .dynamic, .dynsym, .dynstr, and .hash functions have already been
444 created, and this function may modify the section flags if
445 desired. This function will normally create the .got and .plt
446 sections, but different backends have different requirements. */
447 boolean (*elf_backend_create_dynamic_sections)
448 PARAMS ((bfd *abfd, struct bfd_link_info *info));
450 /* The CHECK_RELOCS function is called by the add_symbols phase of
451 the ELF backend linker. It is called once for each section with
452 relocs of an object file, just after the symbols for the object
453 file have been added to the global linker hash table. The
454 function must look through the relocs and do any special handling
455 required. This generally means allocating space in the global
456 offset table, and perhaps allocating space for a reloc. The
457 relocs are always passed as Rela structures; if the section
458 actually uses Rel structures, the r_addend field will always be
459 zero. */
460 boolean (*check_relocs)
461 PARAMS ((bfd *abfd, struct bfd_link_info *info, asection *o,
462 const Elf_Internal_Rela *relocs));
464 /* The ADJUST_DYNAMIC_SYMBOL function is called by the ELF backend
465 linker for every symbol which is defined by a dynamic object and
466 referenced by a regular object. This is called after all the
467 input files have been seen, but before the SIZE_DYNAMIC_SECTIONS
468 function has been called. The hash table entry should be
469 bfd_link_hash_defined ore bfd_link_hash_defweak, and it should be
470 defined in a section from a dynamic object. Dynamic object
471 sections are not included in the final link, and this function is
472 responsible for changing the value to something which the rest of
473 the link can deal with. This will normally involve adding an
474 entry to the .plt or .got or some such section, and setting the
475 symbol to point to that. */
476 boolean (*elf_backend_adjust_dynamic_symbol)
477 PARAMS ((struct bfd_link_info *info, struct elf_link_hash_entry *h));
479 /* The ALWAYS_SIZE_SECTIONS function is called by the backend linker
480 after all the linker input files have been seen but before the
481 section sizes have been set. This is called after
482 ADJUST_DYNAMIC_SYMBOL, but before SIZE_DYNAMIC_SECTIONS. */
483 boolean (*elf_backend_always_size_sections)
484 PARAMS ((bfd *output_bfd, struct bfd_link_info *info));
486 /* The SIZE_DYNAMIC_SECTIONS function is called by the ELF backend
487 linker after all the linker input files have been seen but before
488 the sections sizes have been set. This is called after
489 ADJUST_DYNAMIC_SYMBOL has been called on all appropriate symbols.
490 It is only called when linking against a dynamic object. It must
491 set the sizes of the dynamic sections, and may fill in their
492 contents as well. The generic ELF linker can handle the .dynsym,
493 .dynstr and .hash sections. This function must handle the
494 .interp section and any sections created by the
495 CREATE_DYNAMIC_SECTIONS entry point. */
496 boolean (*elf_backend_size_dynamic_sections)
497 PARAMS ((bfd *output_bfd, struct bfd_link_info *info));
499 /* The RELOCATE_SECTION function is called by the ELF backend linker
500 to handle the relocations for a section.
502 The relocs are always passed as Rela structures; if the section
503 actually uses Rel structures, the r_addend field will always be
504 zero.
506 This function is responsible for adjust the section contents as
507 necessary, and (if using Rela relocs and generating a
508 relocateable output file) adjusting the reloc addend as
509 necessary.
511 This function does not have to worry about setting the reloc
512 address or the reloc symbol index.
514 LOCAL_SYMS is a pointer to the swapped in local symbols.
516 LOCAL_SECTIONS is an array giving the section in the input file
517 corresponding to the st_shndx field of each local symbol.
519 The global hash table entry for the global symbols can be found
520 via elf_sym_hashes (input_bfd).
522 When generating relocateable output, this function must handle
523 STB_LOCAL/STT_SECTION symbols specially. The output symbol is
524 going to be the section symbol corresponding to the output
525 section, which means that the addend must be adjusted
526 accordingly. */
527 boolean (*elf_backend_relocate_section)
528 PARAMS ((bfd *output_bfd, struct bfd_link_info *info,
529 bfd *input_bfd, asection *input_section, bfd_byte *contents,
530 Elf_Internal_Rela *relocs, Elf_Internal_Sym *local_syms,
531 asection **local_sections));
533 /* The FINISH_DYNAMIC_SYMBOL function is called by the ELF backend
534 linker just before it writes a symbol out to the .dynsym section.
535 The processor backend may make any required adjustment to the
536 symbol. It may also take the opportunity to set contents of the
537 dynamic sections. Note that FINISH_DYNAMIC_SYMBOL is called on
538 all .dynsym symbols, while ADJUST_DYNAMIC_SYMBOL is only called
539 on those symbols which are defined by a dynamic object. */
540 boolean (*elf_backend_finish_dynamic_symbol)
541 PARAMS ((bfd *output_bfd, struct bfd_link_info *info,
542 struct elf_link_hash_entry *h, Elf_Internal_Sym *sym));
544 /* The FINISH_DYNAMIC_SECTIONS function is called by the ELF backend
545 linker just before it writes all the dynamic sections out to the
546 output file. The FINISH_DYNAMIC_SYMBOL will have been called on
547 all dynamic symbols. */
548 boolean (*elf_backend_finish_dynamic_sections)
549 PARAMS ((bfd *output_bfd, struct bfd_link_info *info));
551 /* A function to do any beginning processing needed for the ELF file
552 before building the ELF headers and computing file positions. */
553 void (*elf_backend_begin_write_processing)
554 PARAMS ((bfd *, struct bfd_link_info *));
556 /* A function to do any final processing needed for the ELF file
557 before writing it out. The LINKER argument is true if this BFD
558 was created by the ELF backend linker. */
559 void (*elf_backend_final_write_processing)
560 PARAMS ((bfd *, boolean linker));
562 /* This function is called by get_program_header_size. It should
563 return the number of additional program segments which this BFD
564 will need. It should return -1 on error. */
565 int (*elf_backend_additional_program_headers) PARAMS ((bfd *));
567 /* This function is called to modify an existing segment map in a
568 backend specific fashion. */
569 boolean (*elf_backend_modify_segment_map) PARAMS ((bfd *));
571 /* This function is called during section gc to discover the section a
572 particular relocation refers to. It need not be defined for hosts
573 that have no queer relocation types. */
574 asection * (*gc_mark_hook)
575 PARAMS ((bfd *abfd, struct bfd_link_info *, Elf_Internal_Rela *,
576 struct elf_link_hash_entry *h, Elf_Internal_Sym *));
578 /* This function, if defined, is called during the sweep phase of gc
579 in order that a backend might update any data structures it might
580 be maintaining. */
581 boolean (*gc_sweep_hook)
582 PARAMS ((bfd *abfd, struct bfd_link_info *info, asection *o,
583 const Elf_Internal_Rela *relocs));
585 /* This function, if defined, is called after the ELF headers have
586 been created. This allows for things like the OS and ABI versions
587 to be changed. */
588 void (*elf_backend_post_process_headers)
589 PARAMS ((bfd *, struct bfd_link_info *));
591 /* This function, if defined, prints a symbol to file and returns the
592 name of the symbol to be printed. It should return NULL to fall
593 back to default symbol printing. */
594 const char *(*elf_backend_print_symbol_all)
595 PARAMS ((bfd *, PTR, asymbol *));
597 /* This function, if defined, is called after all local symbols and
598 global symbols converted to locals are emited into the symtab
599 section. It allows the backend to emit special global symbols
600 not handled in the hash table. */
601 boolean (*elf_backend_output_arch_syms)
602 PARAMS ((bfd *, struct bfd_link_info *, PTR,
603 boolean (*) PARAMS ((PTR, const char *,
604 Elf_Internal_Sym *, asection *))));
606 /* Copy any information related to dynamic linking from a pre-existing
607 symbol IND to a newly created symbol DIR. */
608 void (*elf_backend_copy_indirect_symbol)
609 PARAMS ((struct elf_link_hash_entry *, struct elf_link_hash_entry *));
611 /* Modify any information related to dynamic linking such that the
612 symbol is not exported. */
613 void (*elf_backend_hide_symbol)
614 PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
616 /* The swapping table to use when dealing with ECOFF information.
617 Used for the MIPS ELF .mdebug section. */
618 const struct ecoff_debug_swap *elf_backend_ecoff_debug_swap;
620 /* Alternate EM_xxxx machine codes for this backend. */
621 int elf_machine_alt1;
622 int elf_machine_alt2;
624 const struct elf_size_info *s;
626 /* offset of the _GLOBAL_OFFSET_TABLE_ symbol from the start of the
627 .got section */
628 bfd_vma got_symbol_offset;
630 /* The size in bytes of the headers for the GOT and PLT. This includes
631 the so-called reserved entries on some systems. */
632 bfd_vma got_header_size;
633 bfd_vma plt_header_size;
635 /* This is true if the linker should act like collect and gather
636 global constructors and destructors by name. This is true for
637 MIPS ELF because the Irix 5 tools can not handle the .init
638 section. */
639 unsigned collect : 1;
641 /* This is true if the linker should ignore changes to the type of a
642 symbol. This is true for MIPS ELF because some Irix 5 objects
643 record undefined functions as STT_OBJECT although the definitions
644 are STT_FUNC. */
645 unsigned type_change_ok : 1;
647 /* Whether the backend may use REL relocations. (Some backends use
648 both REL and RELA relocations, and this flag is set for those
649 backends.) */
650 unsigned may_use_rel_p : 1;
652 /* Whether the backend may use RELA relocations. (Some backends use
653 both REL and RELA relocations, and this flag is set for those
654 backends.) */
655 unsigned may_use_rela_p : 1;
657 /* Whether the default relocation type is RELA. If a backend with
658 this flag set wants REL relocations for a particular section,
659 it must note that explicitly. Similarly, if this flag is clear,
660 and the backend wants RELA relocations for a particular
661 section. */
662 unsigned default_use_rela_p : 1;
664 /* True if addresses "naturally" sign extend. This is used when
665 swapping in from Elf32 when BFD64. */
666 unsigned sign_extend_vma : 1;
668 unsigned want_got_plt : 1;
669 unsigned plt_readonly : 1;
670 unsigned want_plt_sym : 1;
671 unsigned plt_not_loaded : 1;
672 unsigned plt_alignment : 4;
673 unsigned can_gc_sections : 1;
674 unsigned want_dynbss : 1;
677 /* Information stored for each BFD section in an ELF file. This
678 structure is allocated by elf_new_section_hook. */
680 struct bfd_elf_section_data
682 /* The ELF header for this section. */
683 Elf_Internal_Shdr this_hdr;
684 /* The ELF header for the reloc section associated with this
685 section, if any. */
686 Elf_Internal_Shdr rel_hdr;
687 /* If there is a second reloc section associated with this section,
688 as can happen on Irix 6, this field points to the header. */
689 Elf_Internal_Shdr *rel_hdr2;
690 /* The number of relocations currently assigned to REL_HDR. */
691 unsigned int rel_count;
692 /* The number of relocations currently assigned to REL_HDR2. */
693 unsigned int rel_count2;
694 /* The ELF section number of this section. Only used for an output
695 file. */
696 int this_idx;
697 /* The ELF section number of the reloc section indicated by
698 REL_HDR if any. Only used for an output file. */
699 int rel_idx;
700 /* The ELF section number of the reloc section indicated by
701 REL_HDR2 if any. Only used for an output file. */
702 int rel_idx2;
703 /* Used by the backend linker to store the symbol hash table entries
704 associated with relocs against global symbols. */
705 struct elf_link_hash_entry **rel_hashes;
706 /* A pointer to the swapped relocs. If the section uses REL relocs,
707 rather than RELA, all the r_addend fields will be zero. This
708 pointer may be NULL. It is used by the backend linker. */
709 Elf_Internal_Rela *relocs;
710 /* Used by the backend linker when generating a shared library to
711 record the dynamic symbol index for a section symbol
712 corresponding to this section. A value of 0 means that there is
713 no dynamic symbol for this section. */
714 long dynindx;
715 /* A pointer used for .stab linking optimizations. */
716 PTR stab_info;
717 /* A pointer used for SEC_MERGE optimizations. */
718 PTR merge_info;
719 /* A pointer available for the processor specific ELF backend. */
720 PTR tdata;
721 /* Nonzero if this section uses RELA relocations, rather than REL. */
722 unsigned int use_rela_p:1;
725 #define elf_section_data(sec) ((struct bfd_elf_section_data*)sec->used_by_bfd)
727 #define get_elf_backend_data(abfd) \
728 ((struct elf_backend_data *) (abfd)->xvec->backend_data)
730 /* Enumeration to specify the special section. */
731 typedef enum elf_linker_section_enum
733 LINKER_SECTION_UNKNOWN, /* not used */
734 LINKER_SECTION_GOT, /* .got section for global offset pointers */
735 LINKER_SECTION_PLT, /* .plt section for generated procedure stubs */
736 LINKER_SECTION_SDATA, /* .sdata/.sbss section for PowerPC */
737 LINKER_SECTION_SDATA2, /* .sdata2/.sbss2 section for PowerPC */
738 LINKER_SECTION_MAX /* # of linker sections */
739 } elf_linker_section_enum_t;
741 /* Sections created by the linker. */
743 typedef struct elf_linker_section
745 char *name; /* name of the section */
746 char *rel_name; /* name of the associated .rel{,a}. section */
747 char *bss_name; /* name of a related .bss section */
748 char *sym_name; /* name of symbol to reference this section */
749 asection *section; /* pointer to the section */
750 asection *bss_section; /* pointer to the bss section associated with this */
751 asection *rel_section; /* pointer to the relocations needed for this section */
752 struct elf_link_hash_entry *sym_hash; /* pointer to the created symbol hash value */
753 bfd_vma initial_size; /* initial size before any linker generated allocations */
754 bfd_vma sym_offset; /* offset of symbol from beginning of section */
755 bfd_vma hole_size; /* size of reserved address hole in allocation */
756 bfd_vma hole_offset; /* current offset for the hole */
757 bfd_vma max_hole_offset; /* maximum offset for the hole */
758 elf_linker_section_enum_t which; /* which section this is */
759 boolean hole_written_p; /* whether the hole has been initialized */
760 unsigned int alignment; /* alignment for the section */
761 flagword flags; /* flags to use to create the section */
762 } elf_linker_section_t;
764 /* Linked list of allocated pointer entries. This hangs off of the symbol lists, and
765 provides allows us to return different pointers, based on different addend's. */
767 typedef struct elf_linker_section_pointers
769 struct elf_linker_section_pointers *next; /* next allocated pointer for this symbol */
770 bfd_vma offset; /* offset of pointer from beginning of section */
771 bfd_signed_vma addend; /* addend used */
772 elf_linker_section_enum_t which; /* which linker section this is */
773 boolean written_address_p; /* whether address was written yet */
774 } elf_linker_section_pointers_t;
776 /* Some private data is stashed away for future use using the tdata pointer
777 in the bfd structure. */
779 struct elf_obj_tdata
781 Elf_Internal_Ehdr elf_header[1]; /* Actual data, but ref like ptr */
782 Elf_Internal_Shdr **elf_sect_ptr;
783 Elf_Internal_Phdr *phdr;
784 struct elf_segment_map *segment_map;
785 struct bfd_strtab_hash *strtab_ptr;
786 int num_locals;
787 int num_globals;
788 asymbol **section_syms; /* STT_SECTION symbols for each section */
789 Elf_Internal_Shdr symtab_hdr;
790 Elf_Internal_Shdr shstrtab_hdr;
791 Elf_Internal_Shdr strtab_hdr;
792 Elf_Internal_Shdr dynsymtab_hdr;
793 Elf_Internal_Shdr dynstrtab_hdr;
794 Elf_Internal_Shdr dynversym_hdr;
795 Elf_Internal_Shdr dynverref_hdr;
796 Elf_Internal_Shdr dynverdef_hdr;
797 unsigned int symtab_section, shstrtab_section;
798 unsigned int strtab_section, dynsymtab_section;
799 unsigned int dynversym_section, dynverdef_section, dynverref_section;
800 file_ptr next_file_pos;
801 #if 0
802 /* we don't need these inside bfd anymore, and I think
803 these weren't used outside bfd. */
804 void *prstatus; /* The raw /proc prstatus structure */
805 void *prpsinfo; /* The raw /proc prpsinfo structure */
806 #endif
807 bfd_vma gp; /* The gp value (MIPS only, for now) */
808 unsigned int gp_size; /* The gp size (MIPS only, for now) */
810 /* Information grabbed from an elf core file. */
811 int core_signal;
812 int core_pid;
813 int core_lwpid;
814 char* core_program;
815 char* core_command;
817 /* This is set to true if the object was created by the backend
818 linker. */
819 boolean linker;
821 /* A mapping from external symbols to entries in the linker hash
822 table, used when linking. This is indexed by the symbol index
823 minus the sh_info field of the symbol table header. */
824 struct elf_link_hash_entry **sym_hashes;
826 /* A mapping from local symbols to offsets into the global offset
827 table, used when linking. This is indexed by the symbol index.
828 Like for the globals, we use a union and two names primarily to
829 document the intent of any particular piece of code. The field
830 should be used as a count until size_dynamic_sections, at which
831 point the contents of the .got is fixed. Afterward, if an entry
832 is -1, then the symbol does not require a global offset table entry. */
833 union
835 bfd_signed_vma *refcounts;
836 bfd_vma *offsets;
837 } local_got;
839 /* A mapping from local symbols to offsets into the various linker
840 sections added. This is index by the symbol index. */
841 elf_linker_section_pointers_t **linker_section_pointers;
843 /* The linker ELF emulation code needs to let the backend ELF linker
844 know what filename should be used for a dynamic object if the
845 dynamic object is found using a search. The emulation code then
846 sometimes needs to know what name was actually used. Until the
847 file has been added to the linker symbol table, this field holds
848 the name the linker wants. After it has been added, it holds the
849 name actually used, which will be the DT_SONAME entry if there is
850 one. */
851 const char *dt_name;
853 /* When a reference in a regular object is resolved by a shared
854 object is loaded into via the DT_NEEDED entries by the linker
855 ELF emulation code, we need to add the shared object to the
856 DT_NEEDED list of the resulting binary to indicate the dependency
857 as if the -l option is passed to the linker. This field holds the
858 name of the loaded shared object. */
859 const char *dt_soname;
861 /* Irix 5 often screws up the symbol table, sorting local symbols
862 after global symbols. This flag is set if the symbol table in
863 this BFD appears to be screwed up. If it is, we ignore the
864 sh_info field in the symbol table header, and always read all the
865 symbols. */
866 boolean bad_symtab;
868 /* Records the result of `get_program_header_size'. */
869 bfd_size_type program_header_size;
871 /* Used by find_nearest_line entry point. */
872 PTR line_info;
874 /* Used by MIPS ELF find_nearest_line entry point. The structure
875 could be included directly in this one, but there's no point to
876 wasting the memory just for the infrequently called
877 find_nearest_line. */
878 struct mips_elf_find_line *find_line_info;
880 /* A place to stash dwarf1 info for this bfd. */
881 struct dwarf1_debug *dwarf1_find_line_info;
883 /* A place to stash dwarf2 info for this bfd. */
884 PTR dwarf2_find_line_info;
886 /* An array of stub sections indexed by symbol number, used by the
887 MIPS ELF linker. FIXME: We should figure out some way to only
888 include this field for a MIPS ELF target. */
889 asection **local_stubs;
891 /* Used to determine if the e_flags field has been initialized */
892 boolean flags_init;
894 /* Number of symbol version definitions we are about to emit. */
895 unsigned int cverdefs;
897 /* Number of symbol version references we are about to emit. */
898 unsigned int cverrefs;
900 /* Symbol version definitions in external objects. */
901 Elf_Internal_Verdef *verdef;
903 /* Symbol version references to external objects. */
904 Elf_Internal_Verneed *verref;
906 /* Linker sections that we are interested in. */
907 struct elf_linker_section *linker_section[ (int)LINKER_SECTION_MAX ];
909 /* The Irix 5 support uses two virtual sections, which represent
910 text/data symbols defined in dynamic objects. */
911 asymbol *elf_data_symbol;
912 asymbol *elf_text_symbol;
913 asection *elf_data_section;
914 asection *elf_text_section;
917 #define elf_tdata(bfd) ((bfd) -> tdata.elf_obj_data)
918 #define elf_elfheader(bfd) (elf_tdata(bfd) -> elf_header)
919 #define elf_elfsections(bfd) (elf_tdata(bfd) -> elf_sect_ptr)
920 #define elf_shstrtab(bfd) (elf_tdata(bfd) -> strtab_ptr)
921 #define elf_onesymtab(bfd) (elf_tdata(bfd) -> symtab_section)
922 #define elf_dynsymtab(bfd) (elf_tdata(bfd) -> dynsymtab_section)
923 #define elf_dynversym(bfd) (elf_tdata(bfd) -> dynversym_section)
924 #define elf_dynverdef(bfd) (elf_tdata(bfd) -> dynverdef_section)
925 #define elf_dynverref(bfd) (elf_tdata(bfd) -> dynverref_section)
926 #define elf_num_locals(bfd) (elf_tdata(bfd) -> num_locals)
927 #define elf_num_globals(bfd) (elf_tdata(bfd) -> num_globals)
928 #define elf_section_syms(bfd) (elf_tdata(bfd) -> section_syms)
929 #define core_prpsinfo(bfd) (elf_tdata(bfd) -> prpsinfo)
930 #define core_prstatus(bfd) (elf_tdata(bfd) -> prstatus)
931 #define elf_gp(bfd) (elf_tdata(bfd) -> gp)
932 #define elf_gp_size(bfd) (elf_tdata(bfd) -> gp_size)
933 #define elf_sym_hashes(bfd) (elf_tdata(bfd) -> sym_hashes)
934 #define elf_local_got_refcounts(bfd) (elf_tdata(bfd) -> local_got.refcounts)
935 #define elf_local_got_offsets(bfd) (elf_tdata(bfd) -> local_got.offsets)
936 #define elf_local_ptr_offsets(bfd) (elf_tdata(bfd) -> linker_section_pointers)
937 #define elf_dt_name(bfd) (elf_tdata(bfd) -> dt_name)
938 #define elf_dt_soname(bfd) (elf_tdata(bfd) -> dt_soname)
939 #define elf_bad_symtab(bfd) (elf_tdata(bfd) -> bad_symtab)
940 #define elf_flags_init(bfd) (elf_tdata(bfd) -> flags_init)
941 #define elf_linker_section(bfd,n) (elf_tdata(bfd) -> linker_section[(int)n])
943 extern void _bfd_elf_swap_verdef_in
944 PARAMS ((bfd *, const Elf_External_Verdef *, Elf_Internal_Verdef *));
945 extern void _bfd_elf_swap_verdef_out
946 PARAMS ((bfd *, const Elf_Internal_Verdef *, Elf_External_Verdef *));
947 extern void _bfd_elf_swap_verdaux_in
948 PARAMS ((bfd *, const Elf_External_Verdaux *, Elf_Internal_Verdaux *));
949 extern void _bfd_elf_swap_verdaux_out
950 PARAMS ((bfd *, const Elf_Internal_Verdaux *, Elf_External_Verdaux *));
951 extern void _bfd_elf_swap_verneed_in
952 PARAMS ((bfd *, const Elf_External_Verneed *, Elf_Internal_Verneed *));
953 extern void _bfd_elf_swap_verneed_out
954 PARAMS ((bfd *, const Elf_Internal_Verneed *, Elf_External_Verneed *));
955 extern void _bfd_elf_swap_vernaux_in
956 PARAMS ((bfd *, const Elf_External_Vernaux *, Elf_Internal_Vernaux *));
957 extern void _bfd_elf_swap_vernaux_out
958 PARAMS ((bfd *, const Elf_Internal_Vernaux *, Elf_External_Vernaux *));
959 extern void _bfd_elf_swap_versym_in
960 PARAMS ((bfd *, const Elf_External_Versym *, Elf_Internal_Versym *));
961 extern void _bfd_elf_swap_versym_out
962 PARAMS ((bfd *, const Elf_Internal_Versym *, Elf_External_Versym *));
964 extern int _bfd_elf_section_from_bfd_section PARAMS ((bfd *, asection *));
965 extern char *bfd_elf_string_from_elf_section
966 PARAMS ((bfd *, unsigned, unsigned));
967 extern char *bfd_elf_get_str_section PARAMS ((bfd *, unsigned));
969 extern boolean _bfd_elf_print_private_bfd_data PARAMS ((bfd *, PTR));
970 extern void bfd_elf_print_symbol PARAMS ((bfd *, PTR, asymbol *,
971 bfd_print_symbol_type));
972 #define elf_string_from_elf_strtab(abfd,strindex) \
973 bfd_elf_string_from_elf_section(abfd,elf_elfheader(abfd)->e_shstrndx,strindex)
975 #define bfd_elf32_print_symbol bfd_elf_print_symbol
976 #define bfd_elf64_print_symbol bfd_elf_print_symbol
978 extern unsigned long bfd_elf_hash PARAMS ((const char *));
980 extern bfd_reloc_status_type bfd_elf_generic_reloc PARAMS ((bfd *,
981 arelent *,
982 asymbol *,
983 PTR,
984 asection *,
985 bfd *,
986 char **));
987 extern boolean bfd_elf_mkobject PARAMS ((bfd *));
988 extern boolean bfd_elf_mkcorefile PARAMS ((bfd *));
989 extern Elf_Internal_Shdr *bfd_elf_find_section PARAMS ((bfd *, char *));
990 extern boolean _bfd_elf_make_section_from_shdr
991 PARAMS ((bfd *abfd, Elf_Internal_Shdr *hdr, const char *name));
992 extern boolean _bfd_elf_make_section_from_phdr
993 PARAMS ((bfd *abfd, Elf_Internal_Phdr *hdr, int index, const char *typename));
994 extern struct bfd_hash_entry *_bfd_elf_link_hash_newfunc
995 PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
996 extern struct bfd_link_hash_table *_bfd_elf_link_hash_table_create
997 PARAMS ((bfd *));
998 extern void _bfd_elf_link_hash_copy_indirect
999 PARAMS ((struct elf_link_hash_entry *, struct elf_link_hash_entry *));
1000 extern void _bfd_elf_link_hash_hide_symbol
1001 PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
1002 extern boolean _bfd_elf_link_hash_table_init
1003 PARAMS ((struct elf_link_hash_table *, bfd *,
1004 struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
1005 struct bfd_hash_table *,
1006 const char *)));
1007 extern boolean _bfd_elf_slurp_version_tables PARAMS ((bfd *));
1009 extern boolean _bfd_elf_merge_sections
1010 PARAMS ((bfd *, struct bfd_link_info *));
1012 extern boolean _bfd_elf_copy_private_symbol_data
1013 PARAMS ((bfd *, asymbol *, bfd *, asymbol *));
1014 extern boolean _bfd_elf_copy_private_section_data
1015 PARAMS ((bfd *, asection *, bfd *, asection *));
1016 extern boolean _bfd_elf_write_object_contents PARAMS ((bfd *));
1017 extern boolean _bfd_elf_write_corefile_contents PARAMS ((bfd *));
1018 extern boolean _bfd_elf_set_section_contents PARAMS ((bfd *, sec_ptr, PTR,
1019 file_ptr,
1020 bfd_size_type));
1021 extern long _bfd_elf_get_symtab_upper_bound PARAMS ((bfd *));
1022 extern long _bfd_elf_get_symtab PARAMS ((bfd *, asymbol **));
1023 extern long _bfd_elf_get_dynamic_symtab_upper_bound PARAMS ((bfd *));
1024 extern long _bfd_elf_canonicalize_dynamic_symtab PARAMS ((bfd *, asymbol **));
1025 extern long _bfd_elf_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr));
1026 extern long _bfd_elf_canonicalize_reloc PARAMS ((bfd *, sec_ptr,
1027 arelent **, asymbol **));
1028 extern long _bfd_elf_get_dynamic_reloc_upper_bound PARAMS ((bfd *));
1029 extern long _bfd_elf_canonicalize_dynamic_reloc PARAMS ((bfd *, arelent **,
1030 asymbol **));
1031 extern asymbol *_bfd_elf_make_empty_symbol PARAMS ((bfd *));
1032 extern void _bfd_elf_get_symbol_info PARAMS ((bfd *, asymbol *,
1033 symbol_info *));
1034 extern boolean _bfd_elf_is_local_label_name PARAMS ((bfd *, const char *));
1035 extern alent *_bfd_elf_get_lineno PARAMS ((bfd *, asymbol *));
1036 extern boolean _bfd_elf_set_arch_mach PARAMS ((bfd *, enum bfd_architecture,
1037 unsigned long));
1038 extern boolean _bfd_elf_find_nearest_line PARAMS ((bfd *, asection *,
1039 asymbol **,
1040 bfd_vma, const char **,
1041 const char **,
1042 unsigned int *));
1043 #define _bfd_elf_read_minisymbols _bfd_generic_read_minisymbols
1044 #define _bfd_elf_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
1045 extern int _bfd_elf_sizeof_headers PARAMS ((bfd *, boolean));
1046 extern boolean _bfd_elf_new_section_hook PARAMS ((bfd *, asection *));
1047 extern boolean _bfd_elf_init_reloc_shdr
1048 PARAMS ((bfd *, Elf_Internal_Shdr *, asection *, boolean));
1050 /* If the target doesn't have reloc handling written yet: */
1051 extern void _bfd_elf_no_info_to_howto PARAMS ((bfd *, arelent *,
1052 Elf_Internal_Rela *));
1054 extern boolean bfd_section_from_shdr PARAMS ((bfd *, unsigned int shindex));
1055 extern boolean bfd_section_from_phdr PARAMS ((bfd *, Elf_Internal_Phdr *, int));
1057 extern int _bfd_elf_symbol_from_bfd_symbol PARAMS ((bfd *, asymbol **));
1059 asection *bfd_section_from_elf_index PARAMS ((bfd *, unsigned int));
1060 boolean _bfd_elf_create_dynamic_sections PARAMS ((bfd *,
1061 struct bfd_link_info *));
1062 struct bfd_strtab_hash *_bfd_elf_stringtab_init PARAMS ((void));
1063 boolean
1064 _bfd_elf_link_record_dynamic_symbol PARAMS ((struct bfd_link_info *,
1065 struct elf_link_hash_entry *));
1066 long
1067 _bfd_elf_link_lookup_local_dynindx PARAMS ((struct bfd_link_info *,
1068 bfd *, long));
1069 boolean
1070 _bfd_elf_compute_section_file_positions PARAMS ((bfd *,
1071 struct bfd_link_info *));
1072 void _bfd_elf_assign_file_positions_for_relocs PARAMS ((bfd *));
1073 file_ptr _bfd_elf_assign_file_position_for_section PARAMS ((Elf_Internal_Shdr *,
1074 file_ptr,
1075 boolean));
1077 extern boolean _bfd_elf_validate_reloc PARAMS ((bfd *, arelent *));
1079 boolean _bfd_elf_create_dynamic_sections PARAMS ((bfd *,
1080 struct bfd_link_info *));
1081 boolean _bfd_elf_create_got_section PARAMS ((bfd *,
1082 struct bfd_link_info *));
1083 unsigned long _bfd_elf_link_renumber_dynsyms PARAMS ((bfd *,
1084 struct bfd_link_info *));
1086 elf_linker_section_t *_bfd_elf_create_linker_section
1087 PARAMS ((bfd *abfd,
1088 struct bfd_link_info *info,
1089 enum elf_linker_section_enum,
1090 elf_linker_section_t *defaults));
1092 elf_linker_section_pointers_t *_bfd_elf_find_pointer_linker_section
1093 PARAMS ((elf_linker_section_pointers_t *linker_pointers,
1094 bfd_signed_vma addend,
1095 elf_linker_section_enum_t which));
1097 boolean bfd_elf32_create_pointer_linker_section
1098 PARAMS ((bfd *abfd,
1099 struct bfd_link_info *info,
1100 elf_linker_section_t *lsect,
1101 struct elf_link_hash_entry *h,
1102 const Elf32_Internal_Rela *rel));
1104 bfd_vma bfd_elf32_finish_pointer_linker_section
1105 PARAMS ((bfd *output_abfd,
1106 bfd *input_bfd,
1107 struct bfd_link_info *info,
1108 elf_linker_section_t *lsect,
1109 struct elf_link_hash_entry *h,
1110 bfd_vma relocation,
1111 const Elf32_Internal_Rela *rel,
1112 int relative_reloc));
1114 boolean bfd_elf64_create_pointer_linker_section
1115 PARAMS ((bfd *abfd,
1116 struct bfd_link_info *info,
1117 elf_linker_section_t *lsect,
1118 struct elf_link_hash_entry *h,
1119 const Elf64_Internal_Rela *rel));
1121 bfd_vma bfd_elf64_finish_pointer_linker_section
1122 PARAMS ((bfd *output_abfd,
1123 bfd *input_bfd,
1124 struct bfd_link_info *info,
1125 elf_linker_section_t *lsect,
1126 struct elf_link_hash_entry *h,
1127 bfd_vma relocation,
1128 const Elf64_Internal_Rela *rel,
1129 int relative_reloc));
1131 boolean _bfd_elf_make_linker_section_rela
1132 PARAMS ((bfd *dynobj,
1133 elf_linker_section_t *lsect,
1134 int alignment));
1136 boolean _bfd_elfcore_section_from_phdr
1137 PARAMS ((bfd *, Elf_Internal_Phdr *, int));
1139 extern const bfd_target *bfd_elf32_object_p PARAMS ((bfd *));
1140 extern const bfd_target *bfd_elf32_core_file_p PARAMS ((bfd *));
1141 extern char *bfd_elf32_core_file_failing_command PARAMS ((bfd *));
1142 extern int bfd_elf32_core_file_failing_signal PARAMS ((bfd *));
1143 extern boolean bfd_elf32_core_file_matches_executable_p PARAMS ((bfd *,
1144 bfd *));
1146 extern boolean bfd_elf32_bfd_link_add_symbols
1147 PARAMS ((bfd *, struct bfd_link_info *));
1148 extern boolean bfd_elf32_bfd_final_link
1149 PARAMS ((bfd *, struct bfd_link_info *));
1151 extern void bfd_elf32_swap_symbol_in
1152 PARAMS ((bfd *, const Elf32_External_Sym *, Elf_Internal_Sym *));
1153 extern void bfd_elf32_swap_symbol_out
1154 PARAMS ((bfd *, const Elf_Internal_Sym *, PTR));
1155 extern void bfd_elf32_swap_reloc_in
1156 PARAMS ((bfd *, const Elf32_External_Rel *, Elf_Internal_Rel *));
1157 extern void bfd_elf32_swap_reloc_out
1158 PARAMS ((bfd *, const Elf_Internal_Rel *, Elf32_External_Rel *));
1159 extern void bfd_elf32_swap_reloca_in
1160 PARAMS ((bfd *, const Elf32_External_Rela *, Elf_Internal_Rela *));
1161 extern void bfd_elf32_swap_reloca_out
1162 PARAMS ((bfd *, const Elf_Internal_Rela *, Elf32_External_Rela *));
1163 extern void bfd_elf32_swap_phdr_in
1164 PARAMS ((bfd *, const Elf32_External_Phdr *, Elf_Internal_Phdr *));
1165 extern void bfd_elf32_swap_phdr_out
1166 PARAMS ((bfd *, const Elf_Internal_Phdr *, Elf32_External_Phdr *));
1167 extern void bfd_elf32_swap_dyn_in
1168 PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *));
1169 extern void bfd_elf32_swap_dyn_out
1170 PARAMS ((bfd *, const Elf_Internal_Dyn *, PTR));
1171 extern long bfd_elf32_slurp_symbol_table
1172 PARAMS ((bfd *, asymbol **, boolean));
1173 extern boolean bfd_elf32_write_shdrs_and_ehdr PARAMS ((bfd *));
1174 extern int bfd_elf32_write_out_phdrs
1175 PARAMS ((bfd *, const Elf_Internal_Phdr *, int));
1176 extern void bfd_elf32_write_relocs
1177 PARAMS ((bfd *, asection *, PTR));
1178 extern boolean bfd_elf32_slurp_reloc_table
1179 PARAMS ((bfd *, asection *, asymbol **, boolean));
1180 extern boolean bfd_elf32_add_dynamic_entry
1181 PARAMS ((struct bfd_link_info *, bfd_vma, bfd_vma));
1182 extern boolean bfd_elf32_link_create_dynamic_sections
1183 PARAMS ((bfd *, struct bfd_link_info *));
1184 extern Elf_Internal_Rela *_bfd_elf32_link_read_relocs
1185 PARAMS ((bfd *, asection *, PTR, Elf_Internal_Rela *, boolean));
1187 extern const bfd_target *bfd_elf64_object_p PARAMS ((bfd *));
1188 extern const bfd_target *bfd_elf64_core_file_p PARAMS ((bfd *));
1189 extern char *bfd_elf64_core_file_failing_command PARAMS ((bfd *));
1190 extern int bfd_elf64_core_file_failing_signal PARAMS ((bfd *));
1191 extern boolean bfd_elf64_core_file_matches_executable_p PARAMS ((bfd *,
1192 bfd *));
1193 extern boolean bfd_elf64_bfd_link_add_symbols
1194 PARAMS ((bfd *, struct bfd_link_info *));
1195 extern boolean bfd_elf64_bfd_final_link
1196 PARAMS ((bfd *, struct bfd_link_info *));
1198 extern void bfd_elf64_swap_symbol_in
1199 PARAMS ((bfd *, const Elf64_External_Sym *, Elf_Internal_Sym *));
1200 extern void bfd_elf64_swap_symbol_out
1201 PARAMS ((bfd *, const Elf_Internal_Sym *, PTR));
1202 extern void bfd_elf64_swap_reloc_in
1203 PARAMS ((bfd *, const Elf64_External_Rel *, Elf_Internal_Rel *));
1204 extern void bfd_elf64_swap_reloc_out
1205 PARAMS ((bfd *, const Elf_Internal_Rel *, Elf64_External_Rel *));
1206 extern void bfd_elf64_swap_reloca_in
1207 PARAMS ((bfd *, const Elf64_External_Rela *, Elf_Internal_Rela *));
1208 extern void bfd_elf64_swap_reloca_out
1209 PARAMS ((bfd *, const Elf_Internal_Rela *, Elf64_External_Rela *));
1210 extern void bfd_elf64_swap_phdr_in
1211 PARAMS ((bfd *, const Elf64_External_Phdr *, Elf_Internal_Phdr *));
1212 extern void bfd_elf64_swap_phdr_out
1213 PARAMS ((bfd *, const Elf_Internal_Phdr *, Elf64_External_Phdr *));
1214 extern void bfd_elf64_swap_dyn_in
1215 PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *));
1216 extern void bfd_elf64_swap_dyn_out
1217 PARAMS ((bfd *, const Elf_Internal_Dyn *, PTR));
1218 extern long bfd_elf64_slurp_symbol_table
1219 PARAMS ((bfd *, asymbol **, boolean));
1220 extern boolean bfd_elf64_write_shdrs_and_ehdr PARAMS ((bfd *));
1221 extern int bfd_elf64_write_out_phdrs
1222 PARAMS ((bfd *, const Elf_Internal_Phdr *, int));
1223 extern void bfd_elf64_write_relocs
1224 PARAMS ((bfd *, asection *, PTR));
1225 extern boolean bfd_elf64_slurp_reloc_table
1226 PARAMS ((bfd *, asection *, asymbol **, boolean));
1227 extern boolean bfd_elf64_add_dynamic_entry
1228 PARAMS ((struct bfd_link_info *, bfd_vma, bfd_vma));
1229 extern boolean bfd_elf64_link_create_dynamic_sections
1230 PARAMS ((bfd *, struct bfd_link_info *));
1231 extern Elf_Internal_Rela *_bfd_elf64_link_read_relocs
1232 PARAMS ((bfd *, asection *, PTR, Elf_Internal_Rela *, boolean));
1234 #define bfd_elf32_link_record_dynamic_symbol \
1235 _bfd_elf_link_record_dynamic_symbol
1236 #define bfd_elf64_link_record_dynamic_symbol \
1237 _bfd_elf_link_record_dynamic_symbol
1239 boolean _bfd_elf32_link_record_local_dynamic_symbol
1240 PARAMS ((struct bfd_link_info *, bfd *, long));
1241 boolean _bfd_elf64_link_record_local_dynamic_symbol
1242 PARAMS ((struct bfd_link_info *, bfd *, long));
1244 extern boolean _bfd_elf_close_and_cleanup PARAMS ((bfd *));
1245 extern bfd_reloc_status_type _bfd_elf_rel_vtable_reloc_fn
1246 PARAMS ((bfd *, arelent *, struct symbol_cache_entry *, PTR,
1247 asection *, bfd *, char **));
1249 boolean _bfd_elf32_gc_sections
1250 PARAMS ((bfd *abfd, struct bfd_link_info *info));
1251 boolean _bfd_elf32_gc_common_finalize_got_offsets
1252 PARAMS ((bfd *abfd, struct bfd_link_info *info));
1253 boolean _bfd_elf32_gc_common_final_link
1254 PARAMS ((bfd *, struct bfd_link_info *));
1255 boolean _bfd_elf32_gc_record_vtinherit
1256 PARAMS ((bfd *, asection *, struct elf_link_hash_entry *, bfd_vma));
1257 boolean _bfd_elf32_gc_record_vtentry
1258 PARAMS ((bfd *, asection *, struct elf_link_hash_entry *, bfd_vma));
1260 boolean _bfd_elf64_gc_sections
1261 PARAMS ((bfd *abfd, struct bfd_link_info *info));
1262 boolean _bfd_elf64_gc_common_finalize_got_offsets
1263 PARAMS ((bfd *abfd, struct bfd_link_info *info));
1264 boolean _bfd_elf64_gc_common_final_link
1265 PARAMS ((bfd *, struct bfd_link_info *));
1266 boolean _bfd_elf64_gc_record_vtinherit
1267 PARAMS ((bfd *, asection *, struct elf_link_hash_entry *, bfd_vma));
1268 boolean _bfd_elf64_gc_record_vtentry
1269 PARAMS ((bfd *, asection *, struct elf_link_hash_entry *, bfd_vma));
1271 /* MIPS ELF specific routines. */
1273 extern boolean _bfd_mips_elf_object_p PARAMS ((bfd *));
1274 extern boolean _bfd_mips_elf_section_from_shdr
1275 PARAMS ((bfd *, Elf_Internal_Shdr *, char *));
1276 extern boolean _bfd_mips_elf_fake_sections
1277 PARAMS ((bfd *, Elf_Internal_Shdr *, asection *));
1278 extern boolean _bfd_mips_elf_section_from_bfd_section
1279 PARAMS ((bfd *, Elf_Internal_Shdr *, asection *, int *));
1280 extern boolean _bfd_mips_elf_section_processing
1281 PARAMS ((bfd *, Elf_Internal_Shdr *));
1282 extern void _bfd_mips_elf_symbol_processing PARAMS ((bfd *, asymbol *));
1283 extern boolean _bfd_mips_elf_read_ecoff_info
1284 PARAMS ((bfd *, asection *, struct ecoff_debug_info *));
1285 extern void _bfd_mips_elf_final_write_processing PARAMS ((bfd *, boolean));
1286 extern bfd_reloc_status_type _bfd_mips_elf_hi16_reloc
1287 PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
1288 extern bfd_reloc_status_type _bfd_mips_elf_lo16_reloc
1289 PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
1290 extern bfd_reloc_status_type _bfd_mips_elf_gprel16_reloc
1291 PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
1292 extern bfd_reloc_status_type _bfd_mips_elf_got16_reloc
1293 PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
1294 extern bfd_reloc_status_type _bfd_mips_elf_gprel32_reloc
1295 PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
1296 extern boolean _bfd_mips_elf_set_private_flags PARAMS ((bfd *, flagword));
1297 extern boolean _bfd_mips_elf_copy_private_bfd_data PARAMS ((bfd *, bfd *));
1298 extern boolean _bfd_mips_elf_merge_private_bfd_data PARAMS ((bfd *, bfd *));
1299 extern boolean _bfd_mips_elf_find_nearest_line
1300 PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
1301 const char **, unsigned int *));
1302 extern boolean _bfd_mips_elf_set_section_contents
1303 PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type));
1304 extern boolean _bfd_mips_elf_create_dynamic_sections
1305 PARAMS ((bfd *, struct bfd_link_info *));
1306 extern boolean _bfd_mips_elf_add_symbol_hook
1307 PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *,
1308 const char **, flagword *, asection **, bfd_vma *));
1309 extern boolean _bfd_mips_elf_adjust_dynamic_symbol
1310 PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
1311 extern boolean _bfd_mips_elf_finish_dynamic_symbol
1312 PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
1313 Elf_Internal_Sym *));
1314 extern boolean _bfd_mips_elf_finish_dynamic_sections
1315 PARAMS ((bfd *, struct bfd_link_info *));
1316 extern asection * _bfd_mips_elf_gc_mark_hook
1317 PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Rela *,
1318 struct elf_link_hash_entry *, Elf_Internal_Sym *));
1319 extern boolean _bfd_mips_elf_gc_sweep_hook
1320 PARAMS ((bfd *, struct bfd_link_info *, asection *,
1321 const Elf_Internal_Rela *));
1322 extern boolean _bfd_mips_elf_always_size_sections
1323 PARAMS ((bfd *, struct bfd_link_info *));
1324 extern boolean _bfd_mips_elf_size_dynamic_sections
1325 PARAMS ((bfd *, struct bfd_link_info *));
1326 extern boolean _bfd_mips_elf_check_relocs
1327 PARAMS ((bfd *, struct bfd_link_info *, asection *,
1328 const Elf_Internal_Rela *));
1329 extern struct bfd_link_hash_table *_bfd_mips_elf_link_hash_table_create
1330 PARAMS ((bfd *));
1331 extern boolean _bfd_mips_elf_print_private_bfd_data
1332 PARAMS ((bfd *, PTR));
1333 extern boolean _bfd_mips_elf_link_output_symbol_hook
1334 PARAMS ((bfd *, struct bfd_link_info *, const char *, Elf_Internal_Sym *,
1335 asection *));
1336 extern boolean _bfd_mips_elf_final_link
1337 PARAMS ((bfd *, struct bfd_link_info *));
1338 extern int _bfd_mips_elf_additional_program_headers PARAMS ((bfd *));
1339 extern boolean _bfd_mips_elf_modify_segment_map PARAMS ((bfd *));
1340 extern boolean _bfd_mips_elf_relocate_section
1341 PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
1342 Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
1344 /* SH ELF specific routine. */
1346 extern boolean _sh_elf_set_mach_from_flags PARAMS ((bfd *));
1348 #endif /* _LIBELF_H_ */