1 /* BFD back-end data structures for ELF files.
2 Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
3 2002, 2003 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. */
25 #include "elf/common.h"
26 #include "elf/internal.h"
27 #include "elf/external.h"
30 /* The number of entries in a section is its size divided by the size
31 of a single entry. This is normally only applicable to reloc and
32 symbol table sections. */
33 #define NUM_SHDR_ENTRIES(shdr) ((shdr)->sh_size / (shdr)->sh_entsize)
35 /* If size isn't specified as 64 or 32, NAME macro should fail. */
36 /* Do not "beautify" the CONCAT* macro args. Traditional C will not
37 remove whitespace added here, and thus will fail to concatenate
41 #define NAME(x,y) CONCAT4 (x,64,_,y)
44 #define NAME(x,y) CONCAT4 (x,32,_,y)
49 #define NAME(x,y) CONCAT4 (x,NOSIZE,_,y)
52 #define ElfNAME(X) NAME(Elf,X)
53 #define elfNAME(X) NAME(elf,X)
55 /* Information held for an ELF symbol. The first field is the
56 corresponding asymbol. Every symbol is an ELF file is actually a
57 pointer to this structure, although it is often handled as a
58 pointer to an asymbol. */
64 /* ELF symbol information. */
65 Elf_Internal_Sym internal_elf_sym
;
66 /* Backend specific information. */
69 unsigned int hppa_arg_reloc
;
75 /* Version information. This is from an Elf_Internal_Versym
76 structure in a SHT_GNU_versym section. It is zero if there is no
77 version information. */
78 unsigned short version
;
82 struct elf_strtab_hash
;
86 /* ELF linker hash table entries. */
88 struct elf_link_hash_entry
90 struct bfd_link_hash_entry root
;
92 /* Symbol index in output file. This is initialized to -1. It is
93 set to -2 if the symbol is used by a reloc. */
96 /* Symbol index as a dynamic symbol. Initialized to -1, and remains
97 -1 if this is not a dynamic symbol. */
98 /* ??? Note that this is consistently used as a synonym for tests
99 against whether we can perform various simplifying transformations
100 to the code. (E.g. changing a pc-relative jump to a PLT entry
101 into a pc-relative jump to the target function.) That test, which
102 is often relatively complex, and someplaces wrong or incomplete,
103 should really be replaced by a predicate in elflink.c.
105 End result: this field -1 does not indicate that the symbol is
106 not in the dynamic symbol table, but rather that the symbol is
107 not visible outside this DSO. */
110 /* String table index in .dynstr if this is a dynamic symbol. */
111 unsigned long dynstr_index
;
113 /* Hash value of the name computed using the ELF hash function. */
114 unsigned long elf_hash_value
;
116 /* If this is a weak defined symbol from a dynamic object, this
117 field points to a defined symbol with the same value, if there is
118 one. Otherwise it is NULL. */
119 struct elf_link_hash_entry
*weakdef
;
121 /* If this symbol is used in the linker created sections, the processor
122 specific backend uses this field to map the field into the offset
123 from the beginning of the section. */
124 struct elf_linker_section_pointers
*linker_section_pointer
;
126 /* Version information. */
129 /* This field is used for a symbol which is not defined in a
130 regular object. It points to the version information read in
131 from the dynamic object. */
132 Elf_Internal_Verdef
*verdef
;
133 /* This field is used for a symbol which is defined in a regular
134 object. It is set up in size_dynamic_sections. It points to
135 the version information we should write out for this symbol. */
136 struct bfd_elf_version_tree
*vertree
;
139 /* Virtual table entry use information. This array is nominally of size
140 size/sizeof(target_void_pointer), though we have to be able to assume
141 and track a size while the symbol is still undefined. It is indexed
142 via offset/sizeof(target_void_pointer). */
143 size_t vtable_entries_size
;
144 bfd_boolean
*vtable_entries_used
;
146 /* Virtual table derivation info. */
147 struct elf_link_hash_entry
*vtable_parent
;
149 /* If this symbol requires an entry in the global offset table, the
150 processor specific backend uses this field to track usage and
151 final offset. Two schemes are supported: The first assumes that
152 a symbol may only have one GOT entry, and uses REFCOUNT until
153 size_dynamic_sections, at which point the contents of the .got is
154 fixed. Afterward, if OFFSET is -1, then the symbol does not
155 require a global offset table entry. The second scheme allows
156 multiple GOT entries per symbol, managed via a linked list
157 pointed to by GLIST. */
160 bfd_signed_vma refcount
;
162 struct got_entry
*glist
;
163 struct plt_entry
*plist
;
166 /* Same, but tracks a procedure linkage table entry. */
167 union gotplt_union plt
;
172 /* Symbol type (STT_NOTYPE, STT_OBJECT, etc.). */
175 /* Symbol st_other value, symbol visibility. */
178 /* Some flags; legal values follow. */
179 unsigned short elf_link_hash_flags
;
180 /* Symbol is referenced by a non-shared object. */
181 #define ELF_LINK_HASH_REF_REGULAR 01
182 /* Symbol is defined by a non-shared object. */
183 #define ELF_LINK_HASH_DEF_REGULAR 02
184 /* Symbol is referenced by a shared object. */
185 #define ELF_LINK_HASH_REF_DYNAMIC 04
186 /* Symbol is defined by a shared object. */
187 #define ELF_LINK_HASH_DEF_DYNAMIC 010
188 /* Symbol has a non-weak reference from a non-shared object. */
189 #define ELF_LINK_HASH_REF_REGULAR_NONWEAK 020
190 /* Dynamic symbol has been adjustd. */
191 #define ELF_LINK_HASH_DYNAMIC_ADJUSTED 040
192 /* Symbol needs a copy reloc. */
193 #define ELF_LINK_HASH_NEEDS_COPY 0100
194 /* Symbol needs a procedure linkage table entry. */
195 #define ELF_LINK_HASH_NEEDS_PLT 0200
196 /* Symbol appears in a non-ELF input file. */
197 #define ELF_LINK_NON_ELF 0400
198 /* Symbol should be marked as hidden in the version information. */
199 #define ELF_LINK_HIDDEN 01000
200 /* Symbol was forced to local scope due to a version script file. */
201 #define ELF_LINK_FORCED_LOCAL 02000
202 /* Symbol was marked during garbage collection. */
203 #define ELF_LINK_HASH_MARK 04000
204 /* Symbol is referenced by a non-GOT/non-PLT relocation. This is
205 not currently set by all the backends. */
206 #define ELF_LINK_NON_GOT_REF 010000
207 /* Symbol has a definition in a shared object. */
208 #define ELF_LINK_DYNAMIC_DEF 020000
209 /* Symbol is weak in all shared objects. */
210 #define ELF_LINK_DYNAMIC_WEAK 040000
213 /* Will references to this symbol always reference the symbol
214 in this object? STV_PROTECTED is excluded from the visibility test
215 here so that function pointer comparisons work properly. Since
216 function symbols not defined in an app are set to their .plt entry,
217 it's necessary for shared libs to also reference the .plt even
218 though the symbol is really local to the shared lib. */
219 #define SYMBOL_REFERENCES_LOCAL(INFO, H) \
221 || (INFO)->symbolic \
222 || (H)->dynindx == -1 \
223 || ELF_ST_VISIBILITY ((H)->other) == STV_INTERNAL \
224 || ELF_ST_VISIBILITY ((H)->other) == STV_HIDDEN \
225 || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0) \
226 && ((H)->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0)
228 /* Will _calls_ to this symbol always call the version in this object? */
229 #define SYMBOL_CALLS_LOCAL(INFO, H) \
231 || (INFO)->symbolic \
232 || (H)->dynindx == -1 \
233 || ELF_ST_VISIBILITY ((H)->other) != STV_DEFAULT \
234 || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0) \
235 && ((H)->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0)
237 /* Records local symbols to be emitted in the dynamic symbol table. */
239 struct elf_link_local_dynamic_entry
241 struct elf_link_local_dynamic_entry
*next
;
243 /* The input bfd this symbol came from. */
246 /* The index of the local symbol being copied. */
249 /* The index in the outgoing dynamic symbol table. */
252 /* A copy of the input symbol. */
253 Elf_Internal_Sym isym
;
256 struct elf_link_loaded_list
258 struct elf_link_loaded_list
*next
;
262 /* Structures used by the eh_frame optimization code. */
271 struct cie_header hdr
;
272 unsigned char version
;
273 unsigned char augmentation
[20];
274 unsigned int code_align
;
276 unsigned int ra_column
;
277 unsigned int augmentation_size
;
278 struct elf_link_hash_entry
*personality
;
279 unsigned char per_encoding
;
280 unsigned char lsda_encoding
;
281 unsigned char fde_encoding
;
282 unsigned char initial_insn_length
;
283 unsigned char make_relative
;
284 unsigned char make_lsda_relative
;
285 unsigned char initial_instructions
[50];
293 unsigned int new_offset
;
294 unsigned char fde_encoding
;
295 unsigned char lsda_encoding
;
296 unsigned char lsda_offset
;
297 unsigned char cie
: 1;
298 unsigned char removed
: 1;
299 unsigned char make_relative
: 1;
300 unsigned char make_lsda_relative
: 1;
301 unsigned char per_encoding_relative
: 1;
304 struct eh_frame_sec_info
307 unsigned int alloced
;
308 struct eh_cie_fde entry
[1];
311 struct eh_frame_array_ent
317 struct eh_frame_hdr_info
320 asection
*last_cie_sec
;
322 unsigned int last_cie_offset
;
323 unsigned int fde_count
, array_count
;
324 struct eh_frame_array_ent
*array
;
325 /* TRUE if .eh_frame_hdr should contain the sorted search table.
326 We build it if we successfully read all .eh_frame input sections
327 and recognize them. */
331 /* Cached start, size and alignment of PT_TLS segment. */
332 struct elf_link_tls_segment
339 /* ELF linker hash table. */
341 struct elf_link_hash_table
343 struct bfd_link_hash_table root
;
345 /* Whether we have created the special dynamic sections required
346 when linking against or generating a shared object. */
347 bfd_boolean dynamic_sections_created
;
349 /* The BFD used to hold special sections created by the linker.
350 This will be the first BFD found which requires these sections to
354 /* The value to use when initialising got.refcount/offset and
355 plt.refcount/offset in an elf_link_hash_entry. Set to zero when
356 the values are refcounts. Set to init_offset in
357 size_dynamic_sections when the values may be offsets. */
358 union gotplt_union init_refcount
;
360 /* The value to use for got.refcount/offset and plt.refcount/offset
361 when the values may be offsets. Normally (bfd_vma) -1. */
362 union gotplt_union init_offset
;
364 /* The number of symbols found in the link which must be put into
365 the .dynsym section. */
366 bfd_size_type dynsymcount
;
368 /* The string table of dynamic symbols, which becomes the .dynstr
370 struct elf_strtab_hash
*dynstr
;
372 /* The number of buckets in the hash table in the .hash section.
373 This is based on the number of dynamic symbols. */
374 bfd_size_type bucketcount
;
376 /* A linked list of DT_NEEDED names found in dynamic objects
377 included in the link. */
378 struct bfd_link_needed_list
*needed
;
380 /* The _GLOBAL_OFFSET_TABLE_ symbol. */
381 struct elf_link_hash_entry
*hgot
;
383 /* A pointer to information used to link stabs in sections. */
386 /* A pointer to information used to merge SEC_MERGE sections. */
389 /* Used by eh_frame code when editing .eh_frame. */
390 struct eh_frame_hdr_info eh_info
;
392 /* A linked list of local symbols to be added to .dynsym. */
393 struct elf_link_local_dynamic_entry
*dynlocal
;
395 /* A linked list of DT_RPATH/DT_RUNPATH names found in dynamic
396 objects included in the link. */
397 struct bfd_link_needed_list
*runpath
;
399 /* Cached start, size and alignment of PT_TLS segment. */
400 struct elf_link_tls_segment
*tls_segment
;
402 /* A linked list of BFD's loaded in the link. */
403 struct elf_link_loaded_list
*loaded
;
406 /* Look up an entry in an ELF linker hash table. */
408 #define elf_link_hash_lookup(table, string, create, copy, follow) \
409 ((struct elf_link_hash_entry *) \
410 bfd_link_hash_lookup (&(table)->root, (string), (create), \
413 /* Traverse an ELF linker hash table. */
415 #define elf_link_hash_traverse(table, func, info) \
416 (bfd_link_hash_traverse \
418 (bfd_boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \
421 /* Get the ELF linker hash table from a link_info structure. */
423 #define elf_hash_table(p) ((struct elf_link_hash_table *) ((p)->hash))
425 /* Returns TRUE if the hash table is a struct elf_link_hash_table. */
426 #define is_elf_hash_table(p) \
427 ((p)->hash->type == bfd_link_elf_hash_table)
429 /* Used by bfd_section_from_r_symndx to cache a small number of local
430 symbol to section mappings. */
431 #define LOCAL_SYM_CACHE_SIZE 32
435 unsigned long indx
[LOCAL_SYM_CACHE_SIZE
];
436 asection
*sec
[LOCAL_SYM_CACHE_SIZE
];
439 /* Constant information held for an ELF backend. */
441 struct elf_size_info
{
442 unsigned char sizeof_ehdr
, sizeof_phdr
, sizeof_shdr
;
443 unsigned char sizeof_rel
, sizeof_rela
, sizeof_sym
, sizeof_dyn
, sizeof_note
;
445 /* The size of entries in the .hash section. */
446 unsigned char sizeof_hash_entry
;
448 /* The number of internal relocations to allocate per external
450 unsigned char int_rels_per_ext_rel
;
451 /* We use some fixed size arrays. This should be large enough to
452 handle all back-ends. */
453 #define MAX_INT_RELS_PER_EXT_REL 3
455 unsigned char arch_size
, log_file_align
;
456 unsigned char elfclass
, ev_current
;
457 int (*write_out_phdrs
)
458 PARAMS ((bfd
*, const Elf_Internal_Phdr
*, unsigned int));
459 bfd_boolean (*write_shdrs_and_ehdr
)
462 PARAMS ((bfd
*, asection
*, PTR
));
463 void (*swap_symbol_in
)
464 PARAMS ((bfd
*, const PTR
, const PTR
, Elf_Internal_Sym
*));
465 void (*swap_symbol_out
)
466 PARAMS ((bfd
*, const Elf_Internal_Sym
*, PTR
, PTR
));
467 bfd_boolean (*slurp_reloc_table
)
468 PARAMS ((bfd
*, asection
*, asymbol
**, bfd_boolean
));
469 long (*slurp_symbol_table
)
470 PARAMS ((bfd
*, asymbol
**, bfd_boolean
));
472 PARAMS ((bfd
*, const PTR
, Elf_Internal_Dyn
*));
474 PARAMS ((bfd
*, const Elf_Internal_Dyn
*, PTR
));
476 /* This function is called to swap in a REL relocation. If an
477 external relocation corresponds to more than one internal
478 relocation, then all relocations are swapped in at once. */
479 void (*swap_reloc_in
)
480 PARAMS ((bfd
*, const bfd_byte
*, Elf_Internal_Rela
*));
482 /* This function is called to swap out a REL relocation. */
483 void (*swap_reloc_out
)
484 PARAMS ((bfd
*, const Elf_Internal_Rela
*, bfd_byte
*));
486 /* This function is called to swap in a RELA relocation. If an
487 external relocation corresponds to more than one internal
488 relocation, then all relocations are swapped in at once. */
489 void (*swap_reloca_in
)
490 PARAMS ((bfd
*, const bfd_byte
*, Elf_Internal_Rela
*));
492 /* This function is called to swap out a RELA relocation. */
493 void (*swap_reloca_out
)
494 PARAMS ((bfd
*, const Elf_Internal_Rela
*, bfd_byte
*));
497 #define elf_symbol_from(ABFD,S) \
498 (((S)->the_bfd->xvec->flavour == bfd_target_elf_flavour \
499 && (S)->the_bfd->tdata.elf_obj_data != 0) \
500 ? (elf_symbol_type *) (S) \
503 enum elf_reloc_type_class
{
505 reloc_class_relative
,
510 struct elf_reloc_cookie
512 Elf_Internal_Rela
*rels
, *rel
, *relend
;
513 Elf_Internal_Sym
*locsyms
;
517 struct elf_link_hash_entry
**sym_hashes
;
518 bfd_boolean bad_symtab
;
521 /* The level of IRIX compatibility we're striving for. */
529 struct elf_backend_data
531 /* The architecture for this backend. */
532 enum bfd_architecture arch
;
534 /* The ELF machine code (EM_xxxx) for this backend. */
535 int elf_machine_code
;
537 /* The maximum page size for this backend. */
540 /* A function to translate an ELF RELA relocation to a BFD arelent
542 void (*elf_info_to_howto
)
543 PARAMS ((bfd
*, arelent
*, Elf_Internal_Rela
*));
545 /* A function to translate an ELF REL relocation to a BFD arelent
547 void (*elf_info_to_howto_rel
)
548 PARAMS ((bfd
*, arelent
*, Elf_Internal_Rela
*));
550 /* A function to determine whether a symbol is global when
551 partitioning the symbol table into local and global symbols.
552 This should be NULL for most targets, in which case the correct
553 thing will be done. MIPS ELF, at least on the Irix 5, has
554 special requirements. */
555 bfd_boolean (*elf_backend_sym_is_global
)
556 PARAMS ((bfd
*, asymbol
*));
558 /* The remaining functions are hooks which are called only if they
561 /* A function to permit a backend specific check on whether a
562 particular BFD format is relevant for an object file, and to
563 permit the backend to set any global information it wishes. When
564 this is called elf_elfheader is set, but anything else should be
565 used with caution. If this returns FALSE, the check_format
566 routine will return a bfd_error_wrong_format error. */
567 bfd_boolean (*elf_backend_object_p
)
570 /* A function to do additional symbol processing when reading the
571 ELF symbol table. This is where any processor-specific special
572 section indices are handled. */
573 void (*elf_backend_symbol_processing
)
574 PARAMS ((bfd
*, asymbol
*));
576 /* A function to do additional symbol processing after reading the
577 entire ELF symbol table. */
578 bfd_boolean (*elf_backend_symbol_table_processing
)
579 PARAMS ((bfd
*, elf_symbol_type
*, unsigned int));
581 /* A function to set the type of the info field. Processor-specific
582 types should be handled here. */
583 int (*elf_backend_get_symbol_type
)
584 PARAMS (( Elf_Internal_Sym
*, int));
586 /* A function to do additional processing on the ELF section header
587 just before writing it out. This is used to set the flags and
588 type fields for some sections, or to actually write out data for
590 bfd_boolean (*elf_backend_section_processing
)
591 PARAMS ((bfd
*, Elf_Internal_Shdr
*));
593 /* A function to handle unusual section types when creating BFD
594 sections from ELF sections. */
595 bfd_boolean (*elf_backend_section_from_shdr
)
596 PARAMS ((bfd
*, Elf_Internal_Shdr
*, const char *));
598 /* A function to convert machine dependent section header flags to
599 BFD internal section header flags. */
600 bfd_boolean (*elf_backend_section_flags
)
601 PARAMS ((flagword
*, Elf_Internal_Shdr
*));
603 /* A function to handle unusual program segment types when creating BFD
604 sections from ELF program segments. */
605 bfd_boolean (*elf_backend_section_from_phdr
)
606 PARAMS ((bfd
*, Elf_Internal_Phdr
*, int));
608 /* A function to set up the ELF section header for a BFD section in
609 preparation for writing it out. This is where the flags and type
610 fields are set for unusual sections. */
611 bfd_boolean (*elf_backend_fake_sections
)
612 PARAMS ((bfd
*, Elf_Internal_Shdr
*, asection
*));
614 /* A function to get the ELF section index for a BFD section. If
615 this returns TRUE, the section was found. If it is a normal ELF
616 section, *RETVAL should be left unchanged. If it is not a normal
617 ELF section *RETVAL should be set to the SHN_xxxx index. */
618 bfd_boolean (*elf_backend_section_from_bfd_section
)
619 PARAMS ((bfd
*, asection
*, int *retval
));
621 /* If this field is not NULL, it is called by the add_symbols phase
622 of a link just before adding a symbol to the global linker hash
623 table. It may modify any of the fields as it wishes. If *NAME
624 is set to NULL, the symbol will be skipped rather than being
625 added to the hash table. This function is responsible for
626 handling all processor dependent symbol bindings and section
627 indices, and must set at least *FLAGS and *SEC for each processor
628 dependent case; failure to do so will cause a link error. */
629 bfd_boolean (*elf_add_symbol_hook
)
630 PARAMS ((bfd
*abfd
, struct bfd_link_info
*info
,
631 const Elf_Internal_Sym
*, const char **name
,
632 flagword
*flags
, asection
**sec
, bfd_vma
*value
));
634 /* If this field is not NULL, it is called by the elf_link_output_sym
635 phase of a link for each symbol which will appear in the object file. */
636 bfd_boolean (*elf_backend_link_output_symbol_hook
)
637 PARAMS ((bfd
*, struct bfd_link_info
*info
, const char *,
638 Elf_Internal_Sym
*, asection
*));
640 /* The CREATE_DYNAMIC_SECTIONS function is called by the ELF backend
641 linker the first time it encounters a dynamic object in the link.
642 This function must create any sections required for dynamic
643 linking. The ABFD argument is a dynamic object. The .interp,
644 .dynamic, .dynsym, .dynstr, and .hash functions have already been
645 created, and this function may modify the section flags if
646 desired. This function will normally create the .got and .plt
647 sections, but different backends have different requirements. */
648 bfd_boolean (*elf_backend_create_dynamic_sections
)
649 PARAMS ((bfd
*abfd
, struct bfd_link_info
*info
));
651 /* The CHECK_RELOCS function is called by the add_symbols phase of
652 the ELF backend linker. It is called once for each section with
653 relocs of an object file, just after the symbols for the object
654 file have been added to the global linker hash table. The
655 function must look through the relocs and do any special handling
656 required. This generally means allocating space in the global
657 offset table, and perhaps allocating space for a reloc. The
658 relocs are always passed as Rela structures; if the section
659 actually uses Rel structures, the r_addend field will always be
661 bfd_boolean (*check_relocs
)
662 PARAMS ((bfd
*abfd
, struct bfd_link_info
*info
, asection
*o
,
663 const Elf_Internal_Rela
*relocs
));
665 /* The ADJUST_DYNAMIC_SYMBOL function is called by the ELF backend
666 linker for every symbol which is defined by a dynamic object and
667 referenced by a regular object. This is called after all the
668 input files have been seen, but before the SIZE_DYNAMIC_SECTIONS
669 function has been called. The hash table entry should be
670 bfd_link_hash_defined ore bfd_link_hash_defweak, and it should be
671 defined in a section from a dynamic object. Dynamic object
672 sections are not included in the final link, and this function is
673 responsible for changing the value to something which the rest of
674 the link can deal with. This will normally involve adding an
675 entry to the .plt or .got or some such section, and setting the
676 symbol to point to that. */
677 bfd_boolean (*elf_backend_adjust_dynamic_symbol
)
678 PARAMS ((struct bfd_link_info
*info
, struct elf_link_hash_entry
*h
));
680 /* The ALWAYS_SIZE_SECTIONS function is called by the backend linker
681 after all the linker input files have been seen but before the
682 section sizes have been set. This is called after
683 ADJUST_DYNAMIC_SYMBOL, but before SIZE_DYNAMIC_SECTIONS. */
684 bfd_boolean (*elf_backend_always_size_sections
)
685 PARAMS ((bfd
*output_bfd
, struct bfd_link_info
*info
));
687 /* The SIZE_DYNAMIC_SECTIONS function is called by the ELF backend
688 linker after all the linker input files have been seen but before
689 the sections sizes have been set. This is called after
690 ADJUST_DYNAMIC_SYMBOL has been called on all appropriate symbols.
691 It is only called when linking against a dynamic object. It must
692 set the sizes of the dynamic sections, and may fill in their
693 contents as well. The generic ELF linker can handle the .dynsym,
694 .dynstr and .hash sections. This function must handle the
695 .interp section and any sections created by the
696 CREATE_DYNAMIC_SECTIONS entry point. */
697 bfd_boolean (*elf_backend_size_dynamic_sections
)
698 PARAMS ((bfd
*output_bfd
, struct bfd_link_info
*info
));
700 /* The RELOCATE_SECTION function is called by the ELF backend linker
701 to handle the relocations for a section.
703 The relocs are always passed as Rela structures; if the section
704 actually uses Rel structures, the r_addend field will always be
707 This function is responsible for adjust the section contents as
708 necessary, and (if using Rela relocs and generating a
709 relocatable output file) adjusting the reloc addend as
712 This function does not have to worry about setting the reloc
713 address or the reloc symbol index.
715 LOCAL_SYMS is a pointer to the swapped in local symbols.
717 LOCAL_SECTIONS is an array giving the section in the input file
718 corresponding to the st_shndx field of each local symbol.
720 The global hash table entry for the global symbols can be found
721 via elf_sym_hashes (input_bfd).
723 When generating relocatable output, this function must handle
724 STB_LOCAL/STT_SECTION symbols specially. The output symbol is
725 going to be the section symbol corresponding to the output
726 section, which means that the addend must be adjusted
728 bfd_boolean (*elf_backend_relocate_section
)
729 PARAMS ((bfd
*output_bfd
, struct bfd_link_info
*info
,
730 bfd
*input_bfd
, asection
*input_section
, bfd_byte
*contents
,
731 Elf_Internal_Rela
*relocs
, Elf_Internal_Sym
*local_syms
,
732 asection
**local_sections
));
734 /* The FINISH_DYNAMIC_SYMBOL function is called by the ELF backend
735 linker just before it writes a symbol out to the .dynsym section.
736 The processor backend may make any required adjustment to the
737 symbol. It may also take the opportunity to set contents of the
738 dynamic sections. Note that FINISH_DYNAMIC_SYMBOL is called on
739 all .dynsym symbols, while ADJUST_DYNAMIC_SYMBOL is only called
740 on those symbols which are defined by a dynamic object. */
741 bfd_boolean (*elf_backend_finish_dynamic_symbol
)
742 PARAMS ((bfd
*output_bfd
, struct bfd_link_info
*info
,
743 struct elf_link_hash_entry
*h
, Elf_Internal_Sym
*sym
));
745 /* The FINISH_DYNAMIC_SECTIONS function is called by the ELF backend
746 linker just before it writes all the dynamic sections out to the
747 output file. The FINISH_DYNAMIC_SYMBOL will have been called on
748 all dynamic symbols. */
749 bfd_boolean (*elf_backend_finish_dynamic_sections
)
750 PARAMS ((bfd
*output_bfd
, struct bfd_link_info
*info
));
752 /* A function to do any beginning processing needed for the ELF file
753 before building the ELF headers and computing file positions. */
754 void (*elf_backend_begin_write_processing
)
755 PARAMS ((bfd
*, struct bfd_link_info
*));
757 /* A function to do any final processing needed for the ELF file
758 before writing it out. The LINKER argument is TRUE if this BFD
759 was created by the ELF backend linker. */
760 void (*elf_backend_final_write_processing
)
761 PARAMS ((bfd
*, bfd_boolean linker
));
763 /* This function is called by get_program_header_size. It should
764 return the number of additional program segments which this BFD
765 will need. It should return -1 on error. */
766 int (*elf_backend_additional_program_headers
)
769 /* This function is called to modify an existing segment map in a
770 backend specific fashion. */
771 bfd_boolean (*elf_backend_modify_segment_map
)
774 /* This function is called during section gc to discover the section a
775 particular relocation refers to. */
776 asection
* (*gc_mark_hook
)
777 PARAMS ((asection
*sec
, struct bfd_link_info
*, Elf_Internal_Rela
*,
778 struct elf_link_hash_entry
*h
, Elf_Internal_Sym
*));
780 /* This function, if defined, is called during the sweep phase of gc
781 in order that a backend might update any data structures it might
783 bfd_boolean (*gc_sweep_hook
)
784 PARAMS ((bfd
*abfd
, struct bfd_link_info
*info
, asection
*o
,
785 const Elf_Internal_Rela
*relocs
));
787 /* This function, if defined, is called after the ELF headers have
788 been created. This allows for things like the OS and ABI versions
790 void (*elf_backend_post_process_headers
)
791 PARAMS ((bfd
*, struct bfd_link_info
*));
793 /* This function, if defined, prints a symbol to file and returns the
794 name of the symbol to be printed. It should return NULL to fall
795 back to default symbol printing. */
796 const char *(*elf_backend_print_symbol_all
)
797 PARAMS ((bfd
*, PTR
, asymbol
*));
799 /* This function, if defined, is called after all local symbols and
800 global symbols converted to locals are emited into the symtab
801 section. It allows the backend to emit special global symbols
802 not handled in the hash table. */
803 bfd_boolean (*elf_backend_output_arch_syms
)
804 PARAMS ((bfd
*, struct bfd_link_info
*, PTR
,
805 bfd_boolean (*) (PTR
, const char *, Elf_Internal_Sym
*, asection
*)));
807 /* Copy any information related to dynamic linking from a pre-existing
808 symbol to a newly created symbol. Also called to copy flags and
809 other back-end info to a weakdef, in which case the symbol is not
810 newly created and plt/got refcounts and dynamic indices should not
812 void (*elf_backend_copy_indirect_symbol
)
813 PARAMS ((struct elf_backend_data
*, struct elf_link_hash_entry
*,
814 struct elf_link_hash_entry
*));
816 /* Modify any information related to dynamic linking such that the
817 symbol is not exported. */
818 void (*elf_backend_hide_symbol
)
819 PARAMS ((struct bfd_link_info
*, struct elf_link_hash_entry
*, bfd_boolean
));
821 /* Emit relocations. Overrides default routine for emitting relocs,
822 except during a relocatable link, or if all relocs are being emitted. */
823 bfd_boolean (*elf_backend_emit_relocs
)
824 PARAMS ((bfd
*, asection
*, Elf_Internal_Shdr
*, Elf_Internal_Rela
*));
826 /* Count relocations. Not called for relocatable links
827 or if all relocs are being preserved in the output. */
828 unsigned int (*elf_backend_count_relocs
)
829 PARAMS ((asection
*, Elf_Internal_Rela
*));
831 /* This function, if defined, is called when an NT_PRSTATUS note is found
833 bfd_boolean (*elf_backend_grok_prstatus
)
834 PARAMS ((bfd
*, Elf_Internal_Note
*));
836 /* This function, if defined, is called when an NT_PSINFO or NT_PRPSINFO
837 note is found in a core file. */
838 bfd_boolean (*elf_backend_grok_psinfo
)
839 PARAMS ((bfd
*, Elf_Internal_Note
*));
841 /* Functions to print VMAs. Special code to handle 64 bit ELF files. */
842 void (* elf_backend_sprintf_vma
)
843 PARAMS ((bfd
*, char *, bfd_vma
));
844 void (* elf_backend_fprintf_vma
)
845 PARAMS ((bfd
*, PTR
, bfd_vma
));
847 /* This function returns class of a reloc type. */
848 enum elf_reloc_type_class (*elf_backend_reloc_type_class
)
849 PARAMS ((const Elf_Internal_Rela
*));
851 /* This function, if defined, removes information about discarded functions
852 from other sections which mention them. */
853 bfd_boolean (*elf_backend_discard_info
)
854 PARAMS ((bfd
*, struct elf_reloc_cookie
*, struct bfd_link_info
*));
856 /* This function, if defined, signals that the function above has removed
857 the discarded relocations for this section. */
858 bfd_boolean (*elf_backend_ignore_discarded_relocs
)
859 PARAMS ((asection
*));
861 /* This function, if defined, may write out the given section.
862 Returns TRUE if it did so and FALSE if the caller should. */
863 bfd_boolean (*elf_backend_write_section
)
864 PARAMS ((bfd
*, asection
*, bfd_byte
*));
866 /* The level of IRIX compatibility we're striving for.
867 MIPS ELF specific function. */
868 irix_compat_t (*elf_backend_mips_irix_compat
)
871 reloc_howto_type
*(*elf_backend_mips_rtype_to_howto
)
872 PARAMS ((unsigned int, bfd_boolean
));
874 /* The swapping table to use when dealing with ECOFF information.
875 Used for the MIPS ELF .mdebug section. */
876 const struct ecoff_debug_swap
*elf_backend_ecoff_debug_swap
;
878 /* This function implements `bfd_elf_bfd_from_remote_memory';
879 see elf.c, elfcode.h. */
880 bfd
*(*elf_backend_bfd_from_remote_memory
)
881 PARAMS ((bfd
*templ
, bfd_vma ehdr_vma
, bfd_vma
*loadbasep
,
882 int (*target_read_memory
) (bfd_vma vma
, char *myaddr
, int len
)));
884 /* Alternate EM_xxxx machine codes for this backend. */
885 int elf_machine_alt1
;
886 int elf_machine_alt2
;
888 const struct elf_size_info
*s
;
890 /* offset of the _GLOBAL_OFFSET_TABLE_ symbol from the start of the
892 bfd_vma got_symbol_offset
;
894 /* The size in bytes of the headers for the GOT and PLT. This includes
895 the so-called reserved entries on some systems. */
896 bfd_vma got_header_size
;
897 bfd_vma plt_header_size
;
899 /* This is TRUE if the linker should act like collect and gather
900 global constructors and destructors by name. This is TRUE for
901 MIPS ELF because the Irix 5 tools can not handle the .init
903 unsigned collect
: 1;
905 /* This is TRUE if the linker should ignore changes to the type of a
906 symbol. This is TRUE for MIPS ELF because some Irix 5 objects
907 record undefined functions as STT_OBJECT although the definitions
909 unsigned type_change_ok
: 1;
911 /* Whether the backend may use REL relocations. (Some backends use
912 both REL and RELA relocations, and this flag is set for those
914 unsigned may_use_rel_p
: 1;
916 /* Whether the backend may use RELA relocations. (Some backends use
917 both REL and RELA relocations, and this flag is set for those
919 unsigned may_use_rela_p
: 1;
921 /* Whether the default relocation type is RELA. If a backend with
922 this flag set wants REL relocations for a particular section,
923 it must note that explicitly. Similarly, if this flag is clear,
924 and the backend wants RELA relocations for a particular
926 unsigned default_use_rela_p
: 1;
928 /* Set if RELA relocations for a relocatable link can be handled by
929 generic code. Backends that set this flag need do nothing in the
930 backend relocate_section routine for relocatable linking. */
931 unsigned rela_normal
: 1;
933 /* TRUE if addresses "naturally" sign extend. This is used when
934 swapping in from Elf32 when BFD64. */
935 unsigned sign_extend_vma
: 1;
937 unsigned want_got_plt
: 1;
938 unsigned plt_readonly
: 1;
939 unsigned want_plt_sym
: 1;
940 unsigned plt_not_loaded
: 1;
941 unsigned plt_alignment
: 4;
942 unsigned can_gc_sections
: 1;
943 unsigned can_refcount
: 1;
944 unsigned want_got_sym
: 1;
945 unsigned want_dynbss
: 1;
946 /* Targets which do not support physical addressing often require
947 that the p_paddr field in the section header to be set to zero.
948 This field indicates whether this behavior is required. */
949 unsigned want_p_paddr_set_to_zero
: 1;
952 /* Information stored for each BFD section in an ELF file. This
953 structure is allocated by elf_new_section_hook. */
955 struct bfd_elf_section_data
957 /* The ELF header for this section. */
958 Elf_Internal_Shdr this_hdr
;
960 /* The ELF header for the reloc section associated with this
962 Elf_Internal_Shdr rel_hdr
;
964 /* If there is a second reloc section associated with this section,
965 as can happen on Irix 6, this field points to the header. */
966 Elf_Internal_Shdr
*rel_hdr2
;
968 /* The number of relocations currently assigned to REL_HDR. */
969 unsigned int rel_count
;
971 /* The number of relocations currently assigned to REL_HDR2. */
972 unsigned int rel_count2
;
974 /* The ELF section number of this section. Only used for an output
978 /* The ELF section number of the reloc section indicated by
979 REL_HDR if any. Only used for an output file. */
982 /* The ELF section number of the reloc section indicated by
983 REL_HDR2 if any. Only used for an output file. */
986 /* Used by the backend linker when generating a shared library to
987 record the dynamic symbol index for a section symbol
988 corresponding to this section. A value of 0 means that there is
989 no dynamic symbol for this section. */
992 /* Used by the backend linker to store the symbol hash table entries
993 associated with relocs against global symbols. */
994 struct elf_link_hash_entry
**rel_hashes
;
996 /* A pointer to the swapped relocs. If the section uses REL relocs,
997 rather than RELA, all the r_addend fields will be zero. This
998 pointer may be NULL. It is used by the backend linker. */
999 Elf_Internal_Rela
*relocs
;
1001 /* A pointer to a linked list tracking dynamic relocs copied for
1005 /* A pointer to the bfd section used for dynamic relocs. */
1009 /* Group name, if this section is a member of a group. */
1012 /* Group signature sym, if this is the SHT_GROUP section. */
1013 struct symbol_cache_entry
*id
;
1016 /* A linked list of sections in the group. Circular when used by
1018 asection
*next_in_group
;
1020 /* A pointer used for various section optimizations. */
1024 #define elf_section_data(sec) ((struct bfd_elf_section_data*)sec->used_by_bfd)
1025 #define elf_group_name(sec) (elf_section_data(sec)->group.name)
1026 #define elf_group_id(sec) (elf_section_data(sec)->group.id)
1027 #define elf_next_in_group(sec) (elf_section_data(sec)->next_in_group)
1029 /* Return TRUE if section has been discarded. */
1030 #define elf_discarded_section(sec) \
1031 (!bfd_is_abs_section (sec) \
1032 && bfd_is_abs_section ((sec)->output_section) \
1033 && sec->sec_info_type != ELF_INFO_TYPE_MERGE \
1034 && sec->sec_info_type != ELF_INFO_TYPE_JUST_SYMS)
1036 #define get_elf_backend_data(abfd) \
1037 ((struct elf_backend_data *) (abfd)->xvec->backend_data)
1039 /* Enumeration to specify the special section. */
1040 typedef enum elf_linker_section_enum
1042 LINKER_SECTION_UNKNOWN
, /* not used */
1043 LINKER_SECTION_GOT
, /* .got section for global offset pointers */
1044 LINKER_SECTION_PLT
, /* .plt section for generated procedure stubs */
1045 LINKER_SECTION_SDATA
, /* .sdata/.sbss section for PowerPC */
1046 LINKER_SECTION_SDATA2
, /* .sdata2/.sbss2 section for PowerPC */
1047 LINKER_SECTION_MAX
/* # of linker sections */
1048 } elf_linker_section_enum_t
;
1050 /* Sections created by the linker. */
1052 typedef struct elf_linker_section
1054 char *name
; /* name of the section */
1055 char *rel_name
; /* name of the associated .rel{,a}. section */
1056 char *bss_name
; /* name of a related .bss section */
1057 char *sym_name
; /* name of symbol to reference this section */
1058 asection
*section
; /* pointer to the section */
1059 asection
*bss_section
; /* pointer to the bss section associated with this */
1060 asection
*rel_section
; /* pointer to the relocations needed for this section */
1061 struct elf_link_hash_entry
*sym_hash
; /* pointer to the created symbol hash value */
1062 bfd_vma initial_size
; /* initial size before any linker generated allocations */
1063 bfd_vma sym_offset
; /* offset of symbol from beginning of section */
1064 bfd_vma hole_size
; /* size of reserved address hole in allocation */
1065 bfd_vma hole_offset
; /* current offset for the hole */
1066 bfd_vma max_hole_offset
; /* maximum offset for the hole */
1067 elf_linker_section_enum_t which
; /* which section this is */
1068 bfd_boolean hole_written_p
; /* whether the hole has been initialized */
1069 unsigned int alignment
; /* alignment for the section */
1070 flagword flags
; /* flags to use to create the section */
1071 } elf_linker_section_t
;
1073 /* Linked list of allocated pointer entries. This hangs off of the symbol lists, and
1074 provides allows us to return different pointers, based on different addend's. */
1076 typedef struct elf_linker_section_pointers
1078 struct elf_linker_section_pointers
*next
; /* next allocated pointer for this symbol */
1079 bfd_vma offset
; /* offset of pointer from beginning of section */
1080 bfd_vma addend
; /* addend used */
1081 elf_linker_section_enum_t which
; /* which linker section this is */
1082 bfd_boolean written_address_p
; /* whether address was written yet */
1083 } elf_linker_section_pointers_t
;
1085 /* This struct is used to pass information to routines called via
1086 elf_link_hash_traverse which must return failure. */
1088 struct elf_info_failed
1091 struct bfd_link_info
*info
;
1092 struct bfd_elf_version_tree
*verdefs
;
1095 /* This structure is used to pass information to
1096 _bfd_elf_link_assign_sym_version. */
1098 struct elf_assign_sym_version_info
1102 /* General link information. */
1103 struct bfd_link_info
*info
;
1105 struct bfd_elf_version_tree
*verdefs
;
1106 /* Whether we had a failure. */
1110 /* This structure is used to pass information to
1111 _bfd_elf_link_find_version_dependencies. */
1113 struct elf_find_verdep_info
1117 /* General link information. */
1118 struct bfd_link_info
*info
;
1119 /* The number of dependencies. */
1121 /* Whether we had a failure. */
1125 /* Some private data is stashed away for future use using the tdata pointer
1126 in the bfd structure. */
1128 struct elf_obj_tdata
1130 Elf_Internal_Ehdr elf_header
[1]; /* Actual data, but ref like ptr */
1131 Elf_Internal_Shdr
**elf_sect_ptr
;
1132 Elf_Internal_Phdr
*phdr
;
1133 struct elf_segment_map
*segment_map
;
1134 struct elf_strtab_hash
*strtab_ptr
;
1137 unsigned int num_elf_sections
; /* elf_sect_ptr size */
1138 int num_section_syms
;
1139 asymbol
**section_syms
; /* STT_SECTION symbols for each section */
1140 Elf_Internal_Shdr symtab_hdr
;
1141 Elf_Internal_Shdr shstrtab_hdr
;
1142 Elf_Internal_Shdr strtab_hdr
;
1143 Elf_Internal_Shdr dynsymtab_hdr
;
1144 Elf_Internal_Shdr dynstrtab_hdr
;
1145 Elf_Internal_Shdr dynversym_hdr
;
1146 Elf_Internal_Shdr dynverref_hdr
;
1147 Elf_Internal_Shdr dynverdef_hdr
;
1148 Elf_Internal_Shdr symtab_shndx_hdr
;
1149 unsigned int symtab_section
, shstrtab_section
;
1150 unsigned int strtab_section
, dynsymtab_section
;
1151 unsigned int symtab_shndx_section
;
1152 unsigned int dynversym_section
, dynverdef_section
, dynverref_section
;
1153 file_ptr next_file_pos
;
1155 /* we don't need these inside bfd anymore, and I think
1156 these weren't used outside bfd. */
1157 void *prstatus
; /* The raw /proc prstatus structure */
1158 void *prpsinfo
; /* The raw /proc prpsinfo structure */
1160 bfd_vma gp
; /* The gp value */
1161 unsigned int gp_size
; /* The gp size */
1163 Elf_Internal_Shdr
**group_sect_ptr
;
1166 /* Information grabbed from an elf core file. */
1173 /* This is set to TRUE if the object was created by the backend
1177 /* A mapping from external symbols to entries in the linker hash
1178 table, used when linking. This is indexed by the symbol index
1179 minus the sh_info field of the symbol table header. */
1180 struct elf_link_hash_entry
**sym_hashes
;
1182 /* Track usage and final offsets of GOT entries for local symbols.
1183 This array is indexed by symbol index. Elements are used
1184 identically to "got" in struct elf_link_hash_entry. */
1187 bfd_signed_vma
*refcounts
;
1189 struct got_entry
**ents
;
1192 /* A mapping from local symbols to offsets into the various linker
1193 sections added. This is index by the symbol index. */
1194 elf_linker_section_pointers_t
**linker_section_pointers
;
1196 /* The linker ELF emulation code needs to let the backend ELF linker
1197 know what filename should be used for a dynamic object if the
1198 dynamic object is found using a search. The emulation code then
1199 sometimes needs to know what name was actually used. Until the
1200 file has been added to the linker symbol table, this field holds
1201 the name the linker wants. After it has been added, it holds the
1202 name actually used, which will be the DT_SONAME entry if there is
1204 const char *dt_name
;
1206 /* When a reference in a regular object is resolved by a shared
1207 object is loaded into via the DT_NEEDED entries by the linker
1208 ELF emulation code, we need to add the shared object to the
1209 DT_NEEDED list of the resulting binary to indicate the dependency
1210 as if the -l option is passed to the linker. This field holds the
1211 name of the loaded shared object. */
1212 const char *dt_soname
;
1214 /* Irix 5 often screws up the symbol table, sorting local symbols
1215 after global symbols. This flag is set if the symbol table in
1216 this BFD appears to be screwed up. If it is, we ignore the
1217 sh_info field in the symbol table header, and always read all the
1219 bfd_boolean bad_symtab
;
1221 /* Records the result of `get_program_header_size'. */
1222 bfd_size_type program_header_size
;
1224 /* Used by find_nearest_line entry point. */
1227 /* Used by MIPS ELF find_nearest_line entry point. The structure
1228 could be included directly in this one, but there's no point to
1229 wasting the memory just for the infrequently called
1230 find_nearest_line. */
1231 struct mips_elf_find_line
*find_line_info
;
1233 /* A place to stash dwarf1 info for this bfd. */
1234 struct dwarf1_debug
*dwarf1_find_line_info
;
1236 /* A place to stash dwarf2 info for this bfd. */
1237 PTR dwarf2_find_line_info
;
1239 /* An array of stub sections indexed by symbol number, used by the
1240 MIPS ELF linker. FIXME: We should figure out some way to only
1241 include this field for a MIPS ELF target. */
1242 asection
**local_stubs
;
1244 /* Used to determine if PT_GNU_EH_FRAME segment header should be
1246 asection
*eh_frame_hdr
;
1248 /* Used to determine if the e_flags field has been initialized */
1249 bfd_boolean flags_init
;
1251 /* Number of symbol version definitions we are about to emit. */
1252 unsigned int cverdefs
;
1254 /* Number of symbol version references we are about to emit. */
1255 unsigned int cverrefs
;
1257 /* Segment flags for the PT_GNU_STACK segment. */
1258 unsigned int stack_flags
;
1260 /* Symbol version definitions in external objects. */
1261 Elf_Internal_Verdef
*verdef
;
1263 /* Symbol version references to external objects. */
1264 Elf_Internal_Verneed
*verref
;
1266 /* Linker sections that we are interested in. */
1267 struct elf_linker_section
*linker_section
[ (int)LINKER_SECTION_MAX
];
1269 /* The Irix 5 support uses two virtual sections, which represent
1270 text/data symbols defined in dynamic objects. */
1271 asymbol
*elf_data_symbol
;
1272 asymbol
*elf_text_symbol
;
1273 asection
*elf_data_section
;
1274 asection
*elf_text_section
;
1277 #define elf_tdata(bfd) ((bfd) -> tdata.elf_obj_data)
1278 #define elf_elfheader(bfd) (elf_tdata(bfd) -> elf_header)
1279 #define elf_elfsections(bfd) (elf_tdata(bfd) -> elf_sect_ptr)
1280 #define elf_numsections(bfd) (elf_tdata(bfd) -> num_elf_sections)
1281 #define elf_shstrtab(bfd) (elf_tdata(bfd) -> strtab_ptr)
1282 #define elf_onesymtab(bfd) (elf_tdata(bfd) -> symtab_section)
1283 #define elf_symtab_shndx(bfd) (elf_tdata(bfd) -> symtab_shndx_section)
1284 #define elf_dynsymtab(bfd) (elf_tdata(bfd) -> dynsymtab_section)
1285 #define elf_dynversym(bfd) (elf_tdata(bfd) -> dynversym_section)
1286 #define elf_dynverdef(bfd) (elf_tdata(bfd) -> dynverdef_section)
1287 #define elf_dynverref(bfd) (elf_tdata(bfd) -> dynverref_section)
1288 #define elf_num_locals(bfd) (elf_tdata(bfd) -> num_locals)
1289 #define elf_num_globals(bfd) (elf_tdata(bfd) -> num_globals)
1290 #define elf_section_syms(bfd) (elf_tdata(bfd) -> section_syms)
1291 #define elf_num_section_syms(bfd) (elf_tdata(bfd) -> num_section_syms)
1292 #define core_prpsinfo(bfd) (elf_tdata(bfd) -> prpsinfo)
1293 #define core_prstatus(bfd) (elf_tdata(bfd) -> prstatus)
1294 #define elf_gp(bfd) (elf_tdata(bfd) -> gp)
1295 #define elf_gp_size(bfd) (elf_tdata(bfd) -> gp_size)
1296 #define elf_sym_hashes(bfd) (elf_tdata(bfd) -> sym_hashes)
1297 #define elf_local_got_refcounts(bfd) (elf_tdata(bfd) -> local_got.refcounts)
1298 #define elf_local_got_offsets(bfd) (elf_tdata(bfd) -> local_got.offsets)
1299 #define elf_local_got_ents(bfd) (elf_tdata(bfd) -> local_got.ents)
1300 #define elf_local_ptr_offsets(bfd) (elf_tdata(bfd) -> linker_section_pointers)
1301 #define elf_dt_name(bfd) (elf_tdata(bfd) -> dt_name)
1302 #define elf_dt_soname(bfd) (elf_tdata(bfd) -> dt_soname)
1303 #define elf_bad_symtab(bfd) (elf_tdata(bfd) -> bad_symtab)
1304 #define elf_flags_init(bfd) (elf_tdata(bfd) -> flags_init)
1305 #define elf_linker_section(bfd,n) (elf_tdata(bfd) -> linker_section[(int)n])
1307 extern void _bfd_elf_swap_verdef_in
1308 PARAMS ((bfd
*, const Elf_External_Verdef
*, Elf_Internal_Verdef
*));
1309 extern void _bfd_elf_swap_verdef_out
1310 PARAMS ((bfd
*, const Elf_Internal_Verdef
*, Elf_External_Verdef
*));
1311 extern void _bfd_elf_swap_verdaux_in
1312 PARAMS ((bfd
*, const Elf_External_Verdaux
*, Elf_Internal_Verdaux
*));
1313 extern void _bfd_elf_swap_verdaux_out
1314 PARAMS ((bfd
*, const Elf_Internal_Verdaux
*, Elf_External_Verdaux
*));
1315 extern void _bfd_elf_swap_verneed_in
1316 PARAMS ((bfd
*, const Elf_External_Verneed
*, Elf_Internal_Verneed
*));
1317 extern void _bfd_elf_swap_verneed_out
1318 PARAMS ((bfd
*, const Elf_Internal_Verneed
*, Elf_External_Verneed
*));
1319 extern void _bfd_elf_swap_vernaux_in
1320 PARAMS ((bfd
*, const Elf_External_Vernaux
*, Elf_Internal_Vernaux
*));
1321 extern void _bfd_elf_swap_vernaux_out
1322 PARAMS ((bfd
*, const Elf_Internal_Vernaux
*, Elf_External_Vernaux
*));
1323 extern void _bfd_elf_swap_versym_in
1324 PARAMS ((bfd
*, const Elf_External_Versym
*, Elf_Internal_Versym
*));
1325 extern void _bfd_elf_swap_versym_out
1326 PARAMS ((bfd
*, const Elf_Internal_Versym
*, Elf_External_Versym
*));
1328 extern int _bfd_elf_section_from_bfd_section
1329 PARAMS ((bfd
*, asection
*));
1330 extern char *bfd_elf_string_from_elf_section
1331 PARAMS ((bfd
*, unsigned, unsigned));
1332 extern char *bfd_elf_get_str_section
1333 PARAMS ((bfd
*, unsigned));
1334 extern Elf_Internal_Sym
*bfd_elf_get_elf_syms
1335 PARAMS ((bfd
*, Elf_Internal_Shdr
*, size_t, size_t,
1336 Elf_Internal_Sym
*, PTR
, Elf_External_Sym_Shndx
*));
1337 extern const char *bfd_elf_local_sym_name
1338 PARAMS ((bfd
*, Elf_Internal_Sym
*));
1340 extern bfd_boolean _bfd_elf_copy_private_bfd_data
1341 PARAMS ((bfd
*, bfd
*));
1342 extern bfd_boolean _bfd_elf_print_private_bfd_data
1343 PARAMS ((bfd
*, PTR
));
1344 extern void bfd_elf_print_symbol
1345 PARAMS ((bfd
*, PTR
, asymbol
*, bfd_print_symbol_type
));
1347 #define elf_string_from_elf_strtab(abfd, strindex) \
1348 bfd_elf_string_from_elf_section(abfd, elf_elfheader(abfd)->e_shstrndx, \
1351 #define bfd_elf32_print_symbol bfd_elf_print_symbol
1352 #define bfd_elf64_print_symbol bfd_elf_print_symbol
1354 extern void _bfd_elf_sprintf_vma
1355 PARAMS ((bfd
*, char *, bfd_vma
));
1356 extern void _bfd_elf_fprintf_vma
1357 PARAMS ((bfd
*, PTR
, bfd_vma
));
1359 extern enum elf_reloc_type_class _bfd_elf_reloc_type_class
1360 PARAMS ((const Elf_Internal_Rela
*));
1361 extern bfd_vma _bfd_elf_rela_local_sym
1362 PARAMS ((bfd
*, Elf_Internal_Sym
*, asection
*, Elf_Internal_Rela
*));
1363 extern bfd_vma _bfd_elf_rel_local_sym
1364 PARAMS ((bfd
*, Elf_Internal_Sym
*, asection
**, bfd_vma
));
1365 extern bfd_vma _bfd_elf_section_offset
1366 PARAMS ((bfd
*, struct bfd_link_info
*, asection
*, bfd_vma
));
1368 extern unsigned long bfd_elf_hash
1369 PARAMS ((const char *));
1371 extern bfd_reloc_status_type bfd_elf_generic_reloc
1372 PARAMS ((bfd
*, arelent
*, asymbol
*, PTR
, asection
*, bfd
*, char **));
1373 extern bfd_boolean bfd_elf_mkobject
1375 extern bfd_boolean bfd_elf_mkcorefile
1377 extern Elf_Internal_Shdr
*bfd_elf_find_section
1378 PARAMS ((bfd
*, char *));
1379 extern bfd_boolean _bfd_elf_make_section_from_shdr
1380 PARAMS ((bfd
*, Elf_Internal_Shdr
*, const char *));
1381 extern bfd_boolean _bfd_elf_make_section_from_phdr
1382 PARAMS ((bfd
*, Elf_Internal_Phdr
*, int, const char *));
1383 extern struct bfd_hash_entry
*_bfd_elf_link_hash_newfunc
1384 PARAMS ((struct bfd_hash_entry
*, struct bfd_hash_table
*, const char *));
1385 extern struct bfd_link_hash_table
*_bfd_elf_link_hash_table_create
1387 extern void _bfd_elf_link_hash_copy_indirect
1388 PARAMS ((struct elf_backend_data
*, struct elf_link_hash_entry
*,
1389 struct elf_link_hash_entry
*));
1390 extern void _bfd_elf_link_hash_hide_symbol
1391 PARAMS ((struct bfd_link_info
*, struct elf_link_hash_entry
*, bfd_boolean
));
1392 extern bfd_boolean _bfd_elf_link_hash_table_init
1393 PARAMS ((struct elf_link_hash_table
*, bfd
*,
1394 struct bfd_hash_entry
*(*) (struct bfd_hash_entry
*,
1395 struct bfd_hash_table
*,
1397 extern bfd_boolean _bfd_elf_slurp_version_tables
1399 extern bfd_boolean _bfd_elf_merge_sections
1400 PARAMS ((bfd
*, struct bfd_link_info
*));
1401 extern bfd_boolean bfd_elf_discard_group
1402 PARAMS ((bfd
*, struct sec
*));
1403 extern void bfd_elf_set_group_contents
1404 PARAMS ((bfd
*, asection
*, PTR
));
1405 extern void _bfd_elf_link_just_syms
1406 PARAMS ((asection
*, struct bfd_link_info
*));
1407 extern bfd_boolean _bfd_elf_copy_private_symbol_data
1408 PARAMS ((bfd
*, asymbol
*, bfd
*, asymbol
*));
1409 extern bfd_boolean _bfd_elf_copy_private_section_data
1410 PARAMS ((bfd
*, asection
*, bfd
*, asection
*));
1411 extern bfd_boolean _bfd_elf_write_object_contents
1413 extern bfd_boolean _bfd_elf_write_corefile_contents
1415 extern bfd_boolean _bfd_elf_set_section_contents
1416 PARAMS ((bfd
*, sec_ptr
, PTR
, file_ptr
, bfd_size_type
));
1417 extern long _bfd_elf_get_symtab_upper_bound
1419 extern long _bfd_elf_get_symtab
1420 PARAMS ((bfd
*, asymbol
**));
1421 extern long _bfd_elf_get_dynamic_symtab_upper_bound
1423 extern long _bfd_elf_canonicalize_dynamic_symtab
1424 PARAMS ((bfd
*, asymbol
**));
1425 extern long _bfd_elf_get_reloc_upper_bound
1426 PARAMS ((bfd
*, sec_ptr
));
1427 extern long _bfd_elf_canonicalize_reloc
1428 PARAMS ((bfd
*, sec_ptr
, arelent
**, asymbol
**));
1429 extern long _bfd_elf_get_dynamic_reloc_upper_bound
1431 extern long _bfd_elf_canonicalize_dynamic_reloc
1432 PARAMS ((bfd
*, arelent
**, asymbol
**));
1433 extern asymbol
*_bfd_elf_make_empty_symbol
1435 extern void _bfd_elf_get_symbol_info
1436 PARAMS ((bfd
*, asymbol
*, symbol_info
*));
1437 extern bfd_boolean _bfd_elf_is_local_label_name
1438 PARAMS ((bfd
*, const char *));
1439 extern alent
*_bfd_elf_get_lineno
1440 PARAMS ((bfd
*, asymbol
*));
1441 extern bfd_boolean _bfd_elf_set_arch_mach
1442 PARAMS ((bfd
*, enum bfd_architecture
, unsigned long));
1443 extern bfd_boolean _bfd_elf_find_nearest_line
1444 PARAMS ((bfd
*, asection
*, asymbol
**, bfd_vma
, const char **,
1445 const char **, unsigned int *));
1446 #define _bfd_elf_read_minisymbols _bfd_generic_read_minisymbols
1447 #define _bfd_elf_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
1448 extern int _bfd_elf_sizeof_headers
1449 PARAMS ((bfd
*, bfd_boolean
));
1450 extern bfd_boolean _bfd_elf_new_section_hook
1451 PARAMS ((bfd
*, asection
*));
1452 extern bfd_boolean _bfd_elf_init_reloc_shdr
1453 PARAMS ((bfd
*, Elf_Internal_Shdr
*, asection
*, bfd_boolean
));
1455 /* If the target doesn't have reloc handling written yet: */
1456 extern void _bfd_elf_no_info_to_howto
1457 PARAMS ((bfd
*, arelent
*, Elf_Internal_Rela
*));
1459 extern bfd_boolean bfd_section_from_shdr
1460 PARAMS ((bfd
*, unsigned int shindex
));
1461 extern bfd_boolean bfd_section_from_phdr
1462 PARAMS ((bfd
*, Elf_Internal_Phdr
*, int));
1464 extern int _bfd_elf_symbol_from_bfd_symbol
1465 PARAMS ((bfd
*, asymbol
**));
1467 extern asection
*bfd_section_from_r_symndx
1468 PARAMS ((bfd
*, struct sym_sec_cache
*, asection
*, unsigned long));
1469 extern asection
*bfd_section_from_elf_index
1470 PARAMS ((bfd
*, unsigned int));
1471 extern struct bfd_strtab_hash
*_bfd_elf_stringtab_init
1474 extern struct elf_strtab_hash
* _bfd_elf_strtab_init
1476 extern void _bfd_elf_strtab_free
1477 PARAMS ((struct elf_strtab_hash
*));
1478 extern bfd_size_type _bfd_elf_strtab_add
1479 PARAMS ((struct elf_strtab_hash
*, const char *, bfd_boolean
));
1480 extern void _bfd_elf_strtab_addref
1481 PARAMS ((struct elf_strtab_hash
*, bfd_size_type
));
1482 extern void _bfd_elf_strtab_delref
1483 PARAMS ((struct elf_strtab_hash
*, bfd_size_type
));
1484 extern void _bfd_elf_strtab_clear_all_refs
1485 PARAMS ((struct elf_strtab_hash
*));
1486 extern bfd_size_type _bfd_elf_strtab_size
1487 PARAMS ((struct elf_strtab_hash
*));
1488 extern bfd_size_type _bfd_elf_strtab_offset
1489 PARAMS ((struct elf_strtab_hash
*, bfd_size_type
));
1490 extern bfd_boolean _bfd_elf_strtab_emit
1491 PARAMS ((bfd
*, struct elf_strtab_hash
*));
1492 extern void _bfd_elf_strtab_finalize
1493 PARAMS ((struct elf_strtab_hash
*));
1495 extern bfd_boolean _bfd_elf_discard_section_eh_frame
1496 PARAMS ((bfd
*, struct bfd_link_info
*, asection
*,
1497 bfd_boolean (*) (bfd_vma
, PTR
), struct elf_reloc_cookie
*));
1498 extern bfd_boolean _bfd_elf_discard_section_eh_frame_hdr
1499 PARAMS ((bfd
*, struct bfd_link_info
*));
1500 extern bfd_vma _bfd_elf_eh_frame_section_offset
1501 PARAMS ((bfd
*, asection
*, bfd_vma
));
1502 extern bfd_boolean _bfd_elf_write_section_eh_frame
1503 PARAMS ((bfd
*, struct bfd_link_info
*, asection
*, bfd_byte
*));
1504 extern bfd_boolean _bfd_elf_write_section_eh_frame_hdr
1505 PARAMS ((bfd
*, struct bfd_link_info
*));
1506 extern bfd_boolean _bfd_elf_maybe_strip_eh_frame_hdr
1507 PARAMS ((struct bfd_link_info
*));
1509 extern bfd_boolean _bfd_elf_merge_symbol
1510 PARAMS ((bfd
*, struct bfd_link_info
*, const char *,
1511 Elf_Internal_Sym
*, asection
**, bfd_vma
*,
1512 struct elf_link_hash_entry
**, bfd_boolean
*, bfd_boolean
*,
1513 bfd_boolean
*, bfd_boolean
*, bfd_boolean
));
1515 extern bfd_boolean _bfd_elf_add_default_symbol
1516 PARAMS ((bfd
*, struct bfd_link_info
*, struct elf_link_hash_entry
*,
1517 const char *, Elf_Internal_Sym
*, asection
**, bfd_vma
*,
1518 bfd_boolean
*, bfd_boolean
, bfd_boolean
));
1520 extern bfd_boolean _bfd_elf_export_symbol
1521 PARAMS ((struct elf_link_hash_entry
*, PTR
));
1523 extern bfd_boolean _bfd_elf_link_find_version_dependencies
1524 PARAMS ((struct elf_link_hash_entry
*, PTR
));
1526 extern bfd_boolean _bfd_elf_link_assign_sym_version
1527 PARAMS ((struct elf_link_hash_entry
*, PTR
));
1529 extern bfd_boolean _bfd_elf_link_record_dynamic_symbol
1530 PARAMS ((struct bfd_link_info
*, struct elf_link_hash_entry
*));
1531 extern long _bfd_elf_link_lookup_local_dynindx
1532 PARAMS ((struct bfd_link_info
*, bfd
*, long));
1533 extern bfd_boolean _bfd_elf_compute_section_file_positions
1534 PARAMS ((bfd
*, struct bfd_link_info
*));
1535 extern void _bfd_elf_assign_file_positions_for_relocs
1537 extern file_ptr _bfd_elf_assign_file_position_for_section
1538 PARAMS ((Elf_Internal_Shdr
*, file_ptr
, bfd_boolean
));
1540 extern bfd_boolean _bfd_elf_validate_reloc
1541 PARAMS ((bfd
*, arelent
*));
1543 extern bfd_boolean _bfd_elf_link_create_dynamic_sections
1544 PARAMS ((bfd
*, struct bfd_link_info
*));
1545 extern bfd_boolean _bfd_elf_create_dynamic_sections
1546 PARAMS ((bfd
*, struct bfd_link_info
*));
1547 extern bfd_boolean _bfd_elf_create_got_section
1548 PARAMS ((bfd
*, struct bfd_link_info
*));
1549 extern unsigned long _bfd_elf_link_renumber_dynsyms
1550 PARAMS ((bfd
*, struct bfd_link_info
*));
1552 extern bfd_boolean _bfd_elfcore_make_pseudosection
1553 PARAMS ((bfd
*, char *, size_t, ufile_ptr
));
1554 extern char *_bfd_elfcore_strndup
1555 PARAMS ((bfd
*, char *, size_t));
1557 extern elf_linker_section_t
*_bfd_elf_create_linker_section
1558 PARAMS ((bfd
*, struct bfd_link_info
*, enum elf_linker_section_enum
,
1559 elf_linker_section_t
*));
1561 extern elf_linker_section_pointers_t
*_bfd_elf_find_pointer_linker_section
1562 PARAMS ((elf_linker_section_pointers_t
*, bfd_vma
,
1563 elf_linker_section_enum_t
));
1565 extern bfd_boolean bfd_elf32_create_pointer_linker_section
1566 PARAMS ((bfd
*, struct bfd_link_info
*, elf_linker_section_t
*,
1567 struct elf_link_hash_entry
*, const Elf_Internal_Rela
*));
1569 extern bfd_vma bfd_elf32_finish_pointer_linker_section
1570 PARAMS ((bfd
*, bfd
*, struct bfd_link_info
*, elf_linker_section_t
*,
1571 struct elf_link_hash_entry
*, bfd_vma
,
1572 const Elf_Internal_Rela
*, int));
1574 extern bfd_boolean bfd_elf64_create_pointer_linker_section
1575 PARAMS ((bfd
*, struct bfd_link_info
*, elf_linker_section_t
*,
1576 struct elf_link_hash_entry
*, const Elf_Internal_Rela
*));
1578 extern bfd_vma bfd_elf64_finish_pointer_linker_section
1579 PARAMS ((bfd
*, bfd
*, struct bfd_link_info
*, elf_linker_section_t
*,
1580 struct elf_link_hash_entry
*, bfd_vma
,
1581 const Elf_Internal_Rela
*, int));
1583 extern bfd_boolean _bfd_elf_make_linker_section_rela
1584 PARAMS ((bfd
*, elf_linker_section_t
*, int));
1586 extern Elf_Internal_Rela
*_bfd_elf_link_read_relocs
1587 PARAMS ((bfd
*, asection
*, PTR
, Elf_Internal_Rela
*, bfd_boolean
));
1589 extern bfd_boolean _bfd_elf_link_size_reloc_section
1590 PARAMS ((bfd
*, Elf_Internal_Shdr
*, asection
*));
1592 extern bfd_boolean _bfd_elf_link_output_relocs
1593 PARAMS ((bfd
*, asection
*, Elf_Internal_Shdr
*, Elf_Internal_Rela
*));
1595 extern bfd_boolean _bfd_elf_fix_symbol_flags
1596 PARAMS ((struct elf_link_hash_entry
*, struct elf_info_failed
*));
1598 extern bfd_boolean _bfd_elf_adjust_dynamic_symbol
1599 PARAMS ((struct elf_link_hash_entry
*, PTR
));
1601 extern bfd_boolean _bfd_elf_link_sec_merge_syms
1602 PARAMS ((struct elf_link_hash_entry
*, PTR
));
1604 extern const bfd_target
*bfd_elf32_object_p
1606 extern const bfd_target
*bfd_elf32_core_file_p
1608 extern char *bfd_elf32_core_file_failing_command
1610 extern int bfd_elf32_core_file_failing_signal
1612 extern bfd_boolean bfd_elf32_core_file_matches_executable_p
1613 PARAMS ((bfd
*, bfd
*));
1615 extern bfd_boolean bfd_elf32_bfd_link_add_symbols
1616 PARAMS ((bfd
*, struct bfd_link_info
*));
1617 extern bfd_boolean bfd_elf32_bfd_final_link
1618 PARAMS ((bfd
*, struct bfd_link_info
*));
1620 extern void bfd_elf32_swap_symbol_in
1621 PARAMS ((bfd
*, const PTR
, const PTR
, Elf_Internal_Sym
*));
1622 extern void bfd_elf32_swap_symbol_out
1623 PARAMS ((bfd
*, const Elf_Internal_Sym
*, PTR
, PTR
));
1624 extern void bfd_elf32_swap_reloc_in
1625 PARAMS ((bfd
*, const bfd_byte
*, Elf_Internal_Rela
*));
1626 extern void bfd_elf32_swap_reloc_out
1627 PARAMS ((bfd
*, const Elf_Internal_Rela
*, bfd_byte
*));
1628 extern void bfd_elf32_swap_reloca_in
1629 PARAMS ((bfd
*, const bfd_byte
*, Elf_Internal_Rela
*));
1630 extern void bfd_elf32_swap_reloca_out
1631 PARAMS ((bfd
*, const Elf_Internal_Rela
*, bfd_byte
*));
1632 extern void bfd_elf32_swap_phdr_in
1633 PARAMS ((bfd
*, const Elf32_External_Phdr
*, Elf_Internal_Phdr
*));
1634 extern void bfd_elf32_swap_phdr_out
1635 PARAMS ((bfd
*, const Elf_Internal_Phdr
*, Elf32_External_Phdr
*));
1636 extern void bfd_elf32_swap_dyn_in
1637 PARAMS ((bfd
*, const PTR
, Elf_Internal_Dyn
*));
1638 extern void bfd_elf32_swap_dyn_out
1639 PARAMS ((bfd
*, const Elf_Internal_Dyn
*, PTR
));
1640 extern long bfd_elf32_slurp_symbol_table
1641 PARAMS ((bfd
*, asymbol
**, bfd_boolean
));
1642 extern bfd_boolean bfd_elf32_write_shdrs_and_ehdr
1644 extern int bfd_elf32_write_out_phdrs
1645 PARAMS ((bfd
*, const Elf_Internal_Phdr
*, unsigned int));
1646 extern void bfd_elf32_write_relocs
1647 PARAMS ((bfd
*, asection
*, PTR
));
1648 extern bfd_boolean bfd_elf32_slurp_reloc_table
1649 PARAMS ((bfd
*, asection
*, asymbol
**, bfd_boolean
));
1650 extern bfd_boolean bfd_elf32_add_dynamic_entry
1651 PARAMS ((struct bfd_link_info
*, bfd_vma
, bfd_vma
));
1653 extern const bfd_target
*bfd_elf64_object_p
1655 extern const bfd_target
*bfd_elf64_core_file_p
1657 extern char *bfd_elf64_core_file_failing_command
1659 extern int bfd_elf64_core_file_failing_signal
1661 extern bfd_boolean bfd_elf64_core_file_matches_executable_p
1662 PARAMS ((bfd
*, bfd
*));
1663 extern bfd_boolean bfd_elf64_bfd_link_add_symbols
1664 PARAMS ((bfd
*, struct bfd_link_info
*));
1665 extern bfd_boolean bfd_elf64_bfd_final_link
1666 PARAMS ((bfd
*, struct bfd_link_info
*));
1668 extern void bfd_elf64_swap_symbol_in
1669 PARAMS ((bfd
*, const PTR
, const PTR
, Elf_Internal_Sym
*));
1670 extern void bfd_elf64_swap_symbol_out
1671 PARAMS ((bfd
*, const Elf_Internal_Sym
*, PTR
, PTR
));
1672 extern void bfd_elf64_swap_reloc_in
1673 PARAMS ((bfd
*, const bfd_byte
*, Elf_Internal_Rela
*));
1674 extern void bfd_elf64_swap_reloc_out
1675 PARAMS ((bfd
*, const Elf_Internal_Rela
*, bfd_byte
*));
1676 extern void bfd_elf64_swap_reloca_in
1677 PARAMS ((bfd
*, const bfd_byte
*, Elf_Internal_Rela
*));
1678 extern void bfd_elf64_swap_reloca_out
1679 PARAMS ((bfd
*, const Elf_Internal_Rela
*, bfd_byte
*));
1680 extern void bfd_elf64_swap_phdr_in
1681 PARAMS ((bfd
*, const Elf64_External_Phdr
*, Elf_Internal_Phdr
*));
1682 extern void bfd_elf64_swap_phdr_out
1683 PARAMS ((bfd
*, const Elf_Internal_Phdr
*, Elf64_External_Phdr
*));
1684 extern void bfd_elf64_swap_dyn_in
1685 PARAMS ((bfd
*, const PTR
, Elf_Internal_Dyn
*));
1686 extern void bfd_elf64_swap_dyn_out
1687 PARAMS ((bfd
*, const Elf_Internal_Dyn
*, PTR
));
1688 extern long bfd_elf64_slurp_symbol_table
1689 PARAMS ((bfd
*, asymbol
**, bfd_boolean
));
1690 extern bfd_boolean bfd_elf64_write_shdrs_and_ehdr
1692 extern int bfd_elf64_write_out_phdrs
1693 PARAMS ((bfd
*, const Elf_Internal_Phdr
*, unsigned int));
1694 extern void bfd_elf64_write_relocs
1695 PARAMS ((bfd
*, asection
*, PTR
));
1696 extern bfd_boolean bfd_elf64_slurp_reloc_table
1697 PARAMS ((bfd
*, asection
*, asymbol
**, bfd_boolean
));
1698 extern bfd_boolean bfd_elf64_add_dynamic_entry
1699 PARAMS ((struct bfd_link_info
*, bfd_vma
, bfd_vma
));
1701 #define bfd_elf32_link_record_dynamic_symbol \
1702 _bfd_elf_link_record_dynamic_symbol
1703 #define bfd_elf64_link_record_dynamic_symbol \
1704 _bfd_elf_link_record_dynamic_symbol
1706 extern int elf_link_record_local_dynamic_symbol
1707 PARAMS ((struct bfd_link_info
*, bfd
*, long));
1708 #define _bfd_elf32_link_record_local_dynamic_symbol \
1709 elf_link_record_local_dynamic_symbol
1710 #define _bfd_elf64_link_record_local_dynamic_symbol \
1711 elf_link_record_local_dynamic_symbol
1713 extern bfd_boolean _bfd_elf_close_and_cleanup
1715 extern bfd_reloc_status_type _bfd_elf_rel_vtable_reloc_fn
1716 PARAMS ((bfd
*, arelent
*, struct symbol_cache_entry
*, PTR
,
1717 asection
*, bfd
*, char **));
1719 extern bfd_boolean _bfd_elf32_gc_sections
1720 PARAMS ((bfd
*, struct bfd_link_info
*));
1721 extern bfd_boolean _bfd_elf32_gc_common_finalize_got_offsets
1722 PARAMS ((bfd
*, struct bfd_link_info
*));
1723 extern bfd_boolean _bfd_elf32_gc_common_final_link
1724 PARAMS ((bfd
*, struct bfd_link_info
*));
1725 extern bfd_boolean _bfd_elf32_gc_record_vtinherit
1726 PARAMS ((bfd
*, asection
*, struct elf_link_hash_entry
*, bfd_vma
));
1727 extern bfd_boolean _bfd_elf32_gc_record_vtentry
1728 PARAMS ((bfd
*, asection
*, struct elf_link_hash_entry
*, bfd_vma
));
1730 extern bfd_boolean _bfd_elf64_gc_sections
1731 PARAMS ((bfd
*, struct bfd_link_info
*));
1732 extern bfd_boolean _bfd_elf64_gc_common_finalize_got_offsets
1733 PARAMS ((bfd
*, struct bfd_link_info
*));
1734 extern bfd_boolean _bfd_elf64_gc_common_final_link
1735 PARAMS ((bfd
*, struct bfd_link_info
*));
1736 extern bfd_boolean _bfd_elf64_gc_record_vtinherit
1737 PARAMS ((bfd
*, asection
*, struct elf_link_hash_entry
*, bfd_vma
));
1738 extern bfd_boolean _bfd_elf64_gc_record_vtentry
1739 PARAMS ((bfd
*, asection
*, struct elf_link_hash_entry
*, bfd_vma
));
1741 extern bfd_boolean _bfd_elf32_reloc_symbol_deleted_p
1742 PARAMS ((bfd_vma
, PTR
));
1743 extern bfd_boolean _bfd_elf64_reloc_symbol_deleted_p
1744 PARAMS ((bfd_vma
, PTR
));
1746 /* Exported interface for writing elf corefile notes. */
1747 extern char *elfcore_write_note
1748 PARAMS ((bfd
*, char *, int *, const char *, int, const PTR
, int));
1749 extern char *elfcore_write_prpsinfo
1750 PARAMS ((bfd
*, char *, int *, const char *, const char *));
1751 extern char *elfcore_write_prstatus
1752 PARAMS ((bfd
*, char *, int *, long, int, const PTR
));
1753 extern char * elfcore_write_pstatus
1754 PARAMS ((bfd
*, char *, int *, long, int, const PTR
));
1755 extern char *elfcore_write_prfpreg
1756 PARAMS ((bfd
*, char *, int *, const PTR
, int));
1757 extern char *elfcore_write_prxfpreg
1758 PARAMS ((bfd
*, char *, int *, const PTR
, int));
1759 extern char *elfcore_write_lwpstatus
1760 PARAMS ((bfd
*, char *, int *, long, int, const PTR
));
1762 extern bfd
*_bfd_elf32_bfd_from_remote_memory
1763 PARAMS ((bfd
*templ
, bfd_vma ehdr_vma
, bfd_vma
*loadbasep
,
1764 int (*target_read_memory
) (bfd_vma
, char *, int)));
1765 extern bfd
*_bfd_elf64_bfd_from_remote_memory
1766 PARAMS ((bfd
*templ
, bfd_vma ehdr_vma
, bfd_vma
*loadbasep
,
1767 int (*target_read_memory
) (bfd_vma
, char *, int)));
1769 /* SH ELF specific routine. */
1771 extern bfd_boolean _sh_elf_set_mach_from_flags
1774 #endif /* _LIBELF_H_ */