1 /* BFD back-end data structures for ELF files.
2 Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 1999, 2000 Free Software
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. */
25 #include "elf/common.h"
26 #include "elf/internal.h"
27 #include "elf/external.h"
30 /* If size isn't specified as 64 or 32, NAME macro should fail. */
33 #define NAME(x,y) CAT4(x,64,_,y)
36 #define NAME(x,y) CAT4(x,32,_,y)
41 #define NAME(x,y) CAT4(x,NOSIZE,_,y)
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. */
56 /* ELF symbol information. */
57 Elf_Internal_Sym internal_elf_sym
;
58 /* Backend specific information. */
61 unsigned int hppa_arg_reloc
;
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
;
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. */
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. */
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. */
118 bfd_signed_vma refcount
;
122 /* Same, but tracks a procedure linkage table entry. */
125 bfd_signed_vma refcount
;
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. */
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
;
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.). */
160 /* Symbol st_other value, symbol visibility. */
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. */
206 /* The index of the local symbol being copied. */
209 /* The index in the outgoing dynamic symbol table. */
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
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
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. */
244 /* A linked list of local symbols to be added to .dynsym. */
245 struct elf_link_local_dynamic_entry
*dynlocal
;
246 /* A linked list of DT_RPATH/DT_RUNPATH names found in dynamic
247 objects included in the link. */
248 struct bfd_link_needed_list
*runpath
;
251 /* Look up an entry in an ELF linker hash table. */
253 #define elf_link_hash_lookup(table, string, create, copy, follow) \
254 ((struct elf_link_hash_entry *) \
255 bfd_link_hash_lookup (&(table)->root, (string), (create), \
258 /* Traverse an ELF linker hash table. */
260 #define elf_link_hash_traverse(table, func, info) \
261 (bfd_link_hash_traverse \
263 (boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \
266 /* Get the ELF linker hash table from a link_info structure. */
268 #define elf_hash_table(p) ((struct elf_link_hash_table *) ((p)->hash))
270 /* Constant information held for an ELF backend. */
272 struct elf_size_info
{
273 unsigned char sizeof_ehdr
, sizeof_phdr
, sizeof_shdr
;
274 unsigned char sizeof_rel
, sizeof_rela
, sizeof_sym
, sizeof_dyn
, sizeof_note
;
276 /* The size of entries in the .hash section. */
277 unsigned char sizeof_hash_entry
;
279 /* The number of internal relocations to allocate per external
281 unsigned char int_rels_per_ext_rel
;
283 unsigned char arch_size
, file_align
;
284 unsigned char elfclass
, ev_current
;
285 int (*write_out_phdrs
) PARAMS ((bfd
*, const Elf_Internal_Phdr
*, int));
286 boolean (*write_shdrs_and_ehdr
) PARAMS ((bfd
*));
287 void (*write_relocs
) PARAMS ((bfd
*, asection
*, PTR
));
288 void (*swap_symbol_out
) PARAMS ((bfd
*, const Elf_Internal_Sym
*, PTR
));
289 boolean (*slurp_reloc_table
)
290 PARAMS ((bfd
*, asection
*, asymbol
**, boolean
));
291 long (*slurp_symbol_table
) PARAMS ((bfd
*, asymbol
**, boolean
));
292 void (*swap_dyn_in
) PARAMS ((bfd
*, const PTR
, Elf_Internal_Dyn
*));
293 void (*swap_dyn_out
) PARAMS ((bfd
*, const Elf_Internal_Dyn
*, PTR
));
295 /* This function, if defined, is called to swap in a REL
296 relocation. If an external relocation corresponds to more than
297 one internal relocation, then all relocations are swapped in at
299 void (*swap_reloc_in
)
300 PARAMS ((bfd
*, const bfd_byte
*, Elf_Internal_Rel
*));
302 /* This function, if defined, is called to swap out a REL
304 void (*swap_reloc_out
)
305 PARAMS ((bfd
*, const Elf_Internal_Rel
*, bfd_byte
*));
307 /* This function, if defined, is called to swap in a RELA
308 relocation. If an external relocation corresponds to more than
309 one internal relocation, then all relocations are swapped in at
311 void (*swap_reloca_in
)
312 PARAMS ((bfd
*, const bfd_byte
*, Elf_Internal_Rela
*));
314 /* This function, if defined, is called to swap out a RELA
316 void (*swap_reloca_out
)
317 PARAMS ((bfd
*, const Elf_Internal_Rela
*, bfd_byte
*));
321 #define elf_symbol_from(ABFD,S) \
322 (((S)->the_bfd->xvec->flavour == bfd_target_elf_flavour \
323 && (S)->the_bfd->tdata.elf_obj_data != 0) \
324 ? (elf_symbol_type *) (S) \
327 struct elf_backend_data
329 /* The architecture for this backend. */
330 enum bfd_architecture arch
;
332 /* The ELF machine code (EM_xxxx) for this backend. */
333 int elf_machine_code
;
335 /* The maximum page size for this backend. */
338 /* A function to translate an ELF RELA relocation to a BFD arelent
340 void (*elf_info_to_howto
) PARAMS ((bfd
*, arelent
*,
341 Elf_Internal_Rela
*));
343 /* A function to translate an ELF REL relocation to a BFD arelent
345 void (*elf_info_to_howto_rel
) PARAMS ((bfd
*, arelent
*,
346 Elf_Internal_Rel
*));
348 /* A function to determine whether a symbol is global when
349 partitioning the symbol table into local and global symbols.
350 This should be NULL for most targets, in which case the correct
351 thing will be done. MIPS ELF, at least on the Irix 5, has
352 special requirements. */
353 boolean (*elf_backend_sym_is_global
) PARAMS ((bfd
*, asymbol
*));
355 /* The remaining functions are hooks which are called only if they
358 /* A function to permit a backend specific check on whether a
359 particular BFD format is relevant for an object file, and to
360 permit the backend to set any global information it wishes. When
361 this is called elf_elfheader is set, but anything else should be
362 used with caution. If this returns false, the check_format
363 routine will return a bfd_error_wrong_format error. */
364 boolean (*elf_backend_object_p
) PARAMS ((bfd
*));
366 /* A function to do additional symbol processing when reading the
367 ELF symbol table. This is where any processor-specific special
368 section indices are handled. */
369 void (*elf_backend_symbol_processing
) PARAMS ((bfd
*, asymbol
*));
371 /* A function to do additional symbol processing after reading the
372 entire ELF symbol table. */
373 boolean (*elf_backend_symbol_table_processing
) PARAMS ((bfd
*,
377 /* A function to set the type of the info field. Processor-specific
378 types should be handled here. */
379 int (*elf_backend_get_symbol_type
) PARAMS (( Elf_Internal_Sym
*, int));
381 /* A function to do additional processing on the ELF section header
382 just before writing it out. This is used to set the flags and
383 type fields for some sections, or to actually write out data for
385 boolean (*elf_backend_section_processing
) PARAMS ((bfd
*,
386 Elf32_Internal_Shdr
*));
388 /* A function to handle unusual section types when creating BFD
389 sections from ELF sections. */
390 boolean (*elf_backend_section_from_shdr
) PARAMS ((bfd
*,
391 Elf32_Internal_Shdr
*,
394 /* A function to convert machine dependent section header flags to
395 BFD internal section header flags. */
396 boolean (*elf_backend_section_flags
) PARAMS ((flagword
*,
397 Elf32_Internal_Shdr
*));
399 /* A function to handle unusual program segment types when creating BFD
400 sections from ELF program segments. */
401 boolean (*elf_backend_section_from_phdr
) PARAMS ((bfd
*,
402 Elf32_Internal_Phdr
*,
405 /* A function to set up the ELF section header for a BFD section in
406 preparation for writing it out. This is where the flags and type
407 fields are set for unusual sections. */
408 boolean (*elf_backend_fake_sections
) PARAMS ((bfd
*, Elf32_Internal_Shdr
*,
411 /* A function to get the ELF section index for a BFD section. If
412 this returns true, the section was found. If it is a normal ELF
413 section, *RETVAL should be left unchanged. If it is not a normal
414 ELF section *RETVAL should be set to the SHN_xxxx index. */
415 boolean (*elf_backend_section_from_bfd_section
)
416 PARAMS ((bfd
*, Elf32_Internal_Shdr
*, asection
*, int *retval
));
418 /* If this field is not NULL, it is called by the add_symbols phase
419 of a link just before adding a symbol to the global linker hash
420 table. It may modify any of the fields as it wishes. If *NAME
421 is set to NULL, the symbol will be skipped rather than being
422 added to the hash table. This function is responsible for
423 handling all processor dependent symbol bindings and section
424 indices, and must set at least *FLAGS and *SEC for each processor
425 dependent case; failure to do so will cause a link error. */
426 boolean (*elf_add_symbol_hook
)
427 PARAMS ((bfd
*abfd
, struct bfd_link_info
*info
,
428 const Elf_Internal_Sym
*, const char **name
,
429 flagword
*flags
, asection
**sec
, bfd_vma
*value
));
431 /* If this field is not NULL, it is called by the elf_link_output_sym
432 phase of a link for each symbol which will appear in the object file. */
433 boolean (*elf_backend_link_output_symbol_hook
)
434 PARAMS ((bfd
*, struct bfd_link_info
*info
, const char *,
435 Elf_Internal_Sym
*, asection
*));
437 /* The CREATE_DYNAMIC_SECTIONS function is called by the ELF backend
438 linker the first time it encounters a dynamic object in the link.
439 This function must create any sections required for dynamic
440 linking. The ABFD argument is a dynamic object. The .interp,
441 .dynamic, .dynsym, .dynstr, and .hash functions have already been
442 created, and this function may modify the section flags if
443 desired. This function will normally create the .got and .plt
444 sections, but different backends have different requirements. */
445 boolean (*elf_backend_create_dynamic_sections
)
446 PARAMS ((bfd
*abfd
, struct bfd_link_info
*info
));
448 /* The CHECK_RELOCS function is called by the add_symbols phase of
449 the ELF backend linker. It is called once for each section with
450 relocs of an object file, just after the symbols for the object
451 file have been added to the global linker hash table. The
452 function must look through the relocs and do any special handling
453 required. This generally means allocating space in the global
454 offset table, and perhaps allocating space for a reloc. The
455 relocs are always passed as Rela structures; if the section
456 actually uses Rel structures, the r_addend field will always be
458 boolean (*check_relocs
)
459 PARAMS ((bfd
*abfd
, struct bfd_link_info
*info
, asection
*o
,
460 const Elf_Internal_Rela
*relocs
));
462 /* The ADJUST_DYNAMIC_SYMBOL function is called by the ELF backend
463 linker for every symbol which is defined by a dynamic object and
464 referenced by a regular object. This is called after all the
465 input files have been seen, but before the SIZE_DYNAMIC_SECTIONS
466 function has been called. The hash table entry should be
467 bfd_link_hash_defined ore bfd_link_hash_defweak, and it should be
468 defined in a section from a dynamic object. Dynamic object
469 sections are not included in the final link, and this function is
470 responsible for changing the value to something which the rest of
471 the link can deal with. This will normally involve adding an
472 entry to the .plt or .got or some such section, and setting the
473 symbol to point to that. */
474 boolean (*elf_backend_adjust_dynamic_symbol
)
475 PARAMS ((struct bfd_link_info
*info
, struct elf_link_hash_entry
*h
));
477 /* The ALWAYS_SIZE_SECTIONS function is called by the backend linker
478 after all the linker input files have been seen but before the
479 section sizes have been set. This is called after
480 ADJUST_DYNAMIC_SYMBOL, but before SIZE_DYNAMIC_SECTIONS. */
481 boolean (*elf_backend_always_size_sections
)
482 PARAMS ((bfd
*output_bfd
, struct bfd_link_info
*info
));
484 /* The SIZE_DYNAMIC_SECTIONS function is called by the ELF backend
485 linker after all the linker input files have been seen but before
486 the sections sizes have been set. This is called after
487 ADJUST_DYNAMIC_SYMBOL has been called on all appropriate symbols.
488 It is only called when linking against a dynamic object. It must
489 set the sizes of the dynamic sections, and may fill in their
490 contents as well. The generic ELF linker can handle the .dynsym,
491 .dynstr and .hash sections. This function must handle the
492 .interp section and any sections created by the
493 CREATE_DYNAMIC_SECTIONS entry point. */
494 boolean (*elf_backend_size_dynamic_sections
)
495 PARAMS ((bfd
*output_bfd
, struct bfd_link_info
*info
));
497 /* The RELOCATE_SECTION function is called by the ELF backend linker
498 to handle the relocations for a section.
500 The relocs are always passed as Rela structures; if the section
501 actually uses Rel structures, the r_addend field will always be
504 This function is responsible for adjust the section contents as
505 necessary, and (if using Rela relocs and generating a
506 relocateable output file) adjusting the reloc addend as
509 This function does not have to worry about setting the reloc
510 address or the reloc symbol index.
512 LOCAL_SYMS is a pointer to the swapped in local symbols.
514 LOCAL_SECTIONS is an array giving the section in the input file
515 corresponding to the st_shndx field of each local symbol.
517 The global hash table entry for the global symbols can be found
518 via elf_sym_hashes (input_bfd).
520 When generating relocateable output, this function must handle
521 STB_LOCAL/STT_SECTION symbols specially. The output symbol is
522 going to be the section symbol corresponding to the output
523 section, which means that the addend must be adjusted
525 boolean (*elf_backend_relocate_section
)
526 PARAMS ((bfd
*output_bfd
, struct bfd_link_info
*info
,
527 bfd
*input_bfd
, asection
*input_section
, bfd_byte
*contents
,
528 Elf_Internal_Rela
*relocs
, Elf_Internal_Sym
*local_syms
,
529 asection
**local_sections
));
531 /* The FINISH_DYNAMIC_SYMBOL function is called by the ELF backend
532 linker just before it writes a symbol out to the .dynsym section.
533 The processor backend may make any required adjustment to the
534 symbol. It may also take the opportunity to set contents of the
535 dynamic sections. Note that FINISH_DYNAMIC_SYMBOL is called on
536 all .dynsym symbols, while ADJUST_DYNAMIC_SYMBOL is only called
537 on those symbols which are defined by a dynamic object. */
538 boolean (*elf_backend_finish_dynamic_symbol
)
539 PARAMS ((bfd
*output_bfd
, struct bfd_link_info
*info
,
540 struct elf_link_hash_entry
*h
, Elf_Internal_Sym
*sym
));
542 /* The FINISH_DYNAMIC_SECTIONS function is called by the ELF backend
543 linker just before it writes all the dynamic sections out to the
544 output file. The FINISH_DYNAMIC_SYMBOL will have been called on
545 all dynamic symbols. */
546 boolean (*elf_backend_finish_dynamic_sections
)
547 PARAMS ((bfd
*output_bfd
, struct bfd_link_info
*info
));
549 /* A function to do any beginning processing needed for the ELF file
550 before building the ELF headers and computing file positions. */
551 void (*elf_backend_begin_write_processing
)
552 PARAMS ((bfd
*, struct bfd_link_info
*));
554 /* A function to do any final processing needed for the ELF file
555 before writing it out. The LINKER argument is true if this BFD
556 was created by the ELF backend linker. */
557 void (*elf_backend_final_write_processing
)
558 PARAMS ((bfd
*, boolean linker
));
560 /* This function is called by get_program_header_size. It should
561 return the number of additional program segments which this BFD
562 will need. It should return -1 on error. */
563 int (*elf_backend_additional_program_headers
) PARAMS ((bfd
*));
565 /* This function is called to modify an existing segment map in a
566 backend specific fashion. */
567 boolean (*elf_backend_modify_segment_map
) PARAMS ((bfd
*));
569 /* This function is called during section gc to discover the section a
570 particular relocation refers to. It need not be defined for hosts
571 that have no queer relocation types. */
572 asection
* (*gc_mark_hook
)
573 PARAMS ((bfd
*abfd
, struct bfd_link_info
*, Elf_Internal_Rela
*,
574 struct elf_link_hash_entry
*h
, Elf_Internal_Sym
*));
576 /* This function, if defined, is called during the sweep phase of gc
577 in order that a backend might update any data structures it might
579 boolean (*gc_sweep_hook
)
580 PARAMS ((bfd
*abfd
, struct bfd_link_info
*info
, asection
*o
,
581 const Elf_Internal_Rela
*relocs
));
583 /* This function, if defined, is called after the ELF headers have
584 been created. This allows for things like the OS and ABI versions
586 void (*elf_backend_post_process_headers
)
587 PARAMS ((bfd
*, struct bfd_link_info
*));
589 /* This function, if defined, prints a symbol to file and returns the
590 name of the symbol to be printed. It should return NULL to fall
591 back to default symbol printing. */
592 const char *(*elf_backend_print_symbol_all
)
593 PARAMS ((bfd
*, PTR
, asymbol
*));
595 /* This function, if defined, is called after all local symbols and
596 global symbols converted to locals are emited into the symtab
597 section. It allows the backend to emit special global symbols
598 not handled in the hash table. */
599 boolean (*elf_backend_output_arch_syms
)
600 PARAMS ((bfd
*, struct bfd_link_info
*, PTR
,
601 boolean (*) PARAMS ((PTR
, const char *,
602 Elf_Internal_Sym
*, asection
*))));
604 /* Copy any information related to dynamic linking from a pre-existing
605 symbol IND to a newly created symbol DIR. */
606 void (*elf_backend_copy_indirect_symbol
)
607 PARAMS ((struct elf_link_hash_entry
*, struct elf_link_hash_entry
*));
609 /* Modify any information related to dynamic linking such that the
610 symbol is not exported. */
611 void (*elf_backend_hide_symbol
)
612 PARAMS ((struct bfd_link_info
*, struct elf_link_hash_entry
*));
614 /* The swapping table to use when dealing with ECOFF information.
615 Used for the MIPS ELF .mdebug section. */
616 const struct ecoff_debug_swap
*elf_backend_ecoff_debug_swap
;
618 /* Alternate EM_xxxx machine codes for this backend. */
619 int elf_machine_alt1
;
620 int elf_machine_alt2
;
622 const struct elf_size_info
*s
;
624 /* offset of the _GLOBAL_OFFSET_TABLE_ symbol from the start of the
626 bfd_vma got_symbol_offset
;
628 /* The size in bytes of the headers for the GOT and PLT. This includes
629 the so-called reserved entries on some systems. */
630 bfd_vma got_header_size
;
631 bfd_vma plt_header_size
;
633 /* This is true if the linker should act like collect and gather
634 global constructors and destructors by name. This is true for
635 MIPS ELF because the Irix 5 tools can not handle the .init
637 unsigned collect
: 1;
639 /* This is true if the linker should ignore changes to the type of a
640 symbol. This is true for MIPS ELF because some Irix 5 objects
641 record undefined functions as STT_OBJECT although the definitions
643 unsigned type_change_ok
: 1;
645 /* Whether the backend may use REL relocations. (Some backends use
646 both REL and RELA relocations, and this flag is set for those
648 unsigned may_use_rel_p
: 1;
650 /* Whether the backend may use RELA relocations. (Some backends use
651 both REL and RELA relocations, and this flag is set for those
653 unsigned may_use_rela_p
: 1;
655 /* Whether the default relocation type is RELA. If a backend with
656 this flag set wants REL relocations for a particular section,
657 it must note that explicitly. Similarly, if this flag is clear,
658 and the backend wants RELA relocations for a particular
660 unsigned default_use_rela_p
: 1;
662 /* True if addresses "naturally" sign extend. This is used when
663 swapping in from Elf32 when BFD64. */
664 unsigned sign_extend_vma
: 1;
666 unsigned want_got_plt
: 1;
667 unsigned plt_readonly
: 1;
668 unsigned want_plt_sym
: 1;
669 unsigned plt_not_loaded
: 1;
670 unsigned plt_alignment
: 4;
671 unsigned can_gc_sections
: 1;
672 unsigned want_dynbss
: 1;
675 /* Information stored for each BFD section in an ELF file. This
676 structure is allocated by elf_new_section_hook. */
678 struct bfd_elf_section_data
680 /* The ELF header for this section. */
681 Elf_Internal_Shdr this_hdr
;
682 /* The ELF header for the reloc section associated with this
684 Elf_Internal_Shdr rel_hdr
;
685 /* If there is a second reloc section associated with this section,
686 as can happen on Irix 6, this field points to the header. */
687 Elf_Internal_Shdr
*rel_hdr2
;
688 /* The number of relocations currently assigned to REL_HDR. */
689 unsigned int rel_count
;
690 /* The number of relocations currently assigned to REL_HDR2. */
691 unsigned int rel_count2
;
692 /* The ELF section number of this section. Only used for an output
695 /* The ELF section number of the reloc section indicated by
696 REL_HDR if any. Only used for an output file. */
698 /* The ELF section number of the reloc section indicated by
699 REL_HDR2 if any. Only used for an output file. */
701 /* Used by the backend linker to store the symbol hash table entries
702 associated with relocs against global symbols. */
703 struct elf_link_hash_entry
**rel_hashes
;
704 /* A pointer to the swapped relocs. If the section uses REL relocs,
705 rather than RELA, all the r_addend fields will be zero. This
706 pointer may be NULL. It is used by the backend linker. */
707 Elf_Internal_Rela
*relocs
;
708 /* Used by the backend linker when generating a shared library to
709 record the dynamic symbol index for a section symbol
710 corresponding to this section. A value of 0 means that there is
711 no dynamic symbol for this section. */
713 /* A pointer used for .stab linking optimizations. */
715 /* A pointer available for the processor specific ELF backend. */
717 /* Nonzero if this section uses RELA relocations, rather than REL. */
718 unsigned int use_rela_p
:1;
721 #define elf_section_data(sec) ((struct bfd_elf_section_data*)sec->used_by_bfd)
723 #define get_elf_backend_data(abfd) \
724 ((struct elf_backend_data *) (abfd)->xvec->backend_data)
726 /* Enumeration to specify the special section. */
727 typedef enum elf_linker_section_enum
729 LINKER_SECTION_UNKNOWN
, /* not used */
730 LINKER_SECTION_GOT
, /* .got section for global offset pointers */
731 LINKER_SECTION_PLT
, /* .plt section for generated procedure stubs */
732 LINKER_SECTION_SDATA
, /* .sdata/.sbss section for PowerPC */
733 LINKER_SECTION_SDATA2
, /* .sdata2/.sbss2 section for PowerPC */
734 LINKER_SECTION_MAX
/* # of linker sections */
735 } elf_linker_section_enum_t
;
737 /* Sections created by the linker. */
739 typedef struct elf_linker_section
741 char *name
; /* name of the section */
742 char *rel_name
; /* name of the associated .rel{,a}. section */
743 char *bss_name
; /* name of a related .bss section */
744 char *sym_name
; /* name of symbol to reference this section */
745 asection
*section
; /* pointer to the section */
746 asection
*bss_section
; /* pointer to the bss section associated with this */
747 asection
*rel_section
; /* pointer to the relocations needed for this section */
748 struct elf_link_hash_entry
*sym_hash
; /* pointer to the created symbol hash value */
749 bfd_vma initial_size
; /* initial size before any linker generated allocations */
750 bfd_vma sym_offset
; /* offset of symbol from beginning of section */
751 bfd_vma hole_size
; /* size of reserved address hole in allocation */
752 bfd_vma hole_offset
; /* current offset for the hole */
753 bfd_vma max_hole_offset
; /* maximum offset for the hole */
754 elf_linker_section_enum_t which
; /* which section this is */
755 boolean hole_written_p
; /* whether the hole has been initialized */
756 unsigned int alignment
; /* alignment for the section */
757 flagword flags
; /* flags to use to create the section */
758 } elf_linker_section_t
;
760 /* Linked list of allocated pointer entries. This hangs off of the symbol lists, and
761 provides allows us to return different pointers, based on different addend's. */
763 typedef struct elf_linker_section_pointers
765 struct elf_linker_section_pointers
*next
; /* next allocated pointer for this symbol */
766 bfd_vma offset
; /* offset of pointer from beginning of section */
767 bfd_signed_vma addend
; /* addend used */
768 elf_linker_section_enum_t which
; /* which linker section this is */
769 boolean written_address_p
; /* whether address was written yet */
770 } elf_linker_section_pointers_t
;
772 /* Some private data is stashed away for future use using the tdata pointer
773 in the bfd structure. */
777 Elf_Internal_Ehdr elf_header
[1]; /* Actual data, but ref like ptr */
778 Elf_Internal_Shdr
**elf_sect_ptr
;
779 Elf_Internal_Phdr
*phdr
;
780 struct elf_segment_map
*segment_map
;
781 struct bfd_strtab_hash
*strtab_ptr
;
784 asymbol
**section_syms
; /* STT_SECTION symbols for each section */
785 Elf_Internal_Shdr symtab_hdr
;
786 Elf_Internal_Shdr shstrtab_hdr
;
787 Elf_Internal_Shdr strtab_hdr
;
788 Elf_Internal_Shdr dynsymtab_hdr
;
789 Elf_Internal_Shdr dynstrtab_hdr
;
790 Elf_Internal_Shdr dynversym_hdr
;
791 Elf_Internal_Shdr dynverref_hdr
;
792 Elf_Internal_Shdr dynverdef_hdr
;
793 unsigned int symtab_section
, shstrtab_section
;
794 unsigned int strtab_section
, dynsymtab_section
;
795 unsigned int dynversym_section
, dynverdef_section
, dynverref_section
;
796 file_ptr next_file_pos
;
798 /* we don't need these inside bfd anymore, and I think
799 these weren't used outside bfd. */
800 void *prstatus
; /* The raw /proc prstatus structure */
801 void *prpsinfo
; /* The raw /proc prpsinfo structure */
803 bfd_vma gp
; /* The gp value (MIPS only, for now) */
804 unsigned int gp_size
; /* The gp size (MIPS only, for now) */
806 /* Information grabbed from an elf core file. */
813 /* This is set to true if the object was created by the backend
817 /* A mapping from external symbols to entries in the linker hash
818 table, used when linking. This is indexed by the symbol index
819 minus the sh_info field of the symbol table header. */
820 struct elf_link_hash_entry
**sym_hashes
;
822 /* A mapping from local symbols to offsets into the global offset
823 table, used when linking. This is indexed by the symbol index.
824 Like for the globals, we use a union and two names primarily to
825 document the intent of any particular piece of code. The field
826 should be used as a count until size_dynamic_sections, at which
827 point the contents of the .got is fixed. Afterward, if an entry
828 is -1, then the symbol does not require a global offset table entry. */
831 bfd_signed_vma
*refcounts
;
835 /* A mapping from local symbols to offsets into the various linker
836 sections added. This is index by the symbol index. */
837 elf_linker_section_pointers_t
**linker_section_pointers
;
839 /* The linker ELF emulation code needs to let the backend ELF linker
840 know what filename should be used for a dynamic object if the
841 dynamic object is found using a search. The emulation code then
842 sometimes needs to know what name was actually used. Until the
843 file has been added to the linker symbol table, this field holds
844 the name the linker wants. After it has been added, it holds the
845 name actually used, which will be the DT_SONAME entry if there is
849 /* When a reference in a regular object is resolved by a shared
850 object is loaded into via the DT_NEEDED entries by the linker
851 ELF emulation code, we need to add the shared object to the
852 DT_NEEDED list of the resulting binary to indicate the dependency
853 as if the -l option is passed to the linker. This field holds the
854 name of the loaded shared object. */
855 const char *dt_soname
;
857 /* Irix 5 often screws up the symbol table, sorting local symbols
858 after global symbols. This flag is set if the symbol table in
859 this BFD appears to be screwed up. If it is, we ignore the
860 sh_info field in the symbol table header, and always read all the
864 /* Records the result of `get_program_header_size'. */
865 bfd_size_type program_header_size
;
867 /* Used by find_nearest_line entry point. */
870 /* Used by MIPS ELF find_nearest_line entry point. The structure
871 could be included directly in this one, but there's no point to
872 wasting the memory just for the infrequently called
873 find_nearest_line. */
874 struct mips_elf_find_line
*find_line_info
;
876 /* A place to stash dwarf1 info for this bfd. */
877 struct dwarf1_debug
*dwarf1_find_line_info
;
879 /* A place to stash dwarf2 info for this bfd. */
880 PTR dwarf2_find_line_info
;
882 /* An array of stub sections indexed by symbol number, used by the
883 MIPS ELF linker. FIXME: We should figure out some way to only
884 include this field for a MIPS ELF target. */
885 asection
**local_stubs
;
887 /* Used to determine if the e_flags field has been initialized */
890 /* Number of symbol version definitions we are about to emit. */
891 unsigned int cverdefs
;
893 /* Number of symbol version references we are about to emit. */
894 unsigned int cverrefs
;
896 /* Symbol version definitions in external objects. */
897 Elf_Internal_Verdef
*verdef
;
899 /* Symbol version references to external objects. */
900 Elf_Internal_Verneed
*verref
;
902 /* Linker sections that we are interested in. */
903 struct elf_linker_section
*linker_section
[ (int)LINKER_SECTION_MAX
];
905 /* The Irix 5 support uses two virtual sections, which represent
906 text/data symbols defined in dynamic objects. */
907 asymbol
*elf_data_symbol
;
908 asymbol
*elf_text_symbol
;
909 asection
*elf_data_section
;
910 asection
*elf_text_section
;
913 #define elf_tdata(bfd) ((bfd) -> tdata.elf_obj_data)
914 #define elf_elfheader(bfd) (elf_tdata(bfd) -> elf_header)
915 #define elf_elfsections(bfd) (elf_tdata(bfd) -> elf_sect_ptr)
916 #define elf_shstrtab(bfd) (elf_tdata(bfd) -> strtab_ptr)
917 #define elf_onesymtab(bfd) (elf_tdata(bfd) -> symtab_section)
918 #define elf_dynsymtab(bfd) (elf_tdata(bfd) -> dynsymtab_section)
919 #define elf_dynversym(bfd) (elf_tdata(bfd) -> dynversym_section)
920 #define elf_dynverdef(bfd) (elf_tdata(bfd) -> dynverdef_section)
921 #define elf_dynverref(bfd) (elf_tdata(bfd) -> dynverref_section)
922 #define elf_num_locals(bfd) (elf_tdata(bfd) -> num_locals)
923 #define elf_num_globals(bfd) (elf_tdata(bfd) -> num_globals)
924 #define elf_section_syms(bfd) (elf_tdata(bfd) -> section_syms)
925 #define core_prpsinfo(bfd) (elf_tdata(bfd) -> prpsinfo)
926 #define core_prstatus(bfd) (elf_tdata(bfd) -> prstatus)
927 #define elf_gp(bfd) (elf_tdata(bfd) -> gp)
928 #define elf_gp_size(bfd) (elf_tdata(bfd) -> gp_size)
929 #define elf_sym_hashes(bfd) (elf_tdata(bfd) -> sym_hashes)
930 #define elf_local_got_refcounts(bfd) (elf_tdata(bfd) -> local_got.refcounts)
931 #define elf_local_got_offsets(bfd) (elf_tdata(bfd) -> local_got.offsets)
932 #define elf_local_ptr_offsets(bfd) (elf_tdata(bfd) -> linker_section_pointers)
933 #define elf_dt_name(bfd) (elf_tdata(bfd) -> dt_name)
934 #define elf_dt_soname(bfd) (elf_tdata(bfd) -> dt_soname)
935 #define elf_bad_symtab(bfd) (elf_tdata(bfd) -> bad_symtab)
936 #define elf_flags_init(bfd) (elf_tdata(bfd) -> flags_init)
937 #define elf_linker_section(bfd,n) (elf_tdata(bfd) -> linker_section[(int)n])
939 extern void _bfd_elf_swap_verdef_in
940 PARAMS ((bfd
*, const Elf_External_Verdef
*, Elf_Internal_Verdef
*));
941 extern void _bfd_elf_swap_verdef_out
942 PARAMS ((bfd
*, const Elf_Internal_Verdef
*, Elf_External_Verdef
*));
943 extern void _bfd_elf_swap_verdaux_in
944 PARAMS ((bfd
*, const Elf_External_Verdaux
*, Elf_Internal_Verdaux
*));
945 extern void _bfd_elf_swap_verdaux_out
946 PARAMS ((bfd
*, const Elf_Internal_Verdaux
*, Elf_External_Verdaux
*));
947 extern void _bfd_elf_swap_verneed_in
948 PARAMS ((bfd
*, const Elf_External_Verneed
*, Elf_Internal_Verneed
*));
949 extern void _bfd_elf_swap_verneed_out
950 PARAMS ((bfd
*, const Elf_Internal_Verneed
*, Elf_External_Verneed
*));
951 extern void _bfd_elf_swap_vernaux_in
952 PARAMS ((bfd
*, const Elf_External_Vernaux
*, Elf_Internal_Vernaux
*));
953 extern void _bfd_elf_swap_vernaux_out
954 PARAMS ((bfd
*, const Elf_Internal_Vernaux
*, Elf_External_Vernaux
*));
955 extern void _bfd_elf_swap_versym_in
956 PARAMS ((bfd
*, const Elf_External_Versym
*, Elf_Internal_Versym
*));
957 extern void _bfd_elf_swap_versym_out
958 PARAMS ((bfd
*, const Elf_Internal_Versym
*, Elf_External_Versym
*));
960 extern int _bfd_elf_section_from_bfd_section
PARAMS ((bfd
*, asection
*));
961 extern char *bfd_elf_string_from_elf_section
962 PARAMS ((bfd
*, unsigned, unsigned));
963 extern char *bfd_elf_get_str_section
PARAMS ((bfd
*, unsigned));
965 extern boolean _bfd_elf_print_private_bfd_data
PARAMS ((bfd
*, PTR
));
966 extern void bfd_elf_print_symbol
PARAMS ((bfd
*, PTR
, asymbol
*,
967 bfd_print_symbol_type
));
968 #define elf_string_from_elf_strtab(abfd,strindex) \
969 bfd_elf_string_from_elf_section(abfd,elf_elfheader(abfd)->e_shstrndx,strindex)
971 #define bfd_elf32_print_symbol bfd_elf_print_symbol
972 #define bfd_elf64_print_symbol bfd_elf_print_symbol
974 extern unsigned long bfd_elf_hash
PARAMS ((const char *));
976 extern bfd_reloc_status_type bfd_elf_generic_reloc
PARAMS ((bfd
*,
983 extern boolean bfd_elf_mkobject
PARAMS ((bfd
*));
984 extern boolean bfd_elf_mkcorefile
PARAMS ((bfd
*));
985 extern Elf_Internal_Shdr
*bfd_elf_find_section
PARAMS ((bfd
*, char *));
986 extern boolean _bfd_elf_make_section_from_shdr
987 PARAMS ((bfd
*abfd
, Elf_Internal_Shdr
*hdr
, const char *name
));
988 extern boolean _bfd_elf_make_section_from_phdr
989 PARAMS ((bfd
*abfd
, Elf_Internal_Phdr
*hdr
, int index
, const char *typename
));
990 extern struct bfd_hash_entry
*_bfd_elf_link_hash_newfunc
991 PARAMS ((struct bfd_hash_entry
*, struct bfd_hash_table
*, const char *));
992 extern struct bfd_link_hash_table
*_bfd_elf_link_hash_table_create
994 extern void _bfd_elf_link_hash_copy_indirect
995 PARAMS ((struct elf_link_hash_entry
*, struct elf_link_hash_entry
*));
996 extern void _bfd_elf_link_hash_hide_symbol
997 PARAMS ((struct bfd_link_info
*, struct elf_link_hash_entry
*));
998 extern boolean _bfd_elf_link_hash_table_init
999 PARAMS ((struct elf_link_hash_table
*, bfd
*,
1000 struct bfd_hash_entry
*(*) (struct bfd_hash_entry
*,
1001 struct bfd_hash_table
*,
1003 extern boolean _bfd_elf_slurp_version_tables
PARAMS ((bfd
*));
1005 extern boolean _bfd_elf_copy_private_symbol_data
1006 PARAMS ((bfd
*, asymbol
*, bfd
*, asymbol
*));
1007 extern boolean _bfd_elf_copy_private_section_data
1008 PARAMS ((bfd
*, asection
*, bfd
*, asection
*));
1009 extern boolean _bfd_elf_write_object_contents
PARAMS ((bfd
*));
1010 extern boolean _bfd_elf_write_corefile_contents
PARAMS ((bfd
*));
1011 extern boolean _bfd_elf_set_section_contents
PARAMS ((bfd
*, sec_ptr
, PTR
,
1014 extern long _bfd_elf_get_symtab_upper_bound
PARAMS ((bfd
*));
1015 extern long _bfd_elf_get_symtab
PARAMS ((bfd
*, asymbol
**));
1016 extern long _bfd_elf_get_dynamic_symtab_upper_bound
PARAMS ((bfd
*));
1017 extern long _bfd_elf_canonicalize_dynamic_symtab
PARAMS ((bfd
*, asymbol
**));
1018 extern long _bfd_elf_get_reloc_upper_bound
PARAMS ((bfd
*, sec_ptr
));
1019 extern long _bfd_elf_canonicalize_reloc
PARAMS ((bfd
*, sec_ptr
,
1020 arelent
**, asymbol
**));
1021 extern long _bfd_elf_get_dynamic_reloc_upper_bound
PARAMS ((bfd
*));
1022 extern long _bfd_elf_canonicalize_dynamic_reloc
PARAMS ((bfd
*, arelent
**,
1024 extern asymbol
*_bfd_elf_make_empty_symbol
PARAMS ((bfd
*));
1025 extern void _bfd_elf_get_symbol_info
PARAMS ((bfd
*, asymbol
*,
1027 extern boolean _bfd_elf_is_local_label_name
PARAMS ((bfd
*, const char *));
1028 extern alent
*_bfd_elf_get_lineno
PARAMS ((bfd
*, asymbol
*));
1029 extern boolean _bfd_elf_set_arch_mach
PARAMS ((bfd
*, enum bfd_architecture
,
1031 extern boolean _bfd_elf_find_nearest_line
PARAMS ((bfd
*, asection
*,
1033 bfd_vma
, const char **,
1036 #define _bfd_elf_read_minisymbols _bfd_generic_read_minisymbols
1037 #define _bfd_elf_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
1038 extern int _bfd_elf_sizeof_headers
PARAMS ((bfd
*, boolean
));
1039 extern boolean _bfd_elf_new_section_hook
PARAMS ((bfd
*, asection
*));
1040 extern boolean _bfd_elf_init_reloc_shdr
1041 PARAMS ((bfd
*, Elf_Internal_Shdr
*, asection
*, boolean
));
1043 /* If the target doesn't have reloc handling written yet: */
1044 extern void _bfd_elf_no_info_to_howto
PARAMS ((bfd
*, arelent
*,
1045 Elf_Internal_Rela
*));
1047 extern boolean bfd_section_from_shdr
PARAMS ((bfd
*, unsigned int shindex
));
1048 extern boolean bfd_section_from_phdr
PARAMS ((bfd
*, Elf_Internal_Phdr
*, int));
1050 extern int _bfd_elf_symbol_from_bfd_symbol
PARAMS ((bfd
*, asymbol
**));
1052 asection
*bfd_section_from_elf_index
PARAMS ((bfd
*, unsigned int));
1053 boolean _bfd_elf_create_dynamic_sections
PARAMS ((bfd
*,
1054 struct bfd_link_info
*));
1055 struct bfd_strtab_hash
*_bfd_elf_stringtab_init
PARAMS ((void));
1057 _bfd_elf_link_record_dynamic_symbol
PARAMS ((struct bfd_link_info
*,
1058 struct elf_link_hash_entry
*));
1060 _bfd_elf_link_lookup_local_dynindx
PARAMS ((struct bfd_link_info
*,
1063 _bfd_elf_compute_section_file_positions
PARAMS ((bfd
*,
1064 struct bfd_link_info
*));
1065 void _bfd_elf_assign_file_positions_for_relocs
PARAMS ((bfd
*));
1066 file_ptr _bfd_elf_assign_file_position_for_section
PARAMS ((Elf_Internal_Shdr
*,
1070 extern boolean _bfd_elf_validate_reloc
PARAMS ((bfd
*, arelent
*));
1072 boolean _bfd_elf_create_dynamic_sections
PARAMS ((bfd
*,
1073 struct bfd_link_info
*));
1074 boolean _bfd_elf_create_got_section
PARAMS ((bfd
*,
1075 struct bfd_link_info
*));
1076 unsigned long _bfd_elf_link_renumber_dynsyms
PARAMS ((bfd
*,
1077 struct bfd_link_info
*));
1079 elf_linker_section_t
*_bfd_elf_create_linker_section
1081 struct bfd_link_info
*info
,
1082 enum elf_linker_section_enum
,
1083 elf_linker_section_t
*defaults
));
1085 elf_linker_section_pointers_t
*_bfd_elf_find_pointer_linker_section
1086 PARAMS ((elf_linker_section_pointers_t
*linker_pointers
,
1087 bfd_signed_vma addend
,
1088 elf_linker_section_enum_t which
));
1090 boolean bfd_elf32_create_pointer_linker_section
1092 struct bfd_link_info
*info
,
1093 elf_linker_section_t
*lsect
,
1094 struct elf_link_hash_entry
*h
,
1095 const Elf32_Internal_Rela
*rel
));
1097 bfd_vma bfd_elf32_finish_pointer_linker_section
1098 PARAMS ((bfd
*output_abfd
,
1100 struct bfd_link_info
*info
,
1101 elf_linker_section_t
*lsect
,
1102 struct elf_link_hash_entry
*h
,
1104 const Elf32_Internal_Rela
*rel
,
1105 int relative_reloc
));
1107 boolean bfd_elf64_create_pointer_linker_section
1109 struct bfd_link_info
*info
,
1110 elf_linker_section_t
*lsect
,
1111 struct elf_link_hash_entry
*h
,
1112 const Elf64_Internal_Rela
*rel
));
1114 bfd_vma bfd_elf64_finish_pointer_linker_section
1115 PARAMS ((bfd
*output_abfd
,
1117 struct bfd_link_info
*info
,
1118 elf_linker_section_t
*lsect
,
1119 struct elf_link_hash_entry
*h
,
1121 const Elf64_Internal_Rela
*rel
,
1122 int relative_reloc
));
1124 boolean _bfd_elf_make_linker_section_rela
1125 PARAMS ((bfd
*dynobj
,
1126 elf_linker_section_t
*lsect
,
1129 boolean _bfd_elfcore_section_from_phdr
1130 PARAMS ((bfd
*, Elf_Internal_Phdr
*, int));
1132 extern const bfd_target
*bfd_elf32_object_p
PARAMS ((bfd
*));
1133 extern const bfd_target
*bfd_elf32_core_file_p
PARAMS ((bfd
*));
1134 extern char *bfd_elf32_core_file_failing_command
PARAMS ((bfd
*));
1135 extern int bfd_elf32_core_file_failing_signal
PARAMS ((bfd
*));
1136 extern boolean bfd_elf32_core_file_matches_executable_p
PARAMS ((bfd
*,
1139 extern boolean bfd_elf32_bfd_link_add_symbols
1140 PARAMS ((bfd
*, struct bfd_link_info
*));
1141 extern boolean bfd_elf32_bfd_final_link
1142 PARAMS ((bfd
*, struct bfd_link_info
*));
1144 extern void bfd_elf32_swap_symbol_in
1145 PARAMS ((bfd
*, const Elf32_External_Sym
*, Elf_Internal_Sym
*));
1146 extern void bfd_elf32_swap_symbol_out
1147 PARAMS ((bfd
*, const Elf_Internal_Sym
*, PTR
));
1148 extern void bfd_elf32_swap_reloc_in
1149 PARAMS ((bfd
*, const Elf32_External_Rel
*, Elf_Internal_Rel
*));
1150 extern void bfd_elf32_swap_reloc_out
1151 PARAMS ((bfd
*, const Elf_Internal_Rel
*, Elf32_External_Rel
*));
1152 extern void bfd_elf32_swap_reloca_in
1153 PARAMS ((bfd
*, const Elf32_External_Rela
*, Elf_Internal_Rela
*));
1154 extern void bfd_elf32_swap_reloca_out
1155 PARAMS ((bfd
*, const Elf_Internal_Rela
*, Elf32_External_Rela
*));
1156 extern void bfd_elf32_swap_phdr_in
1157 PARAMS ((bfd
*, const Elf32_External_Phdr
*, Elf_Internal_Phdr
*));
1158 extern void bfd_elf32_swap_phdr_out
1159 PARAMS ((bfd
*, const Elf_Internal_Phdr
*, Elf32_External_Phdr
*));
1160 extern void bfd_elf32_swap_dyn_in
1161 PARAMS ((bfd
*, const PTR
, Elf_Internal_Dyn
*));
1162 extern void bfd_elf32_swap_dyn_out
1163 PARAMS ((bfd
*, const Elf_Internal_Dyn
*, PTR
));
1164 extern long bfd_elf32_slurp_symbol_table
1165 PARAMS ((bfd
*, asymbol
**, boolean
));
1166 extern boolean bfd_elf32_write_shdrs_and_ehdr
PARAMS ((bfd
*));
1167 extern int bfd_elf32_write_out_phdrs
1168 PARAMS ((bfd
*, const Elf_Internal_Phdr
*, int));
1169 extern void bfd_elf32_write_relocs
1170 PARAMS ((bfd
*, asection
*, PTR
));
1171 extern boolean bfd_elf32_slurp_reloc_table
1172 PARAMS ((bfd
*, asection
*, asymbol
**, boolean
));
1173 extern boolean bfd_elf32_add_dynamic_entry
1174 PARAMS ((struct bfd_link_info
*, bfd_vma
, bfd_vma
));
1175 extern boolean bfd_elf32_link_create_dynamic_sections
1176 PARAMS ((bfd
*, struct bfd_link_info
*));
1177 extern Elf_Internal_Rela
*_bfd_elf32_link_read_relocs
1178 PARAMS ((bfd
*, asection
*, PTR
, Elf_Internal_Rela
*, boolean
));
1180 extern const bfd_target
*bfd_elf64_object_p
PARAMS ((bfd
*));
1181 extern const bfd_target
*bfd_elf64_core_file_p
PARAMS ((bfd
*));
1182 extern char *bfd_elf64_core_file_failing_command
PARAMS ((bfd
*));
1183 extern int bfd_elf64_core_file_failing_signal
PARAMS ((bfd
*));
1184 extern boolean bfd_elf64_core_file_matches_executable_p
PARAMS ((bfd
*,
1186 extern boolean bfd_elf64_bfd_link_add_symbols
1187 PARAMS ((bfd
*, struct bfd_link_info
*));
1188 extern boolean bfd_elf64_bfd_final_link
1189 PARAMS ((bfd
*, struct bfd_link_info
*));
1191 extern void bfd_elf64_swap_symbol_in
1192 PARAMS ((bfd
*, const Elf64_External_Sym
*, Elf_Internal_Sym
*));
1193 extern void bfd_elf64_swap_symbol_out
1194 PARAMS ((bfd
*, const Elf_Internal_Sym
*, PTR
));
1195 extern void bfd_elf64_swap_reloc_in
1196 PARAMS ((bfd
*, const Elf64_External_Rel
*, Elf_Internal_Rel
*));
1197 extern void bfd_elf64_swap_reloc_out
1198 PARAMS ((bfd
*, const Elf_Internal_Rel
*, Elf64_External_Rel
*));
1199 extern void bfd_elf64_swap_reloca_in
1200 PARAMS ((bfd
*, const Elf64_External_Rela
*, Elf_Internal_Rela
*));
1201 extern void bfd_elf64_swap_reloca_out
1202 PARAMS ((bfd
*, const Elf_Internal_Rela
*, Elf64_External_Rela
*));
1203 extern void bfd_elf64_swap_phdr_in
1204 PARAMS ((bfd
*, const Elf64_External_Phdr
*, Elf_Internal_Phdr
*));
1205 extern void bfd_elf64_swap_phdr_out
1206 PARAMS ((bfd
*, const Elf_Internal_Phdr
*, Elf64_External_Phdr
*));
1207 extern void bfd_elf64_swap_dyn_in
1208 PARAMS ((bfd
*, const PTR
, Elf_Internal_Dyn
*));
1209 extern void bfd_elf64_swap_dyn_out
1210 PARAMS ((bfd
*, const Elf_Internal_Dyn
*, PTR
));
1211 extern long bfd_elf64_slurp_symbol_table
1212 PARAMS ((bfd
*, asymbol
**, boolean
));
1213 extern boolean bfd_elf64_write_shdrs_and_ehdr
PARAMS ((bfd
*));
1214 extern int bfd_elf64_write_out_phdrs
1215 PARAMS ((bfd
*, const Elf_Internal_Phdr
*, int));
1216 extern void bfd_elf64_write_relocs
1217 PARAMS ((bfd
*, asection
*, PTR
));
1218 extern boolean bfd_elf64_slurp_reloc_table
1219 PARAMS ((bfd
*, asection
*, asymbol
**, boolean
));
1220 extern boolean bfd_elf64_add_dynamic_entry
1221 PARAMS ((struct bfd_link_info
*, bfd_vma
, bfd_vma
));
1222 extern boolean bfd_elf64_link_create_dynamic_sections
1223 PARAMS ((bfd
*, struct bfd_link_info
*));
1224 extern Elf_Internal_Rela
*_bfd_elf64_link_read_relocs
1225 PARAMS ((bfd
*, asection
*, PTR
, Elf_Internal_Rela
*, boolean
));
1227 #define bfd_elf32_link_record_dynamic_symbol \
1228 _bfd_elf_link_record_dynamic_symbol
1229 #define bfd_elf64_link_record_dynamic_symbol \
1230 _bfd_elf_link_record_dynamic_symbol
1232 boolean _bfd_elf32_link_record_local_dynamic_symbol
1233 PARAMS ((struct bfd_link_info
*, bfd
*, long));
1234 boolean _bfd_elf64_link_record_local_dynamic_symbol
1235 PARAMS ((struct bfd_link_info
*, bfd
*, long));
1237 extern boolean _bfd_elf_close_and_cleanup
PARAMS ((bfd
*));
1238 extern bfd_reloc_status_type _bfd_elf_rel_vtable_reloc_fn
1239 PARAMS ((bfd
*, arelent
*, struct symbol_cache_entry
*, PTR
,
1240 asection
*, bfd
*, char **));
1242 boolean _bfd_elf32_gc_sections
1243 PARAMS ((bfd
*abfd
, struct bfd_link_info
*info
));
1244 boolean _bfd_elf32_gc_common_finalize_got_offsets
1245 PARAMS ((bfd
*abfd
, struct bfd_link_info
*info
));
1246 boolean _bfd_elf32_gc_common_final_link
1247 PARAMS ((bfd
*, struct bfd_link_info
*));
1248 boolean _bfd_elf32_gc_record_vtinherit
1249 PARAMS ((bfd
*, asection
*, struct elf_link_hash_entry
*, bfd_vma
));
1250 boolean _bfd_elf32_gc_record_vtentry
1251 PARAMS ((bfd
*, asection
*, struct elf_link_hash_entry
*, bfd_vma
));
1253 boolean _bfd_elf64_gc_sections
1254 PARAMS ((bfd
*abfd
, struct bfd_link_info
*info
));
1255 boolean _bfd_elf64_gc_common_finalize_got_offsets
1256 PARAMS ((bfd
*abfd
, struct bfd_link_info
*info
));
1257 boolean _bfd_elf64_gc_common_final_link
1258 PARAMS ((bfd
*, struct bfd_link_info
*));
1259 boolean _bfd_elf64_gc_record_vtinherit
1260 PARAMS ((bfd
*, asection
*, struct elf_link_hash_entry
*, bfd_vma
));
1261 boolean _bfd_elf64_gc_record_vtentry
1262 PARAMS ((bfd
*, asection
*, struct elf_link_hash_entry
*, bfd_vma
));
1264 /* MIPS ELF specific routines. */
1266 extern boolean _bfd_mips_elf_object_p
PARAMS ((bfd
*));
1267 extern boolean _bfd_mips_elf_section_from_shdr
1268 PARAMS ((bfd
*, Elf_Internal_Shdr
*, char *));
1269 extern boolean _bfd_mips_elf_fake_sections
1270 PARAMS ((bfd
*, Elf_Internal_Shdr
*, asection
*));
1271 extern boolean _bfd_mips_elf_section_from_bfd_section
1272 PARAMS ((bfd
*, Elf_Internal_Shdr
*, asection
*, int *));
1273 extern boolean _bfd_mips_elf_section_processing
1274 PARAMS ((bfd
*, Elf_Internal_Shdr
*));
1275 extern void _bfd_mips_elf_symbol_processing
PARAMS ((bfd
*, asymbol
*));
1276 extern boolean _bfd_mips_elf_read_ecoff_info
1277 PARAMS ((bfd
*, asection
*, struct ecoff_debug_info
*));
1278 extern void _bfd_mips_elf_final_write_processing
PARAMS ((bfd
*, boolean
));
1279 extern bfd_reloc_status_type _bfd_mips_elf_hi16_reloc
1280 PARAMS ((bfd
*, arelent
*, asymbol
*, PTR
, asection
*, bfd
*, char **));
1281 extern bfd_reloc_status_type _bfd_mips_elf_lo16_reloc
1282 PARAMS ((bfd
*, arelent
*, asymbol
*, PTR
, asection
*, bfd
*, char **));
1283 extern bfd_reloc_status_type _bfd_mips_elf_gprel16_reloc
1284 PARAMS ((bfd
*, arelent
*, asymbol
*, PTR
, asection
*, bfd
*, char **));
1285 extern bfd_reloc_status_type _bfd_mips_elf_got16_reloc
1286 PARAMS ((bfd
*, arelent
*, asymbol
*, PTR
, asection
*, bfd
*, char **));
1287 extern bfd_reloc_status_type _bfd_mips_elf_gprel32_reloc
1288 PARAMS ((bfd
*, arelent
*, asymbol
*, PTR
, asection
*, bfd
*, char **));
1289 extern boolean _bfd_mips_elf_set_private_flags
PARAMS ((bfd
*, flagword
));
1290 extern boolean _bfd_mips_elf_copy_private_bfd_data
PARAMS ((bfd
*, bfd
*));
1291 extern boolean _bfd_mips_elf_merge_private_bfd_data
PARAMS ((bfd
*, bfd
*));
1292 extern boolean _bfd_mips_elf_find_nearest_line
1293 PARAMS ((bfd
*, asection
*, asymbol
**, bfd_vma
, const char **,
1294 const char **, unsigned int *));
1295 extern boolean _bfd_mips_elf_set_section_contents
1296 PARAMS ((bfd
*, asection
*, PTR
, file_ptr
, bfd_size_type
));
1297 extern boolean _bfd_mips_elf_create_dynamic_sections
1298 PARAMS ((bfd
*, struct bfd_link_info
*));
1299 extern boolean _bfd_mips_elf_add_symbol_hook
1300 PARAMS ((bfd
*, struct bfd_link_info
*, const Elf_Internal_Sym
*,
1301 const char **, flagword
*, asection
**, bfd_vma
*));
1302 extern boolean _bfd_mips_elf_adjust_dynamic_symbol
1303 PARAMS ((struct bfd_link_info
*, struct elf_link_hash_entry
*));
1304 extern boolean _bfd_mips_elf_finish_dynamic_symbol
1305 PARAMS ((bfd
*, struct bfd_link_info
*, struct elf_link_hash_entry
*,
1306 Elf_Internal_Sym
*));
1307 extern boolean _bfd_mips_elf_finish_dynamic_sections
1308 PARAMS ((bfd
*, struct bfd_link_info
*));
1309 extern asection
* _bfd_mips_elf_gc_mark_hook
1310 PARAMS ((bfd
*, struct bfd_link_info
*, Elf_Internal_Rela
*,
1311 struct elf_link_hash_entry
*, Elf_Internal_Sym
*));
1312 extern boolean _bfd_mips_elf_gc_sweep_hook
1313 PARAMS ((bfd
*, struct bfd_link_info
*, asection
*,
1314 const Elf_Internal_Rela
*));
1315 extern boolean _bfd_mips_elf_always_size_sections
1316 PARAMS ((bfd
*, struct bfd_link_info
*));
1317 extern boolean _bfd_mips_elf_size_dynamic_sections
1318 PARAMS ((bfd
*, struct bfd_link_info
*));
1319 extern boolean _bfd_mips_elf_check_relocs
1320 PARAMS ((bfd
*, struct bfd_link_info
*, asection
*,
1321 const Elf_Internal_Rela
*));
1322 extern struct bfd_link_hash_table
*_bfd_mips_elf_link_hash_table_create
1324 extern boolean _bfd_mips_elf_print_private_bfd_data
1325 PARAMS ((bfd
*, PTR
));
1326 extern boolean _bfd_mips_elf_link_output_symbol_hook
1327 PARAMS ((bfd
*, struct bfd_link_info
*, const char *, Elf_Internal_Sym
*,
1329 extern boolean _bfd_mips_elf_final_link
1330 PARAMS ((bfd
*, struct bfd_link_info
*));
1331 extern int _bfd_mips_elf_additional_program_headers
PARAMS ((bfd
*));
1332 extern boolean _bfd_mips_elf_modify_segment_map
PARAMS ((bfd
*));
1333 extern boolean _bfd_mips_elf_relocate_section
1334 PARAMS ((bfd
*, struct bfd_link_info
*, bfd
*, asection
*, bfd_byte
*,
1335 Elf_Internal_Rela
*, Elf_Internal_Sym
*, asection
**));
1337 /* SH ELF specific routine. */
1339 extern boolean _sh_elf_set_mach_from_flags
PARAMS ((bfd
*));
1341 #endif /* _LIBELF_H_ */