Line 1... |
Line 1... |
/* BFD back-end data structures for ELF files.
|
/* BFD back-end data structures for ELF files.
|
Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
|
Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
|
2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
|
2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
|
|
Free Software Foundation, Inc.
|
Written by Cygnus Support.
|
Written by Cygnus Support.
|
|
|
This file is part of BFD, the Binary File Descriptor library.
|
This file is part of BFD, the Binary File Descriptor library.
|
|
|
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
Line 22... |
Line 23... |
|
|
#ifndef _LIBELF_H_
|
#ifndef _LIBELF_H_
|
#define _LIBELF_H_ 1
|
#define _LIBELF_H_ 1
|
|
|
#include "elf/common.h"
|
#include "elf/common.h"
|
#include "elf/internal.h"
|
|
#include "elf/external.h"
|
#include "elf/external.h"
|
|
#include "elf/internal.h"
|
#include "bfdlink.h"
|
#include "bfdlink.h"
|
|
|
/* The number of entries in a section is its size divided by the size
|
/* The number of entries in a section is its size divided by the size
|
of a single entry. This is normally only applicable to reloc and
|
of a single entry. This is normally only applicable to reloc and
|
symbol table sections. */
|
symbol table sections.
|
#define NUM_SHDR_ENTRIES(shdr) ((shdr)->sh_size / (shdr)->sh_entsize)
|
PR 9934: It is possible to have relocations that do not refer to
|
|
symbols, thus it is also possible to have a relocation section in
|
|
an object file, but no symbol table. */
|
|
#define NUM_SHDR_ENTRIES(shdr) ((shdr)->sh_entsize > 0 ? (shdr)->sh_size / (shdr)->sh_entsize : 0)
|
|
|
/* If size isn't specified as 64 or 32, NAME macro should fail. */
|
/* If size isn't specified as 64 or 32, NAME macro should fail. */
|
#ifndef NAME
|
#ifndef NAME
|
#if ARCH_SIZE == 64
|
#if ARCH_SIZE == 64
|
#define NAME(x, y) x ## 64 ## _ ## y
|
#define NAME(x, y) x ## 64 ## _ ## y
|
Line 79... |
Line 83... |
|
|
struct elf_strtab_hash;
|
struct elf_strtab_hash;
|
struct got_entry;
|
struct got_entry;
|
struct plt_entry;
|
struct plt_entry;
|
|
|
|
union gotplt_union
|
|
{
|
|
bfd_signed_vma refcount;
|
|
bfd_vma offset;
|
|
struct got_entry *glist;
|
|
struct plt_entry *plist;
|
|
};
|
|
|
|
struct elf_link_virtual_table_entry
|
|
{
|
|
/* Virtual table entry use information. This array is nominally of size
|
|
size/sizeof(target_void_pointer), though we have to be able to assume
|
|
and track a size while the symbol is still undefined. It is indexed
|
|
via offset/sizeof(target_void_pointer). */
|
|
size_t size;
|
|
bfd_boolean *used;
|
|
|
|
/* Virtual table derivation info. */
|
|
struct elf_link_hash_entry *parent;
|
|
};
|
|
|
/* ELF linker hash table entries. */
|
/* ELF linker hash table entries. */
|
|
|
struct elf_link_hash_entry
|
struct elf_link_hash_entry
|
{
|
{
|
struct bfd_link_hash_entry root;
|
struct bfd_link_hash_entry root;
|
Line 112... |
Line 137... |
size_dynamic_sections, at which point the contents of the .got is
|
size_dynamic_sections, at which point the contents of the .got is
|
fixed. Afterward, if OFFSET is -1, then the symbol does not
|
fixed. Afterward, if OFFSET is -1, then the symbol does not
|
require a global offset table entry. The second scheme allows
|
require a global offset table entry. The second scheme allows
|
multiple GOT entries per symbol, managed via a linked list
|
multiple GOT entries per symbol, managed via a linked list
|
pointed to by GLIST. */
|
pointed to by GLIST. */
|
union gotplt_union
|
union gotplt_union got;
|
{
|
|
bfd_signed_vma refcount;
|
|
bfd_vma offset;
|
|
struct got_entry *glist;
|
|
struct plt_entry *plist;
|
|
} got;
|
|
|
|
/* Same, but tracks a procedure linkage table entry. */
|
/* Same, but tracks a procedure linkage table entry. */
|
union gotplt_union plt;
|
union gotplt_union plt;
|
|
|
/* Symbol size. */
|
/* Symbol size. */
|
Line 132... |
Line 151... |
unsigned int type : 8;
|
unsigned int type : 8;
|
|
|
/* Symbol st_other value, symbol visibility. */
|
/* Symbol st_other value, symbol visibility. */
|
unsigned int other : 8;
|
unsigned int other : 8;
|
|
|
/* Symbol is referenced by a non-shared object. */
|
/* Symbol is referenced by a non-shared object (other than the object
|
|
in which it is defined). */
|
unsigned int ref_regular : 1;
|
unsigned int ref_regular : 1;
|
/* Symbol is defined by a non-shared object. */
|
/* Symbol is defined by a non-shared object. */
|
unsigned int def_regular : 1;
|
unsigned int def_regular : 1;
|
/* Symbol is referenced by a shared object. */
|
/* Symbol is referenced by a shared object. */
|
unsigned int ref_dynamic : 1;
|
unsigned int ref_dynamic : 1;
|
/* Symbol is defined by a shared object. */
|
/* Symbol is defined by a shared object. */
|
unsigned int def_dynamic : 1;
|
unsigned int def_dynamic : 1;
|
/* Symbol has a non-weak reference from a non-shared object. */
|
/* Symbol has a non-weak reference from a non-shared object (other than
|
|
the object in which it is defined). */
|
unsigned int ref_regular_nonweak : 1;
|
unsigned int ref_regular_nonweak : 1;
|
/* Dynamic symbol has been adjustd. */
|
/* Dynamic symbol has been adjustd. */
|
unsigned int dynamic_adjusted : 1;
|
unsigned int dynamic_adjusted : 1;
|
/* Symbol needs a copy reloc. */
|
/* Symbol needs a copy reloc. */
|
unsigned int needs_copy : 1;
|
unsigned int needs_copy : 1;
|
Line 170... |
Line 191... |
/* Symbol is weak in all shared objects. */
|
/* Symbol is weak in all shared objects. */
|
unsigned int dynamic_weak : 1;
|
unsigned int dynamic_weak : 1;
|
/* Symbol is referenced with a relocation where C/C++ pointer equality
|
/* Symbol is referenced with a relocation where C/C++ pointer equality
|
matters. */
|
matters. */
|
unsigned int pointer_equality_needed : 1;
|
unsigned int pointer_equality_needed : 1;
|
|
/* Symbol is a unique global symbol. */
|
|
unsigned int unique_global : 1;
|
|
|
/* String table index in .dynstr if this is a dynamic symbol. */
|
/* String table index in .dynstr if this is a dynamic symbol. */
|
unsigned long dynstr_index;
|
unsigned long dynstr_index;
|
|
|
union
|
union
|
Line 200... |
Line 223... |
object. It is set up in size_dynamic_sections. It points to
|
object. It is set up in size_dynamic_sections. It points to
|
the version information we should write out for this symbol. */
|
the version information we should write out for this symbol. */
|
struct bfd_elf_version_tree *vertree;
|
struct bfd_elf_version_tree *vertree;
|
} verinfo;
|
} verinfo;
|
|
|
struct
|
struct elf_link_virtual_table_entry *vtable;
|
{
|
|
/* Virtual table entry use information. This array is nominally of size
|
|
size/sizeof(target_void_pointer), though we have to be able to assume
|
|
and track a size while the symbol is still undefined. It is indexed
|
|
via offset/sizeof(target_void_pointer). */
|
|
size_t size;
|
|
bfd_boolean *used;
|
|
|
|
/* Virtual table derivation info. */
|
|
struct elf_link_hash_entry *parent;
|
|
} *vtable;
|
|
};
|
};
|
|
|
/* Will references to this symbol always reference the symbol
|
/* Will references to this symbol always reference the symbol
|
in this object? STV_PROTECTED is excluded from the visibility test
|
in this object? STV_PROTECTED is excluded from the visibility test
|
here so that function pointer comparisons work properly. Since
|
here so that function pointer comparisons work properly. Since
|
Line 451... |
Line 463... |
asection *tls_sec;
|
asection *tls_sec;
|
bfd_size_type tls_size;
|
bfd_size_type tls_size;
|
|
|
/* A linked list of BFD's loaded in the link. */
|
/* A linked list of BFD's loaded in the link. */
|
struct elf_link_loaded_list *loaded;
|
struct elf_link_loaded_list *loaded;
|
|
|
|
/* Short-cuts to get to dynamic linker sections. */
|
|
asection *sgot;
|
|
asection *sgotplt;
|
|
asection *srelgot;
|
|
asection *splt;
|
|
asection *srelplt;
|
|
asection *igotplt;
|
|
asection *iplt;
|
|
asection *irelplt;
|
|
asection *irelifunc;
|
};
|
};
|
|
|
/* Look up an entry in an ELF linker hash table. */
|
/* Look up an entry in an ELF linker hash table. */
|
|
|
#define elf_link_hash_lookup(table, string, create, copy, follow) \
|
#define elf_link_hash_lookup(table, string, create, copy, follow) \
|
Line 476... |
Line 499... |
|
|
/* Returns TRUE if the hash table is a struct elf_link_hash_table. */
|
/* Returns TRUE if the hash table is a struct elf_link_hash_table. */
|
#define is_elf_hash_table(htab) \
|
#define is_elf_hash_table(htab) \
|
(((struct bfd_link_hash_table *) (htab))->type == bfd_link_elf_hash_table)
|
(((struct bfd_link_hash_table *) (htab))->type == bfd_link_elf_hash_table)
|
|
|
/* Used by bfd_section_from_r_symndx to cache a small number of local
|
/* Used by bfd_sym_from_r_symndx to cache a small number of local
|
symbol to section mappings. */
|
symbols. */
|
#define LOCAL_SYM_CACHE_SIZE 32
|
#define LOCAL_SYM_CACHE_SIZE 32
|
struct sym_sec_cache
|
struct sym_cache
|
{
|
{
|
bfd *abfd;
|
bfd *abfd;
|
unsigned long indx[LOCAL_SYM_CACHE_SIZE];
|
unsigned long indx[LOCAL_SYM_CACHE_SIZE];
|
unsigned int shndx[LOCAL_SYM_CACHE_SIZE];
|
Elf_Internal_Sym sym[LOCAL_SYM_CACHE_SIZE];
|
};
|
};
|
|
|
/* Constant information held for an ELF backend. */
|
/* Constant information held for an ELF backend. */
|
|
|
struct elf_size_info {
|
struct elf_size_info {
|
Line 592... |
Line 615... |
by a dot then anything.
|
by a dot then anything.
|
> 0 means name must start with the first PREFIX_LENGTH chars of
|
> 0 means name must start with the first PREFIX_LENGTH chars of
|
PREFIX and finish with the last SUFFIX_LENGTH chars of PREFIX. */
|
PREFIX and finish with the last SUFFIX_LENGTH chars of PREFIX. */
|
int suffix_length;
|
int suffix_length;
|
int type;
|
int type;
|
int attr;
|
bfd_vma attr;
|
};
|
};
|
|
|
enum action_discarded
|
enum action_discarded
|
{
|
{
|
COMPLAIN = 1,
|
COMPLAIN = 1,
|
Line 739... |
Line 762... |
bfd_boolean (*elf_add_symbol_hook)
|
bfd_boolean (*elf_add_symbol_hook)
|
(bfd *abfd, struct bfd_link_info *info, Elf_Internal_Sym *,
|
(bfd *abfd, struct bfd_link_info *info, Elf_Internal_Sym *,
|
const char **name, flagword *flags, asection **sec, bfd_vma *value);
|
const char **name, flagword *flags, asection **sec, bfd_vma *value);
|
|
|
/* If this field is not NULL, it is called by the elf_link_output_sym
|
/* If this field is not NULL, it is called by the elf_link_output_sym
|
phase of a link for each symbol which will appear in the object file. */
|
phase of a link for each symbol which will appear in the object file.
|
bfd_boolean (*elf_backend_link_output_symbol_hook)
|
On error, this function returns 0. 1 is returned when the symbol
|
|
should be output, 2 is returned when the symbol should be discarded. */
|
|
int (*elf_backend_link_output_symbol_hook)
|
(struct bfd_link_info *info, const char *, Elf_Internal_Sym *,
|
(struct bfd_link_info *info, const char *, Elf_Internal_Sym *,
|
asection *, struct elf_link_hash_entry *);
|
asection *, struct elf_link_hash_entry *);
|
|
|
/* The CREATE_DYNAMIC_SECTIONS function is called by the ELF backend
|
/* The CREATE_DYNAMIC_SECTIONS function is called by the ELF backend
|
linker the first time it encounters a dynamic object in the link.
|
linker the first time it encounters a dynamic object in the link.
|
Line 991... |
Line 1016... |
/* Merge the backend specific symbol attribute. */
|
/* Merge the backend specific symbol attribute. */
|
void (*elf_backend_merge_symbol_attribute)
|
void (*elf_backend_merge_symbol_attribute)
|
(struct elf_link_hash_entry *, const Elf_Internal_Sym *, bfd_boolean,
|
(struct elf_link_hash_entry *, const Elf_Internal_Sym *, bfd_boolean,
|
bfd_boolean);
|
bfd_boolean);
|
|
|
|
/* This function, if defined, will return a string containing the
|
|
name of a target-specific dynamic tag. */
|
|
char *(*elf_backend_get_target_dtag)
|
|
(bfd_vma);
|
|
|
/* Decide whether an undefined symbol is special and can be ignored.
|
/* Decide whether an undefined symbol is special and can be ignored.
|
This is the case for OPTIONAL symbols on IRIX. */
|
This is the case for OPTIONAL symbols on IRIX. */
|
bfd_boolean (*elf_backend_ignore_undef_symbol)
|
bfd_boolean (*elf_backend_ignore_undef_symbol)
|
(struct elf_link_hash_entry *);
|
(struct elf_link_hash_entry *);
|
|
|
Line 1005... |
Line 1035... |
struct elf_link_hash_entry **);
|
struct elf_link_hash_entry **);
|
|
|
/* Count relocations. Not called for relocatable links
|
/* Count relocations. Not called for relocatable links
|
or if all relocs are being preserved in the output. */
|
or if all relocs are being preserved in the output. */
|
unsigned int (*elf_backend_count_relocs)
|
unsigned int (*elf_backend_count_relocs)
|
(asection *, Elf_Internal_Rela *);
|
(struct bfd_link_info *, asection *);
|
|
|
/* This function, if defined, is called when an NT_PRSTATUS note is found
|
/* This function, if defined, is called when an NT_PRSTATUS note is found
|
in a core file. */
|
in a core file. */
|
bfd_boolean (*elf_backend_grok_prstatus)
|
bfd_boolean (*elf_backend_grok_prstatus)
|
(bfd *, Elf_Internal_Note *);
|
(bfd *, Elf_Internal_Note *);
|
Line 1140... |
Line 1170... |
|
|
/* The size in bytes of the header for the GOT. This includes the
|
/* The size in bytes of the header for the GOT. This includes the
|
so-called reserved entries on some systems. */
|
so-called reserved entries on some systems. */
|
bfd_vma got_header_size;
|
bfd_vma got_header_size;
|
|
|
|
/* The size of the GOT entry for the symbol pointed to by H if non-NULL,
|
|
otherwise by the local symbol with index SYMNDX in IBFD. */
|
|
bfd_vma (*got_elt_size) (bfd *, struct bfd_link_info *,
|
|
struct elf_link_hash_entry *h,
|
|
bfd *ibfd, unsigned long symndx);
|
|
|
/* The vendor name to use for a processor-standard attributes section. */
|
/* The vendor name to use for a processor-standard attributes section. */
|
const char *obj_attrs_vendor;
|
const char *obj_attrs_vendor;
|
|
|
/* The section name to use for a processor-standard attributes section. */
|
/* The section name to use for a processor-standard attributes section. */
|
const char *obj_attrs_section;
|
const char *obj_attrs_section;
|
Line 1153... |
Line 1189... |
int (*obj_attrs_arg_type) (int);
|
int (*obj_attrs_arg_type) (int);
|
|
|
/* The section type to use for an attributes section. */
|
/* The section type to use for an attributes section. */
|
unsigned int obj_attrs_section_type;
|
unsigned int obj_attrs_section_type;
|
|
|
|
/* This function determines the order in which any attributes are written.
|
|
It must be defined for input in the range 4..NUM_KNOWN_OBJ_ATTRIBUTES-1
|
|
(this range is used in order to make unity easy). The returned value is
|
|
the actual tag number to place in the input position. */
|
|
int (*obj_attrs_order) (int);
|
|
|
/* This is TRUE if the linker should act like collect and gather
|
/* This is TRUE if the linker should act like collect and gather
|
global constructors and destructors by name. This is TRUE for
|
global constructors and destructors by name. This is TRUE for
|
MIPS ELF because the Irix 5 tools can not handle the .init
|
MIPS ELF because the Irix 5 tools can not handle the .init
|
section. */
|
section. */
|
unsigned collect : 1;
|
unsigned collect : 1;
|
Line 1182... |
Line 1224... |
it must note that explicitly. Similarly, if this flag is clear,
|
it must note that explicitly. Similarly, if this flag is clear,
|
and the backend wants RELA relocations for a particular
|
and the backend wants RELA relocations for a particular
|
section. */
|
section. */
|
unsigned default_use_rela_p : 1;
|
unsigned default_use_rela_p : 1;
|
|
|
|
/* True if PLT and copy relocations should be RELA by default. */
|
|
unsigned rela_plts_and_copies_p : 1;
|
|
|
/* Set if RELA relocations for a relocatable link can be handled by
|
/* Set if RELA relocations for a relocatable link can be handled by
|
generic code. Backends that set this flag need do nothing in the
|
generic code. Backends that set this flag need do nothing in the
|
backend relocate_section routine for relocatable linking. */
|
backend relocate_section routine for relocatable linking. */
|
unsigned rela_normal : 1;
|
unsigned rela_normal : 1;
|
|
|
Line 1311... |
Line 1356... |
((const struct elf_backend_data *) (xvec)->backend_data)
|
((const struct elf_backend_data *) (xvec)->backend_data)
|
|
|
#define get_elf_backend_data(abfd) \
|
#define get_elf_backend_data(abfd) \
|
xvec_get_elf_backend_data ((abfd)->xvec)
|
xvec_get_elf_backend_data ((abfd)->xvec)
|
|
|
/* This struct is used to pass information to routines called via
|
|
elf_link_hash_traverse which must return failure. */
|
|
|
|
struct elf_info_failed
|
|
{
|
|
bfd_boolean failed;
|
|
struct bfd_link_info *info;
|
|
struct bfd_elf_version_tree *verdefs;
|
|
};
|
|
|
|
/* This structure is used to pass information to
|
|
_bfd_elf_link_assign_sym_version. */
|
|
|
|
struct elf_assign_sym_version_info
|
|
{
|
|
/* Output BFD. */
|
|
bfd *output_bfd;
|
|
/* General link information. */
|
|
struct bfd_link_info *info;
|
|
/* Version tree. */
|
|
struct bfd_elf_version_tree *verdefs;
|
|
/* Whether we had a failure. */
|
|
bfd_boolean failed;
|
|
};
|
|
|
|
/* This structure is used to pass information to
|
|
_bfd_elf_link_find_version_dependencies. */
|
|
|
|
struct elf_find_verdep_info
|
|
{
|
|
/* Output BFD. */
|
|
bfd *output_bfd;
|
|
/* General link information. */
|
|
struct bfd_link_info *info;
|
|
/* The number of dependencies. */
|
|
unsigned int vers;
|
|
/* Whether we had a failure. */
|
|
bfd_boolean failed;
|
|
};
|
|
|
|
/* The maximum number of known object attributes for any target. */
|
/* The maximum number of known object attributes for any target. */
|
#define NUM_KNOWN_OBJ_ATTRIBUTES 32
|
#define NUM_KNOWN_OBJ_ATTRIBUTES 71
|
|
|
/* The value of an object attribute. type & 1 indicates whether there
|
/* The value of an object attribute. The type indicates whether the attribute
|
is an integer value; type & 2 indicates whether there is a string
|
holds and integer, a string, or both. It can also indicate that there can
|
value. */
|
be no default (i.e. all values must be written to file, even zero). */
|
|
|
typedef struct obj_attribute
|
typedef struct obj_attribute
|
{
|
{
|
|
#define ATTR_TYPE_FLAG_INT_VAL (1 << 0)
|
|
#define ATTR_TYPE_FLAG_STR_VAL (1 << 1)
|
|
#define ATTR_TYPE_FLAG_NO_DEFAULT (1 << 2)
|
|
|
|
#define ATTR_TYPE_HAS_INT_VAL(TYPE) ((TYPE) & ATTR_TYPE_FLAG_INT_VAL)
|
|
#define ATTR_TYPE_HAS_STR_VAL(TYPE) ((TYPE) & ATTR_TYPE_FLAG_STR_VAL)
|
|
#define ATTR_TYPE_HAS_NO_DEFAULT(TYPE) ((TYPE) & ATTR_TYPE_FLAG_NO_DEFAULT)
|
|
|
int type;
|
int type;
|
unsigned int i;
|
unsigned int i;
|
char *s;
|
char *s;
|
} obj_attribute;
|
} obj_attribute;
|
|
|
Line 1401... |
Line 1414... |
{
|
{
|
ALPHA_ELF_TDATA = 1,
|
ALPHA_ELF_TDATA = 1,
|
ARM_ELF_TDATA,
|
ARM_ELF_TDATA,
|
HPPA_ELF_TDATA,
|
HPPA_ELF_TDATA,
|
I386_ELF_TDATA,
|
I386_ELF_TDATA,
|
|
MIPS_ELF_TDATA,
|
PPC32_ELF_TDATA,
|
PPC32_ELF_TDATA,
|
PPC64_ELF_TDATA,
|
PPC64_ELF_TDATA,
|
S390_ELF_TDATA,
|
S390_ELF_TDATA,
|
SH_ELF_TDATA,
|
SH_ELF_TDATA,
|
SPARC_ELF_TDATA,
|
SPARC_ELF_TDATA,
|
X86_64_ELF_TDATA,
|
X86_64_ELF_TDATA,
|
|
XTENSA_ELF_TDATA,
|
GENERIC_ELF_TDATA
|
GENERIC_ELF_TDATA
|
};
|
};
|
|
|
/* Some private data is stashed away for future use using the tdata pointer
|
/* Some private data is stashed away for future use using the tdata pointer
|
in the bfd structure. */
|
in the bfd structure. */
|
Line 1563... |
Line 1578... |
|
|
/* NT_GNU_BUILD_ID note type. */
|
/* NT_GNU_BUILD_ID note type. */
|
bfd_size_type build_id_size;
|
bfd_size_type build_id_size;
|
bfd_byte *build_id;
|
bfd_byte *build_id;
|
|
|
|
/* True if the bfd contains symbols that have the STT_GNU_IFUNC
|
|
symbol type. Used to set the osabi field in the ELF header
|
|
structure. */
|
|
bfd_boolean has_ifunc_symbols;
|
|
|
/* An identifier used to distinguish different target
|
/* An identifier used to distinguish different target
|
specific extensions to this structure. */
|
specific extensions to this structure. */
|
enum elf_object_id object_id;
|
enum elf_object_id object_id;
|
};
|
};
|
|
|
Line 1629... |
Line 1649... |
extern void _bfd_elf_swap_versym_in
|
extern void _bfd_elf_swap_versym_in
|
(bfd *, const Elf_External_Versym *, Elf_Internal_Versym *);
|
(bfd *, const Elf_External_Versym *, Elf_Internal_Versym *);
|
extern void _bfd_elf_swap_versym_out
|
extern void _bfd_elf_swap_versym_out
|
(bfd *, const Elf_Internal_Versym *, Elf_External_Versym *);
|
(bfd *, const Elf_Internal_Versym *, Elf_External_Versym *);
|
|
|
extern int _bfd_elf_section_from_bfd_section
|
extern unsigned int _bfd_elf_section_from_bfd_section
|
(bfd *, asection *);
|
(bfd *, asection *);
|
extern char *bfd_elf_string_from_elf_section
|
extern char *bfd_elf_string_from_elf_section
|
(bfd *, unsigned, unsigned);
|
(bfd *, unsigned, unsigned);
|
extern char *bfd_elf_get_str_section
|
|
(bfd *, unsigned);
|
|
extern Elf_Internal_Sym *bfd_elf_get_elf_syms
|
extern Elf_Internal_Sym *bfd_elf_get_elf_syms
|
(bfd *, Elf_Internal_Shdr *, size_t, size_t, Elf_Internal_Sym *, void *,
|
(bfd *, Elf_Internal_Shdr *, size_t, size_t, Elf_Internal_Sym *, void *,
|
Elf_External_Sym_Shndx *);
|
Elf_External_Sym_Shndx *);
|
extern const char *bfd_elf_sym_name
|
extern const char *bfd_elf_sym_name
|
(bfd *, Elf_Internal_Shdr *, Elf_Internal_Sym *, asection *);
|
(bfd *, Elf_Internal_Shdr *, Elf_Internal_Sym *, asection *);
|
Line 1678... |
Line 1696... |
(bfd *, size_t, enum elf_object_id);
|
(bfd *, size_t, enum elf_object_id);
|
extern bfd_boolean bfd_elf_make_generic_object
|
extern bfd_boolean bfd_elf_make_generic_object
|
(bfd *);
|
(bfd *);
|
extern bfd_boolean bfd_elf_mkcorefile
|
extern bfd_boolean bfd_elf_mkcorefile
|
(bfd *);
|
(bfd *);
|
extern Elf_Internal_Shdr *bfd_elf_find_section
|
|
(bfd *, char *);
|
|
extern bfd_boolean _bfd_elf_make_section_from_shdr
|
extern bfd_boolean _bfd_elf_make_section_from_shdr
|
(bfd *, Elf_Internal_Shdr *, const char *, int);
|
(bfd *, Elf_Internal_Shdr *, const char *, int);
|
extern bfd_boolean _bfd_elf_make_section_from_phdr
|
extern bfd_boolean _bfd_elf_make_section_from_phdr
|
(bfd *, Elf_Internal_Phdr *, int, const char *);
|
(bfd *, Elf_Internal_Phdr *, int, const char *);
|
extern struct bfd_hash_entry *_bfd_elf_link_hash_newfunc
|
extern struct bfd_hash_entry *_bfd_elf_link_hash_newfunc
|
Line 1746... |
Line 1762... |
(bfd *, long, asymbol **, long, asymbol **, asymbol **);
|
(bfd *, long, asymbol **, long, asymbol **, asymbol **);
|
extern long _bfd_elf_get_reloc_upper_bound
|
extern long _bfd_elf_get_reloc_upper_bound
|
(bfd *, sec_ptr);
|
(bfd *, sec_ptr);
|
extern long _bfd_elf_canonicalize_reloc
|
extern long _bfd_elf_canonicalize_reloc
|
(bfd *, sec_ptr, arelent **, asymbol **);
|
(bfd *, sec_ptr, arelent **, asymbol **);
|
|
extern asection * _bfd_elf_get_dynamic_reloc_section
|
|
(bfd *, asection *, bfd_boolean);
|
|
extern asection * _bfd_elf_make_dynamic_reloc_section
|
|
(asection *, bfd *, unsigned int, bfd *, bfd_boolean);
|
extern long _bfd_elf_get_dynamic_reloc_upper_bound
|
extern long _bfd_elf_get_dynamic_reloc_upper_bound
|
(bfd *);
|
(bfd *);
|
extern long _bfd_elf_canonicalize_dynamic_reloc
|
extern long _bfd_elf_canonicalize_dynamic_reloc
|
(bfd *, arelent **, asymbol **);
|
(bfd *, arelent **, asymbol **);
|
extern asymbol *_bfd_elf_make_empty_symbol
|
extern asymbol *_bfd_elf_make_empty_symbol
|
Line 1793... |
Line 1813... |
(bfd *, Elf_Internal_Phdr *, int);
|
(bfd *, Elf_Internal_Phdr *, int);
|
|
|
extern int _bfd_elf_symbol_from_bfd_symbol
|
extern int _bfd_elf_symbol_from_bfd_symbol
|
(bfd *, asymbol **);
|
(bfd *, asymbol **);
|
|
|
extern asection *bfd_section_from_r_symndx
|
extern Elf_Internal_Sym *bfd_sym_from_r_symndx
|
(bfd *, struct sym_sec_cache *, asection *, unsigned long);
|
(struct sym_cache *, bfd *, unsigned long);
|
extern asection *bfd_section_from_elf_index
|
extern asection *bfd_section_from_elf_index
|
(bfd *, unsigned int);
|
(bfd *, unsigned int);
|
extern struct bfd_strtab_hash *_bfd_elf_stringtab_init
|
extern struct bfd_strtab_hash *_bfd_elf_stringtab_init
|
(void);
|
(void);
|
|
|
Line 1850... |
Line 1870... |
struct elf_link_hash_entry **, bfd_boolean *,
|
struct elf_link_hash_entry **, bfd_boolean *,
|
bfd_boolean *, bfd_boolean *, bfd_boolean *);
|
bfd_boolean *, bfd_boolean *, bfd_boolean *);
|
|
|
extern bfd_boolean _bfd_elf_hash_symbol (struct elf_link_hash_entry *);
|
extern bfd_boolean _bfd_elf_hash_symbol (struct elf_link_hash_entry *);
|
|
|
extern bfd_boolean _bfd_elf_add_default_symbol
|
|
(bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
|
|
const char *, Elf_Internal_Sym *, asection **, bfd_vma *,
|
|
bfd_boolean *, bfd_boolean);
|
|
|
|
extern bfd_boolean _bfd_elf_export_symbol
|
|
(struct elf_link_hash_entry *, void *);
|
|
|
|
extern bfd_boolean _bfd_elf_link_find_version_dependencies
|
|
(struct elf_link_hash_entry *, void *);
|
|
|
|
extern bfd_boolean _bfd_elf_link_assign_sym_version
|
|
(struct elf_link_hash_entry *, void *);
|
|
|
|
extern long _bfd_elf_link_lookup_local_dynindx
|
extern long _bfd_elf_link_lookup_local_dynindx
|
(struct bfd_link_info *, bfd *, long);
|
(struct bfd_link_info *, bfd *, long);
|
extern bfd_boolean _bfd_elf_compute_section_file_positions
|
extern bfd_boolean _bfd_elf_compute_section_file_positions
|
(bfd *, struct bfd_link_info *);
|
(bfd *, struct bfd_link_info *);
|
extern void _bfd_elf_assign_file_positions_for_relocs
|
extern void _bfd_elf_assign_file_positions_for_relocs
|
Line 1899... |
Line 1905... |
(bfd *, char *, size_t);
|
(bfd *, char *, size_t);
|
|
|
extern Elf_Internal_Rela *_bfd_elf_link_read_relocs
|
extern Elf_Internal_Rela *_bfd_elf_link_read_relocs
|
(bfd *, asection *, void *, Elf_Internal_Rela *, bfd_boolean);
|
(bfd *, asection *, void *, Elf_Internal_Rela *, bfd_boolean);
|
|
|
extern bfd_boolean _bfd_elf_link_size_reloc_section
|
|
(bfd *, Elf_Internal_Shdr *, asection *);
|
|
|
|
extern bfd_boolean _bfd_elf_link_output_relocs
|
extern bfd_boolean _bfd_elf_link_output_relocs
|
(bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *,
|
(bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *,
|
struct elf_link_hash_entry **);
|
struct elf_link_hash_entry **);
|
|
|
extern bfd_boolean _bfd_elf_fix_symbol_flags
|
|
(struct elf_link_hash_entry *, struct elf_info_failed *);
|
|
|
|
extern bfd_boolean _bfd_elf_adjust_dynamic_symbol
|
|
(struct elf_link_hash_entry *, void *);
|
|
|
|
extern bfd_boolean _bfd_elf_adjust_dynamic_copy
|
extern bfd_boolean _bfd_elf_adjust_dynamic_copy
|
(struct elf_link_hash_entry *, asection *);
|
(struct elf_link_hash_entry *, asection *);
|
|
|
extern bfd_boolean _bfd_elf_link_sec_merge_syms
|
|
(struct elf_link_hash_entry *, void *);
|
|
|
|
extern bfd_boolean _bfd_elf_dynamic_symbol_p
|
extern bfd_boolean _bfd_elf_dynamic_symbol_p
|
(struct elf_link_hash_entry *, struct bfd_link_info *, bfd_boolean);
|
(struct elf_link_hash_entry *, struct bfd_link_info *, bfd_boolean);
|
|
|
extern bfd_boolean _bfd_elf_symbol_refs_local_p
|
extern bfd_boolean _bfd_elf_symbol_refs_local_p
|
(struct elf_link_hash_entry *, struct bfd_link_info *, bfd_boolean);
|
(struct elf_link_hash_entry *, struct bfd_link_info *, bfd_boolean);
|
Line 2039... |
Line 2033... |
(struct bfd_link_info *, struct elf_link_hash_entry *);
|
(struct bfd_link_info *, struct elf_link_hash_entry *);
|
|
|
extern int bfd_elf_link_record_local_dynamic_symbol
|
extern int bfd_elf_link_record_local_dynamic_symbol
|
(struct bfd_link_info *, bfd *, long);
|
(struct bfd_link_info *, bfd *, long);
|
|
|
extern void bfd_elf_link_mark_dynamic_symbol
|
|
(struct bfd_link_info *, struct elf_link_hash_entry *,
|
|
Elf_Internal_Sym *);
|
|
|
|
extern bfd_boolean _bfd_elf_close_and_cleanup
|
extern bfd_boolean _bfd_elf_close_and_cleanup
|
(bfd *);
|
(bfd *);
|
|
|
extern bfd_boolean _bfd_elf_common_definition
|
extern bfd_boolean _bfd_elf_common_definition
|
(Elf_Internal_Sym *);
|
(Elf_Internal_Sym *);
|
Line 2058... |
Line 2048... |
(asection *);
|
(asection *);
|
|
|
extern void _bfd_dwarf2_cleanup_debug_info
|
extern void _bfd_dwarf2_cleanup_debug_info
|
(bfd *);
|
(bfd *);
|
|
|
|
extern bfd_vma _bfd_elf_default_got_elt_size
|
|
(bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, bfd *,
|
|
unsigned long);
|
|
|
extern bfd_reloc_status_type _bfd_elf_rel_vtable_reloc_fn
|
extern bfd_reloc_status_type _bfd_elf_rel_vtable_reloc_fn
|
(bfd *, arelent *, struct bfd_symbol *, void *,
|
(bfd *, arelent *, struct bfd_symbol *, void *,
|
asection *, bfd *, char **);
|
asection *, bfd *, char **);
|
|
|
extern bfd_boolean bfd_elf_final_link
|
extern bfd_boolean bfd_elf_final_link
|
Line 2116... |
Line 2110... |
extern bfd_boolean _bfd_elf_map_sections_to_segments
|
extern bfd_boolean _bfd_elf_map_sections_to_segments
|
(bfd *, struct bfd_link_info *);
|
(bfd *, struct bfd_link_info *);
|
|
|
extern bfd_boolean _bfd_elf_is_function_type (unsigned int);
|
extern bfd_boolean _bfd_elf_is_function_type (unsigned int);
|
|
|
|
extern int bfd_elf_get_default_section_type (flagword);
|
|
|
extern Elf_Internal_Phdr * _bfd_elf_find_segment_containing_section
|
extern Elf_Internal_Phdr * _bfd_elf_find_segment_containing_section
|
(bfd * abfd, asection * section);
|
(bfd * abfd, asection * section);
|
|
|
/* Exported interface for writing elf corefile notes. */
|
/* Exported interface for writing elf corefile notes. */
|
extern char *elfcore_write_note
|
extern char *elfcore_write_note
|
Line 2134... |
Line 2130... |
(bfd *, char *, int *, const void *, int);
|
(bfd *, char *, int *, const void *, int);
|
extern char *elfcore_write_prxfpreg
|
extern char *elfcore_write_prxfpreg
|
(bfd *, char *, int *, const void *, int);
|
(bfd *, char *, int *, const void *, int);
|
extern char *elfcore_write_ppc_vmx
|
extern char *elfcore_write_ppc_vmx
|
(bfd *, char *, int *, const void *, int);
|
(bfd *, char *, int *, const void *, int);
|
|
extern char *elfcore_write_ppc_vsx
|
|
(bfd *, char *, int *, const void *, int);
|
extern char *elfcore_write_lwpstatus
|
extern char *elfcore_write_lwpstatus
|
(bfd *, char *, int *, long, int, const void *);
|
(bfd *, char *, int *, long, int, const void *);
|
|
extern char *elfcore_write_register_note
|
|
(bfd *, char *, int *, const char *, const void *, int);
|
|
|
extern bfd *_bfd_elf32_bfd_from_remote_memory
|
extern bfd *_bfd_elf32_bfd_from_remote_memory
|
(bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep,
|
(bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep,
|
int (*target_read_memory) (bfd_vma, bfd_byte *, int));
|
int (*target_read_memory) (bfd_vma, bfd_byte *, int));
|
extern bfd *_bfd_elf64_bfd_from_remote_memory
|
extern bfd *_bfd_elf64_bfd_from_remote_memory
|
Line 2153... |
Line 2153... |
#define bfd_elf_add_proc_attr_int(BFD, TAG, VALUE) \
|
#define bfd_elf_add_proc_attr_int(BFD, TAG, VALUE) \
|
bfd_elf_add_obj_attr_int ((BFD), OBJ_ATTR_PROC, (TAG), (VALUE))
|
bfd_elf_add_obj_attr_int ((BFD), OBJ_ATTR_PROC, (TAG), (VALUE))
|
extern void bfd_elf_add_obj_attr_string (bfd *, int, int, const char *);
|
extern void bfd_elf_add_obj_attr_string (bfd *, int, int, const char *);
|
#define bfd_elf_add_proc_attr_string(BFD, TAG, VALUE) \
|
#define bfd_elf_add_proc_attr_string(BFD, TAG, VALUE) \
|
bfd_elf_add_obj_attr_string ((BFD), OBJ_ATTR_PROC, (TAG), (VALUE))
|
bfd_elf_add_obj_attr_string ((BFD), OBJ_ATTR_PROC, (TAG), (VALUE))
|
extern void bfd_elf_add_obj_attr_compat (bfd *, int, unsigned int,
|
extern void bfd_elf_add_obj_attr_int_string (bfd *, int, int, unsigned int,
|
const char *);
|
const char *);
|
#define bfd_elf_add_proc_attr_compat(BFD, INTVAL, STRVAL) \
|
#define bfd_elf_add_proc_attr_int_string(BFD, TAG, INTVAL, STRVAL) \
|
bfd_elf_add_obj_attr_compat ((BFD), OBJ_ATTR_PROC, (INTVAL), (STRVAL))
|
bfd_elf_add_obj_attr_int_string ((BFD), OBJ_ATTR_PROC, (TAG), \
|
|
(INTVAL), (STRVAL))
|
|
|
extern char *_bfd_elf_attr_strdup (bfd *, const char *);
|
extern char *_bfd_elf_attr_strdup (bfd *, const char *);
|
extern void _bfd_elf_copy_obj_attributes (bfd *, bfd *);
|
extern void _bfd_elf_copy_obj_attributes (bfd *, bfd *);
|
extern int _bfd_elf_obj_attrs_arg_type (bfd *, int, int);
|
extern int _bfd_elf_obj_attrs_arg_type (bfd *, int, int);
|
extern void _bfd_elf_parse_attributes (bfd *, Elf_Internal_Shdr *);
|
extern void _bfd_elf_parse_attributes (bfd *, Elf_Internal_Shdr *);
|
extern bfd_boolean _bfd_elf_merge_object_attributes (bfd *, bfd *);
|
extern bfd_boolean _bfd_elf_merge_object_attributes (bfd *, bfd *);
|
|
|
|
/* The linker may needs to keep track of the number of relocs that it
|
|
decides to copy as dynamic relocs in check_relocs for each symbol.
|
|
This is so that it can later discard them if they are found to be
|
|
unnecessary. We can store the information in a field extending the
|
|
regular ELF linker hash table. */
|
|
|
|
struct elf_dyn_relocs
|
|
{
|
|
struct elf_dyn_relocs *next;
|
|
|
|
/* The input section of the reloc. */
|
|
asection *sec;
|
|
|
|
/* Total number of relocs copied for the input section. */
|
|
bfd_size_type count;
|
|
|
|
/* Number of pc-relative relocs copied for the input section. */
|
|
bfd_size_type pc_count;
|
|
};
|
|
|
|
extern bfd_boolean _bfd_elf_create_ifunc_sections
|
|
(bfd *, struct bfd_link_info *);
|
|
extern asection * _bfd_elf_create_ifunc_dyn_reloc
|
|
(bfd *, struct bfd_link_info *, asection *sec, asection *sreloc,
|
|
struct elf_dyn_relocs **);
|
|
extern bfd_boolean _bfd_elf_allocate_ifunc_dyn_relocs
|
|
(struct bfd_link_info *, struct elf_link_hash_entry *,
|
|
struct elf_dyn_relocs **, unsigned int, unsigned int);
|
|
|
/* Large common section. */
|
/* Large common section. */
|
extern asection _bfd_elf_large_com_section;
|
extern asection _bfd_elf_large_com_section;
|
|
|
/* SH ELF specific routine. */
|
/* Hash for local symbol with the first section id, ID, in the input
|
|
file and the local symbol index, SYM. */
|
extern bfd_boolean _sh_elf_set_mach_from_flags
|
#define ELF_LOCAL_SYMBOL_HASH(ID, SYM) \
|
(bfd *);
|
(((((ID) & 0xff) << 24) | (((ID) & 0xff00) << 8)) \
|
|
^ (SYM) ^ ((ID) >> 16))
|
|
|
/* This is the condition under which finish_dynamic_symbol will be called.
|
/* This is the condition under which finish_dynamic_symbol will be called.
|
If our finish_dynamic_symbol isn't called, we'll need to do something
|
If our finish_dynamic_symbol isn't called, we'll need to do something
|
about initializing any .plt and .got entries in relocate_section. */
|
about initializing any .plt and .got entries in relocate_section. */
|
#define WILL_CALL_FINISH_DYNAMIC_SYMBOL(DYN, SHARED, H) \
|
#define WILL_CALL_FINISH_DYNAMIC_SYMBOL(DYN, SHARED, H) \
|