elf-bfd.h revision 104834
133965Sjdp/* BFD back-end data structures for ELF files.
289857Sobrien   Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
389857Sobrien   2002 Free Software Foundation, Inc.
433965Sjdp   Written by Cygnus Support.
533965Sjdp
633965SjdpThis file is part of BFD, the Binary File Descriptor library.
733965Sjdp
833965SjdpThis program is free software; you can redistribute it and/or modify
933965Sjdpit under the terms of the GNU General Public License as published by
1033965Sjdpthe Free Software Foundation; either version 2 of the License, or
1133965Sjdp(at your option) any later version.
1233965Sjdp
1333965SjdpThis program is distributed in the hope that it will be useful,
1433965Sjdpbut WITHOUT ANY WARRANTY; without even the implied warranty of
1533965SjdpMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1633965SjdpGNU General Public License for more details.
1733965Sjdp
1833965SjdpYou should have received a copy of the GNU General Public License
1933965Sjdpalong with this program; if not, write to the Free Software
2033965SjdpFoundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
2133965Sjdp
2233965Sjdp#ifndef _LIBELF_H_
2333965Sjdp#define _LIBELF_H_ 1
2433965Sjdp
2533965Sjdp#include "elf/common.h"
2633965Sjdp#include "elf/internal.h"
2733965Sjdp#include "elf/external.h"
2833965Sjdp#include "bfdlink.h"
2933965Sjdp
3078828Sobrien/* The number of entries in a section is its size divided by the size
3189857Sobrien   of a single entry.  This is normally only applicable to reloc and
3278828Sobrien   symbol table sections.  */
3378828Sobrien#define NUM_SHDR_ENTRIES(shdr) ((shdr)->sh_size / (shdr)->sh_entsize)
3478828Sobrien
3533965Sjdp/* If size isn't specified as 64 or 32, NAME macro should fail.  */
3689857Sobrien/* Do not "beautify" the CONCAT* macro args.  Traditional C will not
3789857Sobrien   remove whitespace added here, and thus will fail to concatenate
3889857Sobrien   the tokens.  */
3933965Sjdp#ifndef NAME
4033965Sjdp#if ARCH_SIZE==64
4189857Sobrien#define NAME(x,y) CONCAT4 (x,64,_,y)
4233965Sjdp#endif
4333965Sjdp#if ARCH_SIZE==32
4489857Sobrien#define NAME(x,y) CONCAT4 (x,32,_,y)
4533965Sjdp#endif
4633965Sjdp#endif
4733965Sjdp
4833965Sjdp#ifndef NAME
4989857Sobrien#define NAME(x,y) CONCAT4 (x,NOSIZE,_,y)
5033965Sjdp#endif
5133965Sjdp
5233965Sjdp#define ElfNAME(X)	NAME(Elf,X)
5333965Sjdp#define elfNAME(X)	NAME(elf,X)
5433965Sjdp
5533965Sjdp/* Information held for an ELF symbol.  The first field is the
5633965Sjdp   corresponding asymbol.  Every symbol is an ELF file is actually a
5733965Sjdp   pointer to this structure, although it is often handled as a
5833965Sjdp   pointer to an asymbol.  */
5933965Sjdp
6033965Sjdptypedef struct
6133965Sjdp{
6233965Sjdp  /* The BFD symbol.  */
6333965Sjdp  asymbol symbol;
6433965Sjdp  /* ELF symbol information.  */
6533965Sjdp  Elf_Internal_Sym internal_elf_sym;
6633965Sjdp  /* Backend specific information.  */
6733965Sjdp  union
6833965Sjdp    {
6933965Sjdp      unsigned int hppa_arg_reloc;
7033965Sjdp      PTR mips_extr;
7133965Sjdp      PTR any;
7233965Sjdp    }
7333965Sjdp  tc_data;
7433965Sjdp
7533965Sjdp  /* Version information.  This is from an Elf_Internal_Versym
7633965Sjdp     structure in a SHT_GNU_versym section.  It is zero if there is no
7733965Sjdp     version information.  */
7833965Sjdp  unsigned short version;
7933965Sjdp
8033965Sjdp} elf_symbol_type;
8133965Sjdp
8289857Sobrienstruct elf_strtab_hash;
8389857Sobrien
8433965Sjdp/* ELF linker hash table entries.  */
8533965Sjdp
8633965Sjdpstruct elf_link_hash_entry
8733965Sjdp{
8833965Sjdp  struct bfd_link_hash_entry root;
8933965Sjdp
9033965Sjdp  /* Symbol index in output file.  This is initialized to -1.  It is
9133965Sjdp     set to -2 if the symbol is used by a reloc.  */
9233965Sjdp  long indx;
9333965Sjdp
9433965Sjdp  /* Symbol index as a dynamic symbol.  Initialized to -1, and remains
9533965Sjdp     -1 if this is not a dynamic symbol.  */
9660484Sobrien  /* ??? Note that this is consistently used as a synonym for tests
9760484Sobrien     against whether we can perform various simplifying transformations
9860484Sobrien     to the code.  (E.g. changing a pc-relative jump to a PLT entry
9960484Sobrien     into a pc-relative jump to the target function.)  That test, which
10060484Sobrien     is often relatively complex, and someplaces wrong or incomplete,
10160484Sobrien     should really be replaced by a predicate in elflink.c.
10260484Sobrien
10360484Sobrien     End result: this field -1 does not indicate that the symbol is
10460484Sobrien     not in the dynamic symbol table, but rather that the symbol is
10560484Sobrien     not visible outside this DSO.  */
10633965Sjdp  long dynindx;
10733965Sjdp
10833965Sjdp  /* String table index in .dynstr if this is a dynamic symbol.  */
10933965Sjdp  unsigned long dynstr_index;
11033965Sjdp
11189857Sobrien  /* Hash value of the name computed using the ELF hash function.  */
11289857Sobrien  unsigned long elf_hash_value;
11389857Sobrien
11433965Sjdp  /* If this is a weak defined symbol from a dynamic object, this
11533965Sjdp     field points to a defined symbol with the same value, if there is
11633965Sjdp     one.  Otherwise it is NULL.  */
11733965Sjdp  struct elf_link_hash_entry *weakdef;
11833965Sjdp
11933965Sjdp  /* If this symbol is used in the linker created sections, the processor
12033965Sjdp     specific backend uses this field to map the field into the offset
12133965Sjdp     from the beginning of the section.  */
12233965Sjdp  struct elf_linker_section_pointers *linker_section_pointer;
12333965Sjdp
12433965Sjdp  /* Version information.  */
12533965Sjdp  union
12633965Sjdp  {
12733965Sjdp    /* This field is used for a symbol which is not defined in a
12833965Sjdp       regular object.  It points to the version information read in
12933965Sjdp       from the dynamic object.  */
13033965Sjdp    Elf_Internal_Verdef *verdef;
13133965Sjdp    /* This field is used for a symbol which is defined in a regular
13233965Sjdp       object.  It is set up in size_dynamic_sections.  It points to
13333965Sjdp       the version information we should write out for this symbol.  */
13433965Sjdp    struct bfd_elf_version_tree *vertree;
13533965Sjdp  } verinfo;
13633965Sjdp
13760484Sobrien  /* Virtual table entry use information.  This array is nominally of size
13860484Sobrien     size/sizeof(target_void_pointer), though we have to be able to assume
13960484Sobrien     and track a size while the symbol is still undefined.  It is indexed
14060484Sobrien     via offset/sizeof(target_void_pointer).  */
14160484Sobrien  size_t vtable_entries_size;
14260484Sobrien  boolean *vtable_entries_used;
14360484Sobrien
14460484Sobrien  /* Virtual table derivation info.  */
14560484Sobrien  struct elf_link_hash_entry *vtable_parent;
14660484Sobrien
14789857Sobrien  /* If this symbol requires an entry in the global offset table, the
14889857Sobrien     processor specific backend uses this field to track usage and
14989857Sobrien     final offset.  We use a union and two names primarily to document
15089857Sobrien     the intent of any particular piece of code.  The field should be
15189857Sobrien     used as a count until size_dynamic_sections, at which point the
15289857Sobrien     contents of the .got is fixed.  Afterward, if this field is -1,
15389857Sobrien     then the symbol does not require a global offset table entry.  */
15489857Sobrien  union
15589857Sobrien    {
15689857Sobrien      bfd_signed_vma refcount;
15789857Sobrien      bfd_vma offset;
15889857Sobrien    } got;
15989857Sobrien
16089857Sobrien  /* Same, but tracks a procedure linkage table entry.  */
16189857Sobrien  union
16289857Sobrien    {
16389857Sobrien      bfd_signed_vma refcount;
16489857Sobrien      bfd_vma offset;
16589857Sobrien    } plt;
16689857Sobrien
16789857Sobrien  /* Symbol size.  */
16889857Sobrien  bfd_size_type size;
16989857Sobrien
17033965Sjdp  /* Symbol type (STT_NOTYPE, STT_OBJECT, etc.).  */
17133965Sjdp  char type;
17233965Sjdp
17360484Sobrien  /* Symbol st_other value, symbol visibility.  */
17433965Sjdp  unsigned char other;
17533965Sjdp
17633965Sjdp  /* Some flags; legal values follow.  */
17733965Sjdp  unsigned short elf_link_hash_flags;
17833965Sjdp  /* Symbol is referenced by a non-shared object.  */
17933965Sjdp#define ELF_LINK_HASH_REF_REGULAR 01
18033965Sjdp  /* Symbol is defined by a non-shared object.  */
18133965Sjdp#define ELF_LINK_HASH_DEF_REGULAR 02
18233965Sjdp  /* Symbol is referenced by a shared object.  */
18333965Sjdp#define ELF_LINK_HASH_REF_DYNAMIC 04
18433965Sjdp  /* Symbol is defined by a shared object.  */
18533965Sjdp#define ELF_LINK_HASH_DEF_DYNAMIC 010
18660484Sobrien  /* Symbol has a non-weak reference from a non-shared object.  */
18760484Sobrien#define ELF_LINK_HASH_REF_REGULAR_NONWEAK 020
18833965Sjdp  /* Dynamic symbol has been adjustd.  */
18960484Sobrien#define ELF_LINK_HASH_DYNAMIC_ADJUSTED 040
19033965Sjdp  /* Symbol needs a copy reloc.  */
19160484Sobrien#define ELF_LINK_HASH_NEEDS_COPY 0100
19233965Sjdp  /* Symbol needs a procedure linkage table entry.  */
19360484Sobrien#define ELF_LINK_HASH_NEEDS_PLT 0200
19433965Sjdp  /* Symbol appears in a non-ELF input file.  */
19560484Sobrien#define ELF_LINK_NON_ELF 0400
19633965Sjdp  /* Symbol should be marked as hidden in the version information.  */
19760484Sobrien#define ELF_LINK_HIDDEN 01000
19833965Sjdp  /* Symbol was forced to local scope due to a version script file.  */
19960484Sobrien#define ELF_LINK_FORCED_LOCAL 02000
20060484Sobrien  /* Symbol was marked during garbage collection.  */
20160484Sobrien#define ELF_LINK_HASH_MARK 04000
20260484Sobrien  /* Symbol is referenced by a non-GOT/non-PLT relocation.  This is
20360484Sobrien     not currently set by all the backends.  */
20460484Sobrien#define ELF_LINK_NON_GOT_REF 010000
20533965Sjdp};
20633965Sjdp
20760484Sobrien/* Records local symbols to be emitted in the dynamic symbol table.  */
20860484Sobrien
20960484Sobrienstruct elf_link_local_dynamic_entry
21060484Sobrien{
21160484Sobrien  struct elf_link_local_dynamic_entry *next;
21260484Sobrien
21360484Sobrien  /* The input bfd this symbol came from.  */
21460484Sobrien  bfd *input_bfd;
21560484Sobrien
21660484Sobrien  /* The index of the local symbol being copied.  */
21760484Sobrien  long input_indx;
21860484Sobrien
21960484Sobrien  /* The index in the outgoing dynamic symbol table.  */
22060484Sobrien  long dynindx;
22177298Sobrien
22260484Sobrien  /* A copy of the input symbol.  */
22360484Sobrien  Elf_Internal_Sym isym;
22460484Sobrien};
22560484Sobrien
226104834Sobrienstruct elf_link_loaded_list
227104834Sobrien{
228104834Sobrien  struct elf_link_loaded_list *next;
229104834Sobrien  bfd *abfd;
230104834Sobrien};
231104834Sobrien
23289857Sobrienenum elf_link_info_type
23389857Sobrien{
23489857Sobrien  ELF_INFO_TYPE_NONE,
23589857Sobrien  ELF_INFO_TYPE_STABS,
23689857Sobrien  ELF_INFO_TYPE_MERGE,
23789857Sobrien  ELF_INFO_TYPE_EH_FRAME,
23889857Sobrien  ELF_INFO_TYPE_EH_FRAME_HDR,
239104834Sobrien  ELF_INFO_TYPE_JUST_SYMS,
24089857Sobrien  ELF_INFO_TYPE_LAST
24189857Sobrien};
24289857Sobrien
243104834Sobrien/* Cached start, size and alignment of PT_TLS segment.  */
244104834Sobrienstruct elf_link_tls_segment
245104834Sobrien{
246104834Sobrien  bfd_vma start;
247104834Sobrien  bfd_size_type size;
248104834Sobrien  unsigned int align;
249104834Sobrien};
250104834Sobrien
25133965Sjdp/* ELF linker hash table.  */
25233965Sjdp
25333965Sjdpstruct elf_link_hash_table
25433965Sjdp{
25533965Sjdp  struct bfd_link_hash_table root;
25689857Sobrien
25733965Sjdp  /* Whether we have created the special dynamic sections required
25833965Sjdp     when linking against or generating a shared object.  */
25933965Sjdp  boolean dynamic_sections_created;
26089857Sobrien
26133965Sjdp  /* The BFD used to hold special sections created by the linker.
26233965Sjdp     This will be the first BFD found which requires these sections to
26333965Sjdp     be created.  */
26433965Sjdp  bfd *dynobj;
26589857Sobrien
26689857Sobrien  /* The value to use when initialising got.refcount/offset and
26789857Sobrien     plt.refcount/offset in an elf_link_hash_entry.  Set to zero when
26889857Sobrien     the values are refcounts.  Set to -1 in size_dynamic_sections
26989857Sobrien     when the values may be offsets.  */
27089857Sobrien  bfd_signed_vma init_refcount;
27189857Sobrien
27233965Sjdp  /* The number of symbols found in the link which must be put into
27333965Sjdp     the .dynsym section.  */
27433965Sjdp  bfd_size_type dynsymcount;
27589857Sobrien
27633965Sjdp  /* The string table of dynamic symbols, which becomes the .dynstr
27733965Sjdp     section.  */
27889857Sobrien  struct elf_strtab_hash *dynstr;
27989857Sobrien
28033965Sjdp  /* The number of buckets in the hash table in the .hash section.
28133965Sjdp     This is based on the number of dynamic symbols.  */
28233965Sjdp  bfd_size_type bucketcount;
28389857Sobrien
28433965Sjdp  /* A linked list of DT_NEEDED names found in dynamic objects
28533965Sjdp     included in the link.  */
28633965Sjdp  struct bfd_link_needed_list *needed;
28789857Sobrien
28833965Sjdp  /* The _GLOBAL_OFFSET_TABLE_ symbol.  */
28933965Sjdp  struct elf_link_hash_entry *hgot;
29089857Sobrien
29133965Sjdp  /* A pointer to information used to link stabs in sections.  */
29233965Sjdp  PTR stab_info;
29389857Sobrien
29489857Sobrien  /* A pointer to information used to merge SEC_MERGE sections.  */
29589857Sobrien  PTR merge_info;
29689857Sobrien
29760484Sobrien  /* A linked list of local symbols to be added to .dynsym.  */
29860484Sobrien  struct elf_link_local_dynamic_entry *dynlocal;
29989857Sobrien
30077298Sobrien  /* A linked list of DT_RPATH/DT_RUNPATH names found in dynamic
30177298Sobrien     objects included in the link.  */
30277298Sobrien  struct bfd_link_needed_list *runpath;
303104834Sobrien
304104834Sobrien  /* Cached start, size and alignment of PT_TLS segment.  */
305104834Sobrien  struct elf_link_tls_segment *tls_segment;
306104834Sobrien
307104834Sobrien  /* A linked list of BFD's loaded in the link.  */
308104834Sobrien  struct elf_link_loaded_list *loaded;
30933965Sjdp};
31033965Sjdp
31133965Sjdp/* Look up an entry in an ELF linker hash table.  */
31233965Sjdp
31333965Sjdp#define elf_link_hash_lookup(table, string, create, copy, follow)	\
31433965Sjdp  ((struct elf_link_hash_entry *)					\
31533965Sjdp   bfd_link_hash_lookup (&(table)->root, (string), (create),		\
31633965Sjdp			 (copy), (follow)))
31733965Sjdp
31833965Sjdp/* Traverse an ELF linker hash table.  */
31933965Sjdp
32033965Sjdp#define elf_link_hash_traverse(table, func, info)			\
32133965Sjdp  (bfd_link_hash_traverse						\
32233965Sjdp   (&(table)->root,							\
32333965Sjdp    (boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func),	\
32433965Sjdp    (info)))
32533965Sjdp
32633965Sjdp/* Get the ELF linker hash table from a link_info structure.  */
32733965Sjdp
32833965Sjdp#define elf_hash_table(p) ((struct elf_link_hash_table *) ((p)->hash))
32989857Sobrien
33089857Sobrien/* Returns true if the hash table is a struct elf_link_hash_table.  */
33189857Sobrien#define is_elf_hash_table(p)					      	\
33289857Sobrien  ((p)->hash->type == bfd_link_elf_hash_table)
33389857Sobrien
33489857Sobrien/* Used by bfd_section_from_r_symndx to cache a small number of local
33589857Sobrien   symbol to section mappings.  */
33689857Sobrien#define LOCAL_SYM_CACHE_SIZE 32
33789857Sobrienstruct sym_sec_cache
33889857Sobrien{
33989857Sobrien  bfd *abfd;
34089857Sobrien  unsigned long indx[LOCAL_SYM_CACHE_SIZE];
34189857Sobrien  asection *sec[LOCAL_SYM_CACHE_SIZE];
34289857Sobrien};
34333965Sjdp
34433965Sjdp/* Constant information held for an ELF backend.  */
34533965Sjdp
34633965Sjdpstruct elf_size_info {
34733965Sjdp  unsigned char sizeof_ehdr, sizeof_phdr, sizeof_shdr;
34833965Sjdp  unsigned char sizeof_rel, sizeof_rela, sizeof_sym, sizeof_dyn, sizeof_note;
34933965Sjdp
35060484Sobrien  /* The size of entries in the .hash section.  */
35160484Sobrien  unsigned char sizeof_hash_entry;
35260484Sobrien
35360484Sobrien  /* The number of internal relocations to allocate per external
35460484Sobrien     relocation entry.  */
35560484Sobrien  unsigned char int_rels_per_ext_rel;
35660484Sobrien
35733965Sjdp  unsigned char arch_size, file_align;
35833965Sjdp  unsigned char elfclass, ev_current;
35989857Sobrien  int (*write_out_phdrs)
36089857Sobrien    PARAMS ((bfd *, const Elf_Internal_Phdr *, unsigned int));
36189857Sobrien  boolean (*write_shdrs_and_ehdr)
36289857Sobrien    PARAMS ((bfd *));
36389857Sobrien  void (*write_relocs)
36489857Sobrien    PARAMS ((bfd *, asection *, PTR));
365104834Sobrien  void (*swap_symbol_in)
366104834Sobrien    PARAMS ((bfd *, const PTR, const PTR, Elf_Internal_Sym *));
36789857Sobrien  void (*swap_symbol_out)
36889857Sobrien    PARAMS ((bfd *, const Elf_Internal_Sym *, PTR, PTR));
36933965Sjdp  boolean (*slurp_reloc_table)
37033965Sjdp    PARAMS ((bfd *, asection *, asymbol **, boolean));
37189857Sobrien  long (*slurp_symbol_table)
37289857Sobrien    PARAMS ((bfd *, asymbol **, boolean));
37389857Sobrien  void (*swap_dyn_in)
37489857Sobrien    PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *));
37589857Sobrien  void (*swap_dyn_out)
37689857Sobrien    PARAMS ((bfd *, const Elf_Internal_Dyn *, PTR));
37760484Sobrien
37860484Sobrien  /* This function, if defined, is called to swap in a REL
37960484Sobrien     relocation.  If an external relocation corresponds to more than
38060484Sobrien     one internal relocation, then all relocations are swapped in at
38160484Sobrien     once.  */
38260484Sobrien  void (*swap_reloc_in)
38360484Sobrien    PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rel *));
38460484Sobrien
38560484Sobrien  /* This function, if defined, is called to swap out a REL
38660484Sobrien     relocation.  */
38760484Sobrien  void (*swap_reloc_out)
38860484Sobrien    PARAMS ((bfd *, const Elf_Internal_Rel *, bfd_byte *));
38960484Sobrien
39060484Sobrien  /* This function, if defined, is called to swap in a RELA
39160484Sobrien     relocation.  If an external relocation corresponds to more than
39260484Sobrien     one internal relocation, then all relocations are swapped in at
39360484Sobrien     once.  */
39460484Sobrien  void (*swap_reloca_in)
39560484Sobrien    PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rela *));
39660484Sobrien
39760484Sobrien  /* This function, if defined, is called to swap out a RELA
39860484Sobrien     relocation.  */
39960484Sobrien  void (*swap_reloca_out)
40060484Sobrien    PARAMS ((bfd *, const Elf_Internal_Rela *, bfd_byte *));
40160484Sobrien
40233965Sjdp};
40333965Sjdp
40433965Sjdp#define elf_symbol_from(ABFD,S) \
40533965Sjdp	(((S)->the_bfd->xvec->flavour == bfd_target_elf_flavour \
40633965Sjdp	  && (S)->the_bfd->tdata.elf_obj_data != 0) \
40733965Sjdp	 ? (elf_symbol_type *) (S) \
40833965Sjdp	 : 0)
40933965Sjdp
41089857Sobrienenum elf_reloc_type_class {
41189857Sobrien  reloc_class_normal,
41289857Sobrien  reloc_class_relative,
41389857Sobrien  reloc_class_plt,
41489857Sobrien  reloc_class_copy
41589857Sobrien};
41689857Sobrien
41789857Sobrienstruct elf_reloc_cookie
41889857Sobrien{
41989857Sobrien  Elf_Internal_Rela *rels, *rel, *relend;
420104834Sobrien  Elf_Internal_Sym *locsyms;
42189857Sobrien  bfd *abfd;
42289857Sobrien  size_t locsymcount;
42389857Sobrien  size_t extsymoff;
42489857Sobrien  struct elf_link_hash_entry **sym_hashes;
42589857Sobrien  boolean bad_symtab;
42689857Sobrien};
42789857Sobrien
428104834Sobrien/* The level of IRIX compatibility we're striving for.  */
429104834Sobrien
430104834Sobrientypedef enum {
431104834Sobrien  ict_none,
432104834Sobrien  ict_irix5,
433104834Sobrien  ict_irix6
434104834Sobrien} irix_compat_t;
435104834Sobrien
43633965Sjdpstruct elf_backend_data
43733965Sjdp{
43833965Sjdp  /* The architecture for this backend.  */
43933965Sjdp  enum bfd_architecture arch;
44033965Sjdp
44133965Sjdp  /* The ELF machine code (EM_xxxx) for this backend.  */
44233965Sjdp  int elf_machine_code;
44333965Sjdp
44433965Sjdp  /* The maximum page size for this backend.  */
44533965Sjdp  bfd_vma maxpagesize;
44633965Sjdp
44733965Sjdp  /* A function to translate an ELF RELA relocation to a BFD arelent
44833965Sjdp     structure.  */
44989857Sobrien  void (*elf_info_to_howto)
45089857Sobrien    PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
45133965Sjdp
45233965Sjdp  /* A function to translate an ELF REL relocation to a BFD arelent
45333965Sjdp     structure.  */
45489857Sobrien  void (*elf_info_to_howto_rel)
45589857Sobrien    PARAMS ((bfd *, arelent *, Elf_Internal_Rel *));
45633965Sjdp
45733965Sjdp  /* A function to determine whether a symbol is global when
45833965Sjdp     partitioning the symbol table into local and global symbols.
45933965Sjdp     This should be NULL for most targets, in which case the correct
46033965Sjdp     thing will be done.  MIPS ELF, at least on the Irix 5, has
46133965Sjdp     special requirements.  */
46289857Sobrien  boolean (*elf_backend_sym_is_global)
46389857Sobrien    PARAMS ((bfd *, asymbol *));
46433965Sjdp
46533965Sjdp  /* The remaining functions are hooks which are called only if they
46633965Sjdp     are not NULL.  */
46733965Sjdp
46833965Sjdp  /* A function to permit a backend specific check on whether a
46933965Sjdp     particular BFD format is relevant for an object file, and to
47033965Sjdp     permit the backend to set any global information it wishes.  When
47133965Sjdp     this is called elf_elfheader is set, but anything else should be
47233965Sjdp     used with caution.  If this returns false, the check_format
47333965Sjdp     routine will return a bfd_error_wrong_format error.  */
47489857Sobrien  boolean (*elf_backend_object_p)
47589857Sobrien    PARAMS ((bfd *));
47633965Sjdp
47733965Sjdp  /* A function to do additional symbol processing when reading the
47833965Sjdp     ELF symbol table.  This is where any processor-specific special
47933965Sjdp     section indices are handled.  */
48089857Sobrien  void (*elf_backend_symbol_processing)
48189857Sobrien    PARAMS ((bfd *, asymbol *));
48233965Sjdp
48333965Sjdp  /* A function to do additional symbol processing after reading the
48433965Sjdp     entire ELF symbol table.  */
48589857Sobrien  boolean (*elf_backend_symbol_table_processing)
48689857Sobrien    PARAMS ((bfd *, elf_symbol_type *, unsigned int));
48733965Sjdp
48860484Sobrien   /* A function to set the type of the info field.  Processor-specific
48977298Sobrien     types should be handled here.  */
49089857Sobrien  int (*elf_backend_get_symbol_type)
49189857Sobrien    PARAMS (( Elf_Internal_Sym *, int));
49277298Sobrien
49333965Sjdp  /* A function to do additional processing on the ELF section header
49433965Sjdp     just before writing it out.  This is used to set the flags and
49533965Sjdp     type fields for some sections, or to actually write out data for
49633965Sjdp     unusual sections.  */
49789857Sobrien  boolean (*elf_backend_section_processing)
49889857Sobrien    PARAMS ((bfd *, Elf32_Internal_Shdr *));
49933965Sjdp
50033965Sjdp  /* A function to handle unusual section types when creating BFD
50133965Sjdp     sections from ELF sections.  */
50289857Sobrien  boolean (*elf_backend_section_from_shdr)
503104834Sobrien    PARAMS ((bfd *, Elf32_Internal_Shdr *, const char *));
50433965Sjdp
50577298Sobrien  /* A function to convert machine dependent section header flags to
50677298Sobrien     BFD internal section header flags.  */
50789857Sobrien  boolean (*elf_backend_section_flags)
50889857Sobrien    PARAMS ((flagword *, Elf32_Internal_Shdr *));
50977298Sobrien
51060484Sobrien  /* A function to handle unusual program segment types when creating BFD
51177298Sobrien     sections from ELF program segments.  */
51289857Sobrien  boolean (*elf_backend_section_from_phdr)
51389857Sobrien    PARAMS ((bfd *, Elf32_Internal_Phdr *, int));
51460484Sobrien
51533965Sjdp  /* A function to set up the ELF section header for a BFD section in
51633965Sjdp     preparation for writing it out.  This is where the flags and type
51733965Sjdp     fields are set for unusual sections.  */
51889857Sobrien  boolean (*elf_backend_fake_sections)
51989857Sobrien    PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *));
52033965Sjdp
52133965Sjdp  /* A function to get the ELF section index for a BFD section.  If
52233965Sjdp     this returns true, the section was found.  If it is a normal ELF
52333965Sjdp     section, *RETVAL should be left unchanged.  If it is not a normal
52433965Sjdp     ELF section *RETVAL should be set to the SHN_xxxx index.  */
52533965Sjdp  boolean (*elf_backend_section_from_bfd_section)
52689857Sobrien    PARAMS ((bfd *, asection *, int *retval));
52733965Sjdp
52833965Sjdp  /* If this field is not NULL, it is called by the add_symbols phase
52933965Sjdp     of a link just before adding a symbol to the global linker hash
53033965Sjdp     table.  It may modify any of the fields as it wishes.  If *NAME
53133965Sjdp     is set to NULL, the symbol will be skipped rather than being
53233965Sjdp     added to the hash table.  This function is responsible for
53333965Sjdp     handling all processor dependent symbol bindings and section
53433965Sjdp     indices, and must set at least *FLAGS and *SEC for each processor
53533965Sjdp     dependent case; failure to do so will cause a link error.  */
53633965Sjdp  boolean (*elf_add_symbol_hook)
53733965Sjdp    PARAMS ((bfd *abfd, struct bfd_link_info *info,
53833965Sjdp	     const Elf_Internal_Sym *, const char **name,
53933965Sjdp	     flagword *flags, asection **sec, bfd_vma *value));
54033965Sjdp
54133965Sjdp  /* If this field is not NULL, it is called by the elf_link_output_sym
54233965Sjdp     phase of a link for each symbol which will appear in the object file.  */
54333965Sjdp  boolean (*elf_backend_link_output_symbol_hook)
54433965Sjdp    PARAMS ((bfd *, struct bfd_link_info *info, const char *,
54533965Sjdp	     Elf_Internal_Sym *, asection *));
54633965Sjdp
54733965Sjdp  /* The CREATE_DYNAMIC_SECTIONS function is called by the ELF backend
54833965Sjdp     linker the first time it encounters a dynamic object in the link.
54933965Sjdp     This function must create any sections required for dynamic
55033965Sjdp     linking.  The ABFD argument is a dynamic object.  The .interp,
55133965Sjdp     .dynamic, .dynsym, .dynstr, and .hash functions have already been
55233965Sjdp     created, and this function may modify the section flags if
55333965Sjdp     desired.  This function will normally create the .got and .plt
55433965Sjdp     sections, but different backends have different requirements.  */
55533965Sjdp  boolean (*elf_backend_create_dynamic_sections)
55633965Sjdp    PARAMS ((bfd *abfd, struct bfd_link_info *info));
55733965Sjdp
55833965Sjdp  /* The CHECK_RELOCS function is called by the add_symbols phase of
55933965Sjdp     the ELF backend linker.  It is called once for each section with
56033965Sjdp     relocs of an object file, just after the symbols for the object
56133965Sjdp     file have been added to the global linker hash table.  The
56233965Sjdp     function must look through the relocs and do any special handling
56333965Sjdp     required.  This generally means allocating space in the global
56433965Sjdp     offset table, and perhaps allocating space for a reloc.  The
56533965Sjdp     relocs are always passed as Rela structures; if the section
56633965Sjdp     actually uses Rel structures, the r_addend field will always be
56733965Sjdp     zero.  */
56833965Sjdp  boolean (*check_relocs)
56933965Sjdp    PARAMS ((bfd *abfd, struct bfd_link_info *info, asection *o,
57033965Sjdp	     const Elf_Internal_Rela *relocs));
57133965Sjdp
57233965Sjdp  /* The ADJUST_DYNAMIC_SYMBOL function is called by the ELF backend
57333965Sjdp     linker for every symbol which is defined by a dynamic object and
57433965Sjdp     referenced by a regular object.  This is called after all the
57533965Sjdp     input files have been seen, but before the SIZE_DYNAMIC_SECTIONS
57633965Sjdp     function has been called.  The hash table entry should be
57733965Sjdp     bfd_link_hash_defined ore bfd_link_hash_defweak, and it should be
57833965Sjdp     defined in a section from a dynamic object.  Dynamic object
57933965Sjdp     sections are not included in the final link, and this function is
58033965Sjdp     responsible for changing the value to something which the rest of
58133965Sjdp     the link can deal with.  This will normally involve adding an
58233965Sjdp     entry to the .plt or .got or some such section, and setting the
58333965Sjdp     symbol to point to that.  */
58433965Sjdp  boolean (*elf_backend_adjust_dynamic_symbol)
58533965Sjdp    PARAMS ((struct bfd_link_info *info, struct elf_link_hash_entry *h));
58633965Sjdp
58733965Sjdp  /* The ALWAYS_SIZE_SECTIONS function is called by the backend linker
58833965Sjdp     after all the linker input files have been seen but before the
58933965Sjdp     section sizes have been set.  This is called after
59033965Sjdp     ADJUST_DYNAMIC_SYMBOL, but before SIZE_DYNAMIC_SECTIONS.  */
59133965Sjdp  boolean (*elf_backend_always_size_sections)
59233965Sjdp    PARAMS ((bfd *output_bfd, struct bfd_link_info *info));
59333965Sjdp
59433965Sjdp  /* The SIZE_DYNAMIC_SECTIONS function is called by the ELF backend
59533965Sjdp     linker after all the linker input files have been seen but before
59633965Sjdp     the sections sizes have been set.  This is called after
59733965Sjdp     ADJUST_DYNAMIC_SYMBOL has been called on all appropriate symbols.
59833965Sjdp     It is only called when linking against a dynamic object.  It must
59933965Sjdp     set the sizes of the dynamic sections, and may fill in their
60033965Sjdp     contents as well.  The generic ELF linker can handle the .dynsym,
60133965Sjdp     .dynstr and .hash sections.  This function must handle the
60233965Sjdp     .interp section and any sections created by the
60333965Sjdp     CREATE_DYNAMIC_SECTIONS entry point.  */
60433965Sjdp  boolean (*elf_backend_size_dynamic_sections)
60533965Sjdp    PARAMS ((bfd *output_bfd, struct bfd_link_info *info));
60633965Sjdp
60733965Sjdp  /* The RELOCATE_SECTION function is called by the ELF backend linker
60833965Sjdp     to handle the relocations for a section.
60933965Sjdp
61033965Sjdp     The relocs are always passed as Rela structures; if the section
61133965Sjdp     actually uses Rel structures, the r_addend field will always be
61233965Sjdp     zero.
61333965Sjdp
61433965Sjdp     This function is responsible for adjust the section contents as
61533965Sjdp     necessary, and (if using Rela relocs and generating a
61633965Sjdp     relocateable output file) adjusting the reloc addend as
61733965Sjdp     necessary.
61833965Sjdp
61933965Sjdp     This function does not have to worry about setting the reloc
62033965Sjdp     address or the reloc symbol index.
62133965Sjdp
62233965Sjdp     LOCAL_SYMS is a pointer to the swapped in local symbols.
62333965Sjdp
62433965Sjdp     LOCAL_SECTIONS is an array giving the section in the input file
62533965Sjdp     corresponding to the st_shndx field of each local symbol.
62633965Sjdp
62733965Sjdp     The global hash table entry for the global symbols can be found
62833965Sjdp     via elf_sym_hashes (input_bfd).
62933965Sjdp
63033965Sjdp     When generating relocateable output, this function must handle
63133965Sjdp     STB_LOCAL/STT_SECTION symbols specially.  The output symbol is
63233965Sjdp     going to be the section symbol corresponding to the output
63333965Sjdp     section, which means that the addend must be adjusted
63433965Sjdp     accordingly.  */
63533965Sjdp  boolean (*elf_backend_relocate_section)
63633965Sjdp    PARAMS ((bfd *output_bfd, struct bfd_link_info *info,
63733965Sjdp	     bfd *input_bfd, asection *input_section, bfd_byte *contents,
63833965Sjdp	     Elf_Internal_Rela *relocs, Elf_Internal_Sym *local_syms,
63933965Sjdp	     asection **local_sections));
64033965Sjdp
64133965Sjdp  /* The FINISH_DYNAMIC_SYMBOL function is called by the ELF backend
64233965Sjdp     linker just before it writes a symbol out to the .dynsym section.
64333965Sjdp     The processor backend may make any required adjustment to the
64433965Sjdp     symbol.  It may also take the opportunity to set contents of the
64533965Sjdp     dynamic sections.  Note that FINISH_DYNAMIC_SYMBOL is called on
64633965Sjdp     all .dynsym symbols, while ADJUST_DYNAMIC_SYMBOL is only called
64733965Sjdp     on those symbols which are defined by a dynamic object.  */
64833965Sjdp  boolean (*elf_backend_finish_dynamic_symbol)
64933965Sjdp    PARAMS ((bfd *output_bfd, struct bfd_link_info *info,
65033965Sjdp	     struct elf_link_hash_entry *h, Elf_Internal_Sym *sym));
65133965Sjdp
65233965Sjdp  /* The FINISH_DYNAMIC_SECTIONS function is called by the ELF backend
65333965Sjdp     linker just before it writes all the dynamic sections out to the
65433965Sjdp     output file.  The FINISH_DYNAMIC_SYMBOL will have been called on
65533965Sjdp     all dynamic symbols.  */
65633965Sjdp  boolean (*elf_backend_finish_dynamic_sections)
65733965Sjdp    PARAMS ((bfd *output_bfd, struct bfd_link_info *info));
65833965Sjdp
65933965Sjdp  /* A function to do any beginning processing needed for the ELF file
66033965Sjdp     before building the ELF headers and computing file positions.  */
66133965Sjdp  void (*elf_backend_begin_write_processing)
66233965Sjdp    PARAMS ((bfd *, struct bfd_link_info *));
66333965Sjdp
66433965Sjdp  /* A function to do any final processing needed for the ELF file
66533965Sjdp     before writing it out.  The LINKER argument is true if this BFD
66633965Sjdp     was created by the ELF backend linker.  */
66733965Sjdp  void (*elf_backend_final_write_processing)
66833965Sjdp    PARAMS ((bfd *, boolean linker));
66933965Sjdp
67033965Sjdp  /* This function is called by get_program_header_size.  It should
67133965Sjdp     return the number of additional program segments which this BFD
67233965Sjdp     will need.  It should return -1 on error.  */
67389857Sobrien  int (*elf_backend_additional_program_headers)
67489857Sobrien    PARAMS ((bfd *));
67533965Sjdp
67633965Sjdp  /* This function is called to modify an existing segment map in a
67733965Sjdp     backend specific fashion.  */
67889857Sobrien  boolean (*elf_backend_modify_segment_map)
67989857Sobrien    PARAMS ((bfd *));
68033965Sjdp
68160484Sobrien  /* This function is called during section gc to discover the section a
682104834Sobrien     particular relocation refers to.  */
68360484Sobrien  asection * (*gc_mark_hook)
684104834Sobrien    PARAMS ((asection *sec, struct bfd_link_info *, Elf_Internal_Rela *,
68560484Sobrien	     struct elf_link_hash_entry *h, Elf_Internal_Sym *));
68660484Sobrien
68760484Sobrien  /* This function, if defined, is called during the sweep phase of gc
68860484Sobrien     in order that a backend might update any data structures it might
68960484Sobrien     be maintaining.  */
69060484Sobrien  boolean (*gc_sweep_hook)
69160484Sobrien    PARAMS ((bfd *abfd, struct bfd_link_info *info, asection *o,
69260484Sobrien	     const Elf_Internal_Rela *relocs));
69360484Sobrien
69460484Sobrien  /* This function, if defined, is called after the ELF headers have
69560484Sobrien     been created.  This allows for things like the OS and ABI versions
69660484Sobrien     to be changed.  */
69760484Sobrien  void (*elf_backend_post_process_headers)
69860484Sobrien    PARAMS ((bfd *, struct bfd_link_info *));
69960484Sobrien
70060484Sobrien  /* This function, if defined, prints a symbol to file and returns the
70160484Sobrien     name of the symbol to be printed.  It should return NULL to fall
70260484Sobrien     back to default symbol printing.  */
70360484Sobrien  const char *(*elf_backend_print_symbol_all)
70460484Sobrien    PARAMS ((bfd *, PTR, asymbol *));
70560484Sobrien
70660484Sobrien  /* This function, if defined, is called after all local symbols and
70760484Sobrien     global symbols converted to locals are emited into the symtab
70860484Sobrien     section.  It allows the backend to emit special global symbols
70960484Sobrien     not handled in the hash table.  */
71060484Sobrien  boolean (*elf_backend_output_arch_syms)
71160484Sobrien    PARAMS ((bfd *, struct bfd_link_info *, PTR,
71289857Sobrien	    boolean (*) (PTR, const char *, Elf_Internal_Sym *, asection *)));
71360484Sobrien
714104834Sobrien  /* Copy any information related to dynamic linking from a pre-existing
71589857Sobrien     symbol to a newly created symbol.  Also called to copy flags and
71689857Sobrien     other back-end info to a weakdef, in which case the symbol is not
71789857Sobrien     newly created and plt/got refcounts and dynamic indices should not
71889857Sobrien     be copied.  */
71960484Sobrien  void (*elf_backend_copy_indirect_symbol)
720104834Sobrien    PARAMS ((struct elf_backend_data *, struct elf_link_hash_entry *,
721104834Sobrien	     struct elf_link_hash_entry *));
72260484Sobrien
72360484Sobrien  /* Modify any information related to dynamic linking such that the
72460484Sobrien     symbol is not exported.  */
72560484Sobrien  void (*elf_backend_hide_symbol)
72689857Sobrien    PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *, boolean));
72760484Sobrien
72889857Sobrien  /* Emit relocations.  Overrides default routine for emitting relocs,
72989857Sobrien     except during a relocatable link, or if all relocs are being emitted.  */
730104834Sobrien  boolean (*elf_backend_emit_relocs)
73189857Sobrien    PARAMS ((bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *));
73289857Sobrien
73389857Sobrien  /* Count relocations.  Not called for relocatable links
73489857Sobrien     or if all relocs are being preserved in the output.  */
73589857Sobrien  unsigned int (*elf_backend_count_relocs)
73689857Sobrien    PARAMS ((asection *, Elf_Internal_Rela *));
73789857Sobrien
73889857Sobrien  /* This function, if defined, is called when an NT_PRSTATUS note is found
73989857Sobrien     in a core file. */
74089857Sobrien  boolean (*elf_backend_grok_prstatus)
74189857Sobrien    PARAMS ((bfd *, Elf_Internal_Note *));
74289857Sobrien
74389857Sobrien  /* This function, if defined, is called when an NT_PSINFO or NT_PRPSINFO
74489857Sobrien     note is found in a core file. */
74589857Sobrien  boolean (*elf_backend_grok_psinfo)
74689857Sobrien    PARAMS ((bfd *, Elf_Internal_Note *));
74789857Sobrien
74889857Sobrien  /* Functions to print VMAs.  Special code to handle 64 bit ELF files.  */
74989857Sobrien  void (* elf_backend_sprintf_vma)
75089857Sobrien    PARAMS ((bfd *, char *, bfd_vma));
75189857Sobrien  void (* elf_backend_fprintf_vma)
75289857Sobrien    PARAMS ((bfd *, PTR, bfd_vma));
75389857Sobrien
75489857Sobrien  /* This function returns class of a reloc type.  */
75589857Sobrien  enum elf_reloc_type_class (*elf_backend_reloc_type_class)
75689857Sobrien    PARAMS ((const Elf_Internal_Rela *));
75789857Sobrien
75889857Sobrien  /* This function, if defined, removes information about discarded functions
75989857Sobrien     from other sections which mention them.  */
76089857Sobrien  boolean (*elf_backend_discard_info)
76189857Sobrien    PARAMS ((bfd *, struct elf_reloc_cookie *, struct bfd_link_info *));
76289857Sobrien
76389857Sobrien  /* This function, if defined, signals that the function above has removed
76489857Sobrien     the discarded relocations for this section.  */
76589857Sobrien  boolean (*elf_backend_ignore_discarded_relocs)
76689857Sobrien    PARAMS ((asection *));
76789857Sobrien
76889857Sobrien  /* This function, if defined, may write out the given section.
76989857Sobrien     Returns true if it did so and false if the caller should.  */
77089857Sobrien  boolean (*elf_backend_write_section)
77189857Sobrien    PARAMS ((bfd *, asection *, bfd_byte *));
77289857Sobrien
773104834Sobrien  /* This function, if defined, sets  up the file positions for non PT_LOAD
774104834Sobrien     segments, especially for segments containing non-allocated sections.  */
775104834Sobrien  void (*set_nonloadable_filepos)
776104834Sobrien    PARAMS ((bfd *, Elf_Internal_Phdr *));
777104834Sobrien
778104834Sobrien  /* This function, if defined, returns true if the section is contained
779104834Sobrien     within the segment.  File positions are compared.  */
780104834Sobrien  boolean (*is_contained_by_filepos)
781104834Sobrien    PARAMS ((asection *, Elf_Internal_Phdr *));
782104834Sobrien
783104834Sobrien  /* This function, if defined, returns true if copy_private_bfd_data
784104834Sobrien     should be called.  It provides a way of overriding default
785104834Sobrien     test conditions in _bfd_elf_copy_private_section_data.  */
786104834Sobrien  boolean (*copy_private_bfd_data_p)
787104834Sobrien    PARAMS ((bfd *, asection *, bfd *, asection *));
788104834Sobrien
789104834Sobrien  /* The level of IRIX compatibility we're striving for.
790104834Sobrien     MIPS ELF specific function.  */
791104834Sobrien  irix_compat_t (*elf_backend_mips_irix_compat)
792104834Sobrien    PARAMS ((bfd *));
793104834Sobrien
794104834Sobrien  reloc_howto_type *(*elf_backend_mips_rtype_to_howto)
795104834Sobrien    PARAMS ((unsigned int, boolean));
796104834Sobrien
79733965Sjdp  /* The swapping table to use when dealing with ECOFF information.
79833965Sjdp     Used for the MIPS ELF .mdebug section.  */
79933965Sjdp  const struct ecoff_debug_swap *elf_backend_ecoff_debug_swap;
80033965Sjdp
80133965Sjdp  /* Alternate EM_xxxx machine codes for this backend.  */
80233965Sjdp  int elf_machine_alt1;
80333965Sjdp  int elf_machine_alt2;
80433965Sjdp
80533965Sjdp  const struct elf_size_info *s;
80633965Sjdp
80738889Sjdp  /* offset of the _GLOBAL_OFFSET_TABLE_ symbol from the start of the
80838889Sjdp     .got section */
80938889Sjdp  bfd_vma got_symbol_offset;
81038889Sjdp
81160484Sobrien  /* The size in bytes of the headers for the GOT and PLT.  This includes
81260484Sobrien     the so-called reserved entries on some systems.  */
81360484Sobrien  bfd_vma got_header_size;
81460484Sobrien  bfd_vma plt_header_size;
81560484Sobrien
81660484Sobrien  /* This is true if the linker should act like collect and gather
81760484Sobrien     global constructors and destructors by name.  This is true for
81860484Sobrien     MIPS ELF because the Irix 5 tools can not handle the .init
81960484Sobrien     section.  */
82060484Sobrien  unsigned collect : 1;
82160484Sobrien
82260484Sobrien  /* This is true if the linker should ignore changes to the type of a
82360484Sobrien     symbol.  This is true for MIPS ELF because some Irix 5 objects
82460484Sobrien     record undefined functions as STT_OBJECT although the definitions
82560484Sobrien     are STT_FUNC.  */
82660484Sobrien  unsigned type_change_ok : 1;
82760484Sobrien
82860484Sobrien  /* Whether the backend may use REL relocations.  (Some backends use
82960484Sobrien     both REL and RELA relocations, and this flag is set for those
83060484Sobrien     backends.)  */
83160484Sobrien  unsigned may_use_rel_p : 1;
83277298Sobrien
83360484Sobrien  /* Whether the backend may use RELA relocations.  (Some backends use
83460484Sobrien     both REL and RELA relocations, and this flag is set for those
83560484Sobrien     backends.)  */
83660484Sobrien  unsigned may_use_rela_p : 1;
83760484Sobrien
83860484Sobrien  /* Whether the default relocation type is RELA.  If a backend with
83960484Sobrien     this flag set wants REL relocations for a particular section,
84060484Sobrien     it must note that explicitly.  Similarly, if this flag is clear,
84177298Sobrien     and the backend wants RELA relocations for a particular
84277298Sobrien     section.  */
84360484Sobrien  unsigned default_use_rela_p : 1;
84460484Sobrien
84599461Sobrien  /* Set if RELA relocations for a relocatable link can be handled by
84699461Sobrien     generic code.  Backends that set this flag need do nothing in the
84799461Sobrien     backend relocate_section routine for relocatable linking.  */
84899461Sobrien  unsigned rela_normal : 1;
84999461Sobrien
85060484Sobrien  /* True if addresses "naturally" sign extend.  This is used when
85160484Sobrien     swapping in from Elf32 when BFD64.  */
85260484Sobrien  unsigned sign_extend_vma : 1;
85360484Sobrien
85433965Sjdp  unsigned want_got_plt : 1;
85533965Sjdp  unsigned plt_readonly : 1;
85633965Sjdp  unsigned want_plt_sym : 1;
85738889Sjdp  unsigned plt_not_loaded : 1;
85838889Sjdp  unsigned plt_alignment : 4;
85960484Sobrien  unsigned can_gc_sections : 1;
86089857Sobrien  unsigned can_refcount : 1;
86189857Sobrien  unsigned want_got_sym : 1;
86260484Sobrien  unsigned want_dynbss : 1;
863104834Sobrien    /* Targets which do not support physical addressing often require
864104834Sobrien       that the p_paddr field in the section header to be set to zero.
865104834Sobrien       This field indicates whether this behavior is required.  */
866104834Sobrien  unsigned want_p_paddr_set_to_zero : 1;
86733965Sjdp};
86833965Sjdp
86933965Sjdp/* Information stored for each BFD section in an ELF file.  This
87033965Sjdp   structure is allocated by elf_new_section_hook.  */
87133965Sjdp
87233965Sjdpstruct bfd_elf_section_data
87333965Sjdp{
87433965Sjdp  /* The ELF header for this section.  */
87533965Sjdp  Elf_Internal_Shdr this_hdr;
87689857Sobrien
87733965Sjdp  /* The ELF header for the reloc section associated with this
87833965Sjdp     section, if any.  */
87933965Sjdp  Elf_Internal_Shdr rel_hdr;
88089857Sobrien
88133965Sjdp  /* If there is a second reloc section associated with this section,
88233965Sjdp     as can happen on Irix 6, this field points to the header.  */
88333965Sjdp  Elf_Internal_Shdr *rel_hdr2;
88489857Sobrien
88560484Sobrien  /* The number of relocations currently assigned to REL_HDR.  */
88660484Sobrien  unsigned int rel_count;
88789857Sobrien
88860484Sobrien  /* The number of relocations currently assigned to REL_HDR2.  */
88960484Sobrien  unsigned int rel_count2;
89089857Sobrien
89189857Sobrien  /* A pointer to a linked list tracking dynamic relocs copied for
89289857Sobrien     local symbols.  */
89389857Sobrien  PTR local_dynrel;
89489857Sobrien
89589857Sobrien  /* A pointer to the bfd section used for dynamic relocs.  */
89689857Sobrien  asection *sreloc;
89789857Sobrien
89833965Sjdp  /* The ELF section number of this section.  Only used for an output
89933965Sjdp     file.  */
90033965Sjdp  int this_idx;
90189857Sobrien
90260484Sobrien  /* The ELF section number of the reloc section indicated by
90360484Sobrien     REL_HDR if any.  Only used for an output file.  */
90433965Sjdp  int rel_idx;
90589857Sobrien
90660484Sobrien  /* The ELF section number of the reloc section indicated by
90760484Sobrien     REL_HDR2 if any.  Only used for an output file.  */
90860484Sobrien  int rel_idx2;
90989857Sobrien
91033965Sjdp  /* Used by the backend linker to store the symbol hash table entries
91133965Sjdp     associated with relocs against global symbols.  */
91233965Sjdp  struct elf_link_hash_entry **rel_hashes;
91389857Sobrien
91433965Sjdp  /* A pointer to the swapped relocs.  If the section uses REL relocs,
91533965Sjdp     rather than RELA, all the r_addend fields will be zero.  This
91633965Sjdp     pointer may be NULL.  It is used by the backend linker.  */
91733965Sjdp  Elf_Internal_Rela *relocs;
91889857Sobrien
91933965Sjdp  /* Used by the backend linker when generating a shared library to
92033965Sjdp     record the dynamic symbol index for a section symbol
92160484Sobrien     corresponding to this section.  A value of 0 means that there is
92260484Sobrien     no dynamic symbol for this section.  */
92333965Sjdp  long dynindx;
92489857Sobrien
92589857Sobrien  /* A pointer used for various section optimizations.  */
92689857Sobrien  PTR sec_info;
92789857Sobrien
92889857Sobrien  /* Type of that information.  */
92989857Sobrien  enum elf_link_info_type sec_info_type;
93089857Sobrien
931104834Sobrien  union {
932104834Sobrien    /* Group name, if this section is a member of a group.  */
933104834Sobrien    const char *name;
93489857Sobrien
935104834Sobrien    /* Group signature sym, if this is the SHT_GROUP section.  */
936104834Sobrien    struct symbol_cache_entry *id;
937104834Sobrien  } group;
938104834Sobrien
93989857Sobrien  /* A linked list of sections in the group.  Circular when used by
94089857Sobrien     the linker.  */
94189857Sobrien  asection *next_in_group;
94289857Sobrien
94333965Sjdp  /* A pointer available for the processor specific ELF backend.  */
94433965Sjdp  PTR tdata;
94589857Sobrien
94660484Sobrien  /* Nonzero if this section uses RELA relocations, rather than REL.  */
94760484Sobrien  unsigned int use_rela_p:1;
948104834Sobrien
949104834Sobrien  /* Nonzero when a group is COMDAT.  */
950104834Sobrien  unsigned int linkonce_p:1;
95133965Sjdp};
95233965Sjdp
95333965Sjdp#define elf_section_data(sec)  ((struct bfd_elf_section_data*)sec->used_by_bfd)
954104834Sobrien#define elf_group_name(sec)    (elf_section_data(sec)->group.name)
955104834Sobrien#define elf_group_id(sec)      (elf_section_data(sec)->group.id)
95689857Sobrien#define elf_next_in_group(sec) (elf_section_data(sec)->next_in_group)
957104834Sobrien#define elf_linkonce_p(sec)    (elf_section_data(sec)->linkonce_p)
95833965Sjdp
95989857Sobrien/* Return true if section has been discarded.  */
96089857Sobrien#define elf_discarded_section(sec)					\
96189857Sobrien  (!bfd_is_abs_section(sec)						\
96289857Sobrien   && bfd_is_abs_section((sec)->output_section)				\
963104834Sobrien   && elf_section_data (sec)->sec_info_type != ELF_INFO_TYPE_MERGE	\
964104834Sobrien   && elf_section_data (sec)->sec_info_type != ELF_INFO_TYPE_JUST_SYMS)
96589857Sobrien
96633965Sjdp#define get_elf_backend_data(abfd) \
96733965Sjdp  ((struct elf_backend_data *) (abfd)->xvec->backend_data)
96833965Sjdp
96933965Sjdp/* Enumeration to specify the special section.  */
97033965Sjdptypedef enum elf_linker_section_enum
97133965Sjdp{
97233965Sjdp  LINKER_SECTION_UNKNOWN,		/* not used */
97333965Sjdp  LINKER_SECTION_GOT,			/* .got section for global offset pointers */
97433965Sjdp  LINKER_SECTION_PLT,			/* .plt section for generated procedure stubs */
97533965Sjdp  LINKER_SECTION_SDATA,			/* .sdata/.sbss section for PowerPC */
97633965Sjdp  LINKER_SECTION_SDATA2,		/* .sdata2/.sbss2 section for PowerPC */
97733965Sjdp  LINKER_SECTION_MAX			/* # of linker sections */
97833965Sjdp} elf_linker_section_enum_t;
97933965Sjdp
98033965Sjdp/* Sections created by the linker.  */
98133965Sjdp
98233965Sjdptypedef struct elf_linker_section
98333965Sjdp{
98433965Sjdp  char *name;				/* name of the section */
98533965Sjdp  char *rel_name;			/* name of the associated .rel{,a}. section */
98633965Sjdp  char *bss_name;			/* name of a related .bss section */
98733965Sjdp  char *sym_name;			/* name of symbol to reference this section */
98833965Sjdp  asection *section;			/* pointer to the section */
98933965Sjdp  asection *bss_section;		/* pointer to the bss section associated with this */
99033965Sjdp  asection *rel_section;		/* pointer to the relocations needed for this section */
99133965Sjdp  struct elf_link_hash_entry *sym_hash;	/* pointer to the created symbol hash value */
99233965Sjdp  bfd_vma initial_size;			/* initial size before any linker generated allocations */
99333965Sjdp  bfd_vma sym_offset;			/* offset of symbol from beginning of section */
99433965Sjdp  bfd_vma hole_size;			/* size of reserved address hole in allocation */
99533965Sjdp  bfd_vma hole_offset;			/* current offset for the hole */
99633965Sjdp  bfd_vma max_hole_offset;		/* maximum offset for the hole */
99733965Sjdp  elf_linker_section_enum_t which;	/* which section this is */
99833965Sjdp  boolean hole_written_p;		/* whether the hole has been initialized */
99938889Sjdp  unsigned int alignment;		/* alignment for the section */
100033965Sjdp  flagword flags;			/* flags to use to create the section */
100133965Sjdp} elf_linker_section_t;
100233965Sjdp
100333965Sjdp/* Linked list of allocated pointer entries.  This hangs off of the symbol lists, and
100433965Sjdp   provides allows us to return different pointers, based on different addend's.  */
100533965Sjdp
100633965Sjdptypedef struct elf_linker_section_pointers
100733965Sjdp{
100833965Sjdp  struct elf_linker_section_pointers *next;	/* next allocated pointer for this symbol */
100933965Sjdp  bfd_vma offset;				/* offset of pointer from beginning of section */
101089857Sobrien  bfd_vma addend;				/* addend used */
101133965Sjdp  elf_linker_section_enum_t which;		/* which linker section this is */
101233965Sjdp  boolean written_address_p;			/* whether address was written yet */
101333965Sjdp} elf_linker_section_pointers_t;
101433965Sjdp
101533965Sjdp/* Some private data is stashed away for future use using the tdata pointer
101633965Sjdp   in the bfd structure.  */
101733965Sjdp
101833965Sjdpstruct elf_obj_tdata
101933965Sjdp{
102033965Sjdp  Elf_Internal_Ehdr elf_header[1];	/* Actual data, but ref like ptr */
102133965Sjdp  Elf_Internal_Shdr **elf_sect_ptr;
102233965Sjdp  Elf_Internal_Phdr *phdr;
102333965Sjdp  struct elf_segment_map *segment_map;
102489857Sobrien  struct elf_strtab_hash *strtab_ptr;
102533965Sjdp  int num_locals;
102633965Sjdp  int num_globals;
102789857Sobrien  unsigned int num_elf_sections;	/* elf_sect_ptr size */
102889857Sobrien  int num_section_syms;
102933965Sjdp  asymbol **section_syms;		/* STT_SECTION symbols for each section */
103033965Sjdp  Elf_Internal_Shdr symtab_hdr;
103133965Sjdp  Elf_Internal_Shdr shstrtab_hdr;
103233965Sjdp  Elf_Internal_Shdr strtab_hdr;
103333965Sjdp  Elf_Internal_Shdr dynsymtab_hdr;
103433965Sjdp  Elf_Internal_Shdr dynstrtab_hdr;
103533965Sjdp  Elf_Internal_Shdr dynversym_hdr;
103633965Sjdp  Elf_Internal_Shdr dynverref_hdr;
103733965Sjdp  Elf_Internal_Shdr dynverdef_hdr;
103889857Sobrien  Elf_Internal_Shdr symtab_shndx_hdr;
103933965Sjdp  unsigned int symtab_section, shstrtab_section;
104033965Sjdp  unsigned int strtab_section, dynsymtab_section;
104189857Sobrien  unsigned int symtab_shndx_section;
104233965Sjdp  unsigned int dynversym_section, dynverdef_section, dynverref_section;
104333965Sjdp  file_ptr next_file_pos;
104460484Sobrien#if 0
104560484Sobrien  /* we don't need these inside bfd anymore, and I think
104677298Sobrien     these weren't used outside bfd.  */
104733965Sjdp  void *prstatus;			/* The raw /proc prstatus structure */
104833965Sjdp  void *prpsinfo;			/* The raw /proc prpsinfo structure */
104960484Sobrien#endif
105089857Sobrien  bfd_vma gp;				/* The gp value */
105189857Sobrien  unsigned int gp_size;			/* The gp size */
105233965Sjdp
105389857Sobrien  Elf_Internal_Shdr **group_sect_ptr;
105489857Sobrien  int num_group;
105589857Sobrien
105677298Sobrien  /* Information grabbed from an elf core file.  */
105760484Sobrien  int core_signal;
105860484Sobrien  int core_pid;
105960484Sobrien  int core_lwpid;
106060484Sobrien  char* core_program;
106160484Sobrien  char* core_command;
106260484Sobrien
106333965Sjdp  /* This is set to true if the object was created by the backend
106433965Sjdp     linker.  */
106533965Sjdp  boolean linker;
106633965Sjdp
106733965Sjdp  /* A mapping from external symbols to entries in the linker hash
106833965Sjdp     table, used when linking.  This is indexed by the symbol index
106933965Sjdp     minus the sh_info field of the symbol table header.  */
107033965Sjdp  struct elf_link_hash_entry **sym_hashes;
107133965Sjdp
107233965Sjdp  /* A mapping from local symbols to offsets into the global offset
107360484Sobrien     table, used when linking.  This is indexed by the symbol index.
107460484Sobrien     Like for the globals, we use a union and two names primarily to
107560484Sobrien     document the intent of any particular piece of code.  The field
107660484Sobrien     should be used as a count until size_dynamic_sections, at which
107760484Sobrien     point the contents of the .got is fixed.  Afterward, if an entry
107877298Sobrien     is -1, then the symbol does not require a global offset table entry.  */
107960484Sobrien  union
108060484Sobrien    {
108160484Sobrien      bfd_signed_vma *refcounts;
108260484Sobrien      bfd_vma *offsets;
108360484Sobrien    } local_got;
108433965Sjdp
108533965Sjdp  /* A mapping from local symbols to offsets into the various linker
108633965Sjdp     sections added.  This is index by the symbol index.  */
108733965Sjdp  elf_linker_section_pointers_t **linker_section_pointers;
108833965Sjdp
108933965Sjdp  /* The linker ELF emulation code needs to let the backend ELF linker
109033965Sjdp     know what filename should be used for a dynamic object if the
109133965Sjdp     dynamic object is found using a search.  The emulation code then
109233965Sjdp     sometimes needs to know what name was actually used.  Until the
109333965Sjdp     file has been added to the linker symbol table, this field holds
109433965Sjdp     the name the linker wants.  After it has been added, it holds the
109533965Sjdp     name actually used, which will be the DT_SONAME entry if there is
109633965Sjdp     one.  */
109733965Sjdp  const char *dt_name;
109833965Sjdp
109977298Sobrien  /* When a reference in a regular object is resolved by a shared
110077298Sobrien     object is loaded into via the DT_NEEDED entries by the linker
110177298Sobrien     ELF emulation code, we need to add the shared object to the
110277298Sobrien     DT_NEEDED list of the resulting binary to indicate the dependency
110377298Sobrien     as if the -l option is passed to the linker. This field holds the
110477298Sobrien     name of the loaded shared object.  */
110577298Sobrien  const char *dt_soname;
110677298Sobrien
110733965Sjdp  /* Irix 5 often screws up the symbol table, sorting local symbols
110833965Sjdp     after global symbols.  This flag is set if the symbol table in
110933965Sjdp     this BFD appears to be screwed up.  If it is, we ignore the
111033965Sjdp     sh_info field in the symbol table header, and always read all the
111133965Sjdp     symbols.  */
111233965Sjdp  boolean bad_symtab;
111333965Sjdp
111433965Sjdp  /* Records the result of `get_program_header_size'.  */
111533965Sjdp  bfd_size_type program_header_size;
111633965Sjdp
111733965Sjdp  /* Used by find_nearest_line entry point.  */
111833965Sjdp  PTR line_info;
111933965Sjdp
112033965Sjdp  /* Used by MIPS ELF find_nearest_line entry point.  The structure
112133965Sjdp     could be included directly in this one, but there's no point to
112233965Sjdp     wasting the memory just for the infrequently called
112333965Sjdp     find_nearest_line.  */
112433965Sjdp  struct mips_elf_find_line *find_line_info;
112533965Sjdp
112677298Sobrien  /* A place to stash dwarf1 info for this bfd.  */
112760484Sobrien  struct dwarf1_debug *dwarf1_find_line_info;
112860484Sobrien
112977298Sobrien  /* A place to stash dwarf2 info for this bfd.  */
113077298Sobrien  PTR dwarf2_find_line_info;
113138889Sjdp
113233965Sjdp  /* An array of stub sections indexed by symbol number, used by the
113333965Sjdp     MIPS ELF linker.  FIXME: We should figure out some way to only
113433965Sjdp     include this field for a MIPS ELF target.  */
113533965Sjdp  asection **local_stubs;
113633965Sjdp
113733965Sjdp  /* Used to determine if the e_flags field has been initialized */
113833965Sjdp  boolean flags_init;
113933965Sjdp
114089857Sobrien  /* Used to determine if PT_GNU_EH_FRAME segment header should be
114189857Sobrien     created.  */
114289857Sobrien  boolean eh_frame_hdr;
114389857Sobrien
114433965Sjdp  /* Number of symbol version definitions we are about to emit.  */
114538889Sjdp  unsigned int cverdefs;
114633965Sjdp
114733965Sjdp  /* Number of symbol version references we are about to emit.  */
114838889Sjdp  unsigned int cverrefs;
114933965Sjdp
115033965Sjdp  /* Symbol version definitions in external objects.  */
115133965Sjdp  Elf_Internal_Verdef *verdef;
115233965Sjdp
115333965Sjdp  /* Symbol version references to external objects.  */
115433965Sjdp  Elf_Internal_Verneed *verref;
115533965Sjdp
115633965Sjdp  /* Linker sections that we are interested in.  */
115733965Sjdp  struct elf_linker_section *linker_section[ (int)LINKER_SECTION_MAX ];
115877298Sobrien
115977298Sobrien  /* The Irix 5 support uses two virtual sections, which represent
116077298Sobrien     text/data symbols defined in dynamic objects.  */
116177298Sobrien  asymbol *elf_data_symbol;
116277298Sobrien  asymbol *elf_text_symbol;
116377298Sobrien  asection *elf_data_section;
116477298Sobrien  asection *elf_text_section;
116533965Sjdp};
116633965Sjdp
116733965Sjdp#define elf_tdata(bfd)		((bfd) -> tdata.elf_obj_data)
116833965Sjdp#define elf_elfheader(bfd)	(elf_tdata(bfd) -> elf_header)
116933965Sjdp#define elf_elfsections(bfd)	(elf_tdata(bfd) -> elf_sect_ptr)
117089857Sobrien#define elf_numsections(bfd)	(elf_tdata(bfd) -> num_elf_sections)
117133965Sjdp#define elf_shstrtab(bfd)	(elf_tdata(bfd) -> strtab_ptr)
117233965Sjdp#define elf_onesymtab(bfd)	(elf_tdata(bfd) -> symtab_section)
117389857Sobrien#define elf_symtab_shndx(bfd)	(elf_tdata(bfd) -> symtab_shndx_section)
117433965Sjdp#define elf_dynsymtab(bfd)	(elf_tdata(bfd) -> dynsymtab_section)
117533965Sjdp#define elf_dynversym(bfd)	(elf_tdata(bfd) -> dynversym_section)
117633965Sjdp#define elf_dynverdef(bfd)	(elf_tdata(bfd) -> dynverdef_section)
117733965Sjdp#define elf_dynverref(bfd)	(elf_tdata(bfd) -> dynverref_section)
117833965Sjdp#define elf_num_locals(bfd)	(elf_tdata(bfd) -> num_locals)
117933965Sjdp#define elf_num_globals(bfd)	(elf_tdata(bfd) -> num_globals)
118033965Sjdp#define elf_section_syms(bfd)	(elf_tdata(bfd) -> section_syms)
118189857Sobrien#define elf_num_section_syms(bfd) (elf_tdata(bfd) -> num_section_syms)
118233965Sjdp#define core_prpsinfo(bfd)	(elf_tdata(bfd) -> prpsinfo)
118333965Sjdp#define core_prstatus(bfd)	(elf_tdata(bfd) -> prstatus)
118433965Sjdp#define elf_gp(bfd)		(elf_tdata(bfd) -> gp)
118533965Sjdp#define elf_gp_size(bfd)	(elf_tdata(bfd) -> gp_size)
118633965Sjdp#define elf_sym_hashes(bfd)	(elf_tdata(bfd) -> sym_hashes)
118760484Sobrien#define elf_local_got_refcounts(bfd) (elf_tdata(bfd) -> local_got.refcounts)
118860484Sobrien#define elf_local_got_offsets(bfd) (elf_tdata(bfd) -> local_got.offsets)
118933965Sjdp#define elf_local_ptr_offsets(bfd) (elf_tdata(bfd) -> linker_section_pointers)
119033965Sjdp#define elf_dt_name(bfd)	(elf_tdata(bfd) -> dt_name)
119177298Sobrien#define elf_dt_soname(bfd)	(elf_tdata(bfd) -> dt_soname)
119233965Sjdp#define elf_bad_symtab(bfd)	(elf_tdata(bfd) -> bad_symtab)
119333965Sjdp#define elf_flags_init(bfd)	(elf_tdata(bfd) -> flags_init)
119433965Sjdp#define elf_linker_section(bfd,n) (elf_tdata(bfd) -> linker_section[(int)n])
119533965Sjdp
119633965Sjdpextern void _bfd_elf_swap_verdef_in
119733965Sjdp  PARAMS ((bfd *, const Elf_External_Verdef *, Elf_Internal_Verdef *));
119833965Sjdpextern void _bfd_elf_swap_verdef_out
119933965Sjdp  PARAMS ((bfd *, const Elf_Internal_Verdef *, Elf_External_Verdef *));
120033965Sjdpextern void _bfd_elf_swap_verdaux_in
120133965Sjdp  PARAMS ((bfd *, const Elf_External_Verdaux *, Elf_Internal_Verdaux *));
120233965Sjdpextern void _bfd_elf_swap_verdaux_out
120333965Sjdp  PARAMS ((bfd *, const Elf_Internal_Verdaux *, Elf_External_Verdaux *));
120433965Sjdpextern void _bfd_elf_swap_verneed_in
120533965Sjdp  PARAMS ((bfd *, const Elf_External_Verneed *, Elf_Internal_Verneed *));
120633965Sjdpextern void _bfd_elf_swap_verneed_out
120733965Sjdp  PARAMS ((bfd *, const Elf_Internal_Verneed *, Elf_External_Verneed *));
120833965Sjdpextern void _bfd_elf_swap_vernaux_in
120933965Sjdp  PARAMS ((bfd *, const Elf_External_Vernaux *, Elf_Internal_Vernaux *));
121033965Sjdpextern void _bfd_elf_swap_vernaux_out
121133965Sjdp  PARAMS ((bfd *, const Elf_Internal_Vernaux *, Elf_External_Vernaux *));
121233965Sjdpextern void _bfd_elf_swap_versym_in
121333965Sjdp  PARAMS ((bfd *, const Elf_External_Versym *, Elf_Internal_Versym *));
121433965Sjdpextern void _bfd_elf_swap_versym_out
121533965Sjdp  PARAMS ((bfd *, const Elf_Internal_Versym *, Elf_External_Versym *));
121633965Sjdp
121789857Sobrienextern int _bfd_elf_section_from_bfd_section
121889857Sobrien  PARAMS ((bfd *, asection *));
121933965Sjdpextern char *bfd_elf_string_from_elf_section
122033965Sjdp  PARAMS ((bfd *, unsigned, unsigned));
122189857Sobrienextern char *bfd_elf_get_str_section
122289857Sobrien  PARAMS ((bfd *, unsigned));
1223104834Sobrienextern Elf_Internal_Sym *bfd_elf_get_elf_syms
1224104834Sobrien  PARAMS ((bfd *, Elf_Internal_Shdr *, size_t, size_t,
1225104834Sobrien	   Elf_Internal_Sym *, PTR, Elf_External_Sym_Shndx *));
122633965Sjdp
122789857Sobrienextern boolean _bfd_elf_copy_private_bfd_data
122889857Sobrien  PARAMS ((bfd *, bfd *));
122989857Sobrienextern boolean _bfd_elf_print_private_bfd_data
123089857Sobrien  PARAMS ((bfd *, PTR));
123189857Sobrienextern void bfd_elf_print_symbol
123289857Sobrien  PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type));
123333965Sjdp
123489857Sobrien#define elf_string_from_elf_strtab(abfd, strindex) \
123589857Sobrien  bfd_elf_string_from_elf_section(abfd, elf_elfheader(abfd)->e_shstrndx, \
123689857Sobrien				  strindex)
123789857Sobrien
123833965Sjdp#define bfd_elf32_print_symbol	bfd_elf_print_symbol
123933965Sjdp#define bfd_elf64_print_symbol	bfd_elf_print_symbol
124033965Sjdp
124189857Sobrienextern void _bfd_elf_sprintf_vma
124289857Sobrien  PARAMS ((bfd *, char *, bfd_vma));
124389857Sobrienextern void _bfd_elf_fprintf_vma
124489857Sobrien  PARAMS ((bfd *, PTR, bfd_vma));
124533965Sjdp
124689857Sobrienextern enum elf_reloc_type_class _bfd_elf_reloc_type_class
124789857Sobrien  PARAMS ((const Elf_Internal_Rela *));
124889857Sobrienextern bfd_vma _bfd_elf_rela_local_sym
124989857Sobrien  PARAMS ((bfd *, Elf_Internal_Sym *, asection *, Elf_Internal_Rela *));
125089857Sobrienextern bfd_vma _bfd_elf_rel_local_sym
125189857Sobrien  PARAMS ((bfd *, Elf_Internal_Sym *, asection **, bfd_vma));
125289857Sobrienextern bfd_vma _bfd_elf_section_offset
125389857Sobrien  PARAMS ((bfd *, struct bfd_link_info *, asection *, bfd_vma));
125489857Sobrien
125589857Sobrienextern unsigned long bfd_elf_hash
125689857Sobrien  PARAMS ((const char *));
125789857Sobrien
125889857Sobrienextern bfd_reloc_status_type bfd_elf_generic_reloc
125989857Sobrien  PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
126089857Sobrienextern boolean bfd_elf_mkobject
126189857Sobrien  PARAMS ((bfd *));
126289857Sobrienextern boolean bfd_elf_mkcorefile
126389857Sobrien  PARAMS ((bfd *));
126489857Sobrienextern Elf_Internal_Shdr *bfd_elf_find_section
126589857Sobrien  PARAMS ((bfd *, char *));
126633965Sjdpextern boolean _bfd_elf_make_section_from_shdr
126789857Sobrien  PARAMS ((bfd *, Elf_Internal_Shdr *, const char *));
126860484Sobrienextern boolean _bfd_elf_make_section_from_phdr
126989857Sobrien  PARAMS ((bfd *, Elf_Internal_Phdr *, int, const char *));
127033965Sjdpextern struct bfd_hash_entry *_bfd_elf_link_hash_newfunc
127133965Sjdp  PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
127233965Sjdpextern struct bfd_link_hash_table *_bfd_elf_link_hash_table_create
127333965Sjdp  PARAMS ((bfd *));
127460484Sobrienextern void _bfd_elf_link_hash_copy_indirect
1275104834Sobrien  PARAMS ((struct elf_backend_data *, struct elf_link_hash_entry *,
1276104834Sobrien	   struct elf_link_hash_entry *));
127760484Sobrienextern void _bfd_elf_link_hash_hide_symbol
127889857Sobrien  PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *, boolean));
127933965Sjdpextern boolean _bfd_elf_link_hash_table_init
128033965Sjdp  PARAMS ((struct elf_link_hash_table *, bfd *,
128133965Sjdp	   struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
128233965Sjdp				       struct bfd_hash_table *,
128333965Sjdp				       const char *)));
128489857Sobrienextern boolean _bfd_elf_slurp_version_tables
128589857Sobrien  PARAMS ((bfd *));
128689857Sobrienextern boolean _bfd_elf_merge_sections
128789857Sobrien  PARAMS ((bfd *, struct bfd_link_info *));
1288104834Sobrienextern boolean bfd_elf_discard_group
1289104834Sobrien  PARAMS ((bfd *, struct sec *));
1290104834Sobrienextern void bfd_elf_set_group_contents
1291104834Sobrien  PARAMS ((bfd *, asection *, PTR));
1292104834Sobrienextern void _bfd_elf_link_just_syms
1293104834Sobrien  PARAMS ((asection *, struct bfd_link_info *));
129433965Sjdpextern boolean _bfd_elf_copy_private_symbol_data
129533965Sjdp  PARAMS ((bfd *, asymbol *, bfd *, asymbol *));
129633965Sjdpextern boolean _bfd_elf_copy_private_section_data
129733965Sjdp  PARAMS ((bfd *, asection *, bfd *, asection *));
129889857Sobrienextern boolean _bfd_elf_write_object_contents
129989857Sobrien  PARAMS ((bfd *));
130089857Sobrienextern boolean _bfd_elf_write_corefile_contents
130189857Sobrien  PARAMS ((bfd *));
130289857Sobrienextern boolean _bfd_elf_set_section_contents
130389857Sobrien  PARAMS ((bfd *, sec_ptr, PTR, file_ptr, bfd_size_type));
130489857Sobrienextern long _bfd_elf_get_symtab_upper_bound
130589857Sobrien  PARAMS ((bfd *));
130689857Sobrienextern long _bfd_elf_get_symtab
130789857Sobrien  PARAMS ((bfd *, asymbol **));
130889857Sobrienextern long _bfd_elf_get_dynamic_symtab_upper_bound
130989857Sobrien  PARAMS ((bfd *));
131089857Sobrienextern long _bfd_elf_canonicalize_dynamic_symtab
131189857Sobrien  PARAMS ((bfd *, asymbol **));
131289857Sobrienextern long _bfd_elf_get_reloc_upper_bound
131389857Sobrien  PARAMS ((bfd *, sec_ptr));
131489857Sobrienextern long _bfd_elf_canonicalize_reloc
131589857Sobrien  PARAMS ((bfd *, sec_ptr, arelent **, asymbol **));
131689857Sobrienextern long _bfd_elf_get_dynamic_reloc_upper_bound
131789857Sobrien  PARAMS ((bfd *));
131889857Sobrienextern long _bfd_elf_canonicalize_dynamic_reloc
131989857Sobrien  PARAMS ((bfd *, arelent **, asymbol **));
132089857Sobrienextern asymbol *_bfd_elf_make_empty_symbol
132189857Sobrien  PARAMS ((bfd *));
132289857Sobrienextern void _bfd_elf_get_symbol_info
132389857Sobrien  PARAMS ((bfd *, asymbol *, symbol_info *));
132489857Sobrienextern boolean _bfd_elf_is_local_label_name
132589857Sobrien  PARAMS ((bfd *, const char *));
132689857Sobrienextern alent *_bfd_elf_get_lineno
132789857Sobrien  PARAMS ((bfd *, asymbol *));
132889857Sobrienextern boolean _bfd_elf_set_arch_mach
132989857Sobrien  PARAMS ((bfd *, enum bfd_architecture, unsigned long));
133089857Sobrienextern boolean _bfd_elf_find_nearest_line
133189857Sobrien  PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
133289857Sobrien	   const char **, unsigned int *));
133333965Sjdp#define _bfd_elf_read_minisymbols _bfd_generic_read_minisymbols
133433965Sjdp#define _bfd_elf_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
133589857Sobrienextern int _bfd_elf_sizeof_headers
133689857Sobrien  PARAMS ((bfd *, boolean));
133789857Sobrienextern boolean _bfd_elf_new_section_hook
133889857Sobrien  PARAMS ((bfd *, asection *));
133977298Sobrienextern boolean _bfd_elf_init_reloc_shdr
134060484Sobrien  PARAMS ((bfd *, Elf_Internal_Shdr *, asection *, boolean));
134133965Sjdp
134233965Sjdp/* If the target doesn't have reloc handling written yet:  */
134389857Sobrienextern void _bfd_elf_no_info_to_howto
134489857Sobrien  PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
134533965Sjdp
134689857Sobrienextern boolean bfd_section_from_shdr
134789857Sobrien  PARAMS ((bfd *, unsigned int shindex));
134889857Sobrienextern boolean bfd_section_from_phdr
134989857Sobrien  PARAMS ((bfd *, Elf_Internal_Phdr *, int));
135033965Sjdp
135189857Sobrienextern int _bfd_elf_symbol_from_bfd_symbol
135289857Sobrien  PARAMS ((bfd *, asymbol **));
135333965Sjdp
135489857Sobrienextern asection *bfd_section_from_r_symndx
135589857Sobrien  PARAMS ((bfd *, struct sym_sec_cache *, asection *, unsigned long));
135689857Sobrienextern asection *bfd_section_from_elf_index
135789857Sobrien  PARAMS ((bfd *, unsigned int));
135889857Sobrienextern boolean _bfd_elf_create_dynamic_sections
135989857Sobrien  PARAMS ((bfd *, struct bfd_link_info *));
136089857Sobrienextern struct bfd_strtab_hash *_bfd_elf_stringtab_init
136189857Sobrien  PARAMS ((void));
136233965Sjdp
136389857Sobrienextern struct elf_strtab_hash * _bfd_elf_strtab_init
136489857Sobrien  PARAMS ((void));
136589857Sobrienextern void _bfd_elf_strtab_free
136689857Sobrien  PARAMS ((struct elf_strtab_hash *));
136789857Sobrienextern bfd_size_type _bfd_elf_strtab_add
136889857Sobrien  PARAMS ((struct elf_strtab_hash *, const char *, boolean));
136989857Sobrienextern void _bfd_elf_strtab_addref
137089857Sobrien  PARAMS ((struct elf_strtab_hash *, bfd_size_type));
137189857Sobrienextern void _bfd_elf_strtab_delref
137289857Sobrien  PARAMS ((struct elf_strtab_hash *, bfd_size_type));
137389857Sobrienextern void _bfd_elf_strtab_clear_all_refs
137489857Sobrien  PARAMS ((struct elf_strtab_hash *));
137589857Sobrienextern bfd_size_type _bfd_elf_strtab_size
137689857Sobrien  PARAMS ((struct elf_strtab_hash *));
137789857Sobrienextern bfd_size_type _bfd_elf_strtab_offset
137889857Sobrien  PARAMS ((struct elf_strtab_hash *, bfd_size_type));
137989857Sobrienextern boolean _bfd_elf_strtab_emit
138089857Sobrien  PARAMS ((bfd *, struct elf_strtab_hash *));
138189857Sobrienextern void _bfd_elf_strtab_finalize
138289857Sobrien  PARAMS ((struct elf_strtab_hash *));
138333965Sjdp
138489857Sobrienextern boolean _bfd_elf_discard_section_eh_frame
138589857Sobrien  PARAMS ((bfd *, struct bfd_link_info *, asection *, asection *,
138689857Sobrien	   boolean (*) (bfd_vma, PTR), struct elf_reloc_cookie *));
138789857Sobrienextern boolean _bfd_elf_discard_section_eh_frame_hdr
138889857Sobrien  PARAMS ((bfd *, struct bfd_link_info *, asection *));
138989857Sobrienextern bfd_vma _bfd_elf_eh_frame_section_offset
139089857Sobrien  PARAMS ((bfd *, asection *, bfd_vma));
139189857Sobrienextern boolean _bfd_elf_write_section_eh_frame
139289857Sobrien  PARAMS ((bfd *, asection *, asection *, bfd_byte *));
139389857Sobrienextern boolean _bfd_elf_write_section_eh_frame_hdr
139489857Sobrien  PARAMS ((bfd *, asection *));
139589857Sobrienextern boolean _bfd_elf_maybe_strip_eh_frame_hdr
139689857Sobrien  PARAMS ((struct bfd_link_info *));
139733965Sjdp
139889857Sobrienextern boolean _bfd_elf_link_record_dynamic_symbol
139989857Sobrien  PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
140089857Sobrienextern long _bfd_elf_link_lookup_local_dynindx
140189857Sobrien  PARAMS ((struct bfd_link_info *, bfd *, long));
140289857Sobrienextern boolean _bfd_elf_compute_section_file_positions
140389857Sobrien  PARAMS ((bfd *, struct bfd_link_info *));
140489857Sobrienextern void _bfd_elf_assign_file_positions_for_relocs
140589857Sobrien  PARAMS ((bfd *));
140689857Sobrienextern file_ptr _bfd_elf_assign_file_position_for_section
140789857Sobrien  PARAMS ((Elf_Internal_Shdr *, file_ptr, boolean));
140833965Sjdp
140989857Sobrienextern boolean _bfd_elf_validate_reloc
141089857Sobrien  PARAMS ((bfd *, arelent *));
141133965Sjdp
141289857Sobrienextern boolean _bfd_elf_create_dynamic_sections
141389857Sobrien  PARAMS ((bfd *, struct bfd_link_info *));
141489857Sobrienextern boolean _bfd_elf_create_got_section
141589857Sobrien  PARAMS ((bfd *, struct bfd_link_info *));
141689857Sobrienextern unsigned long _bfd_elf_link_renumber_dynsyms
141789857Sobrien  PARAMS ((bfd *, struct bfd_link_info *));
141833965Sjdp
141989857Sobrienextern boolean _bfd_elfcore_make_pseudosection
142089857Sobrien  PARAMS ((bfd *, char *, size_t, ufile_ptr));
142189857Sobrienextern char *_bfd_elfcore_strndup
142289857Sobrien  PARAMS ((bfd *, char *, size_t));
142333965Sjdp
142489857Sobrienextern elf_linker_section_t *_bfd_elf_create_linker_section
142589857Sobrien  PARAMS ((bfd *, struct bfd_link_info *, enum elf_linker_section_enum,
142689857Sobrien	   elf_linker_section_t *));
142733965Sjdp
142889857Sobrienextern elf_linker_section_pointers_t *_bfd_elf_find_pointer_linker_section
142989857Sobrien  PARAMS ((elf_linker_section_pointers_t *, bfd_vma,
143089857Sobrien	   elf_linker_section_enum_t));
143133965Sjdp
143289857Sobrienextern boolean bfd_elf32_create_pointer_linker_section
143389857Sobrien  PARAMS ((bfd *, struct bfd_link_info *, elf_linker_section_t *,
143489857Sobrien	   struct elf_link_hash_entry *, const Elf32_Internal_Rela *));
143533965Sjdp
143689857Sobrienextern bfd_vma bfd_elf32_finish_pointer_linker_section
143789857Sobrien  PARAMS ((bfd *, bfd *, struct bfd_link_info *, elf_linker_section_t *,
143889857Sobrien	   struct elf_link_hash_entry *, bfd_vma,
143989857Sobrien	   const Elf32_Internal_Rela *, int));
144060484Sobrien
144189857Sobrienextern boolean bfd_elf64_create_pointer_linker_section
144289857Sobrien  PARAMS ((bfd *, struct bfd_link_info *, elf_linker_section_t *,
144389857Sobrien	   struct elf_link_hash_entry *, const Elf64_Internal_Rela *));
144433965Sjdp
144589857Sobrienextern bfd_vma bfd_elf64_finish_pointer_linker_section
144689857Sobrien  PARAMS ((bfd *, bfd *, struct bfd_link_info *, elf_linker_section_t *,
144789857Sobrien	   struct elf_link_hash_entry *, bfd_vma,
144889857Sobrien	   const Elf64_Internal_Rela *, int));
144989857Sobrien
145089857Sobrienextern boolean _bfd_elf_make_linker_section_rela
145189857Sobrien  PARAMS ((bfd *, elf_linker_section_t *, int));
145289857Sobrien
145389857Sobrienextern const bfd_target *bfd_elf32_object_p
145489857Sobrien  PARAMS ((bfd *));
145589857Sobrienextern const bfd_target *bfd_elf32_core_file_p
145689857Sobrien  PARAMS ((bfd *));
145789857Sobrienextern char *bfd_elf32_core_file_failing_command
145889857Sobrien  PARAMS ((bfd *));
145989857Sobrienextern int bfd_elf32_core_file_failing_signal
146089857Sobrien  PARAMS ((bfd *));
146189857Sobrienextern boolean bfd_elf32_core_file_matches_executable_p
146289857Sobrien  PARAMS ((bfd *, bfd *));
146389857Sobrien
146433965Sjdpextern boolean bfd_elf32_bfd_link_add_symbols
146533965Sjdp  PARAMS ((bfd *, struct bfd_link_info *));
146633965Sjdpextern boolean bfd_elf32_bfd_final_link
146733965Sjdp  PARAMS ((bfd *, struct bfd_link_info *));
146833965Sjdp
146933965Sjdpextern void bfd_elf32_swap_symbol_in
1470104834Sobrien  PARAMS ((bfd *, const PTR, const PTR, Elf_Internal_Sym *));
147133965Sjdpextern void bfd_elf32_swap_symbol_out
147289857Sobrien  PARAMS ((bfd *, const Elf_Internal_Sym *, PTR, PTR));
147333965Sjdpextern void bfd_elf32_swap_reloc_in
147433965Sjdp  PARAMS ((bfd *, const Elf32_External_Rel *, Elf_Internal_Rel *));
147533965Sjdpextern void bfd_elf32_swap_reloc_out
147633965Sjdp  PARAMS ((bfd *, const Elf_Internal_Rel *, Elf32_External_Rel *));
147733965Sjdpextern void bfd_elf32_swap_reloca_in
147833965Sjdp  PARAMS ((bfd *, const Elf32_External_Rela *, Elf_Internal_Rela *));
147933965Sjdpextern void bfd_elf32_swap_reloca_out
148033965Sjdp  PARAMS ((bfd *, const Elf_Internal_Rela *, Elf32_External_Rela *));
148133965Sjdpextern void bfd_elf32_swap_phdr_in
148233965Sjdp  PARAMS ((bfd *, const Elf32_External_Phdr *, Elf_Internal_Phdr *));
148333965Sjdpextern void bfd_elf32_swap_phdr_out
148433965Sjdp  PARAMS ((bfd *, const Elf_Internal_Phdr *, Elf32_External_Phdr *));
148533965Sjdpextern void bfd_elf32_swap_dyn_in
148633965Sjdp  PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *));
148733965Sjdpextern void bfd_elf32_swap_dyn_out
148860484Sobrien  PARAMS ((bfd *, const Elf_Internal_Dyn *, PTR));
148933965Sjdpextern long bfd_elf32_slurp_symbol_table
149033965Sjdp  PARAMS ((bfd *, asymbol **, boolean));
149189857Sobrienextern boolean bfd_elf32_write_shdrs_and_ehdr
149289857Sobrien  PARAMS ((bfd *));
149333965Sjdpextern int bfd_elf32_write_out_phdrs
149489857Sobrien  PARAMS ((bfd *, const Elf_Internal_Phdr *, unsigned int));
149577298Sobrienextern void bfd_elf32_write_relocs
149677298Sobrien  PARAMS ((bfd *, asection *, PTR));
149777298Sobrienextern boolean bfd_elf32_slurp_reloc_table
149877298Sobrien  PARAMS ((bfd *, asection *, asymbol **, boolean));
149933965Sjdpextern boolean bfd_elf32_add_dynamic_entry
150033965Sjdp  PARAMS ((struct bfd_link_info *, bfd_vma, bfd_vma));
150133965Sjdpextern boolean bfd_elf32_link_create_dynamic_sections
150233965Sjdp  PARAMS ((bfd *, struct bfd_link_info *));
150333965Sjdpextern Elf_Internal_Rela *_bfd_elf32_link_read_relocs
150433965Sjdp  PARAMS ((bfd *, asection *, PTR, Elf_Internal_Rela *, boolean));
150533965Sjdp
150689857Sobrienextern const bfd_target *bfd_elf64_object_p
150789857Sobrien  PARAMS ((bfd *));
150889857Sobrienextern const bfd_target *bfd_elf64_core_file_p
150989857Sobrien  PARAMS ((bfd *));
151089857Sobrienextern char *bfd_elf64_core_file_failing_command
151189857Sobrien  PARAMS ((bfd *));
151289857Sobrienextern int bfd_elf64_core_file_failing_signal
151389857Sobrien  PARAMS ((bfd *));
151489857Sobrienextern boolean bfd_elf64_core_file_matches_executable_p
151589857Sobrien  PARAMS ((bfd *, bfd *));
151633965Sjdpextern boolean bfd_elf64_bfd_link_add_symbols
151733965Sjdp  PARAMS ((bfd *, struct bfd_link_info *));
151833965Sjdpextern boolean bfd_elf64_bfd_final_link
151933965Sjdp  PARAMS ((bfd *, struct bfd_link_info *));
152033965Sjdp
152133965Sjdpextern void bfd_elf64_swap_symbol_in
1522104834Sobrien  PARAMS ((bfd *, const PTR, const PTR, Elf_Internal_Sym *));
152333965Sjdpextern void bfd_elf64_swap_symbol_out
152489857Sobrien  PARAMS ((bfd *, const Elf_Internal_Sym *, PTR, PTR));
152533965Sjdpextern void bfd_elf64_swap_reloc_in
152633965Sjdp  PARAMS ((bfd *, const Elf64_External_Rel *, Elf_Internal_Rel *));
152733965Sjdpextern void bfd_elf64_swap_reloc_out
152833965Sjdp  PARAMS ((bfd *, const Elf_Internal_Rel *, Elf64_External_Rel *));
152933965Sjdpextern void bfd_elf64_swap_reloca_in
153033965Sjdp  PARAMS ((bfd *, const Elf64_External_Rela *, Elf_Internal_Rela *));
153133965Sjdpextern void bfd_elf64_swap_reloca_out
153233965Sjdp  PARAMS ((bfd *, const Elf_Internal_Rela *, Elf64_External_Rela *));
153333965Sjdpextern void bfd_elf64_swap_phdr_in
153433965Sjdp  PARAMS ((bfd *, const Elf64_External_Phdr *, Elf_Internal_Phdr *));
153533965Sjdpextern void bfd_elf64_swap_phdr_out
153633965Sjdp  PARAMS ((bfd *, const Elf_Internal_Phdr *, Elf64_External_Phdr *));
153733965Sjdpextern void bfd_elf64_swap_dyn_in
153833965Sjdp  PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *));
153933965Sjdpextern void bfd_elf64_swap_dyn_out
154060484Sobrien  PARAMS ((bfd *, const Elf_Internal_Dyn *, PTR));
154133965Sjdpextern long bfd_elf64_slurp_symbol_table
154233965Sjdp  PARAMS ((bfd *, asymbol **, boolean));
154389857Sobrienextern boolean bfd_elf64_write_shdrs_and_ehdr
154489857Sobrien  PARAMS ((bfd *));
154533965Sjdpextern int bfd_elf64_write_out_phdrs
154689857Sobrien  PARAMS ((bfd *, const Elf_Internal_Phdr *, unsigned int));
154777298Sobrienextern void bfd_elf64_write_relocs
154877298Sobrien  PARAMS ((bfd *, asection *, PTR));
154977298Sobrienextern boolean bfd_elf64_slurp_reloc_table
155077298Sobrien  PARAMS ((bfd *, asection *, asymbol **, boolean));
155133965Sjdpextern boolean bfd_elf64_add_dynamic_entry
155233965Sjdp  PARAMS ((struct bfd_link_info *, bfd_vma, bfd_vma));
155333965Sjdpextern boolean bfd_elf64_link_create_dynamic_sections
155433965Sjdp  PARAMS ((bfd *, struct bfd_link_info *));
155533965Sjdpextern Elf_Internal_Rela *_bfd_elf64_link_read_relocs
155633965Sjdp  PARAMS ((bfd *, asection *, PTR, Elf_Internal_Rela *, boolean));
155733965Sjdp
155860484Sobrien#define bfd_elf32_link_record_dynamic_symbol \
155960484Sobrien  _bfd_elf_link_record_dynamic_symbol
156060484Sobrien#define bfd_elf64_link_record_dynamic_symbol \
156160484Sobrien  _bfd_elf_link_record_dynamic_symbol
156233965Sjdp
1563104834Sobrienextern int elf_link_record_local_dynamic_symbol
156460484Sobrien  PARAMS ((struct bfd_link_info *, bfd *, long));
1565104834Sobrien#define _bfd_elf32_link_record_local_dynamic_symbol \
1566104834Sobrien  elf_link_record_local_dynamic_symbol
1567104834Sobrien#define _bfd_elf64_link_record_local_dynamic_symbol \
1568104834Sobrien  elf_link_record_local_dynamic_symbol
156960484Sobrien
157089857Sobrienextern boolean _bfd_elf_close_and_cleanup
157189857Sobrien  PARAMS ((bfd *));
157260484Sobrienextern bfd_reloc_status_type _bfd_elf_rel_vtable_reloc_fn
157360484Sobrien  PARAMS ((bfd *, arelent *, struct symbol_cache_entry *, PTR,
157460484Sobrien           asection *, bfd *, char **));
157538889Sjdp
157689857Sobrienextern boolean _bfd_elf32_gc_sections
157760484Sobrien  PARAMS ((bfd *, struct bfd_link_info *));
157889857Sobrienextern boolean _bfd_elf32_gc_common_finalize_got_offsets
157989857Sobrien  PARAMS ((bfd *, struct bfd_link_info *));
158089857Sobrienextern boolean _bfd_elf32_gc_common_final_link
158189857Sobrien  PARAMS ((bfd *, struct bfd_link_info *));
158289857Sobrienextern boolean _bfd_elf32_gc_record_vtinherit
158360484Sobrien  PARAMS ((bfd *, asection *, struct elf_link_hash_entry *, bfd_vma));
158489857Sobrienextern boolean _bfd_elf32_gc_record_vtentry
158560484Sobrien  PARAMS ((bfd *, asection *, struct elf_link_hash_entry *, bfd_vma));
158660484Sobrien
158789857Sobrienextern boolean _bfd_elf64_gc_sections
158860484Sobrien  PARAMS ((bfd *, struct bfd_link_info *));
158989857Sobrienextern boolean _bfd_elf64_gc_common_finalize_got_offsets
159089857Sobrien  PARAMS ((bfd *, struct bfd_link_info *));
159189857Sobrienextern boolean _bfd_elf64_gc_common_final_link
159289857Sobrien  PARAMS ((bfd *, struct bfd_link_info *));
159389857Sobrienextern boolean _bfd_elf64_gc_record_vtinherit
159460484Sobrien  PARAMS ((bfd *, asection *, struct elf_link_hash_entry *, bfd_vma));
159589857Sobrienextern boolean _bfd_elf64_gc_record_vtentry
159660484Sobrien  PARAMS ((bfd *, asection *, struct elf_link_hash_entry *, bfd_vma));
159760484Sobrien
159889857Sobrienextern boolean _bfd_elf32_reloc_symbol_deleted_p
159989857Sobrien  PARAMS ((bfd_vma, PTR));
160089857Sobrienextern boolean _bfd_elf64_reloc_symbol_deleted_p
160189857Sobrien  PARAMS ((bfd_vma, PTR));
160289857Sobrien
160389857Sobrien/* Exported interface for writing elf corefile notes. */
1604104834Sobrienextern char *elfcore_write_note
1605104834Sobrien  PARAMS ((bfd *, char *, int *, const char *, int, const PTR, int));
1606104834Sobrienextern char *elfcore_write_prpsinfo
1607104834Sobrien  PARAMS ((bfd *, char *, int *, const char *, const char *));
1608104834Sobrienextern char *elfcore_write_prstatus
1609104834Sobrien  PARAMS ((bfd *, char *, int *, long, int, const PTR));
1610104834Sobrienextern char * elfcore_write_pstatus
1611104834Sobrien  PARAMS ((bfd *, char *, int *, long, int, const PTR));
1612104834Sobrienextern char *elfcore_write_prfpreg
1613104834Sobrien  PARAMS ((bfd *, char *, int *, const PTR, int));
1614104834Sobrienextern char *elfcore_write_prxfpreg
1615104834Sobrien  PARAMS ((bfd *, char *, int *, const PTR, int));
1616104834Sobrienextern char *elfcore_write_lwpstatus
1617104834Sobrien  PARAMS ((bfd *, char *, int *, long, int, const PTR));
161889857Sobrien
161960484Sobrien/* SH ELF specific routine.  */
162060484Sobrien
162189857Sobrienextern boolean _sh_elf_set_mach_from_flags
162289857Sobrien  PARAMS ((bfd *));
162360484Sobrien
162433965Sjdp#endif /* _LIBELF_H_ */
1625