Back to index

cell-binutils  2.17cvs20070401
Classes | Defines | Typedefs | Enumerations | Functions
bfd-in.h File Reference
#include "ansidecl.h"
#include "symcat.h"

Go to the source code of this file.

Classes

struct  carsym
struct  orl
struct  lineno_cache_entry
struct  _symbol_info
struct  bfd_hash_entry
struct  bfd_hash_table
struct  stab_info
struct  _bfd_window
struct  coff_comdat_info
union  orl.u
union  lineno_cache_entry.u

Defines

#define STRING_COMMA_LEN(STR)   (STR), ((STR) ? sizeof (STR) - 1 : 0)
#define CONST_STRNEQ(STR1, STR2)   (strncmp ((STR1), (STR2), sizeof (STR2) - 1) == 0)
#define LITMEMCPY(DEST, STR2)   memcpy ((DEST), (STR2), sizeof (STR2) - 1)
#define LITSTRCPY(DEST, STR2)   memcpy ((DEST), (STR2), sizeof (STR2))
#define BFD_ARCH_SIZE   @wordsize@
#define BFD_DEFAULT_TARGET_SIZE   @bfd_default_target_size@
#define BFD_HOST_64BIT_LONG   @BFD_HOST_64BIT_LONG@
#define BFD_HOST_LONG_LONG   @BFD_HOST_LONG_LONG@
#define INLINE
#define FALSE   0
#define TRUE   1
#define fprintf_vma(s, x)   fprintf (s, "%08lx", x)
#define sprintf_vma(s, x)   sprintf (s, "%08lx", x)
#define HALF_BFD_SIZE_TYPE   (((bfd_size_type) 1) << (8 * sizeof (bfd_size_type) / 2))
#define printf_vma(x)   fprintf_vma(stdout,x)
#define bfd_printf_vma(abfd, x)   bfd_fprintf_vma (abfd,stdout,x)
#define BFD_NO_FLAGS   0x00
#define HAS_RELOC   0x01
#define EXEC_P   0x02
#define HAS_LINENO   0x04
#define HAS_DEBUG   0x08
#define HAS_SYMS   0x10
#define HAS_LOCALS   0x20
#define DYNAMIC   0x40
#define WP_TEXT   0x80
#define D_PAGED   0x100
#define BFD_IS_RELAXABLE   0x200
#define BFD_TRADITIONAL_FORMAT   0x400
#define BFD_IN_MEMORY   0x800
#define HAS_LOAD_PAGE   0x1000
#define BFD_LINKER_CREATED   0x2000
#define BFD_NO_MORE_SYMBOLS   ((symindex) ~0)
#define bfd_get_section(x)   ((x)->section)
#define bfd_get_output_section(x)   ((x)->section->output_section)
#define bfd_set_section(x, y)   ((x)->section) = (y)
#define bfd_asymbol_base(x)   ((x)->section->vma)
#define bfd_asymbol_value(x)   (bfd_asymbol_base(x) + (x)->value)
#define bfd_asymbol_name(x)   ((x)->name)
#define bfd_asymbol_bfd(x)   ((x)->the_bfd)
#define bfd_asymbol_flavour(x)   (bfd_asymbol_bfd(x)->xvec->flavour)
#define align_power(addr, align)   (((addr) + ((bfd_vma) 1 << (align)) - 1) & ((bfd_vma) -1 << (align)))
#define bfd_get_section_name(bfd, ptr)   ((ptr)->name + 0)
#define bfd_get_section_vma(bfd, ptr)   ((ptr)->vma + 0)
#define bfd_get_section_lma(bfd, ptr)   ((ptr)->lma + 0)
#define bfd_get_section_alignment(bfd, ptr)   ((ptr)->alignment_power + 0)
#define bfd_section_name(bfd, ptr)   ((ptr)->name)
#define bfd_section_size(bfd, ptr)   ((ptr)->size)
#define bfd_get_section_size(ptr)   ((ptr)->size)
#define bfd_section_vma(bfd, ptr)   ((ptr)->vma)
#define bfd_section_lma(bfd, ptr)   ((ptr)->lma)
#define bfd_section_alignment(bfd, ptr)   ((ptr)->alignment_power)
#define bfd_get_section_flags(bfd, ptr)   ((ptr)->flags + 0)
#define bfd_get_section_userdata(bfd, ptr)   ((ptr)->userdata)
#define bfd_is_com_section(ptr)   (((ptr)->flags & SEC_IS_COMMON) != 0)
#define bfd_set_section_vma(bfd, ptr, val)   (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = TRUE), TRUE)
#define bfd_set_section_alignment(bfd, ptr, val)   (((ptr)->alignment_power = (val)),TRUE)
#define bfd_set_section_userdata(bfd, ptr, val)   (((ptr)->userdata = (val)),TRUE)
#define bfd_get_section_limit(bfd, sec)
#define elf_discarded_section(sec)
#define COFF_SWAP_TABLE   (void *) &bfd_coff_std_swap_table
#define bfd_read(BUF, ELTSIZE, NITEMS, ABFD)
#define bfd_write(BUF, ELTSIZE, NITEMS, ABFD)
#define bfd_get_filename(abfd)   ((char *) (abfd)->filename)
#define bfd_get_cacheable(abfd)   ((abfd)->cacheable)
#define bfd_get_format(abfd)   ((abfd)->format)
#define bfd_get_target(abfd)   ((abfd)->xvec->name)
#define bfd_get_flavour(abfd)   ((abfd)->xvec->flavour)
#define bfd_family_coff(abfd)
#define bfd_big_endian(abfd)   ((abfd)->xvec->byteorder == BFD_ENDIAN_BIG)
#define bfd_little_endian(abfd)   ((abfd)->xvec->byteorder == BFD_ENDIAN_LITTLE)
#define bfd_header_big_endian(abfd)   ((abfd)->xvec->header_byteorder == BFD_ENDIAN_BIG)
#define bfd_header_little_endian(abfd)   ((abfd)->xvec->header_byteorder == BFD_ENDIAN_LITTLE)
#define bfd_get_file_flags(abfd)   ((abfd)->flags)
#define bfd_applicable_file_flags(abfd)   ((abfd)->xvec->object_flags)
#define bfd_applicable_section_flags(abfd)   ((abfd)->xvec->section_flags)
#define bfd_my_archive(abfd)   ((abfd)->my_archive)
#define bfd_has_map(abfd)   ((abfd)->has_armap)
#define bfd_valid_reloc_types(abfd)   ((abfd)->xvec->valid_reloc_types)
#define bfd_usrdata(abfd)   ((abfd)->usrdata)
#define bfd_get_start_address(abfd)   ((abfd)->start_address)
#define bfd_get_symcount(abfd)   ((abfd)->symcount)
#define bfd_get_outsymbols(abfd)   ((abfd)->outsymbols)
#define bfd_count_sections(abfd)   ((abfd)->section_count)
#define bfd_get_dynamic_symcount(abfd)   ((abfd)->dynsymcount)
#define bfd_get_symbol_leading_char(abfd)   ((abfd)->xvec->symbol_leading_char)
#define bfd_set_cacheable(abfd, bool)   (((abfd)->cacheable = bool), TRUE)
#define BFD_ARM_SPECIAL_SYM_TYPE_MAP   (1 << 0)
#define BFD_ARM_SPECIAL_SYM_TYPE_TAG   (1 << 1)
#define BFD_ARM_SPECIAL_SYM_TYPE_OTHER   (1 << 2)
#define BFD_ARM_SPECIAL_SYM_TYPE_ANY   (~0)

Typedefs

typedef struct bfd
typedef int bfd_boolean
typedef unsigned long bfd_vma
typedef long bfd_signed_vma
typedef unsigned long symvalue
typedef unsigned long bfd_size_type
typedef bfd_signed_vma bfd_int64_t
typedef bfd_vma bfd_uint64_t
typedef bfd_file_ptr file_ptr
typedef unsigned bfd_file_ptr ufile_ptr
typedef unsigned int flagword
typedef unsigned char bfd_byte
typedef enum bfd_format bfd_format
typedef unsigned long symindex
typedef struct reloc_howto_struct
typedef struct carsym carsym
typedef struct lineno_cache_entry alent
typedef struct bfd_sectionsec_ptr
typedef enum bfd_print_symbol bfd_print_symbol_type
typedef struct _symbol_info symbol_info
typedef struct _bfd_window_internal
typedef struct _bfd_window bfd_window

Enumerations

enum  bfd_format {
  bfd_unknown = 0, bfd_object, bfd_archive, bfd_core,
  bfd_type_end, bfd_unknown = 0, bfd_object, bfd_archive,
  bfd_core, bfd_type_end
}
enum  bfd_print_symbol {
  bfd_print_symbol_name, bfd_print_symbol_more, bfd_print_symbol_all, bfd_print_symbol_name,
  bfd_print_symbol_more, bfd_print_symbol_all
}
enum  dynamic_lib_link_class {
  DYN_NORMAL = 0, DYN_AS_NEEDED = 1, DYN_DT_NEEDED = 2, DYN_NO_ADD_NEEDED = 4,
  DYN_NO_NEEDED = 8, DYN_NORMAL = 0, DYN_AS_NEEDED = 1, DYN_DT_NEEDED = 2,
  DYN_NO_ADD_NEEDED = 4, DYN_NO_NEEDED = 8
}
enum  notice_asneeded_action {
  notice_as_needed, notice_not_needed, notice_needed, notice_as_needed,
  notice_not_needed, notice_needed
}
enum  bfd_arm_vfp11_fix {
  BFD_ARM_VFP11_FIX_DEFAULT, BFD_ARM_VFP11_FIX_NONE, BFD_ARM_VFP11_FIX_SCALAR, BFD_ARM_VFP11_FIX_VECTOR,
  BFD_ARM_VFP11_FIX_DEFAULT, BFD_ARM_VFP11_FIX_NONE, BFD_ARM_VFP11_FIX_SCALAR, BFD_ARM_VFP11_FIX_VECTOR
}

Functions

void bfd_sprintf_vma (bfd *, char *, bfd_vma)
void bfd_fprintf_vma (bfd *, void *, bfd_vma)
const char * bfd_get_stab_name (int)
bfd_boolean bfd_hash_table_init (struct bfd_hash_table *, struct bfd_hash_entry *(*)(struct bfd_hash_entry *, struct bfd_hash_table *, const char *), unsigned int)
bfd_boolean bfd_hash_table_init_n (struct bfd_hash_table *, struct bfd_hash_entry *(*)(struct bfd_hash_entry *, struct bfd_hash_table *, const char *), unsigned int, unsigned int)
void bfd_hash_table_free (struct bfd_hash_table *)
struct bfd_hash_entrybfd_hash_lookup (struct bfd_hash_table *, const char *, bfd_boolean create, bfd_boolean copy)
void bfd_hash_replace (struct bfd_hash_table *, struct bfd_hash_entry *old, struct bfd_hash_entry *nw)
struct bfd_hash_entrybfd_hash_newfunc (struct bfd_hash_entry *, struct bfd_hash_table *, const char *)
void * bfd_hash_allocate (struct bfd_hash_table *, unsigned int)
void bfd_hash_traverse (struct bfd_hash_table *, bfd_boolean(*)(struct bfd_hash_entry *, void *), void *info)
void bfd_hash_set_default_size (bfd_size_type)
bfd_size_type bfd_bread (void *, bfd_size_type, bfd *)
bfd_size_type bfd_bwrite (const void *, bfd_size_type, bfd *)
int bfd_seek (bfd *, file_ptr, int)
file_ptr bfd_tell (bfd *)
int bfd_flush (bfd *)
int bfd_stat (bfd *, struct stat *)
void warn_deprecated (const char *, const char *, int, const char *)
bfd_boolean bfd_cache_close (bfd *abfd)
bfd_boolean bfd_cache_close_all (void)
bfd_boolean bfd_record_phdr (bfd *, unsigned long, bfd_boolean, flagword, bfd_boolean, bfd_vma, bfd_boolean, bfd_boolean, unsigned int, struct bfd_section **)
bfd_uint64_t bfd_getb64 (const void *)
bfd_uint64_t bfd_getl64 (const void *)
bfd_int64_t bfd_getb_signed_64 (const void *)
bfd_int64_t bfd_getl_signed_64 (const void *)
bfd_vma bfd_getb32 (const void *)
bfd_vma bfd_getl32 (const void *)
bfd_signed_vma bfd_getb_signed_32 (const void *)
bfd_signed_vma bfd_getl_signed_32 (const void *)
bfd_vma bfd_getb16 (const void *)
bfd_vma bfd_getl16 (const void *)
bfd_signed_vma bfd_getb_signed_16 (const void *)
bfd_signed_vma bfd_getl_signed_16 (const void *)
void bfd_putb64 (bfd_uint64_t, void *)
void bfd_putl64 (bfd_uint64_t, void *)
void bfd_putb32 (bfd_vma, void *)
void bfd_putl32 (bfd_vma, void *)
void bfd_putb16 (bfd_vma, void *)
void bfd_putl16 (bfd_vma, void *)
bfd_uint64_t bfd_get_bits (const void *, int, bfd_boolean)
void bfd_put_bits (bfd_uint64_t, void *, int, bfd_boolean)
bfd_boolean bfd_section_already_linked_table_init (void)
void bfd_section_already_linked_table_free (void)
bfd_vma bfd_ecoff_get_gp_value (bfd *abfd)
bfd_boolean bfd_ecoff_set_gp_value (bfd *abfd, bfd_vma gp_value)
bfd_boolean bfd_ecoff_set_regmasks (bfd *abfd, unsigned long gprmask, unsigned long fprmask, unsigned long *cprmask)
void * bfd_ecoff_debug_init (bfd *output_bfd, struct ecoff_debug_info *output_debug, const struct ecoff_debug_swap *output_swap, struct bfd_link_info *)
void bfd_ecoff_debug_free (void *handle, bfd *output_bfd, struct ecoff_debug_info *output_debug, const struct ecoff_debug_swap *output_swap, struct bfd_link_info *)
bfd_boolean bfd_ecoff_debug_accumulate (void *handle, bfd *output_bfd, struct ecoff_debug_info *output_debug, const struct ecoff_debug_swap *output_swap, bfd *input_bfd, struct ecoff_debug_info *input_debug, const struct ecoff_debug_swap *input_swap, struct bfd_link_info *)
bfd_boolean bfd_ecoff_debug_accumulate_other (void *handle, bfd *output_bfd, struct ecoff_debug_info *output_debug, const struct ecoff_debug_swap *output_swap, bfd *input_bfd, struct bfd_link_info *)
bfd_boolean bfd_ecoff_debug_externals (bfd *abfd, struct ecoff_debug_info *debug, const struct ecoff_debug_swap *swap, bfd_boolean relocatable, bfd_boolean(*get_extr)(struct bfd_symbol *, struct ecoff_extr *), void(*set_index)(struct bfd_symbol *, bfd_size_type))
bfd_boolean bfd_ecoff_debug_one_external (bfd *abfd, struct ecoff_debug_info *debug, const struct ecoff_debug_swap *swap, const char *name, struct ecoff_extr *esym)
bfd_size_type bfd_ecoff_debug_size (bfd *abfd, struct ecoff_debug_info *debug, const struct ecoff_debug_swap *swap)
bfd_boolean bfd_ecoff_write_debug (bfd *abfd, struct ecoff_debug_info *debug, const struct ecoff_debug_swap *swap, file_ptr where)
bfd_boolean bfd_ecoff_write_accumulated_debug (void *handle, bfd *abfd, struct ecoff_debug_info *debug, const struct ecoff_debug_swap *swap, struct bfd_link_info *info, file_ptr where)
bfd_boolean bfd_elf_record_link_assignment (bfd *, struct bfd_link_info *, const char *, bfd_boolean, bfd_boolean)
struct bfd_link_needed_listbfd_elf_get_needed_list (bfd *, struct bfd_link_info *)
bfd_boolean bfd_elf_get_bfd_needed_list (bfd *, struct bfd_link_needed_list **)
bfd_boolean bfd_elf_size_dynamic_sections (bfd *, const char *, const char *, const char *, const char *const *, struct bfd_link_info *, struct bfd_section **, struct bfd_elf_version_tree *)
bfd_boolean bfd_elf_size_dynsym_hash_dynstr (bfd *, struct bfd_link_info *)
void bfd_elf_set_dt_needed_name (bfd *, const char *)
const char * bfd_elf_get_dt_soname (bfd *)
void bfd_elf_set_dyn_lib_class (bfd *, enum dynamic_lib_link_class)
int bfd_elf_get_dyn_lib_class (bfd *)
struct bfd_link_needed_listbfd_elf_get_runpath_list (bfd *, struct bfd_link_info *)
bfd_boolean bfd_elf_discard_info (bfd *, struct bfd_link_info *)
unsigned int _bfd_elf_default_action_discarded (struct bfd_section *)
long bfd_get_elf_phdr_upper_bound (bfd *abfd)
int bfd_get_elf_phdrs (bfd *abfd, void *phdrs)
bfdbfd_elf_bfd_from_remote_memory (bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep, int(*target_read_memory)(bfd_vma vma, bfd_byte *myaddr, int len))
int bfd_get_arch_size (bfd *)
int bfd_get_sign_extend_vma (bfd *)
struct bfd_section_bfd_elf_tls_setup (bfd *, struct bfd_link_info *)
void _bfd_fix_excluded_sec_syms (bfd *, struct bfd_link_info *)
unsigned bfd_m68k_mach_to_features (int)
int bfd_m68k_features_to_mach (unsigned)
bfd_boolean bfd_m68k_elf32_create_embedded_relocs (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **)
bfd_boolean bfd_bfin_elf32_create_embedded_relocs (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **)
struct bfd_link_needed_listbfd_sunos_get_needed_list (bfd *, struct bfd_link_info *)
bfd_boolean bfd_sunos_record_link_assignment (bfd *, struct bfd_link_info *, const char *)
bfd_boolean bfd_sunos_size_dynamic_sections (bfd *, struct bfd_link_info *, struct bfd_section **, struct bfd_section **, struct bfd_section **)
bfd_boolean bfd_i386linux_size_dynamic_sections (bfd *, struct bfd_link_info *)
bfd_boolean bfd_m68klinux_size_dynamic_sections (bfd *, struct bfd_link_info *)
bfd_boolean bfd_sparclinux_size_dynamic_sections (bfd *, struct bfd_link_info *)
void bfd_init_window (bfd_window *)
void bfd_free_window (bfd_window *)
bfd_boolean bfd_get_file_window (bfd *, file_ptr, bfd_size_type, bfd_window *, bfd_boolean)
bfd_boolean bfd_xcoff_link_record_set (bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *, bfd_size_type)
bfd_boolean bfd_xcoff_import_symbol (bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *, bfd_vma, const char *, const char *, const char *, unsigned int)
bfd_boolean bfd_xcoff_export_symbol (bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *)
bfd_boolean bfd_xcoff_link_count_reloc (bfd *, struct bfd_link_info *, const char *)
bfd_boolean bfd_xcoff_record_link_assignment (bfd *, struct bfd_link_info *, const char *)
bfd_boolean bfd_xcoff_size_dynamic_sections (bfd *, struct bfd_link_info *, const char *, const char *, unsigned long, unsigned long, unsigned long, bfd_boolean, int, bfd_boolean, bfd_boolean, struct bfd_section **, bfd_boolean)
bfd_boolean bfd_xcoff_link_generate_rtinit (bfd *, const char *, const char *, bfd_boolean)
bfd_boolean bfd_xcoff_ar_archive_set_magic (bfd *, char *)
bfd_boolean bfd_coff_get_syment (bfd *, struct bfd_symbol *, struct internal_syment *)
bfd_boolean bfd_coff_get_auxent (bfd *, struct bfd_symbol *, int, union internal_auxent *)
bfd_boolean bfd_coff_set_symbol_class (bfd *, struct bfd_symbol *, unsigned int)
bfd_boolean bfd_m68k_coff_create_embedded_relocs (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **)
void bfd_elf32_arm_init_maps (bfd *)
void bfd_elf32_arm_set_vfp11_fix (bfd *, struct bfd_link_info *)
bfd_boolean bfd_elf32_arm_vfp11_erratum_scan (bfd *, struct bfd_link_info *)
void bfd_elf32_arm_vfp11_fix_veneer_locations (bfd *, struct bfd_link_info *)
bfd_boolean bfd_arm_allocate_interworking_sections (struct bfd_link_info *)
bfd_boolean bfd_arm_process_before_allocation (bfd *, struct bfd_link_info *, int)
bfd_boolean bfd_arm_get_bfd_for_interworking (bfd *, struct bfd_link_info *)
bfd_boolean bfd_arm_pe_allocate_interworking_sections (struct bfd_link_info *)
bfd_boolean bfd_arm_pe_process_before_allocation (bfd *, struct bfd_link_info *, int)
bfd_boolean bfd_arm_pe_get_bfd_for_interworking (bfd *, struct bfd_link_info *)
bfd_boolean bfd_elf32_arm_allocate_interworking_sections (struct bfd_link_info *)
bfd_boolean bfd_elf32_arm_process_before_allocation (bfd *, struct bfd_link_info *)
void bfd_elf32_arm_set_target_relocs (bfd *, struct bfd_link_info *, int, char *, int, int, bfd_arm_vfp11_fix, int, int)
bfd_boolean bfd_elf32_arm_get_bfd_for_interworking (bfd *, struct bfd_link_info *)
bfd_boolean bfd_elf32_arm_add_glue_sections_to_bfd (bfd *, struct bfd_link_info *)
bfd_boolean bfd_is_arm_special_symbol_name (const char *name, int type)
void bfd_elf32_arm_set_byteswap_code (struct bfd_link_info *, int)
bfd_boolean bfd_arm_merge_machines (bfd *, bfd *)
bfd_boolean bfd_arm_update_notes (bfd *, const char *)
unsigned int bfd_arm_get_mach_from_notes (bfd *, const char *)
void bfd_ticoff_set_section_load_page (struct bfd_section *, int)
int bfd_ticoff_get_section_load_page (struct bfd_section *)
bfd_vma bfd_h8300_pad_address (bfd *, bfd_vma)
void bfd_elf32_ia64_after_parse (int)
void bfd_elf64_ia64_after_parse (int)
struct coff_comdat_infobfd_coff_get_comdat_section (bfd *, struct bfd_section *)

Class Documentation

struct carsym

Definition at line 291 of file bfd-in.h.

Class Members
file_ptr file_offset
char * name
struct orl

Definition at line 300 of file bfd-in.h.

Class Members
char ** name
int namidx
union orl u
union orl u
struct lineno_cache_entry

Definition at line 312 of file bfd-in.h.

Class Members
unsigned int line_number
union lineno_cache_entry u
union lineno_cache_entry u
struct _symbol_info

Definition at line 372 of file bfd-in.h.

Class Members
const char * name
short stab_desc
const char * stab_name
char stab_other
unsigned char stab_type
char type
symvalue value
struct bfd_hash_entry

Definition at line 392 of file bfd-in.h.

Collaboration diagram for bfd_hash_entry:
Class Members
unsigned long hash
struct bfd_hash_entry * next
const char * string
struct stab_info

Definition at line 488 of file bfd-in.h.

Collaboration diagram for stab_info:
Class Members
struct bfd_section * stabstr
struct bfd_strtab_hash * strings
struct bfd_link_needed_list

Definition at line 660 of file bfd-in.h.

Collaboration diagram for bfd_link_needed_list:
Class Members
bfd * by
const char * name
struct bfd_link_needed_list * next
struct _bfd_window

Definition at line 791 of file bfd-in.h.

Collaboration diagram for _bfd_window:
Class Members
void * data
struct _bfd_window_internal * i
bfd_size_type size
struct coff_comdat_info

Definition at line 957 of file bfd-in.h.

Class Members
const char * name
long symbol
union orl.u

Definition at line 303 of file bfd-in.h.

Class Members
bfd * abfd
file_ptr pos
union lineno_cache_entry.u

Definition at line 315 of file bfd-in.h.

Class Members
bfd_vma offset
struct bfd_symbol * sym

Define Documentation

#define align_power (   addr,
  align 
)    (((addr) + ((bfd_vma) 1 << (align)) - 1) & ((bfd_vma) -1 << (align)))

Definition at line 325 of file bfd-in.h.

#define bfd_applicable_file_flags (   abfd)    ((abfd)->xvec->object_flags)

Definition at line 547 of file bfd-in.h.

#define bfd_applicable_section_flags (   abfd)    ((abfd)->xvec->section_flags)

Definition at line 548 of file bfd-in.h.

#define BFD_ARCH_SIZE   @wordsize@

Definition at line 73 of file bfd-in.h.

#define BFD_ARM_SPECIAL_SYM_TYPE_ANY   (~0)

Definition at line 918 of file bfd-in.h.

#define BFD_ARM_SPECIAL_SYM_TYPE_MAP   (1 << 0)

Definition at line 915 of file bfd-in.h.

#define BFD_ARM_SPECIAL_SYM_TYPE_OTHER   (1 << 2)

Definition at line 917 of file bfd-in.h.

#define BFD_ARM_SPECIAL_SYM_TYPE_TAG   (1 << 1)

Definition at line 916 of file bfd-in.h.

#define bfd_asymbol_base (   x)    ((x)->section->vma)

Definition at line 282 of file bfd-in.h.

#define bfd_asymbol_bfd (   x)    ((x)->the_bfd)

Definition at line 286 of file bfd-in.h.

#define bfd_asymbol_flavour (   x)    (bfd_asymbol_bfd(x)->xvec->flavour)

Definition at line 287 of file bfd-in.h.

#define bfd_asymbol_name (   x)    ((x)->name)

Definition at line 284 of file bfd-in.h.

#define bfd_asymbol_value (   x)    (bfd_asymbol_base(x) + (x)->value)

Definition at line 283 of file bfd-in.h.

#define bfd_big_endian (   abfd)    ((abfd)->xvec->byteorder == BFD_ENDIAN_BIG)

Definition at line 540 of file bfd-in.h.

#define bfd_count_sections (   abfd)    ((abfd)->section_count)

Definition at line 558 of file bfd-in.h.

#define BFD_DEFAULT_TARGET_SIZE   @bfd_default_target_size@

Definition at line 76 of file bfd-in.h.

#define bfd_family_coff (   abfd)
Value:

Definition at line 537 of file bfd-in.h.

#define bfd_get_cacheable (   abfd)    ((abfd)->cacheable)

Definition at line 533 of file bfd-in.h.

#define bfd_get_dynamic_symcount (   abfd)    ((abfd)->dynsymcount)

Definition at line 560 of file bfd-in.h.

#define bfd_get_file_flags (   abfd)    ((abfd)->flags)

Definition at line 546 of file bfd-in.h.

#define bfd_get_filename (   abfd)    ((char *) (abfd)->filename)

Definition at line 532 of file bfd-in.h.

#define bfd_get_flavour (   abfd)    ((abfd)->xvec->flavour)

Definition at line 536 of file bfd-in.h.

#define bfd_get_format (   abfd)    ((abfd)->format)

Definition at line 534 of file bfd-in.h.

#define bfd_get_output_section (   x)    ((x)->section->output_section)

Definition at line 280 of file bfd-in.h.

#define bfd_get_outsymbols (   abfd)    ((abfd)->outsymbols)

Definition at line 557 of file bfd-in.h.

#define bfd_get_section (   x)    ((x)->section)

Definition at line 279 of file bfd-in.h.

#define bfd_get_section_alignment (   bfd,
  ptr 
)    ((ptr)->alignment_power + 0)

Definition at line 333 of file bfd-in.h.

#define bfd_get_section_flags (   bfd,
  ptr 
)    ((ptr)->flags + 0)

Definition at line 340 of file bfd-in.h.

#define bfd_get_section_limit (   bfd,
  sec 
)
Value:
(((sec)->rawsize ? (sec)->rawsize : (sec)->size) \
   / bfd_octets_per_byte (bfd))

Definition at line 349 of file bfd-in.h.

#define bfd_get_section_lma (   bfd,
  ptr 
)    ((ptr)->lma + 0)

Definition at line 332 of file bfd-in.h.

#define bfd_get_section_name (   bfd,
  ptr 
)    ((ptr)->name + 0)

Definition at line 330 of file bfd-in.h.

#define bfd_get_section_size (   ptr)    ((ptr)->size)

Definition at line 336 of file bfd-in.h.

#define bfd_get_section_userdata (   bfd,
  ptr 
)    ((ptr)->userdata)

Definition at line 341 of file bfd-in.h.

#define bfd_get_section_vma (   bfd,
  ptr 
)    ((ptr)->vma + 0)

Definition at line 331 of file bfd-in.h.

#define bfd_get_start_address (   abfd)    ((abfd)->start_address)

Definition at line 555 of file bfd-in.h.

#define bfd_get_symbol_leading_char (   abfd)    ((abfd)->xvec->symbol_leading_char)

Definition at line 562 of file bfd-in.h.

#define bfd_get_symcount (   abfd)    ((abfd)->symcount)

Definition at line 556 of file bfd-in.h.

#define bfd_get_target (   abfd)    ((abfd)->xvec->name)

Definition at line 535 of file bfd-in.h.

#define bfd_has_map (   abfd)    ((abfd)->has_armap)

Definition at line 550 of file bfd-in.h.

#define bfd_header_big_endian (   abfd)    ((abfd)->xvec->header_byteorder == BFD_ENDIAN_BIG)

Definition at line 542 of file bfd-in.h.

#define bfd_header_little_endian (   abfd)    ((abfd)->xvec->header_byteorder == BFD_ENDIAN_LITTLE)

Definition at line 544 of file bfd-in.h.

Definition at line 78 of file bfd-in.h.

Definition at line 79 of file bfd-in.h.

#define BFD_IN_MEMORY   0x800

Definition at line 257 of file bfd-in.h.

#define bfd_is_com_section (   ptr)    (((ptr)->flags & SEC_IS_COMMON) != 0)

Definition at line 343 of file bfd-in.h.

#define BFD_IS_RELAXABLE   0x200

Definition at line 247 of file bfd-in.h.

#define BFD_LINKER_CREATED   0x2000

Definition at line 264 of file bfd-in.h.

#define bfd_little_endian (   abfd)    ((abfd)->xvec->byteorder == BFD_ENDIAN_LITTLE)

Definition at line 541 of file bfd-in.h.

#define bfd_my_archive (   abfd)    ((abfd)->my_archive)

Definition at line 549 of file bfd-in.h.

#define BFD_NO_FLAGS   0x00

Definition at line 210 of file bfd-in.h.

#define BFD_NO_MORE_SYMBOLS   ((symindex) ~0)

Definition at line 274 of file bfd-in.h.

#define bfd_printf_vma (   abfd,
  x 
)    bfd_fprintf_vma (abfd,stdout,x)

Definition at line 185 of file bfd-in.h.

#define bfd_read (   BUF,
  ELTSIZE,
  NITEMS,
  ABFD 
)
Value:
(warn_deprecated ("bfd_read", (const char *) 0, 0, (const char *) 0), \
   bfd_bread ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))

Definition at line 521 of file bfd-in.h.

#define bfd_section_alignment (   bfd,
  ptr 
)    ((ptr)->alignment_power)

Definition at line 339 of file bfd-in.h.

#define bfd_section_lma (   bfd,
  ptr 
)    ((ptr)->lma)

Definition at line 338 of file bfd-in.h.

#define bfd_section_name (   bfd,
  ptr 
)    ((ptr)->name)

Definition at line 334 of file bfd-in.h.

#define bfd_section_size (   bfd,
  ptr 
)    ((ptr)->size)

Definition at line 335 of file bfd-in.h.

#define bfd_section_vma (   bfd,
  ptr 
)    ((ptr)->vma)

Definition at line 337 of file bfd-in.h.

#define bfd_set_cacheable (   abfd,
  bool 
)    (((abfd)->cacheable = bool), TRUE)

Definition at line 564 of file bfd-in.h.

#define bfd_set_section (   x,
  y 
)    ((x)->section) = (y)

Definition at line 281 of file bfd-in.h.

#define bfd_set_section_alignment (   bfd,
  ptr,
  val 
)    (((ptr)->alignment_power = (val)),TRUE)

Definition at line 346 of file bfd-in.h.

#define bfd_set_section_userdata (   bfd,
  ptr,
  val 
)    (((ptr)->userdata = (val)),TRUE)

Definition at line 347 of file bfd-in.h.

#define bfd_set_section_vma (   bfd,
  ptr,
  val 
)    (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = TRUE), TRUE)

Definition at line 345 of file bfd-in.h.

#define BFD_TRADITIONAL_FORMAT   0x400

Definition at line 253 of file bfd-in.h.

#define bfd_usrdata (   abfd)    ((abfd)->usrdata)

Definition at line 553 of file bfd-in.h.

#define bfd_valid_reloc_types (   abfd)    ((abfd)->xvec->valid_reloc_types)

Definition at line 552 of file bfd-in.h.

#define bfd_write (   BUF,
  ELTSIZE,
  NITEMS,
  ABFD 
)
Value:
(warn_deprecated ("bfd_write", (const char *) 0, 0, (const char *) 0),\
   bfd_bwrite ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))

Definition at line 524 of file bfd-in.h.

#define COFF_SWAP_TABLE   (void *) &bfd_coff_std_swap_table

Definition at line 498 of file bfd-in.h.

#define CONST_STRNEQ (   STR1,
  STR2 
)    (strncmp ((STR1), (STR2), sizeof (STR2) - 1) == 0)

Definition at line 61 of file bfd-in.h.

#define D_PAGED   0x100

Definition at line 242 of file bfd-in.h.

#define DYNAMIC   0x40

Definition at line 233 of file bfd-in.h.

#define elf_discarded_section (   sec)
Value:
(!bfd_is_abs_section (sec)                              \
   && bfd_is_abs_section ((sec)->output_section)        \
   && (sec)->sec_info_type != ELF_INFO_TYPE_MERGE              \
   && (sec)->sec_info_type != ELF_INFO_TYPE_JUST_SYMS)

Definition at line 354 of file bfd-in.h.

#define EXEC_P   0x02

Definition at line 216 of file bfd-in.h.

#define FALSE   0

Definition at line 114 of file bfd-in.h.

#define fprintf_vma (   s,
  x 
)    fprintf (s, "%08lx", x)

Definition at line 159 of file bfd-in.h.

#define HALF_BFD_SIZE_TYPE   (((bfd_size_type) 1) << (8 * sizeof (bfd_size_type) / 2))

Definition at line 164 of file bfd-in.h.

#define HAS_DEBUG   0x08

Definition at line 223 of file bfd-in.h.

#define HAS_LINENO   0x04

Definition at line 220 of file bfd-in.h.

#define HAS_LOAD_PAGE   0x1000

Definition at line 260 of file bfd-in.h.

#define HAS_LOCALS   0x20

Definition at line 230 of file bfd-in.h.

#define HAS_RELOC   0x01

Definition at line 213 of file bfd-in.h.

#define HAS_SYMS   0x10

Definition at line 226 of file bfd-in.h.

#define INLINE

Definition at line 95 of file bfd-in.h.

#define LITMEMCPY (   DEST,
  STR2 
)    memcpy ((DEST), (STR2), sizeof (STR2) - 1)

Definition at line 66 of file bfd-in.h.

#define LITSTRCPY (   DEST,
  STR2 
)    memcpy ((DEST), (STR2), sizeof (STR2))

Definition at line 67 of file bfd-in.h.

#define printf_vma (   x)    fprintf_vma(stdout,x)

Definition at line 184 of file bfd-in.h.

#define sprintf_vma (   s,
  x 
)    sprintf (s, "%08lx", x)

Definition at line 160 of file bfd-in.h.

#define STRING_COMMA_LEN (   STR)    (STR), ((STR) ? sizeof (STR) - 1 : 0)

Definition at line 51 of file bfd-in.h.

#define TRUE   1

Definition at line 115 of file bfd-in.h.

#define WP_TEXT   0x80

Definition at line 238 of file bfd-in.h.


Typedef Documentation

Definition at line 789 of file bfd-in.h.

Definition at line 100 of file bfd-in.h.

Definition at line 111 of file bfd-in.h.

typedef unsigned char bfd_byte

Definition at line 188 of file bfd-in.h.

typedef enum bfd_format bfd_format

Definition at line 172 of file bfd-in.h.

Definition at line 153 of file bfd-in.h.

Definition at line 156 of file bfd-in.h.

Definition at line 173 of file bfd-in.h.

Definition at line 147 of file bfd-in.h.

typedef struct carsym carsym
typedef bfd_file_ptr file_ptr

Definition at line 178 of file bfd-in.h.

Definition at line 187 of file bfd-in.h.

Definition at line 272 of file bfd-in.h.

void sec_ptr

Definition at line 328 of file bfd-in.h.

Definition at line 269 of file bfd-in.h.

Definition at line 155 of file bfd-in.h.

typedef unsigned bfd_file_ptr ufile_ptr

Definition at line 179 of file bfd-in.h.


Enumeration Type Documentation

Enumerator:
BFD_ARM_VFP11_FIX_DEFAULT 
BFD_ARM_VFP11_FIX_NONE 
BFD_ARM_VFP11_FIX_SCALAR 
BFD_ARM_VFP11_FIX_VECTOR 
BFD_ARM_VFP11_FIX_DEFAULT 
BFD_ARM_VFP11_FIX_NONE 
BFD_ARM_VFP11_FIX_SCALAR 
BFD_ARM_VFP11_FIX_VECTOR 

Definition at line 857 of file bfd-in.h.

enum bfd_format
Enumerator:
bfd_unknown 
bfd_object 
bfd_archive 
bfd_core 
bfd_type_end 
bfd_unknown 
bfd_object 
bfd_archive 
bfd_core 
bfd_type_end 

Definition at line 192 of file bfd-in.h.

{
  bfd_unknown = 0,   /* File format is unknown.  */
  bfd_object,        /* Linker/assembler/compiler output.  */
  bfd_archive,              /* Object archive file.  */
  bfd_core,          /* Core dump.  */
  bfd_type_end              /* Marks the end; don't use it!  */
}
Enumerator:
bfd_print_symbol_name 
bfd_print_symbol_more 
bfd_print_symbol_all 
bfd_print_symbol_name 
bfd_print_symbol_more 
bfd_print_symbol_all 

Definition at line 363 of file bfd-in.h.

Enumerator:
DYN_NORMAL 
DYN_AS_NEEDED 
DYN_DT_NEEDED 
DYN_NO_ADD_NEEDED 
DYN_NO_NEEDED 
DYN_NORMAL 
DYN_AS_NEEDED 
DYN_DT_NEEDED 
DYN_NO_ADD_NEEDED 
DYN_NO_NEEDED 

Definition at line 667 of file bfd-in.h.

Enumerator:
notice_as_needed 
notice_not_needed 
notice_needed 
notice_as_needed 
notice_not_needed 
notice_needed 

Definition at line 675 of file bfd-in.h.


Function Documentation

Definition at line 7974 of file elflink.c.

{
  if (sec->flags & SEC_DEBUGGING)
    return PRETEND;

  if (strcmp (".eh_frame", sec->name) == 0)
    return 0;

  if (strcmp (".gcc_except_table", sec->name) == 0)
    return 0;

  return COMPLAIN | PRETEND;
}

Here is the caller graph for this function:

Definition at line 2748 of file elflink.c.

{
  struct bfd_section *sec, *tls;
  unsigned int align = 0;

  for (sec = obfd->sections; sec != NULL; sec = sec->next)
    if ((sec->flags & SEC_THREAD_LOCAL) != 0)
      break;
  tls = sec;

  for (; sec != NULL && (sec->flags & SEC_THREAD_LOCAL) != 0; sec = sec->next)
    if (sec->alignment_power > align)
      align = sec->alignment_power;

  elf_hash_table (info)->tls_sec = tls;

  /* Ensure the alignment of the first section is the largest alignment,
     so that the tls segment starts aligned.  */
  if (tls != NULL)
    tls->alignment_power = align;

  return tls;
}

Here is the caller graph for this function:

Definition at line 3162 of file linker.c.

Here is the caller graph for this function:

Definition at line 1783 of file coff-arm.c.

{
  asection *                        s;
  bfd_byte *                        foo;
  struct coff_arm_link_hash_table * globals;

  globals = coff_arm_hash_table (info);

  BFD_ASSERT (globals != NULL);

  if (globals->arm_glue_size != 0)
    {
      BFD_ASSERT (globals->bfd_of_glue_owner != NULL);

      s = bfd_get_section_by_name
       (globals->bfd_of_glue_owner, ARM2THUMB_GLUE_SECTION_NAME);

      BFD_ASSERT (s != NULL);

      foo = bfd_alloc (globals->bfd_of_glue_owner, globals->arm_glue_size);

      s->size = globals->arm_glue_size;
      s->contents = foo;
    }

  if (globals->thumb_glue_size != 0)
    {
      BFD_ASSERT (globals->bfd_of_glue_owner != NULL);

      s = bfd_get_section_by_name
       (globals->bfd_of_glue_owner, THUMB2ARM_GLUE_SECTION_NAME);

      BFD_ASSERT (s != NULL);

      foo = bfd_alloc (globals->bfd_of_glue_owner, globals->thumb_glue_size);

      s->size = globals->thumb_glue_size;
      s->contents = foo;
    }

  return TRUE;
}

Definition at line 1963 of file coff-arm.c.

{
  struct coff_arm_link_hash_table * globals;
  flagword                      flags;
  asection *                    sec;

  /* If we are only performing a partial link do not bother
     getting a bfd to hold the glue.  */
  if (info->relocatable)
    return TRUE;

  globals = coff_arm_hash_table (info);

  BFD_ASSERT (globals != NULL);

  if (globals->bfd_of_glue_owner != NULL)
    return TRUE;

  sec = bfd_get_section_by_name (abfd, ARM2THUMB_GLUE_SECTION_NAME);

  if (sec == NULL)
    {
      flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
              | SEC_CODE | SEC_READONLY);
      sec = bfd_make_section_with_flags (abfd, ARM2THUMB_GLUE_SECTION_NAME,
                                    flags);
      if (sec == NULL
         || ! bfd_set_section_alignment (abfd, sec, 2))
       return FALSE;
    }

  sec = bfd_get_section_by_name (abfd, THUMB2ARM_GLUE_SECTION_NAME);

  if (sec == NULL)
    {
      flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
              | SEC_CODE | SEC_READONLY);
      sec = bfd_make_section_with_flags (abfd, THUMB2ARM_GLUE_SECTION_NAME,
                                    flags);

      if (sec == NULL
         || ! bfd_set_section_alignment (abfd, sec, 2))
       return FALSE;
    }

  /* Save the bfd for later use.  */
  globals->bfd_of_glue_owner = abfd;

  return TRUE;
}

Definition at line 371 of file cpu-arm.c.

{
  asection *     arm_arch_section;
  bfd_size_type  buffer_size;
  bfd_byte *     buffer;
  char *         arch_string;
  int            i;

  /* Look for a note section.  If one is present check the architecture
     string encoded in it, and set it to the current architecture if it is
     different.  */
  arm_arch_section = bfd_get_section_by_name (abfd, note_section);

  if (arm_arch_section == NULL)
    return bfd_mach_arm_unknown;

  buffer_size = arm_arch_section->size;
  if (buffer_size == 0)
    return bfd_mach_arm_unknown;

  if (!bfd_malloc_and_get_section (abfd, arm_arch_section, &buffer))
    goto FAIL;

  /* Parse the note.  */
  if (! arm_check_note (abfd, buffer, buffer_size, NOTE_ARCH_STRING, & arch_string))
    goto FAIL;

  /* Interpret the architecture string.  */
  for (i = ARRAY_SIZE (architectures); i--;)
    if (strcmp (arch_string, architectures[i].string) == 0)
      {
       free (buffer);
       return architectures[i].mach;
      }

 FAIL:
  if (buffer != NULL)
    free (buffer);
  return bfd_mach_arm_unknown;
}

Here is the caller graph for this function:

Definition at line 156 of file cpu-arm.c.

{
  unsigned int in  = bfd_get_mach (ibfd);
  unsigned int out = bfd_get_mach (obfd);

  /* If the output architecture is unknown, we now have a value to set.  */
  if (out == bfd_mach_arm_unknown)
    bfd_set_arch_mach (obfd, bfd_arch_arm, in);

  /* If the input architecture is unknown,
     then so must be the output architecture.  */
  else if (in == bfd_mach_arm_unknown)
    /* FIXME: We ought to have some way to
       override this on the command line.  */
    bfd_set_arch_mach (obfd, bfd_arch_arm, bfd_mach_arm_unknown);

  /* If they are the same then nothing needs to be done.  */
  else if (out == in)
    ;

  /* Otherwise the general principle that a earlier architecture can be
     linked with a later architecture to produce a binary that will execute
     on the later architecture.

     We fail however if we attempt to link a Cirrus EP9312 binary with an
     Intel XScale binary, since these architecture have co-processors which
     will not both be present on the same physical hardware.  */
  else if (in == bfd_mach_arm_ep9312
          && (out == bfd_mach_arm_XScale
              || out == bfd_mach_arm_iWMMXt
              || out == bfd_mach_arm_iWMMXt2))
    {
      _bfd_error_handler (_("\
ERROR: %B is compiled for the EP9312, whereas %B is compiled for XScale"),
                       ibfd, obfd);
      bfd_set_error (bfd_error_wrong_format);
      return FALSE;
    }
  else if (out == bfd_mach_arm_ep9312
          && (in == bfd_mach_arm_XScale
              || in == bfd_mach_arm_iWMMXt
              || in == bfd_mach_arm_iWMMXt2))
    {
      _bfd_error_handler (_("\
ERROR: %B is compiled for the EP9312, whereas %B is compiled for XScale"),
                       obfd, ibfd);
      bfd_set_error (bfd_error_wrong_format);
      return FALSE;
    }
  else if (in > out)
    bfd_set_arch_mach (obfd, bfd_arch_arm, in);
  /* else
     Nothing to do.  */

  return TRUE;
}

Here is the caller graph for this function:

Definition at line 2016 of file coff-arm.c.

{
  asection * sec;
  struct coff_arm_link_hash_table * globals;

  /* If we are only performing a partial link do not bother
     to construct any glue.  */
  if (info->relocatable)
    return TRUE;

  /* Here we have a bfd that is to be included on the link.  We have a hook
     to do reloc rummaging, before section sizes are nailed down.  */
  _bfd_coff_get_external_symbols (abfd);

  globals = coff_arm_hash_table (info);

  BFD_ASSERT (globals != NULL);
  BFD_ASSERT (globals->bfd_of_glue_owner != NULL);

  globals->support_old_code = support_old_code;

  /* Rummage around all the relocs and map the glue vectors.  */
  sec = abfd->sections;

  if (sec == NULL)
    return TRUE;

  for (; sec != NULL; sec = sec->next)
    {
      struct internal_reloc * i;
      struct internal_reloc * rel;

      if (sec->reloc_count == 0)
       continue;

      /* Load the relocs.  */
      /* FIXME: there may be a storage leak here.  */
      i = _bfd_coff_read_internal_relocs (abfd, sec, 1, 0, 0, 0);

      BFD_ASSERT (i != 0);

      for (rel = i; rel < i + sec->reloc_count; ++rel)
       {
         unsigned short                 r_type  = rel->r_type;
         long                           symndx;
         struct coff_link_hash_entry *  h;

         symndx = rel->r_symndx;

         /* If the relocation is not against a symbol it cannot concern us.  */
         if (symndx == -1)
           continue;

         /* If the index is outside of the range of our table, something has gone wrong.  */
         if (symndx >= obj_conv_table_size (abfd))
           {
             _bfd_error_handler (_("%B: illegal symbol index in reloc: %d"),
                              abfd, symndx);
             continue;
           }

         h = obj_coff_sym_hashes (abfd)[symndx];

         /* If the relocation is against a static symbol it must be within
            the current section and so cannot be a cross ARM/Thumb relocation.  */
         if (h == NULL)
           continue;

         switch (r_type)
           {
           case ARM_26:
             /* This one is a call from arm code.  We need to look up
               the target of the call. If it is a thumb target, we
               insert glue.  */

             if (h->class == C_THUMBEXTFUNC)
              record_arm_to_thumb_glue (info, h);
             break;

#ifndef ARM_WINCE
           case ARM_THUMB23:
             /* This one is a call from thumb code.  We used to look
               for ARM_THUMB9 and ARM_THUMB12 as well.  We need to look
               up the target of the call. If it is an arm target, we
               insert glue.  If the symbol does not exist it will be
               given a class of C_EXT and so we will generate a stub
               for it.  This is not really a problem, since the link
               is doomed anyway.  */

             switch (h->class)
              {
              case C_EXT:
              case C_STAT:
              case C_LABEL:
                record_thumb_to_arm_glue (info, h);
                break;
              default:
                ;
              }
             break;
#endif

           default:
             break;
           }
       }
    }

  return TRUE;
}
bfd_boolean bfd_arm_update_notes ( bfd ,
const char *   
)

Definition at line 274 of file cpu-arm.c.

{
  asection *     arm_arch_section;
  bfd_size_type  buffer_size;
  bfd_byte *     buffer;
  char *         arch_string;
  char *         expected;

  /* Look for a note section.  If one is present check the architecture
     string encoded in it, and set it to the current architecture if it is
     different.  */
  arm_arch_section = bfd_get_section_by_name (abfd, note_section);

  if (arm_arch_section == NULL)
    return TRUE;

  buffer_size = arm_arch_section->size;
  if (buffer_size == 0)
    return FALSE;

  if (!bfd_malloc_and_get_section (abfd, arm_arch_section, &buffer))
    goto FAIL;

  /* Parse the note.  */
  if (! arm_check_note (abfd, buffer, buffer_size, NOTE_ARCH_STRING, & arch_string))
    goto FAIL;

  /* Check the architecture in the note against the architecture of the bfd.  */
  switch (bfd_get_mach (abfd))
    {
    default:
    case bfd_mach_arm_unknown: expected = "unknown"; break;
    case bfd_mach_arm_2:       expected = "armv2"; break;
    case bfd_mach_arm_2a:      expected = "armv2a"; break;
    case bfd_mach_arm_3:       expected = "armv3"; break;
    case bfd_mach_arm_3M:      expected = "armv3M"; break;
    case bfd_mach_arm_4:       expected = "armv4"; break;
    case bfd_mach_arm_4T:      expected = "armv4t"; break;
    case bfd_mach_arm_5:       expected = "armv5"; break;
    case bfd_mach_arm_5T:      expected = "armv5t"; break;
    case bfd_mach_arm_5TE:     expected = "armv5te"; break;
    case bfd_mach_arm_XScale:  expected = "XScale"; break;
    case bfd_mach_arm_ep9312:  expected = "ep9312"; break;
    case bfd_mach_arm_iWMMXt:  expected = "iWMMXt"; break;
    case bfd_mach_arm_iWMMXt2: expected = "iWMMXt2"; break;
    }

  if (strcmp (arch_string, expected) != 0)
    {
      strcpy ((char *) buffer + (offsetof (arm_Note, name)
                             + ((strlen (NOTE_ARCH_STRING) + 3) & ~3)),
             expected);

      if (! bfd_set_section_contents (abfd, arm_arch_section, buffer,
                                  (file_ptr) 0, buffer_size))
       {
         (*_bfd_error_handler)
           (_("warning: unable to update contents of %s section in %s"),
            note_section, bfd_get_filename (abfd));
         goto FAIL;
       }
    }

  free (buffer);
  return TRUE;

 FAIL:
  if (buffer != NULL)
    free (buffer);
  return FALSE;
}

Here is the caller graph for this function:

Definition at line 5379 of file elf32-bfin.c.

{
  Elf_Internal_Shdr *symtab_hdr;
  Elf_Internal_Sym *isymbuf = NULL;
  Elf_Internal_Rela *internal_relocs = NULL;
  Elf_Internal_Rela *irel, *irelend;
  bfd_byte *p;
  bfd_size_type amt;

  BFD_ASSERT (! info->relocatable);

  *errmsg = NULL;

  if (datasec->reloc_count == 0)
    return TRUE;

  symtab_hdr = &elf_tdata (abfd)->symtab_hdr;

  /* Get a copy of the native relocations.  */
  internal_relocs = (_bfd_elf_link_read_relocs
                   (abfd, datasec, (PTR) NULL, (Elf_Internal_Rela *) NULL,
                    info->keep_memory));
  if (internal_relocs == NULL)
    goto error_return;

  amt = (bfd_size_type) datasec->reloc_count * 12;
  relsec->contents = (bfd_byte *) bfd_alloc (abfd, amt);
  if (relsec->contents == NULL)
    goto error_return;

  p = relsec->contents;

  irelend = internal_relocs + datasec->reloc_count;
  for (irel = internal_relocs; irel < irelend; irel++, p += 12)
    {
      asection *targetsec;

      /* We are going to write a four byte longword into the runtime
       reloc section.  The longword will be the address in the data
       section which must be relocated.  It is followed by the name
       of the target section NUL-padded or truncated to 8
       characters.  */

      /* We can only relocate absolute longword relocs at run time.  */
      if (ELF32_R_TYPE (irel->r_info) != (int) R_byte4_data)
       {
         *errmsg = _("unsupported reloc type");
         bfd_set_error (bfd_error_bad_value);
         goto error_return;
       }

      /* Get the target section referred to by the reloc.  */
      if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info)
       {
         /* A local symbol.  */
         Elf_Internal_Sym *isym;

         /* Read this BFD's local symbols if we haven't done so already.  */
         if (isymbuf == NULL)
           {
             isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents;
             if (isymbuf == NULL)
              isymbuf = bfd_elf_get_elf_syms (abfd, symtab_hdr,
                                          symtab_hdr->sh_info, 0,
                                          NULL, NULL, NULL);
             if (isymbuf == NULL)
              goto error_return;
           }

         isym = isymbuf + ELF32_R_SYM (irel->r_info);
         targetsec = bfd_section_from_elf_index (abfd, isym->st_shndx);
       }
      else
       {
         unsigned long indx;
         struct elf_link_hash_entry *h;

         /* An external symbol.  */
         indx = ELF32_R_SYM (irel->r_info) - symtab_hdr->sh_info;
         h = elf_sym_hashes (abfd)[indx];
         BFD_ASSERT (h != NULL);
         if (h->root.type == bfd_link_hash_defined
             || h->root.type == bfd_link_hash_defweak)
           targetsec = h->root.u.def.section;
         else
           targetsec = NULL;
       }

      bfd_put_32 (abfd, irel->r_offset + datasec->output_offset, p);
      memset (p + 4, 0, 8);
      if (targetsec != NULL)
       strncpy ((char *) p + 4, targetsec->output_section->name, 8);
    }

  if (isymbuf != NULL && symtab_hdr->contents != (unsigned char *) isymbuf)
    free (isymbuf);
  if (internal_relocs != NULL
      && elf_section_data (datasec)->relocs != internal_relocs)
    free (internal_relocs);
  return TRUE;

error_return:
  if (isymbuf != NULL && symtab_hdr->contents != (unsigned char *) isymbuf)
    free (isymbuf);
  if (internal_relocs != NULL
      && elf_section_data (datasec)->relocs != internal_relocs)
    free (internal_relocs);
  return FALSE;
}
bfd_size_type bfd_bread ( void *  ,
bfd_size_type  ,
bfd  
)

Definition at line 115 of file bfdio.c.

{
  size_t nread;

  /* If this is an archive element, don't read past the end of
     this element.  */
  if (abfd->arelt_data != NULL)
    {
      size_t maxbytes = ((struct areltdata *) abfd->arelt_data)->parsed_size;
      if (size > maxbytes)
       size = maxbytes;
    }

  if ((abfd->flags & BFD_IN_MEMORY) != 0)
    {
      struct bfd_in_memory *bim;
      bfd_size_type get;

      bim = abfd->iostream;
      get = size;
      if (abfd->where + get > bim->size)
       {
         if (bim->size < (bfd_size_type) abfd->where)
           get = 0;
         else
           get = bim->size - abfd->where;
         bfd_set_error (bfd_error_file_truncated);
       }
      memcpy (ptr, bim->buffer + abfd->where, (size_t) get);
      abfd->where += get;
      return get;
    }

  if (abfd->iovec)
    nread = abfd->iovec->bread (abfd, ptr, size);
  else
    nread = 0;
  if (nread != (size_t) -1)
    abfd->where += nread;

  return nread;
}
bfd_size_type bfd_bwrite ( const void *  ,
bfd_size_type  ,
bfd  
)

Definition at line 159 of file bfdio.c.

{
  size_t nwrote;

  if ((abfd->flags & BFD_IN_MEMORY) != 0)
    {
      struct bfd_in_memory *bim = abfd->iostream;

      size = (size_t) size;
      if (abfd->where + size > bim->size)
       {
         bfd_size_type newsize, oldsize;

         oldsize = (bim->size + 127) & ~(bfd_size_type) 127;
         bim->size = abfd->where + size;
         /* Round up to cut down on memory fragmentation */
         newsize = (bim->size + 127) & ~(bfd_size_type) 127;
         if (newsize > oldsize)
           {
             bim->buffer = bfd_realloc (bim->buffer, newsize);
             if (bim->buffer == 0)
              {
                bim->size = 0;
                return 0;
              }
           }
       }
      memcpy (bim->buffer + abfd->where, ptr, (size_t) size);
      abfd->where += size;
      return size;
    }

  if (abfd->iovec)
    nwrote = abfd->iovec->bwrite (abfd, ptr, size);
  else
    nwrote = 0;

  if (nwrote != (size_t) -1)
    abfd->where += nwrote;
  if (nwrote != size)
    {
#ifdef ENOSPC
      errno = ENOSPC;
#endif
      bfd_set_error (bfd_error_system_call);
    }
  return nwrote;
}

Definition at line 410 of file cache.c.

{
  if (abfd->iovec != &cache_iovec)
    return TRUE;

  if (abfd->iostream == NULL)
    /* Previously closed.  */
    return TRUE;

  return bfd_cache_delete (abfd);
}

Here is the caller graph for this function:

Definition at line 439 of file cache.c.

{
  bfd_boolean ret = TRUE;

  while (bfd_last_cache != NULL)
    ret &= bfd_cache_close (bfd_last_cache);

  return ret;
}

Definition at line 1820 of file coffgen.c.

{
  coff_symbol_type *csym;
  combined_entry_type *ent;

  csym = coff_symbol_from (abfd, symbol);

  if (csym == NULL
      || csym->native == NULL
      || indx >= csym->native->u.syment.n_numaux)
    {
      bfd_set_error (bfd_error_invalid_operation);
      return FALSE;
    }

  ent = csym->native + indx + 1;

  *pauxent = ent->u.auxent;

  if (ent->fix_tag)
    pauxent->x_sym.x_tagndx.l =
      ((combined_entry_type *) pauxent->x_sym.x_tagndx.p
       - obj_raw_syments (abfd));

  if (ent->fix_end)
    pauxent->x_sym.x_fcnary.x_fcn.x_endndx.l =
      ((combined_entry_type *) pauxent->x_sym.x_fcnary.x_fcn.x_endndx.p
       - obj_raw_syments (abfd));

  if (ent->fix_scnlen)
    pauxent->x_csect.x_scnlen.l =
      ((combined_entry_type *) pauxent->x_csect.x_scnlen.p
       - obj_raw_syments (abfd));

  return TRUE;
}

Here is the caller graph for this function:

Definition at line 2319 of file coffgen.c.

{
  if (bfd_get_flavour (abfd) == bfd_target_coff_flavour
      && coff_section_data (abfd, sec) != NULL)
    return coff_section_data (abfd, sec)->comdat;
  else
    return NULL;
}

Here is the caller graph for this function:

Definition at line 1793 of file coffgen.c.

{
  coff_symbol_type *csym;

  csym = coff_symbol_from (abfd, symbol);
  if (csym == NULL || csym->native == NULL)
    {
      bfd_set_error (bfd_error_invalid_operation);
      return FALSE;
    }

  *psyment = csym->native->u.syment;

  if (csym->native->fix_value)
    psyment->n_value = psyment->n_value -
      (unsigned long) obj_raw_syments (abfd);

  /* FIXME: We should handle fix_line here.  */

  return TRUE;
}

Here is the caller graph for this function:

Definition at line 2257 of file coffgen.c.

{
  coff_symbol_type * csym;

  csym = coff_symbol_from (abfd, symbol);
  if (csym == NULL)
    {
      bfd_set_error (bfd_error_invalid_operation);
      return FALSE;
    }
  else if (csym->native == NULL)
    {
      /* This is an alien symbol which no native coff backend data.
        We cheat here by creating a fake native entry for it and
        then filling in the class.  This code is based on that in
        coff_write_alien_symbol().  */

      combined_entry_type * native;
      bfd_size_type amt = sizeof (* native);

      native = bfd_zalloc (abfd, amt);
      if (native == NULL)
       return FALSE;

      native->u.syment.n_type   = T_NULL;
      native->u.syment.n_sclass = class;

      if (bfd_is_und_section (symbol->section))
       {
         native->u.syment.n_scnum = N_UNDEF;
         native->u.syment.n_value = symbol->value;
       }
      else if (bfd_is_com_section (symbol->section))
       {
         native->u.syment.n_scnum = N_UNDEF;
         native->u.syment.n_value = symbol->value;
       }
      else
       {
         native->u.syment.n_scnum =
           symbol->section->output_section->target_index;
         native->u.syment.n_value = (symbol->value
                                  + symbol->section->output_offset);
         if (! obj_pe (abfd))
           native->u.syment.n_value += symbol->section->output_section->vma;

         /* Copy the any flags from the file header into the symbol.
            FIXME: Why?  */
         native->u.syment.n_flags = bfd_asymbol_bfd (& csym->symbol)->flags;
       }

      csym->native = native;
    }
  else
    csym->native->u.syment.n_sclass = class;

  return TRUE;
}

Here is the caller graph for this function:

bfd_boolean bfd_ecoff_debug_accumulate ( void *  handle,
bfd output_bfd,
struct ecoff_debug_info output_debug,
const struct ecoff_debug_swap output_swap,
bfd input_bfd,
struct ecoff_debug_info input_debug,
const struct ecoff_debug_swap input_swap,
struct bfd_link_info  
)

Here is the caller graph for this function:

bfd_boolean bfd_ecoff_debug_accumulate_other ( void *  handle,
bfd output_bfd,
struct ecoff_debug_info output_debug,
const struct ecoff_debug_swap output_swap,
bfd input_bfd,
struct bfd_link_info  
)

Here is the caller graph for this function:

bfd_boolean bfd_ecoff_debug_externals ( bfd abfd,
struct ecoff_debug_info debug,
const struct ecoff_debug_swap swap,
bfd_boolean  relocatable,
bfd_boolean(*)(struct bfd_symbol *, struct ecoff_extr *)  get_extr,
void(*)(struct bfd_symbol *, bfd_size_type set_index 
)

Here is the caller graph for this function:

void bfd_ecoff_debug_free ( void *  handle,
bfd output_bfd,
struct ecoff_debug_info output_debug,
const struct ecoff_debug_swap output_swap,
struct bfd_link_info  
)

Here is the caller graph for this function:

void* bfd_ecoff_debug_init ( bfd output_bfd,
struct ecoff_debug_info output_debug,
const struct ecoff_debug_swap output_swap,
struct bfd_link_info  
)

Here is the caller graph for this function:

Definition at line 1312 of file ecofflink.c.

{
  const bfd_size_type external_ext_size = swap->external_ext_size;
  void (* const swap_ext_out) PARAMS ((bfd *, const EXTR *, PTR))
    = swap->swap_ext_out;
  HDRR * const symhdr = &debug->symbolic_header;
  size_t namelen;

  namelen = strlen (name);

  if ((size_t) (debug->ssext_end - debug->ssext)
      < symhdr->issExtMax + namelen + 1)
    {
      if (! ecoff_add_bytes ((char **) &debug->ssext,
                          (char **) &debug->ssext_end,
                          symhdr->issExtMax + namelen + 1))
       return FALSE;
    }
  if ((size_t) ((char *) debug->external_ext_end
              - (char *) debug->external_ext)
      < (symhdr->iextMax + 1) * external_ext_size)
    {
      char *external_ext = debug->external_ext;
      char *external_ext_end = debug->external_ext_end;
      if (! ecoff_add_bytes ((char **) &external_ext,
                          (char **) &external_ext_end,
                          (symhdr->iextMax + 1) * (size_t) external_ext_size))
       return FALSE;
      debug->external_ext = external_ext;
      debug->external_ext_end = external_ext_end;
    }

  esym->asym.iss = symhdr->issExtMax;

  (*swap_ext_out) (abfd, esym,
                 ((char *) debug->external_ext
                  + symhdr->iextMax * swap->external_ext_size));

  ++symhdr->iextMax;

  strcpy (debug->ssext + symhdr->issExtMax, name);
  symhdr->issExtMax += namelen + 1;

  return TRUE;
}

Here is the caller graph for this function:

Definition at line 1427 of file ecofflink.c.

{
  bfd_size_type tot;

  ecoff_align_debug (abfd, debug, swap);
  tot = swap->external_hdr_size;

#define ADD(count, size) \
  tot += debug->symbolic_header.count * size

  ADD (cbLine, sizeof (unsigned char));
  ADD (idnMax, swap->external_dnr_size);
  ADD (ipdMax, swap->external_pdr_size);
  ADD (isymMax, swap->external_sym_size);
  ADD (ioptMax, swap->external_opt_size);
  ADD (iauxMax, sizeof (union aux_ext));
  ADD (issMax, sizeof (char));
  ADD (issExtMax, sizeof (char));
  ADD (ifdMax, swap->external_fdr_size);
  ADD (crfd, swap->external_rfd_size);
  ADD (iextMax, swap->external_ext_size);

#undef ADD

  return tot;
}

Here is the caller graph for this function:

Definition at line 2178 of file ecoff.c.

bfd_boolean bfd_ecoff_set_gp_value ( bfd abfd,
bfd_vma  gp_value 
)

Definition at line 2194 of file ecoff.c.

{
  if (bfd_get_flavour (abfd) != bfd_target_ecoff_flavour
      || bfd_get_format (abfd) != bfd_object)
    {
      bfd_set_error (bfd_error_invalid_operation);
      return FALSE;
    }

  ecoff_data (abfd)->gp = gp_value;

  return TRUE;
}

Here is the caller graph for this function:

bfd_boolean bfd_ecoff_set_regmasks ( bfd abfd,
unsigned long  gprmask,
unsigned long  fprmask,
unsigned long cprmask 
)

Definition at line 2212 of file ecoff.c.

{
  ecoff_data_type *tdata;

  if (bfd_get_flavour (abfd) != bfd_target_ecoff_flavour
      || bfd_get_format (abfd) != bfd_object)
    {
      bfd_set_error (bfd_error_invalid_operation);
      return FALSE;
    }

  tdata = ecoff_data (abfd);
  tdata->gprmask = gprmask;
  tdata->fprmask = fprmask;
  if (cprmask != NULL)
    {
      int i;

      for (i = 0; i < 3; i++)
       tdata->cprmask[i] = cprmask[i];
    }

  return TRUE;
}

Here is the caller graph for this function:

bfd_boolean bfd_ecoff_write_accumulated_debug ( void *  handle,
bfd abfd,
struct ecoff_debug_info debug,
const struct ecoff_debug_swap swap,
struct bfd_link_info info,
file_ptr  where 
)

Here is the caller graph for this function:

Definition at line 1529 of file ecofflink.c.

{
  HDRR * const symhdr = &debug->symbolic_header;

  if (! ecoff_write_symhdr (abfd, debug, swap, where))
    return FALSE;

#define WRITE(ptr, count, size, offset) \
  BFD_ASSERT (symhdr->offset == 0 \
             || (bfd_vma) bfd_tell (abfd) == symhdr->offset); \
  if (bfd_bwrite ((PTR) debug->ptr, (bfd_size_type) size * symhdr->count, abfd)\
      != size * symhdr->count) \
    return FALSE;

  WRITE (line, cbLine, sizeof (unsigned char), cbLineOffset);
  WRITE (external_dnr, idnMax, swap->external_dnr_size, cbDnOffset);
  WRITE (external_pdr, ipdMax, swap->external_pdr_size, cbPdOffset);
  WRITE (external_sym, isymMax, swap->external_sym_size, cbSymOffset);
  WRITE (external_opt, ioptMax, swap->external_opt_size, cbOptOffset);
  WRITE (external_aux, iauxMax, (bfd_size_type) sizeof (union aux_ext),
        cbAuxOffset);
  WRITE (ss, issMax, sizeof (char), cbSsOffset);
  WRITE (ssext, issExtMax, sizeof (char), cbSsExtOffset);
  WRITE (external_fdr, ifdMax, swap->external_fdr_size, cbFdOffset);
  WRITE (external_rfd, crfd, swap->external_rfd_size, cbRfdOffset);
  WRITE (external_ext, iextMax, swap->external_ext_size, cbExtOffset);
#undef WRITE

  return TRUE;
}

Here is the caller graph for this function:

Definition at line 2988 of file elf32-arm.c.

{
  flagword flags;
  asection *sec;

  /* If we are only performing a partial
     link do not bother adding the glue.  */
  if (info->relocatable)
    return TRUE;

  sec = bfd_get_section_by_name (abfd, ARM2THUMB_GLUE_SECTION_NAME);

  if (sec == NULL)
    {
      /* Note: we do not include the flag SEC_LINKER_CREATED, as this
        will prevent elf_link_input_bfd() from processing the contents
        of this section.  */
      flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
              | SEC_CODE | SEC_READONLY);

      sec = bfd_make_section_with_flags (abfd,
                                    ARM2THUMB_GLUE_SECTION_NAME,
                                    flags);

      if (sec == NULL
         || !bfd_set_section_alignment (abfd, sec, 2))
       return FALSE;

      /* Set the gc mark to prevent the section from being removed by garbage
        collection, despite the fact that no relocs refer to this section.  */
      sec->gc_mark = 1;
    }

  sec = bfd_get_section_by_name (abfd, THUMB2ARM_GLUE_SECTION_NAME);

  if (sec == NULL)
    {
      flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
              | SEC_CODE | SEC_READONLY);

      sec = bfd_make_section_with_flags (abfd,
                                    THUMB2ARM_GLUE_SECTION_NAME,
                                    flags);

      if (sec == NULL
         || !bfd_set_section_alignment (abfd, sec, 2))
       return FALSE;

      sec->gc_mark = 1;
    }

  sec = bfd_get_section_by_name (abfd, VFP11_ERRATUM_VENEER_SECTION_NAME);

  if (sec == NULL)
    {
      flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
              | SEC_CODE | SEC_READONLY);

      sec = bfd_make_section_with_flags (abfd,
                                    VFP11_ERRATUM_VENEER_SECTION_NAME,
                                         flags);

      if (sec == NULL
         || !bfd_set_section_alignment (abfd, sec, 2))
       return FALSE;

      sec->gc_mark = 1;
    }

  return TRUE;
}

Definition at line 2630 of file elf32-arm.c.

Definition at line 3066 of file elf32-arm.c.

{
  struct elf32_arm_link_hash_table *globals;

  /* If we are only performing a partial link
     do not bother getting a bfd to hold the glue.  */
  if (info->relocatable)
    return TRUE;

  /* Make sure we don't attach the glue sections to a dynamic object.  */
  BFD_ASSERT (!(abfd->flags & DYNAMIC));

  globals = elf32_arm_hash_table (info);

  BFD_ASSERT (globals != NULL);

  if (globals->bfd_of_glue_owner != NULL)
    return TRUE;

  /* Save the bfd for later use.  */
  globals->bfd_of_glue_owner = abfd;

  return TRUE;
}

Definition at line 3264 of file elf32-arm.c.

{
  Elf_Internal_Sym *isymbuf;
  Elf_Internal_Shdr *hdr;
  unsigned int i, localsyms;

  if ((abfd->flags & DYNAMIC) != 0)
    return;

  hdr = &elf_tdata (abfd)->symtab_hdr;
  localsyms = hdr->sh_info;

  /* Obtain a buffer full of symbols for this BFD. The hdr->sh_info field
     should contain the number of local symbols, which should come before any
     global symbols.  Mapping symbols are always local.  */
  isymbuf = bfd_elf_get_elf_syms (abfd, hdr, localsyms, 0, NULL, NULL,
                              NULL);

  /* No internal symbols read?  Skip this BFD.  */
  if (isymbuf == NULL)
    return;

  for (i = 0; i < localsyms; i++)
    {
      Elf_Internal_Sym *isym = &isymbuf[i];
      asection *sec = bfd_section_from_elf_index (abfd, isym->st_shndx);
      const char *name;
      
      if (sec != NULL
          && ELF_ST_BIND (isym->st_info) == STB_LOCAL)
        {
          name = bfd_elf_string_from_elf_section (abfd,
            hdr->sh_link, isym->st_name);
          
          if (bfd_is_arm_special_symbol_name (name,
                                         BFD_ARM_SPECIAL_SYM_TYPE_MAP))
            elf32_arm_section_map_add (sec, name[1], isym->st_value);
        }
    }
}

Here is the caller graph for this function:

Definition at line 3098 of file elf32-arm.c.

{
  Elf_Internal_Shdr *symtab_hdr;
  Elf_Internal_Rela *internal_relocs = NULL;
  Elf_Internal_Rela *irel, *irelend;
  bfd_byte *contents = NULL;

  asection *sec;
  struct elf32_arm_link_hash_table *globals;

  /* If we are only performing a partial link do not bother
     to construct any glue.  */
  if (link_info->relocatable)
    return TRUE;

  /* Here we have a bfd that is to be included on the link.  We have a hook
     to do reloc rummaging, before section sizes are nailed down.  */
  globals = elf32_arm_hash_table (link_info);
  check_use_blx (globals);

  BFD_ASSERT (globals != NULL);
  BFD_ASSERT (globals->bfd_of_glue_owner != NULL);

  if (globals->byteswap_code && !bfd_big_endian (abfd))
    {
      _bfd_error_handler (_("%B: BE8 images only valid in big-endian mode."),
                       abfd);
      return FALSE;
    }

  /* Rummage around all the relocs and map the glue vectors.  */
  sec = abfd->sections;

  if (sec == NULL)
    return TRUE;

  for (; sec != NULL; sec = sec->next)
    {
      if (sec->reloc_count == 0)
       continue;

      if ((sec->flags & SEC_EXCLUDE) != 0)
       continue;

      symtab_hdr = &elf_tdata (abfd)->symtab_hdr;

      /* Load the relocs.  */
      internal_relocs
       = _bfd_elf_link_read_relocs (abfd, sec, (void *) NULL,
                                 (Elf_Internal_Rela *) NULL, FALSE);

      if (internal_relocs == NULL)
       goto error_return;

      irelend = internal_relocs + sec->reloc_count;
      for (irel = internal_relocs; irel < irelend; irel++)
       {
         long r_type;
         unsigned long r_index;

         struct elf_link_hash_entry *h;

         r_type = ELF32_R_TYPE (irel->r_info);
         r_index = ELF32_R_SYM (irel->r_info);

         /* These are the only relocation types we care about.  */
         if (   r_type != R_ARM_PC24
             && r_type != R_ARM_PLT32
             && r_type != R_ARM_CALL
             && r_type != R_ARM_JUMP24
             && r_type != R_ARM_THM_CALL)
           continue;

         /* Get the section contents if we haven't done so already.  */
         if (contents == NULL)
           {
             /* Get cached copy if it exists.  */
             if (elf_section_data (sec)->this_hdr.contents != NULL)
              contents = elf_section_data (sec)->this_hdr.contents;
             else
              {
                /* Go get them off disk.  */
                if (! bfd_malloc_and_get_section (abfd, sec, &contents))
                  goto error_return;
              }
           }

         /* If the relocation is not against a symbol it cannot concern us.  */
         h = NULL;

         /* We don't care about local symbols.  */
         if (r_index < symtab_hdr->sh_info)
           continue;

         /* This is an external symbol.  */
         r_index -= symtab_hdr->sh_info;
         h = (struct elf_link_hash_entry *)
           elf_sym_hashes (abfd)[r_index];

         /* If the relocation is against a static symbol it must be within
            the current section and so cannot be a cross ARM/Thumb relocation.  */
         if (h == NULL)
           continue;

         /* If the call will go through a PLT entry then we do not need
            glue.  */
         if (globals->splt != NULL && h->plt.offset != (bfd_vma) -1)
           continue;

         switch (r_type)
           {
           case R_ARM_PC24:
           case R_ARM_PLT32:
           case R_ARM_CALL:
           case R_ARM_JUMP24:
             /* This one is a call from arm code.  We need to look up
                the target of the call.  If it is a thumb target, we
                insert glue.  */
             if (ELF_ST_TYPE(h->type) == STT_ARM_TFUNC
                && !(r_type == R_ARM_CALL && globals->use_blx))
              record_arm_to_thumb_glue (link_info, h);
             break;

           case R_ARM_THM_CALL:
             /* This one is a call from thumb code.  We look
                up the target of the call.  If it is not a thumb
                 target, we insert glue.  */
             if (ELF_ST_TYPE (h->type) != STT_ARM_TFUNC && !globals->use_blx)
              record_thumb_to_arm_glue (link_info, h);
             break;

           default:
             abort ();
           }
       }

      if (contents != NULL
         && elf_section_data (sec)->this_hdr.contents != contents)
       free (contents);
      contents = NULL;

      if (internal_relocs != NULL
         && elf_section_data (sec)->relocs != internal_relocs)
       free (internal_relocs);
      internal_relocs = NULL;
    }

  return TRUE;

error_return:
  if (contents != NULL
      && elf_section_data (sec)->this_hdr.contents != contents)
    free (contents);
  if (internal_relocs != NULL
      && elf_section_data (sec)->relocs != internal_relocs)
    free (internal_relocs);

  return FALSE;
}

Here is the caller graph for this function:

Definition at line 8869 of file elf32-arm.c.

{
  struct elf32_arm_link_hash_table *globals;

  globals = elf32_arm_hash_table (info);
  globals->byteswap_code = byteswap_code;
}
void bfd_elf32_arm_set_target_relocs ( bfd ,
struct bfd_link_info ,
int  ,
char *  ,
int  ,
int  ,
bfd_arm_vfp11_fix  ,
int  ,
int   
)

Definition at line 3893 of file elf32-arm.c.

{
  struct elf32_arm_link_hash_table *globals;

  globals = elf32_arm_hash_table (link_info);

  globals->target1_is_rel = target1_is_rel;
  if (strcmp (target2_type, "rel") == 0)
    globals->target2_reloc = R_ARM_REL32;
  else if (strcmp (target2_type, "abs") == 0)
    globals->target2_reloc = R_ARM_ABS32;
  else if (strcmp (target2_type, "got-rel") == 0)
    globals->target2_reloc = R_ARM_GOT_PREL;
  else
    {
      _bfd_error_handler (_("Invalid TARGET2 relocation type '%s'."),
                       target2_type);
    }
  globals->fix_v4bx = fix_v4bx;
  globals->use_blx |= use_blx;
  globals->vfp11_fix = vfp11_fix;
  globals->pic_veneer = pic_veneer;

  elf32_arm_tdata (output_bfd)->no_enum_size_warning = no_enum_warn;
}

Definition at line 3307 of file elf32-arm.c.

{
  struct elf32_arm_link_hash_table *globals = elf32_arm_hash_table (link_info);
  aeabi_attribute *out_attr = elf32_arm_tdata (obfd)->known_eabi_attributes;
  
  /* We assume that ARMv7+ does not need the VFP11 denorm erratum fix.  */
  if (out_attr[Tag_CPU_arch].i >= TAG_CPU_ARCH_V7)
    {
      switch (globals->vfp11_fix)
        {
        case BFD_ARM_VFP11_FIX_DEFAULT:
        case BFD_ARM_VFP11_FIX_NONE:
          globals->vfp11_fix = BFD_ARM_VFP11_FIX_NONE;
          break;
        
        default:
          /* Give a warning, but do as the user requests anyway.  */
          (*_bfd_error_handler) (_("%B: warning: selected VFP11 erratum "
            "workaround is not necessary for target architecture"), obfd);
        }
    }
  else if (globals->vfp11_fix == BFD_ARM_VFP11_FIX_DEFAULT)
    /* For earlier architectures, we might need the workaround, but do not
       enable it by default.  If users is running with broken hardware, they
       must enable the erratum fix explicitly.  */
    globals->vfp11_fix = BFD_ARM_VFP11_FIX_NONE;
}

Definition at line 3605 of file elf32-arm.c.

{
  asection *sec;
  bfd_byte *contents = NULL;
  int state = 0;
  int regs[3], numregs = 0;
  struct elf32_arm_link_hash_table *globals = elf32_arm_hash_table (link_info);
  int use_vector = (globals->vfp11_fix == BFD_ARM_VFP11_FIX_VECTOR);
  
  /* We use a simple FSM to match troublesome VFP11 instruction sequences.
     The states transition as follows:
     
       0 -> 1 (vector) or 0 -> 2 (scalar)
           A VFP FMAC-pipeline instruction has been seen. Fill
           regs[0]..regs[numregs-1] with its input operands. Remember this
           instruction in 'first_fmac'.

       1 -> 2
           Any instruction, except for a VFP instruction which overwrites
           regs[*].
       
       1 -> 3 [ -> 0 ]  or
       2 -> 3 [ -> 0 ]
           A VFP instruction has been seen which overwrites any of regs[*].
           We must make a veneer!  Reset state to 0 before examining next
           instruction.
       
       2 -> 0
           If we fail to match anything in state 2, reset to state 0 and reset
           the instruction pointer to the instruction after 'first_fmac'.

     If the VFP11 vector mode is in use, there must be at least two unrelated
     instructions between anti-dependent VFP11 instructions to properly avoid
     triggering the erratum, hence the use of the extra state 1.
  */

  /* If we are only performing a partial link do not bother
     to construct any glue.  */
  if (link_info->relocatable)
    return TRUE;

  /* We should have chosen a fix type by the time we get here.  */
  BFD_ASSERT (globals->vfp11_fix != BFD_ARM_VFP11_FIX_DEFAULT);

  if (globals->vfp11_fix == BFD_ARM_VFP11_FIX_NONE)
    return TRUE;
  
  for (sec = abfd->sections; sec != NULL; sec = sec->next)
    {
      unsigned int i, span, first_fmac = 0, veneer_of_insn = 0;
      struct _arm_elf_section_data *sec_data;

      /* If we don't have executable progbits, we're not interested in this
         section.  Also skip if section is to be excluded.  */
      if (elf_section_type (sec) != SHT_PROGBITS
          || (elf_section_flags (sec) & SHF_EXECINSTR) == 0
          || (sec->flags & SEC_EXCLUDE) != 0
          || strcmp (sec->name, VFP11_ERRATUM_VENEER_SECTION_NAME) == 0)
        continue;

      sec_data = elf32_arm_section_data (sec);
      
      if (sec_data->mapcount == 0)
        continue;
      
      if (elf_section_data (sec)->this_hdr.contents != NULL)
       contents = elf_section_data (sec)->this_hdr.contents;
      else if (! bfd_malloc_and_get_section (abfd, sec, &contents))
       goto error_return;

      qsort (sec_data->map, sec_data->mapcount, sizeof (elf32_arm_section_map),
            elf32_arm_compare_mapping);

      for (span = 0; span < sec_data->mapcount; span++)
        {
          unsigned int span_start = sec_data->map[span].vma;
          unsigned int span_end = (span == sec_data->mapcount - 1)
                              ? sec->size : sec_data->map[span + 1].vma;
          char span_type = sec_data->map[span].type;
          
          /* FIXME: Only ARM mode is supported at present.  We may need to
             support Thumb-2 mode also at some point.  */
          if (span_type != 'a')
            continue;

          for (i = span_start; i < span_end;)
            {
              unsigned int next_i = i + 4;
              unsigned int insn = bfd_big_endian (abfd)
                ? (contents[i] << 24)
                  | (contents[i + 1] << 16)
                  | (contents[i + 2] << 8)
                  | contents[i + 3]
                : (contents[i + 3] << 24)
                  | (contents[i + 2] << 16)
                  | (contents[i + 1] << 8)
                  | contents[i];
              unsigned int writemask = 0;
              enum bfd_arm_vfp11_pipe pipe;

              switch (state)
                {
                case 0:
                  pipe = bfd_arm_vfp11_insn_decode (insn, &writemask, regs,
                                                    &numregs);
                  /* I'm assuming the VFP11 erratum can trigger with denorm
                     operands on either the FMAC or the DS pipeline. This might
                     lead to slightly overenthusiastic veneer insertion.  */
                  if (pipe == VFP11_FMAC || pipe == VFP11_DS)
                    {
                      state = use_vector ? 1 : 2;
                      first_fmac = i;
                      veneer_of_insn = insn;
                    }
                  break;

                case 1:
                  {
                    int other_regs[3], other_numregs;
                    pipe = bfd_arm_vfp11_insn_decode (insn, &writemask,
                                                other_regs,
                                                      &other_numregs);
                    if (pipe != VFP11_BAD
                        && bfd_arm_vfp11_antidependency (writemask, regs,
                                                  numregs))
                      state = 3;
                    else
                      state = 2;
                  }
                  break;

                case 2:
                  {
                    int other_regs[3], other_numregs;
                    pipe = bfd_arm_vfp11_insn_decode (insn, &writemask,
                                                other_regs,
                                                      &other_numregs);
                    if (pipe != VFP11_BAD
                        && bfd_arm_vfp11_antidependency (writemask, regs,
                                                  numregs))
                      state = 3;
                    else
                      {
                        state = 0;
                        next_i = first_fmac + 4;
                      }
                  }
                  break;

                case 3:
                  abort ();  /* Should be unreachable.  */
                }

              if (state == 3)
                {
                  elf32_vfp11_erratum_list *newerr
                    = bfd_zmalloc (sizeof (elf32_vfp11_erratum_list));
                  int errcount;

                  errcount = ++(elf32_arm_section_data (sec)->erratumcount);

                  newerr->u.b.vfp_insn = veneer_of_insn;

                  switch (span_type)
                    {
                    case 'a':
                      newerr->type = VFP11_ERRATUM_BRANCH_TO_ARM_VENEER;
                      break;
                    
                    default:
                      abort ();
                    }

                  record_vfp11_erratum_veneer (link_info, newerr, abfd, sec,
                                          first_fmac);

                  newerr->vma = -1;

                  newerr->next = sec_data->erratumlist;
                  sec_data->erratumlist = newerr;

                  state = 0;
                }

              i = next_i;
            }
        }
      
      if (contents != NULL
          && elf_section_data (sec)->this_hdr.contents != contents)
        free (contents);
      contents = NULL;
    }

  return TRUE;

error_return:
  if (contents != NULL
      && elf_section_data (sec)->this_hdr.contents != contents)
    free (contents);
  
  return FALSE;
}

Here is the caller graph for this function:

Definition at line 3813 of file elf32-arm.c.

{
  asection *sec;
  struct elf32_arm_link_hash_table *globals;
  char *tmp_name;
  
  if (link_info->relocatable)
    return;
  
  globals = elf32_arm_hash_table (link_info);
  
  tmp_name = bfd_malloc ((bfd_size_type) strlen
                        (VFP11_ERRATUM_VENEER_ENTRY_NAME) + 10);

  for (sec = abfd->sections; sec != NULL; sec = sec->next)
    {
      struct _arm_elf_section_data *sec_data = elf32_arm_section_data (sec);
      elf32_vfp11_erratum_list *errnode = sec_data->erratumlist;
      
      for (; errnode != NULL; errnode = errnode->next)
        {
          struct elf_link_hash_entry *myh;
          bfd_vma vma;

          switch (errnode->type)
            {
            case VFP11_ERRATUM_BRANCH_TO_ARM_VENEER:
            case VFP11_ERRATUM_BRANCH_TO_THUMB_VENEER:
              /* Find veneer symbol.  */
              sprintf (tmp_name, VFP11_ERRATUM_VENEER_ENTRY_NAME,
                     errnode->u.b.veneer->u.v.id);

              myh = elf_link_hash_lookup
                (&(globals)->root, tmp_name, FALSE, FALSE, TRUE);

              if (myh == NULL)
                (*_bfd_error_handler) (_("%B: unable to find VFP11 veneer "
                                    "`%s'"), abfd, tmp_name);

              vma = myh->root.u.def.section->output_section->vma
                    + myh->root.u.def.section->output_offset
                    + myh->root.u.def.value;

              errnode->u.b.veneer->vma = vma;
              break;

           case VFP11_ERRATUM_ARM_VENEER:
            case VFP11_ERRATUM_THUMB_VENEER:
              /* Find return location.  */
              sprintf (tmp_name, VFP11_ERRATUM_VENEER_ENTRY_NAME "_r",
                       errnode->u.v.id);

              myh = elf_link_hash_lookup
                (&(globals)->root, tmp_name, FALSE, FALSE, TRUE);

              if (myh == NULL)
                (*_bfd_error_handler) (_("%B: unable to find VFP11 veneer "
                                    "`%s'"), abfd, tmp_name);

              vma = myh->root.u.def.section->output_section->vma
                    + myh->root.u.def.section->output_offset
                    + myh->root.u.def.value;

              errnode->u.v.branch->vma = vma;
              break;
            
            default:
              abort ();
            }
        }
    }
  
  free (tmp_name);
}
bfd* bfd_elf_bfd_from_remote_memory ( bfd templ,
bfd_vma  ehdr_vma,
bfd_vma loadbasep,
int(*)(bfd_vma vma, bfd_byte *myaddr, int len target_read_memory 
)

Definition at line 10914 of file elflink.c.

{
  struct elf_reloc_cookie cookie;
  asection *stab, *eh;
  Elf_Internal_Shdr *symtab_hdr;
  const struct elf_backend_data *bed;
  bfd *abfd;
  unsigned int count;
  bfd_boolean ret = FALSE;

  if (info->traditional_format
      || !is_elf_hash_table (info->hash))
    return FALSE;

  for (abfd = info->input_bfds; abfd != NULL; abfd = abfd->link_next)
    {
      if (bfd_get_flavour (abfd) != bfd_target_elf_flavour)
       continue;

      bed = get_elf_backend_data (abfd);

      if ((abfd->flags & DYNAMIC) != 0)
       continue;

      eh = NULL;
      if (!info->relocatable)
       {
         eh = bfd_get_section_by_name (abfd, ".eh_frame");
         if (eh != NULL
             && (eh->size == 0
                || bfd_is_abs_section (eh->output_section)))
           eh = NULL;
       }

      stab = bfd_get_section_by_name (abfd, ".stab");
      if (stab != NULL
         && (stab->size == 0
             || bfd_is_abs_section (stab->output_section)
             || stab->sec_info_type != ELF_INFO_TYPE_STABS))
       stab = NULL;

      if (stab == NULL
         && eh == NULL
         && bed->elf_backend_discard_info == NULL)
       continue;

      symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
      cookie.abfd = abfd;
      cookie.sym_hashes = elf_sym_hashes (abfd);
      cookie.bad_symtab = elf_bad_symtab (abfd);
      if (cookie.bad_symtab)
       {
         cookie.locsymcount = symtab_hdr->sh_size / bed->s->sizeof_sym;
         cookie.extsymoff = 0;
       }
      else
       {
         cookie.locsymcount = symtab_hdr->sh_info;
         cookie.extsymoff = symtab_hdr->sh_info;
       }

      if (bed->s->arch_size == 32)
       cookie.r_sym_shift = 8;
      else
       cookie.r_sym_shift = 32;

      cookie.locsyms = (Elf_Internal_Sym *) symtab_hdr->contents;
      if (cookie.locsyms == NULL && cookie.locsymcount != 0)
       {
         cookie.locsyms = bfd_elf_get_elf_syms (abfd, symtab_hdr,
                                           cookie.locsymcount, 0,
                                           NULL, NULL, NULL);
         if (cookie.locsyms == NULL)
           return FALSE;
       }

      if (stab != NULL)
       {
         cookie.rels = NULL;
         count = stab->reloc_count;
         if (count != 0)
           cookie.rels = _bfd_elf_link_read_relocs (abfd, stab, NULL, NULL,
                                               info->keep_memory);
         if (cookie.rels != NULL)
           {
             cookie.rel = cookie.rels;
             cookie.relend = cookie.rels;
             cookie.relend += count * bed->s->int_rels_per_ext_rel;
             if (_bfd_discard_section_stabs (abfd, stab,
                                         elf_section_data (stab)->sec_info,
                                         bfd_elf_reloc_symbol_deleted_p,
                                         &cookie))
              ret = TRUE;
             if (elf_section_data (stab)->relocs != cookie.rels)
              free (cookie.rels);
           }
       }

      if (eh != NULL)
       {
         cookie.rels = NULL;
         count = eh->reloc_count;
         if (count != 0)
           cookie.rels = _bfd_elf_link_read_relocs (abfd, eh, NULL, NULL,
                                               info->keep_memory);
         cookie.rel = cookie.rels;
         cookie.relend = cookie.rels;
         if (cookie.rels != NULL)
           cookie.relend += count * bed->s->int_rels_per_ext_rel;

         if (_bfd_elf_discard_section_eh_frame (abfd, info, eh,
                                           bfd_elf_reloc_symbol_deleted_p,
                                           &cookie))
           ret = TRUE;

         if (cookie.rels != NULL
             && elf_section_data (eh)->relocs != cookie.rels)
           free (cookie.rels);
       }

      if (bed->elf_backend_discard_info != NULL
         && (*bed->elf_backend_discard_info) (abfd, &cookie, info))
       ret = TRUE;

      if (cookie.locsyms != NULL
         && symtab_hdr->contents != (unsigned char *) cookie.locsyms)
       {
         if (! info->keep_memory)
           free (cookie.locsyms);
         else
           symtab_hdr->contents = (unsigned char *) cookie.locsyms;
       }
    }

  if (info->eh_frame_hdr
      && !info->relocatable
      && _bfd_elf_discard_section_eh_frame_hdr (output_bfd, info))
    ret = TRUE;

  return ret;
}

Definition at line 1723 of file elf.c.

{
  asection *s;
  bfd_byte *dynbuf = NULL;
  int elfsec;
  unsigned long shlink;
  bfd_byte *extdyn, *extdynend;
  size_t extdynsize;
  void (*swap_dyn_in) (bfd *, const void *, Elf_Internal_Dyn *);

  *pneeded = NULL;

  if (bfd_get_flavour (abfd) != bfd_target_elf_flavour
      || bfd_get_format (abfd) != bfd_object)
    return TRUE;

  s = bfd_get_section_by_name (abfd, ".dynamic");
  if (s == NULL || s->size == 0)
    return TRUE;

  if (!bfd_malloc_and_get_section (abfd, s, &dynbuf))
    goto error_return;

  elfsec = _bfd_elf_section_from_bfd_section (abfd, s);
  if (elfsec == -1)
    goto error_return;

  shlink = elf_elfsections (abfd)[elfsec]->sh_link;

  extdynsize = get_elf_backend_data (abfd)->s->sizeof_dyn;
  swap_dyn_in = get_elf_backend_data (abfd)->s->swap_dyn_in;

  extdyn = dynbuf;
  extdynend = extdyn + s->size;
  for (; extdyn < extdynend; extdyn += extdynsize)
    {
      Elf_Internal_Dyn dyn;

      (*swap_dyn_in) (abfd, extdyn, &dyn);

      if (dyn.d_tag == DT_NULL)
       break;

      if (dyn.d_tag == DT_NEEDED)
       {
         const char *string;
         struct bfd_link_needed_list *l;
         unsigned int tagv = dyn.d_un.d_val;
         bfd_size_type amt;

         string = bfd_elf_string_from_elf_section (abfd, shlink, tagv);
         if (string == NULL)
           goto error_return;

         amt = sizeof *l;
         l = bfd_alloc (abfd, amt);
         if (l == NULL)
           goto error_return;

         l->by = abfd;
         l->name = string;
         l->next = *pneeded;
         *pneeded = l;
       }
    }

  free (dynbuf);

  return TRUE;

 error_return:
  if (dynbuf != NULL)
    free (dynbuf);
  return FALSE;
}

Definition at line 1711 of file elf.c.

Here is the caller graph for this function:

Definition at line 1663 of file elf.c.

{
  int lib_class;
  if (bfd_get_flavour (abfd) == bfd_target_elf_flavour
      && bfd_get_format (abfd) == bfd_object)
    lib_class = elf_dyn_lib_class (abfd);
  else
    lib_class = 0;
  return lib_class;
}

Definition at line 464 of file elflink.c.

{
  struct elf_link_hash_entry *h;
  struct elf_link_hash_table *htab;

  if (!is_elf_hash_table (info->hash))
    return TRUE;

  htab = elf_hash_table (info);
  h = elf_link_hash_lookup (htab, name, !provide, TRUE, FALSE);
  if (h == NULL)
    return provide;

  /* Since we're defining the symbol, don't let it seem to have not
     been defined.  record_dynamic_symbol and size_dynamic_sections
     may depend on this.  */
  if (h->root.type == bfd_link_hash_undefweak
      || h->root.type == bfd_link_hash_undefined)
    {
      h->root.type = bfd_link_hash_new;
      if (h->root.u.undef.next != NULL || htab->root.undefs_tail == &h->root)
       bfd_link_repair_undef_list (&htab->root);
    }

  if (h->root.type == bfd_link_hash_new)
    {
      bfd_elf_link_mark_dynamic_symbol (info, h, NULL);
      h->non_elf = 0;
    }

  /* If this symbol is being provided by the linker script, and it is
     currently defined by a dynamic object, but not by a regular
     object, then mark it as undefined so that the generic linker will
     force the correct value.  */
  if (provide
      && h->def_dynamic
      && !h->def_regular)
    h->root.type = bfd_link_hash_undefined;

  /* If this symbol is not being provided by the linker script, and it is
     currently defined by a dynamic object, but not by a regular object,
     then clear out any version information because the symbol will not be
     associated with the dynamic object any more.  */
  if (!provide
      && h->def_dynamic
      && !h->def_regular)
    h->verinfo.verdef = NULL;

  h->def_regular = 1;

  if (provide && hidden)
    {
      const struct elf_backend_data *bed = get_elf_backend_data (output_bfd);

      h->other = (h->other & ~ELF_ST_VISIBILITY (-1)) | STV_HIDDEN;
      (*bed->elf_backend_hide_symbol) (info, h, TRUE);
    }

  /* STV_HIDDEN and STV_INTERNAL symbols must be STB_LOCAL in shared objects
     and executables.  */
  if (!info->relocatable
      && h->dynindx != -1
      && (ELF_ST_VISIBILITY (h->other) == STV_HIDDEN
         || ELF_ST_VISIBILITY (h->other) == STV_INTERNAL))
    h->forced_local = 1;

  if ((h->def_dynamic
       || h->ref_dynamic
       || info->shared
       || (info->executable && elf_hash_table (info)->is_relocatable_executable))
      && h->dynindx == -1)
    {
      if (! bfd_elf_link_record_dynamic_symbol (info, h))
       return FALSE;

      /* If this is a weak defined symbol, and we know a corresponding
        real symbol from the same dynamic object, make sure the real
        symbol is also made into a dynamic symbol.  */
      if (h->u.weakdef != NULL
         && h->u.weakdef->dynindx == -1)
       {
         if (! bfd_elf_link_record_dynamic_symbol (info, h->u.weakdef))
           return FALSE;
       }
    }

  return TRUE;
}
void bfd_elf_set_dt_needed_name ( bfd ,
const char *   
)

Definition at line 1655 of file elf.c.

void bfd_elf_set_dyn_lib_class ( bfd ,
enum  dynamic_lib_link_class 
)

Definition at line 1675 of file elf.c.

bfd_boolean bfd_elf_size_dynamic_sections ( bfd ,
const char *  ,
const char *  ,
const char *  ,
const char *const ,
struct bfd_link_info ,
struct bfd_section **  ,
struct bfd_elf_version_tree  
)

Definition at line 5219 of file elflink.c.

{
  bfd_size_type soname_indx;
  bfd *dynobj;
  const struct elf_backend_data *bed;
  struct elf_assign_sym_version_info asvinfo;

  *sinterpptr = NULL;

  soname_indx = (bfd_size_type) -1;

  if (!is_elf_hash_table (info->hash))
    return TRUE;

  bed = get_elf_backend_data (output_bfd);
  elf_tdata (output_bfd)->relro = info->relro;
  if (info->execstack)
    elf_tdata (output_bfd)->stack_flags = PF_R | PF_W | PF_X;
  else if (info->noexecstack)
    elf_tdata (output_bfd)->stack_flags = PF_R | PF_W;
  else
    {
      bfd *inputobj;
      asection *notesec = NULL;
      int exec = 0;

      for (inputobj = info->input_bfds;
          inputobj;
          inputobj = inputobj->link_next)
       {
         asection *s;

         if (inputobj->flags & (DYNAMIC | BFD_LINKER_CREATED))
           continue;
         s = bfd_get_section_by_name (inputobj, ".note.GNU-stack");
         if (s)
           {
             if (s->flags & SEC_CODE)
              exec = PF_X;
             notesec = s;
           }
         else if (bed->default_execstack)
           exec = PF_X;
       }
      if (notesec)
       {
         elf_tdata (output_bfd)->stack_flags = PF_R | PF_W | exec;
         if (exec && info->relocatable
             && notesec->output_section != bfd_abs_section_ptr)
           notesec->output_section->flags |= SEC_CODE;
       }
    }

  /* Any syms created from now on start with -1 in
     got.refcount/offset and plt.refcount/offset.  */
  elf_hash_table (info)->init_got_refcount
    = elf_hash_table (info)->init_got_offset;
  elf_hash_table (info)->init_plt_refcount
    = elf_hash_table (info)->init_plt_offset;

  /* The backend may have to create some sections regardless of whether
     we're dynamic or not.  */
  if (bed->elf_backend_always_size_sections
      && ! (*bed->elf_backend_always_size_sections) (output_bfd, info))
    return FALSE;

  if (! _bfd_elf_maybe_strip_eh_frame_hdr (info))
    return FALSE;

  dynobj = elf_hash_table (info)->dynobj;

  /* If there were no dynamic objects in the link, there is nothing to
     do here.  */
  if (dynobj == NULL)
    return TRUE;

  if (elf_hash_table (info)->dynamic_sections_created)
    {
      struct elf_info_failed eif;
      struct elf_link_hash_entry *h;
      asection *dynstr;
      struct bfd_elf_version_tree *t;
      struct bfd_elf_version_expr *d;
      asection *s;
      bfd_boolean all_defined;

      *sinterpptr = bfd_get_section_by_name (dynobj, ".interp");
      BFD_ASSERT (*sinterpptr != NULL || !info->executable);

      if (soname != NULL)
       {
         soname_indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr,
                                        soname, TRUE);
         if (soname_indx == (bfd_size_type) -1
             || !_bfd_elf_add_dynamic_entry (info, DT_SONAME, soname_indx))
           return FALSE;
       }

      if (info->symbolic)
       {
         if (!_bfd_elf_add_dynamic_entry (info, DT_SYMBOLIC, 0))
           return FALSE;
         info->flags |= DF_SYMBOLIC;
       }

      if (rpath != NULL)
       {
         bfd_size_type indx;

         indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr, rpath,
                                  TRUE);
         if (indx == (bfd_size_type) -1
             || !_bfd_elf_add_dynamic_entry (info, DT_RPATH, indx))
           return FALSE;

         if  (info->new_dtags)
           {
             _bfd_elf_strtab_addref (elf_hash_table (info)->dynstr, indx);
             if (!_bfd_elf_add_dynamic_entry (info, DT_RUNPATH, indx))
              return FALSE;
           }
       }

      if (filter_shlib != NULL)
       {
         bfd_size_type indx;

         indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr,
                                  filter_shlib, TRUE);
         if (indx == (bfd_size_type) -1
             || !_bfd_elf_add_dynamic_entry (info, DT_FILTER, indx))
           return FALSE;
       }

      if (auxiliary_filters != NULL)
       {
         const char * const *p;

         for (p = auxiliary_filters; *p != NULL; p++)
           {
             bfd_size_type indx;

             indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr,
                                     *p, TRUE);
             if (indx == (bfd_size_type) -1
                || !_bfd_elf_add_dynamic_entry (info, DT_AUXILIARY, indx))
              return FALSE;
           }
       }

      eif.info = info;
      eif.verdefs = verdefs;
      eif.failed = FALSE;

      /* If we are supposed to export all symbols into the dynamic symbol
        table (this is not the normal case), then do so.  */
      if (info->export_dynamic
         || (info->executable && info->dynamic))
       {
         elf_link_hash_traverse (elf_hash_table (info),
                              _bfd_elf_export_symbol,
                              &eif);
         if (eif.failed)
           return FALSE;
       }

      /* Make all global versions with definition.  */
      for (t = verdefs; t != NULL; t = t->next)
       for (d = t->globals.list; d != NULL; d = d->next)
         if (!d->symver && d->symbol)
           {
             const char *verstr, *name;
             size_t namelen, verlen, newlen;
             char *newname, *p;
             struct elf_link_hash_entry *newh;

             name = d->symbol;
             namelen = strlen (name);
             verstr = t->name;
             verlen = strlen (verstr);
             newlen = namelen + verlen + 3;

             newname = bfd_malloc (newlen);
             if (newname == NULL)
              return FALSE;
             memcpy (newname, name, namelen);

             /* Check the hidden versioned definition.  */
             p = newname + namelen;
             *p++ = ELF_VER_CHR;
             memcpy (p, verstr, verlen + 1);
             newh = elf_link_hash_lookup (elf_hash_table (info),
                                      newname, FALSE, FALSE,
                                      FALSE);
             if (newh == NULL
                || (newh->root.type != bfd_link_hash_defined
                    && newh->root.type != bfd_link_hash_defweak))
              {
                /* Check the default versioned definition.  */
                *p++ = ELF_VER_CHR;
                memcpy (p, verstr, verlen + 1);
                newh = elf_link_hash_lookup (elf_hash_table (info),
                                          newname, FALSE, FALSE,
                                          FALSE);
              }
             free (newname);

             /* Mark this version if there is a definition and it is
               not defined in a shared object.  */
             if (newh != NULL
                && !newh->def_dynamic
                && (newh->root.type == bfd_link_hash_defined
                    || newh->root.type == bfd_link_hash_defweak))
              d->symver = 1;
           }

      /* Attach all the symbols to their version information.  */
      asvinfo.output_bfd = output_bfd;
      asvinfo.info = info;
      asvinfo.verdefs = verdefs;
      asvinfo.failed = FALSE;

      elf_link_hash_traverse (elf_hash_table (info),
                           _bfd_elf_link_assign_sym_version,
                           &asvinfo);
      if (asvinfo.failed)
       return FALSE;

      if (!info->allow_undefined_version)
       {
         /* Check if all global versions have a definition.  */
         all_defined = TRUE;
         for (t = verdefs; t != NULL; t = t->next)
           for (d = t->globals.list; d != NULL; d = d->next)
             if (!d->symver && !d->script)
              {
                (*_bfd_error_handler)
                  (_("%s: undefined version: %s"),
                   d->pattern, t->name);
                all_defined = FALSE;
              }

         if (!all_defined)
           {
             bfd_set_error (bfd_error_bad_value);
             return FALSE;
           }
       }

      /* Find all symbols which were defined in a dynamic object and make
        the backend pick a reasonable value for them.  */
      elf_link_hash_traverse (elf_hash_table (info),
                           _bfd_elf_adjust_dynamic_symbol,
                           &eif);
      if (eif.failed)
       return FALSE;

      /* Add some entries to the .dynamic section.  We fill in some of the
        values later, in bfd_elf_final_link, but we must add the entries
        now so that we know the final size of the .dynamic section.  */

      /* If there are initialization and/or finalization functions to
        call then add the corresponding DT_INIT/DT_FINI entries.  */
      h = (info->init_function
          ? elf_link_hash_lookup (elf_hash_table (info),
                               info->init_function, FALSE,
                               FALSE, FALSE)
          : NULL);
      if (h != NULL
         && (h->ref_regular
             || h->def_regular))
       {
         if (!_bfd_elf_add_dynamic_entry (info, DT_INIT, 0))
           return FALSE;
       }
      h = (info->fini_function
          ? elf_link_hash_lookup (elf_hash_table (info),
                               info->fini_function, FALSE,
                               FALSE, FALSE)
          : NULL);
      if (h != NULL
         && (h->ref_regular
             || h->def_regular))
       {
         if (!_bfd_elf_add_dynamic_entry (info, DT_FINI, 0))
           return FALSE;
       }

      s = bfd_get_section_by_name (output_bfd, ".preinit_array");
      if (s != NULL && s->linker_has_input)
       {
         /* DT_PREINIT_ARRAY is not allowed in shared library.  */
         if (! info->executable)
           {
             bfd *sub;
             asection *o;

             for (sub = info->input_bfds; sub != NULL;
                 sub = sub->link_next)
              for (o = sub->sections; o != NULL; o = o->next)
                if (elf_section_data (o)->this_hdr.sh_type
                    == SHT_PREINIT_ARRAY)
                  {
                    (*_bfd_error_handler)
                     (_("%B: .preinit_array section is not allowed in DSO"),
                      sub);
                    break;
                  }

             bfd_set_error (bfd_error_nonrepresentable_section);
             return FALSE;
           }

         if (!_bfd_elf_add_dynamic_entry (info, DT_PREINIT_ARRAY, 0)
             || !_bfd_elf_add_dynamic_entry (info, DT_PREINIT_ARRAYSZ, 0))
           return FALSE;
       }
      s = bfd_get_section_by_name (output_bfd, ".init_array");
      if (s != NULL && s->linker_has_input)
       {
         if (!_bfd_elf_add_dynamic_entry (info, DT_INIT_ARRAY, 0)
             || !_bfd_elf_add_dynamic_entry (info, DT_INIT_ARRAYSZ, 0))
           return FALSE;
       }
      s = bfd_get_section_by_name (output_bfd, ".fini_array");
      if (s != NULL && s->linker_has_input)
       {
         if (!_bfd_elf_add_dynamic_entry (info, DT_FINI_ARRAY, 0)
             || !_bfd_elf_add_dynamic_entry (info, DT_FINI_ARRAYSZ, 0))
           return FALSE;
       }

      dynstr = bfd_get_section_by_name (dynobj, ".dynstr");
      /* If .dynstr is excluded from the link, we don't want any of
        these tags.  Strictly, we should be checking each section
        individually;  This quick check covers for the case where
        someone does a /DISCARD/ : { *(*) }.  */
      if (dynstr != NULL && dynstr->output_section != bfd_abs_section_ptr)
       {
         bfd_size_type strsize;

         strsize = _bfd_elf_strtab_size (elf_hash_table (info)->dynstr);
         if ((info->emit_hash
              && !_bfd_elf_add_dynamic_entry (info, DT_HASH, 0))
             || (info->emit_gnu_hash
                && !_bfd_elf_add_dynamic_entry (info, DT_GNU_HASH, 0))
             || !_bfd_elf_add_dynamic_entry (info, DT_STRTAB, 0)
             || !_bfd_elf_add_dynamic_entry (info, DT_SYMTAB, 0)
             || !_bfd_elf_add_dynamic_entry (info, DT_STRSZ, strsize)
             || !_bfd_elf_add_dynamic_entry (info, DT_SYMENT,
                                         bed->s->sizeof_sym))
           return FALSE;
       }
    }

  /* The backend must work out the sizes of all the other dynamic
     sections.  */
  if (bed->elf_backend_size_dynamic_sections
      && ! (*bed->elf_backend_size_dynamic_sections) (output_bfd, info))
    return FALSE;

  if (elf_hash_table (info)->dynamic_sections_created)
    {
      unsigned long section_sym_count;
      asection *s;

      /* Set up the version definition section.  */
      s = bfd_get_section_by_name (dynobj, ".gnu.version_d");
      BFD_ASSERT (s != NULL);

      /* We may have created additional version definitions if we are
        just linking a regular application.  */
      verdefs = asvinfo.verdefs;

      /* Skip anonymous version tag.  */
      if (verdefs != NULL && verdefs->vernum == 0)
       verdefs = verdefs->next;

      if (verdefs == NULL && !info->create_default_symver)
       s->flags |= SEC_EXCLUDE;
      else
       {
         unsigned int cdefs;
         bfd_size_type size;
         struct bfd_elf_version_tree *t;
         bfd_byte *p;
         Elf_Internal_Verdef def;
         Elf_Internal_Verdaux defaux;
         struct bfd_link_hash_entry *bh;
         struct elf_link_hash_entry *h;
         const char *name;

         cdefs = 0;
         size = 0;

         /* Make space for the base version.  */
         size += sizeof (Elf_External_Verdef);
         size += sizeof (Elf_External_Verdaux);
         ++cdefs;

         /* Make space for the default version.  */
         if (info->create_default_symver)
           {
             size += sizeof (Elf_External_Verdef);
             ++cdefs;
           }

         for (t = verdefs; t != NULL; t = t->next)
           {
             struct bfd_elf_version_deps *n;

             size += sizeof (Elf_External_Verdef);
             size += sizeof (Elf_External_Verdaux);
             ++cdefs;

             for (n = t->deps; n != NULL; n = n->next)
              size += sizeof (Elf_External_Verdaux);
           }

         s->size = size;
         s->contents = bfd_alloc (output_bfd, s->size);
         if (s->contents == NULL && s->size != 0)
           return FALSE;

         /* Fill in the version definition section.  */

         p = s->contents;

         def.vd_version = VER_DEF_CURRENT;
         def.vd_flags = VER_FLG_BASE;
         def.vd_ndx = 1;
         def.vd_cnt = 1;
         if (info->create_default_symver)
           {
             def.vd_aux = 2 * sizeof (Elf_External_Verdef);
             def.vd_next = sizeof (Elf_External_Verdef);
           }
         else
           {
             def.vd_aux = sizeof (Elf_External_Verdef);
             def.vd_next = (sizeof (Elf_External_Verdef)
                          + sizeof (Elf_External_Verdaux));
           }

         if (soname_indx != (bfd_size_type) -1)
           {
             _bfd_elf_strtab_addref (elf_hash_table (info)->dynstr,
                                  soname_indx);
             def.vd_hash = bfd_elf_hash (soname);
             defaux.vda_name = soname_indx;
             name = soname;
           }
         else
           {
             bfd_size_type indx;

             name = lbasename (output_bfd->filename);
             def.vd_hash = bfd_elf_hash (name);
             indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr,
                                     name, FALSE);
             if (indx == (bfd_size_type) -1)
              return FALSE;
             defaux.vda_name = indx;
           }
         defaux.vda_next = 0;

         _bfd_elf_swap_verdef_out (output_bfd, &def,
                                (Elf_External_Verdef *) p);
         p += sizeof (Elf_External_Verdef);
         if (info->create_default_symver)
           {
             /* Add a symbol representing this version.  */
             bh = NULL;
             if (! (_bfd_generic_link_add_one_symbol
                   (info, dynobj, name, BSF_GLOBAL, bfd_abs_section_ptr,
                    0, NULL, FALSE,
                    get_elf_backend_data (dynobj)->collect, &bh)))
              return FALSE;
             h = (struct elf_link_hash_entry *) bh;
             h->non_elf = 0;
             h->def_regular = 1;
             h->type = STT_OBJECT;
             h->verinfo.vertree = NULL;

             if (! bfd_elf_link_record_dynamic_symbol (info, h))
              return FALSE;

             /* Create a duplicate of the base version with the same
               aux block, but different flags.  */
             def.vd_flags = 0;
             def.vd_ndx = 2;
             def.vd_aux = sizeof (Elf_External_Verdef);
             if (verdefs)
              def.vd_next = (sizeof (Elf_External_Verdef)
                            + sizeof (Elf_External_Verdaux));
             else
              def.vd_next = 0;
             _bfd_elf_swap_verdef_out (output_bfd, &def,
                                   (Elf_External_Verdef *) p);
             p += sizeof (Elf_External_Verdef);
           }
         _bfd_elf_swap_verdaux_out (output_bfd, &defaux,
                                 (Elf_External_Verdaux *) p);
         p += sizeof (Elf_External_Verdaux);

         for (t = verdefs; t != NULL; t = t->next)
           {
             unsigned int cdeps;
             struct bfd_elf_version_deps *n;

             cdeps = 0;
             for (n = t->deps; n != NULL; n = n->next)
              ++cdeps;

             /* Add a symbol representing this version.  */
             bh = NULL;
             if (! (_bfd_generic_link_add_one_symbol
                   (info, dynobj, t->name, BSF_GLOBAL, bfd_abs_section_ptr,
                    0, NULL, FALSE,
                    get_elf_backend_data (dynobj)->collect, &bh)))
              return FALSE;
             h = (struct elf_link_hash_entry *) bh;
             h->non_elf = 0;
             h->def_regular = 1;
             h->type = STT_OBJECT;
             h->verinfo.vertree = t;

             if (! bfd_elf_link_record_dynamic_symbol (info, h))
              return FALSE;

             def.vd_version = VER_DEF_CURRENT;
             def.vd_flags = 0;
             if (t->globals.list == NULL
                && t->locals.list == NULL
                && ! t->used)
              def.vd_flags |= VER_FLG_WEAK;
             def.vd_ndx = t->vernum + (info->create_default_symver ? 2 : 1);
             def.vd_cnt = cdeps + 1;
             def.vd_hash = bfd_elf_hash (t->name);
             def.vd_aux = sizeof (Elf_External_Verdef);
             def.vd_next = 0;
             if (t->next != NULL)
              def.vd_next = (sizeof (Elf_External_Verdef)
                            + (cdeps + 1) * sizeof (Elf_External_Verdaux));

             _bfd_elf_swap_verdef_out (output_bfd, &def,
                                   (Elf_External_Verdef *) p);
             p += sizeof (Elf_External_Verdef);

             defaux.vda_name = h->dynstr_index;
             _bfd_elf_strtab_addref (elf_hash_table (info)->dynstr,
                                  h->dynstr_index);
             defaux.vda_next = 0;
             if (t->deps != NULL)
              defaux.vda_next = sizeof (Elf_External_Verdaux);
             t->name_indx = defaux.vda_name;

             _bfd_elf_swap_verdaux_out (output_bfd, &defaux,
                                    (Elf_External_Verdaux *) p);
             p += sizeof (Elf_External_Verdaux);

             for (n = t->deps; n != NULL; n = n->next)
              {
                if (n->version_needed == NULL)
                  {
                    /* This can happen if there was an error in the
                      version script.  */
                    defaux.vda_name = 0;
                  }
                else
                  {
                    defaux.vda_name = n->version_needed->name_indx;
                    _bfd_elf_strtab_addref (elf_hash_table (info)->dynstr,
                                         defaux.vda_name);
                  }
                if (n->next == NULL)
                  defaux.vda_next = 0;
                else
                  defaux.vda_next = sizeof (Elf_External_Verdaux);

                _bfd_elf_swap_verdaux_out (output_bfd, &defaux,
                                        (Elf_External_Verdaux *) p);
                p += sizeof (Elf_External_Verdaux);
              }
           }

         if (!_bfd_elf_add_dynamic_entry (info, DT_VERDEF, 0)
             || !_bfd_elf_add_dynamic_entry (info, DT_VERDEFNUM, cdefs))
           return FALSE;

         elf_tdata (output_bfd)->cverdefs = cdefs;
       }

      if ((info->new_dtags && info->flags) || (info->flags & DF_STATIC_TLS))
       {
         if (!_bfd_elf_add_dynamic_entry (info, DT_FLAGS, info->flags))
           return FALSE;
       }
      else if (info->flags & DF_BIND_NOW)
       {
         if (!_bfd_elf_add_dynamic_entry (info, DT_BIND_NOW, 0))
           return FALSE;
       }

      if (info->flags_1)
       {
         if (info->executable)
           info->flags_1 &= ~ (DF_1_INITFIRST
                            | DF_1_NODELETE
                            | DF_1_NOOPEN);
         if (!_bfd_elf_add_dynamic_entry (info, DT_FLAGS_1, info->flags_1))
           return FALSE;
       }

      /* Work out the size of the version reference section.  */

      s = bfd_get_section_by_name (dynobj, ".gnu.version_r");
      BFD_ASSERT (s != NULL);
      {
       struct elf_find_verdep_info sinfo;

       sinfo.output_bfd = output_bfd;
       sinfo.info = info;
       sinfo.vers = elf_tdata (output_bfd)->cverdefs;
       if (sinfo.vers == 0)
         sinfo.vers = 1;
       sinfo.failed = FALSE;

       elf_link_hash_traverse (elf_hash_table (info),
                            _bfd_elf_link_find_version_dependencies,
                            &sinfo);

       if (elf_tdata (output_bfd)->verref == NULL)
         s->flags |= SEC_EXCLUDE;
       else
         {
           Elf_Internal_Verneed *t;
           unsigned int size;
           unsigned int crefs;
           bfd_byte *p;

           /* Build the version definition section.  */
           size = 0;
           crefs = 0;
           for (t = elf_tdata (output_bfd)->verref;
               t != NULL;
               t = t->vn_nextref)
             {
              Elf_Internal_Vernaux *a;

              size += sizeof (Elf_External_Verneed);
              ++crefs;
              for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr)
                size += sizeof (Elf_External_Vernaux);
             }

           s->size = size;
           s->contents = bfd_alloc (output_bfd, s->size);
           if (s->contents == NULL)
             return FALSE;

           p = s->contents;
           for (t = elf_tdata (output_bfd)->verref;
               t != NULL;
               t = t->vn_nextref)
             {
              unsigned int caux;
              Elf_Internal_Vernaux *a;
              bfd_size_type indx;

              caux = 0;
              for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr)
                ++caux;

              t->vn_version = VER_NEED_CURRENT;
              t->vn_cnt = caux;
              indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr,
                                       elf_dt_name (t->vn_bfd) != NULL
                                       ? elf_dt_name (t->vn_bfd)
                                       : lbasename (t->vn_bfd->filename),
                                       FALSE);
              if (indx == (bfd_size_type) -1)
                return FALSE;
              t->vn_file = indx;
              t->vn_aux = sizeof (Elf_External_Verneed);
              if (t->vn_nextref == NULL)
                t->vn_next = 0;
              else
                t->vn_next = (sizeof (Elf_External_Verneed)
                            + caux * sizeof (Elf_External_Vernaux));

              _bfd_elf_swap_verneed_out (output_bfd, t,
                                      (Elf_External_Verneed *) p);
              p += sizeof (Elf_External_Verneed);

              for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr)
                {
                  a->vna_hash = bfd_elf_hash (a->vna_nodename);
                  indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr,
                                          a->vna_nodename, FALSE);
                  if (indx == (bfd_size_type) -1)
                    return FALSE;
                  a->vna_name = indx;
                  if (a->vna_nextptr == NULL)
                    a->vna_next = 0;
                  else
                    a->vna_next = sizeof (Elf_External_Vernaux);

                  _bfd_elf_swap_vernaux_out (output_bfd, a,
                                          (Elf_External_Vernaux *) p);
                  p += sizeof (Elf_External_Vernaux);
                }
             }

           if (!_bfd_elf_add_dynamic_entry (info, DT_VERNEED, 0)
              || !_bfd_elf_add_dynamic_entry (info, DT_VERNEEDNUM, crefs))
             return FALSE;

           elf_tdata (output_bfd)->cverrefs = crefs;
         }
      }

      if ((elf_tdata (output_bfd)->cverrefs == 0
          && elf_tdata (output_bfd)->cverdefs == 0)
         || _bfd_elf_link_renumber_dynsyms (output_bfd, info,
                                        &section_sym_count) == 0)
       {
         s = bfd_get_section_by_name (dynobj, ".gnu.version");
         s->flags |= SEC_EXCLUDE;
       }
    }
  return TRUE;
}

Definition at line 6006 of file elflink.c.

{
  const struct elf_backend_data *bed;

  if (!is_elf_hash_table (info->hash))
    return TRUE;

  bed = get_elf_backend_data (output_bfd);
  (*bed->elf_backend_init_index_section) (output_bfd, info);

  if (elf_hash_table (info)->dynamic_sections_created)
    {
      bfd *dynobj;
      asection *s;
      bfd_size_type dynsymcount;
      unsigned long section_sym_count;
      unsigned int dtagcount;

      dynobj = elf_hash_table (info)->dynobj;

      /* Assign dynsym indicies.  In a shared library we generate a
        section symbol for each output section, which come first.
        Next come all of the back-end allocated local dynamic syms,
        followed by the rest of the global symbols.  */

      dynsymcount = _bfd_elf_link_renumber_dynsyms (output_bfd, info,
                                              &section_sym_count);

      /* Work out the size of the symbol version section.  */
      s = bfd_get_section_by_name (dynobj, ".gnu.version");
      BFD_ASSERT (s != NULL);
      if (dynsymcount != 0
         && (s->flags & SEC_EXCLUDE) == 0)
       {
         s->size = dynsymcount * sizeof (Elf_External_Versym);
         s->contents = bfd_zalloc (output_bfd, s->size);
         if (s->contents == NULL)
           return FALSE;

         if (!_bfd_elf_add_dynamic_entry (info, DT_VERSYM, 0))
           return FALSE;
       }

      /* Set the size of the .dynsym and .hash sections.  We counted
        the number of dynamic symbols in elf_link_add_object_symbols.
        We will build the contents of .dynsym and .hash when we build
        the final symbol table, because until then we do not know the
        correct value to give the symbols.  We built the .dynstr
        section as we went along in elf_link_add_object_symbols.  */
      s = bfd_get_section_by_name (dynobj, ".dynsym");
      BFD_ASSERT (s != NULL);
      s->size = dynsymcount * bed->s->sizeof_sym;

      if (dynsymcount != 0)
       {
         s->contents = bfd_alloc (output_bfd, s->size);
         if (s->contents == NULL)
           return FALSE;

         /* The first entry in .dynsym is a dummy symbol.
            Clear all the section syms, in case we don't output them all.  */
         ++section_sym_count;
         memset (s->contents, 0, section_sym_count * bed->s->sizeof_sym);
       }

      elf_hash_table (info)->bucketcount = 0;

      /* Compute the size of the hashing table.  As a side effect this
        computes the hash values for all the names we export.  */
      if (info->emit_hash)
       {
         unsigned long int *hashcodes;
         unsigned long int *hashcodesp;
         bfd_size_type amt;
         unsigned long int nsyms;
         size_t bucketcount;
         size_t hash_entry_size;

         /* Compute the hash values for all exported symbols.  At the same
            time store the values in an array so that we could use them for
            optimizations.  */
         amt = dynsymcount * sizeof (unsigned long int);
         hashcodes = bfd_malloc (amt);
         if (hashcodes == NULL)
           return FALSE;
         hashcodesp = hashcodes;

         /* Put all hash values in HASHCODES.  */
         elf_link_hash_traverse (elf_hash_table (info),
                              elf_collect_hash_codes, &hashcodesp);

         nsyms = hashcodesp - hashcodes;
         bucketcount
           = compute_bucket_count (info, hashcodes, nsyms, 0);
         free (hashcodes);

         if (bucketcount == 0)
           return FALSE;

         elf_hash_table (info)->bucketcount = bucketcount;

         s = bfd_get_section_by_name (dynobj, ".hash");
         BFD_ASSERT (s != NULL);
         hash_entry_size = elf_section_data (s)->this_hdr.sh_entsize;
         s->size = ((2 + bucketcount + dynsymcount) * hash_entry_size);
         s->contents = bfd_zalloc (output_bfd, s->size);
         if (s->contents == NULL)
           return FALSE;

         bfd_put (8 * hash_entry_size, output_bfd, bucketcount, s->contents);
         bfd_put (8 * hash_entry_size, output_bfd, dynsymcount,
                 s->contents + hash_entry_size);
       }

      if (info->emit_gnu_hash)
       {
         size_t i, cnt;
         unsigned char *contents;
         struct collect_gnu_hash_codes cinfo;
         bfd_size_type amt;
         size_t bucketcount;

         memset (&cinfo, 0, sizeof (cinfo));

         /* Compute the hash values for all exported symbols.  At the same
            time store the values in an array so that we could use them for
            optimizations.  */
         amt = dynsymcount * 2 * sizeof (unsigned long int);
         cinfo.hashcodes = bfd_malloc (amt);
         if (cinfo.hashcodes == NULL)
           return FALSE;

         cinfo.hashval = cinfo.hashcodes + dynsymcount;
         cinfo.min_dynindx = -1;
         cinfo.output_bfd = output_bfd;
         cinfo.bed = bed;

         /* Put all hash values in HASHCODES.  */
         elf_link_hash_traverse (elf_hash_table (info),
                              elf_collect_gnu_hash_codes, &cinfo);

         bucketcount
           = compute_bucket_count (info, cinfo.hashcodes, cinfo.nsyms, 1);

         if (bucketcount == 0)
           {
             free (cinfo.hashcodes);
             return FALSE;
           }

         s = bfd_get_section_by_name (dynobj, ".gnu.hash");
         BFD_ASSERT (s != NULL);

         if (cinfo.nsyms == 0)
           {
             /* Empty .gnu.hash section is special.  */
             BFD_ASSERT (cinfo.min_dynindx == -1);
             free (cinfo.hashcodes);
             s->size = 5 * 4 + bed->s->arch_size / 8;
             contents = bfd_zalloc (output_bfd, s->size);
             if (contents == NULL)
              return FALSE;
             s->contents = contents;
             /* 1 empty bucket.  */
             bfd_put_32 (output_bfd, 1, contents);
             /* SYMIDX above the special symbol 0.  */
             bfd_put_32 (output_bfd, 1, contents + 4);
             /* Just one word for bitmask.  */
             bfd_put_32 (output_bfd, 1, contents + 8);
             /* Only hash fn bloom filter.  */
             bfd_put_32 (output_bfd, 0, contents + 12);
             /* No hashes are valid - empty bitmask.  */
             bfd_put (bed->s->arch_size, output_bfd, 0, contents + 16);
             /* No hashes in the only bucket.  */
             bfd_put_32 (output_bfd, 0,
                       contents + 16 + bed->s->arch_size / 8);
           }
         else
           {
             unsigned long int maskwords, maskbitslog2;
             BFD_ASSERT (cinfo.min_dynindx != -1);

             maskbitslog2 = bfd_log2 (cinfo.nsyms) + 1;
             if (maskbitslog2 < 3)
              maskbitslog2 = 5;
             else if ((1 << (maskbitslog2 - 2)) & cinfo.nsyms)
              maskbitslog2 = maskbitslog2 + 3;
             else
              maskbitslog2 = maskbitslog2 + 2;
             if (bed->s->arch_size == 64)
              {
                if (maskbitslog2 == 5)
                  maskbitslog2 = 6;
                cinfo.shift1 = 6;
              }
             else
              cinfo.shift1 = 5;
             cinfo.mask = (1 << cinfo.shift1) - 1;
             cinfo.shift2 = maskbitslog2;
             cinfo.maskbits = 1 << maskbitslog2;
             maskwords = 1 << (maskbitslog2 - cinfo.shift1);
             amt = bucketcount * sizeof (unsigned long int) * 2;
             amt += maskwords * sizeof (bfd_vma);
             cinfo.bitmask = bfd_malloc (amt);
             if (cinfo.bitmask == NULL)
              {
                free (cinfo.hashcodes);
                return FALSE;
              }

             cinfo.counts = (void *) (cinfo.bitmask + maskwords);
             cinfo.indx = cinfo.counts + bucketcount;
             cinfo.symindx = dynsymcount - cinfo.nsyms;
             memset (cinfo.bitmask, 0, maskwords * sizeof (bfd_vma));

             /* Determine how often each hash bucket is used.  */
             memset (cinfo.counts, 0, bucketcount * sizeof (cinfo.counts[0]));
             for (i = 0; i < cinfo.nsyms; ++i)
              ++cinfo.counts[cinfo.hashcodes[i] % bucketcount];

             for (i = 0, cnt = cinfo.symindx; i < bucketcount; ++i)
              if (cinfo.counts[i] != 0)
                {
                  cinfo.indx[i] = cnt;
                  cnt += cinfo.counts[i];
                }
             BFD_ASSERT (cnt == dynsymcount);
             cinfo.bucketcount = bucketcount;
             cinfo.local_indx = cinfo.min_dynindx;

             s->size = (4 + bucketcount + cinfo.nsyms) * 4;
             s->size += cinfo.maskbits / 8;
             contents = bfd_zalloc (output_bfd, s->size);
             if (contents == NULL)
              {
                free (cinfo.bitmask);
                free (cinfo.hashcodes);
                return FALSE;
              }

             s->contents = contents;
             bfd_put_32 (output_bfd, bucketcount, contents);
             bfd_put_32 (output_bfd, cinfo.symindx, contents + 4);
             bfd_put_32 (output_bfd, maskwords, contents + 8);
             bfd_put_32 (output_bfd, cinfo.shift2, contents + 12);
             contents += 16 + cinfo.maskbits / 8;

             for (i = 0; i < bucketcount; ++i)
              {
                if (cinfo.counts[i] == 0)
                  bfd_put_32 (output_bfd, 0, contents);
                else
                  bfd_put_32 (output_bfd, cinfo.indx[i], contents);
                contents += 4;
              }

             cinfo.contents = contents;

             /* Renumber dynamic symbols, populate .gnu.hash section.  */
             elf_link_hash_traverse (elf_hash_table (info),
                                  elf_renumber_gnu_hash_syms, &cinfo);

             contents = s->contents + 16;
             for (i = 0; i < maskwords; ++i)
              {
                bfd_put (bed->s->arch_size, output_bfd, cinfo.bitmask[i],
                        contents);
                contents += bed->s->arch_size / 8;
              }

             free (cinfo.bitmask);
             free (cinfo.hashcodes);
           }
       }

      s = bfd_get_section_by_name (dynobj, ".dynstr");
      BFD_ASSERT (s != NULL);

      elf_finalize_dynstr (output_bfd, info);

      s->size = _bfd_elf_strtab_size (elf_hash_table (info)->dynstr);

      for (dtagcount = 0; dtagcount <= info->spare_dynamic_tags; ++dtagcount)
       if (!_bfd_elf_add_dynamic_entry (info, DT_NULL, 0))
         return FALSE;
    }

  return TRUE;
}
int bfd_flush ( bfd )

Definition at line 231 of file bfdio.c.

{
  if ((abfd->flags & BFD_IN_MEMORY) != 0)
    return 0;

  if (abfd->iovec)
    return abfd->iovec->bflush (abfd);
  return 0;
}

Here is the caller graph for this function:

void bfd_fprintf_vma ( bfd ,
void *  ,
bfd_vma   
)

Definition at line 1387 of file bfd.c.

{
  if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
    get_elf_backend_data (abfd)->elf_backend_fprintf_vma (abfd, stream, value);
  else
    fprintf_vma ((FILE *) stream, value);
}

Here is the caller graph for this function:

Here is the caller graph for this function:

Definition at line 867 of file bfd.c.

{
  if (abfd->xvec->flavour == bfd_target_elf_flavour)
    return get_elf_backend_data (abfd)->s->arch_size;

  return -1;
}

Here is the caller graph for this function:

bfd_uint64_t bfd_get_bits ( const void *  ,
int  ,
bfd_boolean   
)

Definition at line 786 of file libbfd.c.

{
  const bfd_byte *addr = p;
  bfd_uint64_t data;
  int i;
  int bytes;

  if (bits % 8 != 0)
    abort ();

  data = 0;
  bytes = bits / 8;
  for (i = 0; i < bytes; i++)
    {
      int index = big_p ? i : bytes - i - 1;

      data = (data << 8) | addr[index];
    }

  return data;
}

Here is the caller graph for this function:

Definition at line 8511 of file elf.c.

{
  if (abfd->xvec->flavour != bfd_target_elf_flavour)
    {
      bfd_set_error (bfd_error_wrong_format);
      return -1;
    }

  return elf_elfheader (abfd)->e_phnum * sizeof (Elf_Internal_Phdr);
}
int bfd_get_elf_phdrs ( bfd abfd,
void *  phdrs 
)

Definition at line 8531 of file elf.c.

{
  int num_phdrs;

  if (abfd->xvec->flavour != bfd_target_elf_flavour)
    {
      bfd_set_error (bfd_error_wrong_format);
      return -1;
    }

  num_phdrs = elf_elfheader (abfd)->e_phnum;
  memcpy (phdrs, elf_tdata (abfd)->phdr,
         num_phdrs * sizeof (Elf_Internal_Phdr));

  return num_phdrs;
}

Here is the caller graph for this function:

Definition at line 897 of file bfd.c.

{
  char *name;

  if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
    return get_elf_backend_data (abfd)->sign_extend_vma;

  name = bfd_get_target (abfd);

  /* Return a proper value for DJGPP & PE COFF.
     This function is required for DWARF2 support, but there is
     no place to store this information in the COFF back end.
     Should enough other COFF targets add support for DWARF2,
     a place will have to be found.  Until then, this hack will do.  */
  if (CONST_STRNEQ (name, "coff-go32")
      || strcmp (name, "pe-i386") == 0
      || strcmp (name, "pei-i386") == 0
      || strcmp (name, "pe-arm-wince-little") == 0
      || strcmp (name, "pei-arm-wince-little") == 0)
    return 1;

  bfd_set_error (bfd_error_wrong_format);
  return -1;
}

Here is the caller graph for this function:

Definition at line 47 of file stab-syms.c.

{
  switch (code)
    {
#define __define_name(val, str) case val: return str;
#include "aout/stab.def"
      EXTRA_SYMBOLS
    }

  return (const char *) 0;
}

Here is the caller graph for this function:

bfd_vma bfd_getb16 ( const void *  )

Definition at line 521 of file libbfd.c.

{
  const bfd_byte *addr = p;
  return (addr[0] << 8) | addr[1];
}

Here is the caller graph for this function:

bfd_vma bfd_getb32 ( const void *  )

Definition at line 565 of file libbfd.c.

{
  const bfd_byte *addr = p;
  unsigned long v;

  v = (unsigned long) addr[0] << 24;
  v |= (unsigned long) addr[1] << 16;
  v |= (unsigned long) addr[2] << 8;
  v |= (unsigned long) addr[3];
  return v;
}

Here is the caller graph for this function:

Definition at line 535 of file libbfd.c.

{
  const bfd_byte *addr = p;
  return COERCE16 ((addr[0] << 8) | addr[1]);
}

Definition at line 591 of file libbfd.c.

{
  const bfd_byte *addr = p;
  unsigned long v;

  v = (unsigned long) addr[0] << 24;
  v |= (unsigned long) addr[1] << 16;
  v |= (unsigned long) addr[2] << 8;
  v |= (unsigned long) addr[3];
  return COERCE32 (v);
}
bfd_vma bfd_getl16 ( const void *  )

Definition at line 528 of file libbfd.c.

{
  const bfd_byte *addr = p;
  return (addr[1] << 8) | addr[0];
}

Here is the caller graph for this function:

bfd_vma bfd_getl32 ( const void *  )

Definition at line 578 of file libbfd.c.

{
  const bfd_byte *addr = p;
  unsigned long v;

  v = (unsigned long) addr[0];
  v |= (unsigned long) addr[1] << 8;
  v |= (unsigned long) addr[2] << 16;
  v |= (unsigned long) addr[3] << 24;
  return v;
}

Here is the caller graph for this function:

Here is the caller graph for this function:

Definition at line 542 of file libbfd.c.

{
  const bfd_byte *addr = p;
  return COERCE16 ((addr[1] << 8) | addr[0]);
}

Definition at line 604 of file libbfd.c.

{
  const bfd_byte *addr = p;
  unsigned long v;

  v = (unsigned long) addr[0];
  v |= (unsigned long) addr[1] << 8;
  v |= (unsigned long) addr[2] << 16;
  v |= (unsigned long) addr[3] << 24;
  return COERCE32 (v);
}

Here is the caller graph for this function:

Definition at line 232 of file cpu-h8300.c.

{
  /* Cope with bfd_vma's larger than 32 bits.  */
  address &= 0xffffffffu;

  switch (bfd_get_mach (abfd))
    {
    case bfd_mach_h8300:
    case bfd_mach_h8300hn:
    case bfd_mach_h8300sn:
    case bfd_mach_h8300sxn:
      /* Sign extend a 16-bit address.  */
      if (address >= 0x8000)
       return address | 0xffff0000u;
      return address;

    case bfd_mach_h8300h:
      /* Sign extend a 24-bit address.  */
      if (address >= 0x800000)
       return address | 0xff000000u;
      return address;

    case bfd_mach_h8300s:
    case bfd_mach_h8300sx:
      return address;

    default:
      abort ();
    }
}

Here is the caller graph for this function:

Definition at line 544 of file hash.c.

{
  void * ret;

  ret = objalloc_alloc ((struct objalloc *) table->memory, size);
  if (ret == NULL && size != 0)
    bfd_set_error (bfd_error_no_memory);
  return ret;
}
struct bfd_hash_entry* bfd_hash_lookup ( struct bfd_hash_table ,
const char *  ,
bfd_boolean  create,
bfd_boolean  copy 
) [read]

Definition at line 416 of file hash.c.

{
  const unsigned char *s;
  unsigned long hash;
  unsigned int c;
  struct bfd_hash_entry *hashp;
  unsigned int len;
  unsigned int index;

  hash = 0;
  len = 0;
  s = (const unsigned char *) string;
  while ((c = *s++) != '\0')
    {
      hash += c + (c << 17);
      hash ^= hash >> 2;
    }
  len = (s - (const unsigned char *) string) - 1;
  hash += len + (len << 17);
  hash ^= hash >> 2;

  index = hash % table->size;
  for (hashp = table->table[index];
       hashp != NULL;
       hashp = hashp->next)
    {
      if (hashp->hash == hash
         && strcmp (hashp->string, string) == 0)
       return hashp;
    }

  if (! create)
    return NULL;

  hashp = (*table->newfunc) (NULL, table, string);
  if (hashp == NULL)
    return NULL;
  if (copy)
    {
      char *new;

      new = objalloc_alloc ((struct objalloc *) table->memory, len + 1);
      if (!new)
       {
         bfd_set_error (bfd_error_no_memory);
         return NULL;
       }
      memcpy (new, string, len + 1);
      string = new;
    }
  hashp->string = string;
  hashp->hash = hash;
  hashp->next = table->table[index];
  table->table[index] = hashp;
  table->count++;

  if (!table->frozen && table->count > table->size * 3 / 4)
    {
      unsigned long newsize = higher_prime_number (table->size);
      struct bfd_hash_entry **newtable;
      unsigned int hi;
      unsigned long alloc = newsize * sizeof (struct bfd_hash_entry *);

      /* If we can't find a higher prime, or we can't possibly alloc
        that much memory, don't try to grow the table.  */
      if (newsize == 0 || alloc / sizeof (struct bfd_hash_entry *) != newsize)
       {
         table->frozen = 1;
         return hashp;
       }

      newtable = ((struct bfd_hash_entry **)
                objalloc_alloc ((struct objalloc *) table->memory, alloc));
      memset ((PTR) newtable, 0, alloc);

      for (hi = 0; hi < table->size; hi ++)
       while (table->table[hi])
         {
           struct bfd_hash_entry *chain = table->table[hi];
           struct bfd_hash_entry *chain_end = chain;
           int index;

           while (chain_end->next && chain_end->next->hash == chain->hash)
             chain_end = chain_end->next;

           table->table[hi] = chain_end->next;
           index = chain->hash % newsize;
           chain_end->next = newtable[index];
           newtable[index] = chain;
         }
      table->table = newtable;
      table->size = newsize;
    }

  return hashp;
}

Here is the caller graph for this function:

Here is the caller graph for this function:

Definition at line 519 of file hash.c.

{
  unsigned int index;
  struct bfd_hash_entry **pph;

  index = old->hash % table->size;
  for (pph = &table->table[index];
       (*pph) != NULL;
       pph = &(*pph)->next)
    {
      if (*pph == old)
       {
         *pph = nw;
         return;
       }
    }

  abort ();
}

Here is the caller graph for this function:

Definition at line 590 of file hash.c.

{
  /* Extend this prime list if you want more granularity of hash table size.  */
  static const bfd_size_type hash_size_primes[] =
    {
      251, 509, 1021, 2039, 4051, 8599, 16699, 32749
    };
  size_t index;

  /* Work out best prime number near the hash_size.  */
  for (index = 0; index < ARRAY_SIZE (hash_size_primes) - 1; ++index)
    if (hash_size <= hash_size_primes[index])
      break;

  bfd_default_hash_table_size = hash_size_primes[index];
}

Here is the caller graph for this function:

Definition at line 407 of file hash.c.

{
  objalloc_free (table->memory);
  table->memory = NULL;
}

Here is the caller graph for this function:

bfd_boolean bfd_hash_table_init ( struct bfd_hash_table ,
struct bfd_hash_entry *)(struct bfd_hash_entry *, struct bfd_hash_table *, const char *,
unsigned  int 
)

Here is the caller graph for this function:

bfd_boolean bfd_hash_table_init_n ( struct bfd_hash_table ,
struct bfd_hash_entry *)(struct bfd_hash_entry *, struct bfd_hash_table *, const char *,
unsigned  int,
unsigned  int 
)

Here is the caller graph for this function:

void bfd_hash_traverse ( struct bfd_hash_table ,
bfd_boolean(*)(struct bfd_hash_entry *, void *)  ,
void *  info 
)

Definition at line 570 of file hash.c.

{
  unsigned int i;

  table->frozen = 1;
  for (i = 0; i < table->size; i++)
    {
      struct bfd_hash_entry *p;

      for (p = table->table[i]; p != NULL; p = p->next)
       if (! (*func) (p, info))
         goto out;
    }
 out:
  table->frozen = 0;
}

Here is the caller graph for this function:

Definition at line 554 of file i386linux.c.

{
  struct fixup *f;
  asection *s;

  if (output_bfd->xvec != &MY(vec))
    return TRUE;

  /* First find the fixups... */
  linux_link_hash_traverse (linux_hash_table (info),
                         linux_tally_symbols,
                         (PTR) info);

  /* If there are builtin fixups, leave room for a marker.  This is
     used by the dynamic linker so that it knows that all that follow
     are builtin fixups instead of regular fixups.  */
  for (f = linux_hash_table (info)->fixup_list; f != NULL; f = f->next)
    {
      if (f->builtin)
       {
         ++linux_hash_table (info)->fixup_count;
         ++linux_hash_table (info)->local_builtins;
         break;
       }
    }

  if (linux_hash_table (info)->dynobj == NULL)
    {
      if (linux_hash_table (info)->fixup_count > 0)
       abort ();
      return TRUE;
    }

  /* Allocate memory for our fixup table.  We will fill it in later.  */
  s = bfd_get_section_by_name (linux_hash_table (info)->dynobj,
                            ".linux-dynamic");
  if (s != NULL)
    {
      s->size = linux_hash_table (info)->fixup_count + 1;
      s->size *= 8;
      s->contents = (bfd_byte *) bfd_zalloc (output_bfd, s->size);
      if (s->contents == NULL)
       return FALSE;
    }

  return TRUE;
}

Here is the caller graph for this function:

bfd_boolean bfd_is_arm_special_symbol_name ( const char *  name,
int  type 
)

Definition at line 413 of file cpu-arm.c.

{
  /* The ARM compiler outputs several obsolete forms.  Recognize them
     in addition to the standard $a, $t and $d.  We are somewhat loose
     in what we accept here, since the full set is not documented.  */
  if (!name || name[0] != '$')
    return FALSE;
  if (name[1] == 'a' || name[1] == 't' || name[1] == 'd')
    type &= BFD_ARM_SPECIAL_SYM_TYPE_MAP;
  else if (name[1] == 'm' || name[1] == 'f' || name[1] == 'p')
    type &= BFD_ARM_SPECIAL_SYM_TYPE_TAG;
  else if (name[1] >= 'a' && name[1] <= 'z')
    type &= BFD_ARM_SPECIAL_SYM_TYPE_OTHER;
  else
    return FALSE;

  return (type != 0 && (name[2] == 0 || name[2] == '.'));
}

Here is the caller graph for this function:

Definition at line 456 of file coff-m68k.c.

{
  char *extsyms;
  bfd_size_type symesz;
  struct internal_reloc *irel, *irelend;
  bfd_byte *p;
  bfd_size_type amt;

  BFD_ASSERT (! info->relocatable);

  *errmsg = NULL;

  if (datasec->reloc_count == 0)
    return TRUE;

  extsyms = obj_coff_external_syms (abfd);
  symesz = bfd_coff_symesz (abfd);

  irel = _bfd_coff_read_internal_relocs (abfd, datasec, TRUE, NULL, FALSE,
                                    NULL);
  irelend = irel + datasec->reloc_count;

  amt = (bfd_size_type) datasec->reloc_count * 12;
  relsec->contents = (bfd_byte *) bfd_alloc (abfd, amt);
  if (relsec->contents == NULL)
    return FALSE;

  p = relsec->contents;

  for (; irel < irelend; irel++, p += 12)
    {
      asection *targetsec;

      /* We are going to write a four byte longword into the runtime
       reloc section.  The longword will be the address in the data
       section which must be relocated.  It is followed by the name
       of the target section NUL-padded or truncated to 8
       characters.  */

      /* We can only relocate absolute longword relocs at run time.  */
      if (irel->r_type != R_RELLONG)
       {
         *errmsg = _("unsupported reloc type");
         bfd_set_error (bfd_error_bad_value);
         return FALSE;
       }

      if (irel->r_symndx == -1)
       targetsec = bfd_abs_section_ptr;
      else
       {
         struct coff_link_hash_entry *h;

         h = obj_coff_sym_hashes (abfd)[irel->r_symndx];
         if (h == NULL)
           {
             struct internal_syment isym;

             bfd_coff_swap_sym_in (abfd, extsyms + symesz * irel->r_symndx,
                                &isym);
             targetsec = coff_section_from_bfd_index (abfd, isym.n_scnum);
           }
         else if (h->root.type == bfd_link_hash_defined
                 || h->root.type == bfd_link_hash_defweak)
           targetsec = h->root.u.def.section;
         else
           targetsec = NULL;
       }

      bfd_put_32 (abfd,
                (irel->r_vaddr - datasec->vma + datasec->output_offset), p);
      memset (p + 4, 0, 8);
      if (targetsec != NULL)
       strncpy ((char *) p + 4, targetsec->output_section->name, 8);
    }

  return TRUE;
}

Definition at line 2321 of file elf32-m68k.c.

{
  Elf_Internal_Shdr *symtab_hdr;
  Elf_Internal_Sym *isymbuf = NULL;
  Elf_Internal_Rela *internal_relocs = NULL;
  Elf_Internal_Rela *irel, *irelend;
  bfd_byte *p;
  bfd_size_type amt;

  BFD_ASSERT (! info->relocatable);

  *errmsg = NULL;

  if (datasec->reloc_count == 0)
    return TRUE;

  symtab_hdr = &elf_tdata (abfd)->symtab_hdr;

  /* Get a copy of the native relocations.  */
  internal_relocs = (_bfd_elf_link_read_relocs
                   (abfd, datasec, (PTR) NULL, (Elf_Internal_Rela *) NULL,
                    info->keep_memory));
  if (internal_relocs == NULL)
    goto error_return;

  amt = (bfd_size_type) datasec->reloc_count * 12;
  relsec->contents = (bfd_byte *) bfd_alloc (abfd, amt);
  if (relsec->contents == NULL)
    goto error_return;

  p = relsec->contents;

  irelend = internal_relocs + datasec->reloc_count;
  for (irel = internal_relocs; irel < irelend; irel++, p += 12)
    {
      asection *targetsec;

      /* We are going to write a four byte longword into the runtime
       reloc section.  The longword will be the address in the data
       section which must be relocated.  It is followed by the name
       of the target section NUL-padded or truncated to 8
       characters.  */

      /* We can only relocate absolute longword relocs at run time.  */
      if (ELF32_R_TYPE (irel->r_info) != (int) R_68K_32)
       {
         *errmsg = _("unsupported reloc type");
         bfd_set_error (bfd_error_bad_value);
         goto error_return;
       }

      /* Get the target section referred to by the reloc.  */
      if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info)
       {
         /* A local symbol.  */
         Elf_Internal_Sym *isym;

         /* Read this BFD's local symbols if we haven't done so already.  */
         if (isymbuf == NULL)
           {
             isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents;
             if (isymbuf == NULL)
              isymbuf = bfd_elf_get_elf_syms (abfd, symtab_hdr,
                                          symtab_hdr->sh_info, 0,
                                          NULL, NULL, NULL);
             if (isymbuf == NULL)
              goto error_return;
           }

         isym = isymbuf + ELF32_R_SYM (irel->r_info);
         targetsec = bfd_section_from_elf_index (abfd, isym->st_shndx);
       }
      else
       {
         unsigned long indx;
         struct elf_link_hash_entry *h;

         /* An external symbol.  */
         indx = ELF32_R_SYM (irel->r_info) - symtab_hdr->sh_info;
         h = elf_sym_hashes (abfd)[indx];
         BFD_ASSERT (h != NULL);
         if (h->root.type == bfd_link_hash_defined
             || h->root.type == bfd_link_hash_defweak)
           targetsec = h->root.u.def.section;
         else
           targetsec = NULL;
       }

      bfd_put_32 (abfd, irel->r_offset + datasec->output_offset, p);
      memset (p + 4, 0, 8);
      if (targetsec != NULL)
       strncpy ((char *) p + 4, targetsec->output_section->name, 8);
    }

  if (isymbuf != NULL && symtab_hdr->contents != (unsigned char *) isymbuf)
    free (isymbuf);
  if (internal_relocs != NULL
      && elf_section_data (datasec)->relocs != internal_relocs)
    free (internal_relocs);
  return TRUE;

error_return:
  if (isymbuf != NULL && symtab_hdr->contents != (unsigned char *) isymbuf)
    free (isymbuf);
  if (internal_relocs != NULL
      && elf_section_data (datasec)->relocs != internal_relocs)
    free (internal_relocs);
  return FALSE;
}

Definition at line 158 of file cpu-m68k.c.

{
  int superset = 0, subset = 0;
  unsigned extra = 99, missing = 99;
  unsigned ix;

  for (ix = 0;
       ix != sizeof (m68k_arch_features) / sizeof (m68k_arch_features[0]);
       ix++)
    {
      unsigned this_extra, this_missing;
      
      if (m68k_arch_features[ix] == features)
       return ix;
      this_extra = bit_count (m68k_arch_features[ix] & ~features);
      if (this_extra < extra)
       {
         extra = this_extra;
         superset = ix;
       }
      
      this_missing = bit_count (features & ~m68k_arch_features[ix]);
      if (this_missing < missing)
       {
         missing = this_missing;
         superset = ix;
       }
    }
  return superset ? superset : subset;
}

Here is the caller graph for this function:

Definition at line 145 of file cpu-m68k.c.

{
  if ((unsigned)mach
      >= sizeof (m68k_arch_features) / sizeof (m68k_arch_features[0]))
    mach = 0;
  return m68k_arch_features[mach];
}

Here is the caller graph for this function:

Definition at line 558 of file m68klinux.c.

{
  struct fixup *f;
  asection *s;

  if (output_bfd->xvec != &MY(vec))
    return TRUE;

  /* First find the fixups...  */
  linux_link_hash_traverse (linux_hash_table (info),
                         linux_tally_symbols,
                         (PTR) info);

  /* If there are builtin fixups, leave room for a marker.  This is
     used by the dynamic linker so that it knows that all that follow
     are builtin fixups instead of regular fixups.  */
  for (f = linux_hash_table (info)->fixup_list; f != NULL; f = f->next)
    {
      if (f->builtin)
       {
         ++linux_hash_table (info)->fixup_count;
         ++linux_hash_table (info)->local_builtins;
         break;
       }
    }

  if (linux_hash_table (info)->dynobj == NULL)
    {
      if (linux_hash_table (info)->fixup_count > 0)
       abort ();
      return TRUE;
    }

  /* Allocate memory for our fixup table.  We will fill it in later.  */
  s = bfd_get_section_by_name (linux_hash_table (info)->dynobj,
                            ".linux-dynamic");
  if (s != NULL)
    {
      s->size = linux_hash_table (info)->fixup_count + 1;
      s->size *= 8;
      s->contents = (bfd_byte *) bfd_zalloc (output_bfd, s->size);
      if (s->contents == NULL)
       {
         bfd_set_error (bfd_error_no_memory);
         return FALSE;
       }
    }

  return TRUE;
}
void bfd_put_bits ( bfd_uint64_t  ,
void *  ,
int  ,
bfd_boolean   
)

Definition at line 766 of file libbfd.c.

{
  bfd_byte *addr = p;
  int i;
  int bytes;

  if (bits % 8 != 0)
    abort ();

  bytes = bits / 8;
  for (i = 0; i < bytes; i++)
    {
      int index = big_p ? bytes - i - 1 : i;

      addr[index] = data & 0xff;
      data >>= 8;
    }
}

Here is the caller graph for this function:

void bfd_putb16 ( bfd_vma  ,
void *   
)

Definition at line 549 of file libbfd.c.

{
  bfd_byte *addr = p;
  addr[0] = (data >> 8) & 0xff;
  addr[1] = data & 0xff;
}

Here is the caller graph for this function:

void bfd_putb32 ( bfd_vma  ,
void *   
)

Definition at line 710 of file libbfd.c.

{
  bfd_byte *addr = p;
  addr[0] = (data >> 24) & 0xff;
  addr[1] = (data >> 16) & 0xff;
  addr[2] = (data >>  8) & 0xff;
  addr[3] = data & 0xff;
}

Here is the caller graph for this function:

void bfd_putb64 ( bfd_uint64_t  ,
void *   
)

Here is the caller graph for this function:

void bfd_putl16 ( bfd_vma  ,
void *   
)

Definition at line 557 of file libbfd.c.

{
  bfd_byte *addr = p;
  addr[0] = data & 0xff;
  addr[1] = (data >> 8) & 0xff;
}

Here is the caller graph for this function:

void bfd_putl32 ( bfd_vma  ,
void *   
)

Definition at line 720 of file libbfd.c.

{
  bfd_byte *addr = p;
  addr[0] = data & 0xff;
  addr[1] = (data >>  8) & 0xff;
  addr[2] = (data >> 16) & 0xff;
  addr[3] = (data >> 24) & 0xff;
}

Here is the caller graph for this function:

void bfd_putl64 ( bfd_uint64_t  ,
void *   
)

Here is the caller graph for this function:

Definition at line 1336 of file bfd.c.

{
  struct elf_segment_map *m, **pm;
  bfd_size_type amt;

  if (bfd_get_flavour (abfd) != bfd_target_elf_flavour)
    return TRUE;

  amt = sizeof (struct elf_segment_map);
  amt += ((bfd_size_type) count - 1) * sizeof (asection *);
  m = bfd_zalloc (abfd, amt);
  if (m == NULL)
    return FALSE;

  m->p_type = type;
  m->p_flags = flags;
  m->p_paddr = at;
  m->p_flags_valid = flags_valid;
  m->p_paddr_valid = at_valid;
  m->includes_filehdr = includes_filehdr;
  m->includes_phdrs = includes_phdrs;
  m->count = count;
  if (count > 0)
    memcpy (m->sections, secs, count * sizeof (asection *));

  for (pm = &elf_tdata (abfd)->segment_map; *pm != NULL; pm = &(*pm)->next)
    ;
  *pm = m;

  return TRUE;
}

Here is the caller graph for this function:

Definition at line 2965 of file linker.c.

{
  bfd_hash_table_free (&_bfd_section_already_linked_table);
}

Here is the caller graph for this function:

Definition at line 2956 of file linker.c.

{
  return bfd_hash_table_init_n (&_bfd_section_already_linked_table,
                            already_linked_newfunc,
                            sizeof (struct bfd_section_already_linked_hash_entry),
                            42);
}

Here is the caller graph for this function:

int bfd_seek ( bfd ,
file_ptr  ,
int   
)

Definition at line 265 of file bfdio.c.

{
  int result;
  file_ptr file_position;
  /* For the time being, a BFD may not seek to it's end.  The problem
     is that we don't easily have a way to recognize the end of an
     element in an archive.  */

  BFD_ASSERT (direction == SEEK_SET || direction == SEEK_CUR);

  if (direction == SEEK_CUR && position == 0)
    return 0;

  if ((abfd->flags & BFD_IN_MEMORY) != 0)
    {
      struct bfd_in_memory *bim;

      bim = abfd->iostream;

      if (direction == SEEK_SET)
       abfd->where = position;
      else
       abfd->where += position;

      if (abfd->where > bim->size)
       {
         if ((abfd->direction == write_direction) ||
             (abfd->direction == both_direction))
           {
             bfd_size_type newsize, oldsize;

             oldsize = (bim->size + 127) & ~(bfd_size_type) 127;
             bim->size = abfd->where;
             /* Round up to cut down on memory fragmentation */
             newsize = (bim->size + 127) & ~(bfd_size_type) 127;
             if (newsize > oldsize)
               {
                bim->buffer = bfd_realloc (bim->buffer, newsize);
                if (bim->buffer == 0)
                  {
                    bim->size = 0;
                    return -1;
                  }
               }
           }
         else
           {
             abfd->where = bim->size;
             bfd_set_error (bfd_error_file_truncated);
             return -1;
           }
       }
      return 0;
    }

  if (abfd->format != bfd_archive && abfd->my_archive == 0)
    {
      if (direction == SEEK_SET && (bfd_vma) position == abfd->where)
       return 0;
    }
  else
    {
      /* We need something smarter to optimize access to archives.
        Currently, anything inside an archive is read via the file
        handle for the archive.  Which means that a bfd_seek on one
        component affects the `current position' in the archive, as
        well as in any other component.

        It might be sufficient to put a spike through the cache
        abstraction, and look to the archive for the file position,
        but I think we should try for something cleaner.

        In the meantime, no optimization for archives.  */
    }

  file_position = position;
  if (direction == SEEK_SET && abfd->my_archive != NULL)
    file_position += abfd->origin;

  if (abfd->iovec)
    result = abfd->iovec->bseek (abfd, file_position, direction);
  else
    result = -1;

  if (result != 0)
    {
      int hold_errno = errno;

      /* Force redetermination of `where' field.  */
      bfd_tell (abfd);

      /* An EINVAL error probably means that the file offset was
         absurd.  */
      if (hold_errno == EINVAL)
       bfd_set_error (bfd_error_file_truncated);
      else
       {
         bfd_set_error (bfd_error_system_call);
         errno = hold_errno;
       }
    }
  else
    {
      /* Adjust `where' field.  */
      if (direction == SEEK_SET)
       abfd->where = position;
      else
       abfd->where += position;
    }
  return result;
}

Definition at line 554 of file sparclinux.c.

{
  struct fixup *f;
  asection *s;

  if (output_bfd->xvec != &MY(vec))
    return TRUE;

  /* First find the fixups...  */
  linux_link_hash_traverse (linux_hash_table (info),
                         linux_tally_symbols,
                         (PTR) info);

  /* If there are builtin fixups, leave room for a marker.  This is
     used by the dynamic linker so that it knows that all that follow
     are builtin fixups instead of regular fixups.  */
  for (f = linux_hash_table (info)->fixup_list; f != NULL; f = f->next)
    {
      if (f->builtin)
       {
         ++linux_hash_table (info)->fixup_count;
         ++linux_hash_table (info)->local_builtins;
         break;
       }
    }

  if (linux_hash_table (info)->dynobj == NULL)
    {
      if (linux_hash_table (info)->fixup_count > 0)
       abort ();
      return TRUE;
    }

  /* Allocate memory for our fixup table.  We will fill it in later.  */
  s = bfd_get_section_by_name (linux_hash_table (info)->dynobj,
                            ".linux-dynamic");
  if (s != NULL)
    {
      s->size = linux_hash_table (info)->fixup_count + 1;
      s->size *= 8;
      s->contents = (bfd_byte *) bfd_zalloc (output_bfd, s->size);
      if (s->contents == NULL)
       return FALSE;
    }

  return TRUE;
}
void bfd_sprintf_vma ( bfd ,
char *  ,
bfd_vma   
)

Definition at line 1378 of file bfd.c.

{
  if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
    get_elf_backend_data (abfd)->elf_backend_sprintf_vma (abfd, buf, value);
  else
    sprintf_vma (buf, value);
}

Here is the caller graph for this function:

int bfd_stat ( bfd ,
struct stat  
)

Definition at line 244 of file bfdio.c.

{
  int result;

  if ((abfd->flags & BFD_IN_MEMORY) != 0)
    abort ();

  if (abfd->iovec)
    result = abfd->iovec->bstat (abfd, statbuf);
  else
    result = -1;

  if (result < 0)
    bfd_set_error (bfd_error_system_call);
  return result;
}

Here is the caller graph for this function:

Definition at line 1202 of file sunos.c.

{
  struct sunos_link_hash_entry *h;

  if (output_bfd->xvec != &MY(vec))
    return TRUE;

  /* This is called after we have examined all the input objects.  If
     the symbol does not exist, it merely means that no object refers
     to it, and we can just ignore it at this point.  */
  h = sunos_link_hash_lookup (sunos_hash_table (info), name,
                           FALSE, FALSE, FALSE);
  if (h == NULL)
    return TRUE;

  /* In a shared library, the __DYNAMIC symbol does not appear in the
     dynamic symbol table.  */
  if (! info->shared || strcmp (name, "__DYNAMIC") != 0)
    {
      h->flags |= SUNOS_DEF_REGULAR;

      if (h->dynindx == -1)
       {
         ++sunos_hash_table (info)->dynsymcount;
         h->dynindx = -2;
       }
    }

  return TRUE;
}

Definition at line 1871 of file sunos.c.

{
  bfd *dynobj;
  bfd_size_type dynsymcount;
  struct sunos_link_hash_entry *h;
  asection *s;
  size_t bucketcount;
  bfd_size_type hashalloc;
  size_t i;
  bfd *sub;

  *sdynptr = NULL;
  *sneedptr = NULL;
  *srulesptr = NULL;

  if (info->relocatable)
    return TRUE;

  if (output_bfd->xvec != &MY(vec))
    return TRUE;

  /* Look through all the input BFD's and read their relocs.  It would
     be better if we didn't have to do this, but there is no other way
     to determine the number of dynamic relocs we need, and, more
     importantly, there is no other way to know which symbols should
     get an entry in the procedure linkage table.  */
  for (sub = info->input_bfds; sub != NULL; sub = sub->link_next)
    {
      if ((sub->flags & DYNAMIC) == 0
         && sub->xvec == output_bfd->xvec)
       {
         if (! sunos_scan_relocs (info, sub, obj_textsec (sub),
                               exec_hdr (sub)->a_trsize)
             || ! sunos_scan_relocs (info, sub, obj_datasec (sub),
                                  exec_hdr (sub)->a_drsize))
           return FALSE;
       }
    }

  dynobj = sunos_hash_table (info)->dynobj;
  dynsymcount = sunos_hash_table (info)->dynsymcount;

  /* If there were no dynamic objects in the link, and we don't need
     to build a global offset table, there is nothing to do here.  */
  if (! sunos_hash_table (info)->dynamic_sections_needed
      && ! sunos_hash_table (info)->got_needed)
    return TRUE;

  /* If __GLOBAL_OFFSET_TABLE_ was mentioned, define it.  */
  h = sunos_link_hash_lookup (sunos_hash_table (info),
                           "__GLOBAL_OFFSET_TABLE_", FALSE, FALSE, FALSE);
  if (h != NULL && (h->flags & SUNOS_REF_REGULAR) != 0)
    {
      h->flags |= SUNOS_DEF_REGULAR;
      if (h->dynindx == -1)
       {
         ++sunos_hash_table (info)->dynsymcount;
         h->dynindx = -2;
       }
      h->root.root.type = bfd_link_hash_defined;
      h->root.root.u.def.section = bfd_get_section_by_name (dynobj, ".got");

      /* If the .got section is more than 0x1000 bytes, we set
        __GLOBAL_OFFSET_TABLE_ to be 0x1000 bytes into the section,
        so that 13 bit relocations have a greater chance of working.  */
      s = bfd_get_section_by_name (dynobj, ".got");
      BFD_ASSERT (s != NULL);
      if (s->size >= 0x1000)
       h->root.root.u.def.value = 0x1000;
      else
       h->root.root.u.def.value = 0;

      sunos_hash_table (info)->got_base = h->root.root.u.def.value;
    }

  /* If there are any shared objects in the link, then we need to set
     up the dynamic linking information.  */
  if (sunos_hash_table (info)->dynamic_sections_needed)
    {
      *sdynptr = bfd_get_section_by_name (dynobj, ".dynamic");

      /* The .dynamic section is always the same size.  */
      s = *sdynptr;
      BFD_ASSERT (s != NULL);
      s->size = (sizeof (struct external_sun4_dynamic)
                    + EXTERNAL_SUN4_DYNAMIC_DEBUGGER_SIZE
                    + sizeof (struct external_sun4_dynamic_link));

      /* Set the size of the .dynsym and .hash sections.  We counted
        the number of dynamic symbols as we read the input files.  We
        will build the dynamic symbol table (.dynsym) and the hash
        table (.hash) when we build the final symbol table, because
        until then we do not know the correct value to give the
        symbols.  We build the dynamic symbol string table (.dynstr)
        in a traversal of the symbol table using
        sunos_scan_dynamic_symbol.  */
      s = bfd_get_section_by_name (dynobj, ".dynsym");
      BFD_ASSERT (s != NULL);
      s->size = dynsymcount * sizeof (struct external_nlist);
      s->contents = bfd_alloc (output_bfd, s->size);
      if (s->contents == NULL && s->size != 0)
       return FALSE;

      /* The number of buckets is just the number of symbols divided
        by four.  To compute the final size of the hash table, we
        must actually compute the hash table.  Normally we need
        exactly as many entries in the hash table as there are
        dynamic symbols, but if some of the buckets are not used we
        will need additional entries.  In the worst case, every
        symbol will hash to the same bucket, and we will need
        BUCKETCOUNT - 1 extra entries.  */
      if (dynsymcount >= 4)
       bucketcount = dynsymcount / 4;
      else if (dynsymcount > 0)
       bucketcount = dynsymcount;
      else
       bucketcount = 1;
      s = bfd_get_section_by_name (dynobj, ".hash");
      BFD_ASSERT (s != NULL);
      hashalloc = (dynsymcount + bucketcount - 1) * HASH_ENTRY_SIZE;
      s->contents = bfd_zalloc (dynobj, hashalloc);
      if (s->contents == NULL && dynsymcount > 0)
       return FALSE;
      for (i = 0; i < bucketcount; i++)
       PUT_WORD (output_bfd, (bfd_vma) -1, s->contents + i * HASH_ENTRY_SIZE);
      s->size = bucketcount * HASH_ENTRY_SIZE;

      sunos_hash_table (info)->bucketcount = bucketcount;

      /* Scan all the symbols, place them in the dynamic symbol table,
        and build the dynamic hash table.  We reuse dynsymcount as a
        counter for the number of symbols we have added so far.  */
      sunos_hash_table (info)->dynsymcount = 0;
      sunos_link_hash_traverse (sunos_hash_table (info),
                            sunos_scan_dynamic_symbol,
                            (void *) info);
      BFD_ASSERT (sunos_hash_table (info)->dynsymcount == dynsymcount);

      /* The SunOS native linker seems to align the total size of the
        symbol strings to a multiple of 8.  I don't know if this is
        important, but it can't hurt much.  */
      s = bfd_get_section_by_name (dynobj, ".dynstr");
      BFD_ASSERT (s != NULL);
      if ((s->size & 7) != 0)
       {
         bfd_size_type add;
         bfd_byte *contents;

         add = 8 - (s->size & 7);
         contents = bfd_realloc (s->contents, s->size + add);
         if (contents == NULL)
           return FALSE;
         memset (contents + s->size, 0, (size_t) add);
         s->contents = contents;
         s->size += add;
       }
    }

  /* Now that we have worked out the sizes of the procedure linkage
     table and the dynamic relocs, allocate storage for them.  */
  s = bfd_get_section_by_name (dynobj, ".plt");
  BFD_ASSERT (s != NULL);
  if (s->size != 0)
    {
      s->contents = bfd_alloc (dynobj, s->size);
      if (s->contents == NULL)
       return FALSE;

      /* Fill in the first entry in the table.  */
      switch (bfd_get_arch (dynobj))
       {
       case bfd_arch_sparc:
         memcpy (s->contents, sparc_plt_first_entry, SPARC_PLT_ENTRY_SIZE);
         break;

       case bfd_arch_m68k:
         memcpy (s->contents, m68k_plt_first_entry, M68K_PLT_ENTRY_SIZE);
         break;

       default:
         abort ();
       }
    }

  s = bfd_get_section_by_name (dynobj, ".dynrel");
  if (s->size != 0)
    {
      s->contents = bfd_alloc (dynobj, s->size);
      if (s->contents == NULL)
       return FALSE;
    }
  /* We use the reloc_count field to keep track of how many of the
     relocs we have output so far.  */
  s->reloc_count = 0;

  /* Make space for the global offset table.  */
  s = bfd_get_section_by_name (dynobj, ".got");
  s->contents = bfd_alloc (dynobj, s->size);
  if (s->contents == NULL)
    return FALSE;

  *sneedptr = bfd_get_section_by_name (dynobj, ".need");
  *srulesptr = bfd_get_section_by_name (dynobj, ".rules");

  return TRUE;
}

Definition at line 209 of file bfdio.c.

{
  file_ptr ptr;

  if ((abfd->flags & BFD_IN_MEMORY) != 0)
    return abfd->where;

  if (abfd->iovec)
    {
      ptr = abfd->iovec->btell (abfd);

      if (abfd->my_archive)
       ptr -= abfd->origin;
    }
  else
    ptr = 0;

  abfd->where = ptr;
  return ptr;
}

Here is the caller graph for this function:

Definition at line 108 of file coff-tic54x.c.

{
  int page;

  /* Provide meaningful defaults for predefined sections.  */
  if (sect == &bfd_com_section)
    page = PG_DATA;

  else if (sect == &bfd_und_section
      || sect == &bfd_abs_section
      || sect == &bfd_ind_section)
    page = PG_PROG;

  else
    page = FLAG_TO_PG (sect->lma);

  return page;
}

Definition at line 100 of file coff-tic54x.c.

{
  sect->lma = (sect->lma & ADDR_MASK) | PG_TO_FLAG(page);
}

Definition at line 2560 of file xcofflink.c.

{
  struct xcoff_link_hash_entry *h = (struct xcoff_link_hash_entry *) harg;

  if (bfd_get_flavour (output_bfd) != bfd_target_xcoff_flavour)
    return TRUE;

  h->flags |= XCOFF_EXPORT;

  /* FIXME: I'm not at all sure what syscall is supposed to mean, so
     I'm just going to ignore it until somebody explains it.  */

  /* See if this is a function descriptor.  It may be one even though
     it is not so marked.  */
  if ((h->flags & XCOFF_DESCRIPTOR) == 0
      && h->root.root.string[0] != '.')
    {
      char *fnname;
      struct xcoff_link_hash_entry *hfn;
      bfd_size_type amt = strlen (h->root.root.string) + 2;

      fnname = bfd_malloc (amt);
      if (fnname == NULL)
       return FALSE;
      fnname[0] = '.';
      strcpy (fnname + 1, h->root.root.string);
      hfn = xcoff_link_hash_lookup (xcoff_hash_table (info),
                                fnname, FALSE, FALSE, TRUE);
      free (fnname);
      if (hfn != NULL
         && hfn->smclas == XMC_PR
         && (hfn->root.type == bfd_link_hash_defined
             || hfn->root.type == bfd_link_hash_defweak))
       {
         h->flags |= XCOFF_DESCRIPTOR;
         h->descriptor = hfn;
         hfn->descriptor = h;
       }
    }

  /* Make sure we don't garbage collect this symbol.  */
  if (! xcoff_mark_symbol (info, h))
    return FALSE;

  /* If this is a function descriptor, make sure we don't garbage
     collect the associated function code.  We normally don't have to
     worry about this, because the descriptor will be attached to a
     section with relocs, but if we are creating the descriptor
     ourselves those relocs will not be visible to the mark code.  */
  if ((h->flags & XCOFF_DESCRIPTOR) != 0)
    {
      if (! xcoff_mark_symbol (info, h->descriptor))
       return FALSE;
    }

  return TRUE;
}
bfd_boolean bfd_xcoff_import_symbol ( bfd ,
struct bfd_link_info ,
struct bfd_link_hash_entry ,
bfd_vma  ,
const char *  ,
const char *  ,
const char *  ,
unsigned  int 
)

Definition at line 2443 of file xcofflink.c.

{
  struct xcoff_link_hash_entry *h = (struct xcoff_link_hash_entry *) harg;

  if (bfd_get_flavour (output_bfd) != bfd_target_xcoff_flavour)
    return TRUE;

  /* A symbol name which starts with a period is the code for a
     function.  If the symbol is undefined, then add an undefined
     symbol for the function descriptor, and import that instead.  */
  if (h->root.root.string[0] == '.'
      && h->root.type == bfd_link_hash_undefined
      && val == (bfd_vma) -1)
    {
      struct xcoff_link_hash_entry *hds;

      hds = h->descriptor;
      if (hds == NULL)
       {
         hds = xcoff_link_hash_lookup (xcoff_hash_table (info),
                                   h->root.root.string + 1,
                                   TRUE, FALSE, TRUE);
         if (hds == NULL)
           return FALSE;
         if (hds->root.type == bfd_link_hash_new)
           {
             hds->root.type = bfd_link_hash_undefined;
             hds->root.u.undef.abfd = h->root.u.undef.abfd;
           }
         hds->flags |= XCOFF_DESCRIPTOR;
         BFD_ASSERT ((hds->flags & XCOFF_CALLED) == 0
                    && (h->flags & XCOFF_DESCRIPTOR) == 0);
         hds->descriptor = h;
         h->descriptor = hds;
       }

      /* Now, if the descriptor is undefined, import the descriptor
        rather than the symbol we were told to import.  FIXME: Is
        this correct in all cases?  */
      if (hds->root.type == bfd_link_hash_undefined)
       h = hds;
    }

  h->flags |= (XCOFF_IMPORT | syscall_flag);

  if (val != (bfd_vma) -1)
    {
      if (h->root.type == bfd_link_hash_defined
         && (! bfd_is_abs_section (h->root.u.def.section)
             || h->root.u.def.value != val))
       {
         if (! ((*info->callbacks->multiple_definition)
               (info, h->root.root.string, h->root.u.def.section->owner,
                h->root.u.def.section, h->root.u.def.value,
                output_bfd, bfd_abs_section_ptr, val)))
           return FALSE;
       }

      h->root.type = bfd_link_hash_defined;
      h->root.u.def.section = bfd_abs_section_ptr;
      h->root.u.def.value = val;
    }

  /* We overload the ldindx field to hold the l_ifile value for this
     symbol.  */
  BFD_ASSERT (h->ldsym == NULL);
  BFD_ASSERT ((h->flags & XCOFF_BUILT_LDSYM) == 0);
  if (imppath == NULL)
    h->ldindx = -1;
  else
    {
      unsigned int c;
      struct xcoff_import_file **pp;

      /* We start c at 1 because the first entry in the import list is
        reserved for the library search path.  */
      for (pp = &xcoff_hash_table (info)->imports, c = 1;
          *pp != NULL;
          pp = &(*pp)->next, ++c)
       {
         if (strcmp ((*pp)->path, imppath) == 0
             && strcmp ((*pp)->file, impfile) == 0
             && strcmp ((*pp)->member, impmember) == 0)
           break;
       }

      if (*pp == NULL)
       {
         struct xcoff_import_file *n;
         bfd_size_type amt = sizeof (* n);

         n = bfd_alloc (output_bfd, amt);
         if (n == NULL)
           return FALSE;
         n->next = NULL;
         n->path = imppath;
         n->file = impfile;
         n->member = impmember;
         *pp = n;
       }

      h->ldindx = c;
    }

  return TRUE;
}

Definition at line 2625 of file xcofflink.c