Back to index

cell-binutils  2.17cvs20070401
Classes | Defines | Typedefs | Functions | Variables
libbfd.h File Reference
#include "hashtab.h"

Go to the source code of this file.

Classes

struct  bfd_in_memory
struct  section_hash_entry
struct  artdata
struct  areltdata
struct  bfd_section_already_linked_hash_entry
struct  bfd_section_already_linked
struct  bfd_iovec
struct  _bfd_window_internal

Defines

#define BFD_ALIGN(this, boundary)
#define DEFAULT_BUFFERSIZE   8192
#define set_tdata(bfd, v)   ((bfd)->tdata.any = (v))
#define bfd_ardata(bfd)   ((bfd)->tdata.aout_ar_data)
#define arelt_size(bfd)   (((struct areltdata *)((bfd)->arelt_data))->parsed_size)
#define bfd_slurp_bsd_armap   bfd_slurp_armap
#define bfd_slurp_coff_armap   bfd_slurp_armap
#define _bfd_read_ar_hdr(abfd)   BFD_SEND (abfd, _bfd_read_ar_hdr_fn, (abfd))
#define _bfd_generic_close_and_cleanup   bfd_true
#define _bfd_generic_bfd_free_cached_info   bfd_true
#define _bfd_generic_bfd_copy_private_bfd_data   ((bfd_boolean (*) (bfd *, bfd *)) bfd_true)
#define _bfd_generic_bfd_merge_private_bfd_data   ((bfd_boolean (*) (bfd *, bfd *)) bfd_true)
#define _bfd_generic_bfd_set_private_flags   ((bfd_boolean (*) (bfd *, flagword)) bfd_true)
#define _bfd_generic_bfd_copy_private_section_data   ((bfd_boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true)
#define _bfd_generic_bfd_copy_private_symbol_data   ((bfd_boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true)
#define _bfd_generic_bfd_copy_private_header_data   ((bfd_boolean (*) (bfd *, bfd *)) bfd_true)
#define _bfd_generic_bfd_print_private_bfd_data   ((bfd_boolean (*) (bfd *, void *)) bfd_true)
#define _bfd_noarchive_slurp_armap   bfd_false
#define _bfd_noarchive_slurp_extended_name_table   bfd_false
#define _bfd_noarchive_construct_extended_name_table
#define _bfd_noarchive_truncate_arname   ((void (*) (bfd *, const char *, char *)) bfd_void)
#define _bfd_noarchive_write_armap
#define _bfd_noarchive_read_ar_hdr   bfd_nullvoidptr
#define _bfd_noarchive_openr_next_archived_file   ((bfd *(*) (bfd *, bfd *)) bfd_nullvoidptr)
#define _bfd_noarchive_get_elt_at_index   ((bfd *(*) (bfd *, symindex)) bfd_nullvoidptr)
#define _bfd_noarchive_generic_stat_arch_elt   bfd_generic_stat_arch_elt
#define _bfd_noarchive_update_armap_timestamp   bfd_false
#define _bfd_archive_bsd_slurp_armap   bfd_slurp_bsd_armap
#define _bfd_archive_bsd_slurp_extended_name_table   _bfd_slurp_extended_name_table
#define _bfd_archive_bsd_truncate_arname   bfd_bsd_truncate_arname
#define _bfd_archive_bsd_write_armap   bsd_write_armap
#define _bfd_archive_bsd_read_ar_hdr   _bfd_generic_read_ar_hdr
#define _bfd_archive_bsd_openr_next_archived_file   bfd_generic_openr_next_archived_file
#define _bfd_archive_bsd_get_elt_at_index   _bfd_generic_get_elt_at_index
#define _bfd_archive_bsd_generic_stat_arch_elt   bfd_generic_stat_arch_elt
#define _bfd_archive_coff_slurp_armap   bfd_slurp_coff_armap
#define _bfd_archive_coff_slurp_extended_name_table   _bfd_slurp_extended_name_table
#define _bfd_archive_coff_truncate_arname   bfd_dont_truncate_arname
#define _bfd_archive_coff_write_armap   coff_write_armap
#define _bfd_archive_coff_read_ar_hdr   _bfd_generic_read_ar_hdr
#define _bfd_archive_coff_openr_next_archived_file   bfd_generic_openr_next_archived_file
#define _bfd_archive_coff_get_elt_at_index   _bfd_generic_get_elt_at_index
#define _bfd_archive_coff_generic_stat_arch_elt   bfd_generic_stat_arch_elt
#define _bfd_archive_coff_update_armap_timestamp   bfd_true
#define _bfd_nosymbols_get_symtab_upper_bound   _bfd_n1
#define _bfd_nosymbols_canonicalize_symtab   ((long (*) (bfd *, asymbol **)) _bfd_n1)
#define _bfd_nosymbols_make_empty_symbol   _bfd_generic_make_empty_symbol
#define _bfd_nosymbols_print_symbol   ((void (*) (bfd *, void *, asymbol *, bfd_print_symbol_type)) bfd_void)
#define _bfd_nosymbols_get_symbol_info   ((void (*) (bfd *, asymbol *, symbol_info *)) bfd_void)
#define _bfd_nosymbols_bfd_is_local_label_name   ((bfd_boolean (*) (bfd *, const char *)) bfd_false)
#define _bfd_nosymbols_bfd_is_target_special_symbol   ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
#define _bfd_nosymbols_get_lineno   ((alent *(*) (bfd *, asymbol *)) bfd_nullvoidptr)
#define _bfd_nosymbols_find_nearest_line
#define _bfd_nosymbols_find_inliner_info
#define _bfd_nosymbols_bfd_make_debug_symbol   ((asymbol *(*) (bfd *, void *, unsigned long)) bfd_nullvoidptr)
#define _bfd_nosymbols_read_minisymbols   ((long (*) (bfd *, bfd_boolean, void **, unsigned int *)) _bfd_n1)
#define _bfd_nosymbols_minisymbol_to_symbol
#define _bfd_norelocs_bfd_reloc_type_lookup   ((reloc_howto_type *(*) (bfd *, bfd_reloc_code_real_type)) bfd_nullvoidptr)
#define _bfd_norelocs_bfd_reloc_name_lookup   ((reloc_howto_type *(*) (bfd *, const char *)) bfd_nullvoidptr)
#define _bfd_nowrite_set_arch_mach
#define _bfd_nowrite_set_section_contents
#define _bfd_generic_set_arch_mach   bfd_default_set_arch_mach
#define _bfd_nolink_sizeof_headers   ((int (*) (bfd *, struct bfd_link_info *)) bfd_0)
#define _bfd_nolink_bfd_get_relocated_section_contents
#define _bfd_nolink_bfd_relax_section
#define _bfd_nolink_bfd_gc_sections
#define _bfd_nolink_bfd_merge_sections
#define _bfd_nolink_bfd_is_group_section
#define _bfd_nolink_bfd_discard_group
#define _bfd_nolink_bfd_link_hash_table_create   ((struct bfd_link_hash_table *(*) (bfd *)) bfd_nullvoidptr)
#define _bfd_nolink_bfd_link_hash_table_free   ((void (*) (struct bfd_link_hash_table *)) bfd_void)
#define _bfd_nolink_bfd_link_add_symbols   ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) bfd_false)
#define _bfd_nolink_bfd_link_just_syms   ((void (*) (asection *, struct bfd_link_info *)) bfd_void)
#define _bfd_nolink_bfd_final_link   ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) bfd_false)
#define _bfd_nolink_bfd_link_split_section   ((bfd_boolean (*) (bfd *, struct bfd_section *)) bfd_false)
#define _bfd_nolink_section_already_linked   ((void (*) (bfd *, struct bfd_section *, struct bfd_link_info *)) bfd_void)
#define _bfd_nodynamic_get_dynamic_symtab_upper_bound   _bfd_n1
#define _bfd_nodynamic_canonicalize_dynamic_symtab   ((long (*) (bfd *, asymbol **)) _bfd_n1)
#define _bfd_nodynamic_get_synthetic_symtab   ((long (*) (bfd *, long, asymbol **, long, asymbol **, asymbol **)) _bfd_n1)
#define _bfd_nodynamic_get_dynamic_reloc_upper_bound   _bfd_n1
#define _bfd_nodynamic_canonicalize_dynamic_reloc   ((long (*) (bfd *, arelent **, asymbol **)) _bfd_n1)
#define bfd_read_p(abfd)   ((abfd)->direction == read_direction || (abfd)->direction == both_direction)
#define bfd_write_p(abfd)   ((abfd)->direction == write_direction || (abfd)->direction == both_direction)
#define BFD_ASSERT(x)   do { if (!(x)) bfd_assert(__FILE__,__LINE__); } while (0)
#define BFD_FAIL()   do { bfd_assert(__FILE__,__LINE__); } while (0)
#define __PRETTY_FUNCTION__   ((char *) NULL)
#define abort()   _bfd_abort (__FILE__, __LINE__, __PRETTY_FUNCTION__)

Typedefs

typedef struct bfd_link_hash_entry

Functions

void * bfd_malloc (bfd_size_type)
void * bfd_realloc (void *, bfd_size_type)
void * bfd_zmalloc (bfd_size_type)
void * bfd_malloc2 (bfd_size_type, bfd_size_type)
void * bfd_realloc2 (void *, bfd_size_type, bfd_size_type)
void * bfd_zmalloc2 (bfd_size_type, bfd_size_type)
void _bfd_default_error_handler (const char *s,...)
void * bfd_alloc (bfd *, bfd_size_type)
void * bfd_zalloc (bfd *, bfd_size_type)
void * bfd_alloc2 (bfd *, bfd_size_type, bfd_size_type)
void * bfd_zalloc2 (bfd *, bfd_size_type, bfd_size_type)
void bfd_release (bfd *, void *)
bfd_bfd_create_empty_archive_element_shell (bfd *obfd)
bfd_bfd_look_for_bfd_in_cache (bfd *, file_ptr)
bfd_boolean _bfd_add_bfd_to_archive_cache (bfd *, file_ptr, bfd *)
bfd_boolean _bfd_generic_mkarchive (bfd *abfd)
const bfd_targetbfd_generic_archive_p (bfd *abfd)
bfd_boolean bfd_slurp_armap (bfd *abfd)
bfd_boolean bfd_slurp_bsd_armap_f2 (bfd *abfd)
bfd_boolean _bfd_slurp_extended_name_table (bfd *abfd)
 Extended name table.
bfd_boolean _bfd_construct_extended_name_table (bfd *, bfd_boolean, char **, bfd_size_type *)
bfd_boolean _bfd_write_archive_contents (bfd *abfd)
bfd_boolean _bfd_compute_and_write_armap (bfd *, unsigned int elength)
bfd_bfd_get_elt_at_filepos (bfd *archive, file_ptr filepos)
bfd_bfd_generic_get_elt_at_index (bfd *, symindex)
bfd_bfd_new_bfd (void)
void _bfd_delete_bfd (bfd *)
bfd_boolean _bfd_free_cached_info (bfd *)
bfd_boolean bfd_false (bfd *ignore)
bfd_boolean bfd_true (bfd *ignore)
void * bfd_nullvoidptr (bfd *ignore)
int bfd_0 (bfd *ignore)
unsigned int bfd_0u (bfd *ignore)
long bfd_0l (bfd *ignore)
long _bfd_n1 (bfd *ignore)
void bfd_void (bfd *ignore)
bfd_bfd_new_bfd_contained_in (bfd *)
const bfd_target_bfd_dummy_target (bfd *abfd)
void bfd_dont_truncate_arname (bfd *abfd, const char *filename, char *hdr)
void bfd_bsd_truncate_arname (bfd *abfd, const char *filename, char *hdr)
void bfd_gnu_truncate_arname (bfd *abfd, const char *filename, char *hdr)
bfd_boolean bsd_write_armap (bfd *arch, unsigned int elength, struct orl *map, unsigned int orl_count, int stridx)
bfd_boolean coff_write_armap (bfd *arch, unsigned int elength, struct orl *map, unsigned int orl_count, int stridx)
void * _bfd_generic_read_ar_hdr (bfd *)
void _bfd_ar_spacepad (char *, size_t, const char *, long)
void * _bfd_generic_read_ar_hdr_mag (bfd *, const char *)
bfdbfd_generic_openr_next_archived_file (bfd *archive, bfd *last_file)
int bfd_generic_stat_arch_elt (bfd *, struct stat *)
bfd_boolean _bfd_generic_new_section_hook (bfd *, asection *)
bfd_boolean _bfd_generic_get_section_contents (bfd *, asection *, void *, file_ptr, bfd_size_type)
bfd_boolean _bfd_generic_get_section_contents_in_window (bfd *, asection *, bfd_window *, file_ptr, bfd_size_type)
bfd_boolean _bfd_generic_init_private_section_data (bfd *, asection *, bfd *, asection *, struct bfd_link_info *)
char * _bfd_nocore_core_file_failing_command (bfd *)
int _bfd_nocore_core_file_failing_signal (bfd *)
bfd_boolean _bfd_nocore_core_file_matches_executable_p (bfd *, bfd *)
bfd_boolean _bfd_archive_bsd_construct_extended_name_table (bfd *, char **, bfd_size_type *, const char **)
bfd_boolean _bfd_archive_bsd_update_armap_timestamp (bfd *)
bfd_boolean _bfd_archive_coff_construct_extended_name_table (bfd *, char **, bfd_size_type *, const char **)
long _bfd_norelocs_get_reloc_upper_bound (bfd *, asection *)
long _bfd_norelocs_canonicalize_reloc (bfd *, asection *, arelent **, asymbol **)
bfd_boolean _bfd_generic_set_section_contents (bfd *, asection *, const void *, file_ptr, bfd_size_type)
bfd_boolean bfd_generic_is_local_label_name (bfd *, const char *)
long _bfd_generic_read_minisymbols (bfd *, bfd_boolean, void **, unsigned int *)
asymbol_bfd_generic_minisymbol_to_symbol (bfd *, bfd_boolean, const void *, asymbol *)
bfd_boolean _bfd_stab_section_find_nearest_line (bfd *, asymbol **, asection *, bfd_vma, bfd_boolean *, const char **, const char **, unsigned int *, void **)
bfd_boolean _bfd_dwarf1_find_nearest_line (bfd *, asection *, asymbol **, bfd_vma, const char **, const char **, unsigned int *)
bfd_boolean _bfd_dwarf2_find_nearest_line (bfd *, asection *, asymbol **, bfd_vma, const char **, const char **, unsigned int *, unsigned int, void **)
bfd_boolean _bfd_dwarf2_find_line (bfd *, asymbol **, asymbol *, const char **, unsigned int *, unsigned int, void **)
bfd_boolean _bfd_generic_find_line (bfd *, asymbol **, asymbol *, const char **, unsigned int *)
bfd_boolean _bfd_dwarf2_find_inliner_info (bfd *, const char **, const char **, unsigned int *, void **)
struct bfd_hash_entrybfd_section_hash_newfunc (struct bfd_hash_entry *, struct bfd_hash_table *, const char *)
struct bfd_hash_entry_bfd_link_hash_newfunc (struct bfd_hash_entry *entry, struct bfd_hash_table *table, const char *string)
bfd_boolean _bfd_link_hash_table_init (struct bfd_link_hash_table *, bfd *, struct bfd_hash_entry *(*)(struct bfd_hash_entry *, struct bfd_hash_table *, const char *), unsigned int)
struct bfd_link_hash_table_bfd_generic_link_hash_table_create (bfd *)
void _bfd_generic_link_hash_table_free (struct bfd_link_hash_table *)
bfd_boolean _bfd_generic_link_add_symbols (bfd *, struct bfd_link_info *)
bfd_boolean _bfd_generic_link_add_symbols_collect (bfd *, struct bfd_link_info *)
bfd_boolean _bfd_generic_link_add_archive_symbols (bfd *, struct bfd_link_info *, bfd_boolean(*)(bfd *, struct bfd_link_info *, bfd_boolean *))
bfd_boolean _bfd_generic_link_add_one_symbol (struct bfd_link_info *, bfd *, const char *name, flagword, asection *, bfd_vma, const char *, bfd_boolean copy, bfd_boolean constructor, struct bfd_link_hash_entry **)
void _bfd_generic_link_just_syms (asection *, struct bfd_link_info *)
bfd_boolean _bfd_generic_final_link (bfd *, struct bfd_link_info *)
bfd_boolean _bfd_generic_link_split_section (bfd *, struct bfd_section *)
void _bfd_generic_section_already_linked (bfd *, struct bfd_section *, struct bfd_link_info *)
bfd_boolean _bfd_generic_reloc_link_order (bfd *, struct bfd_link_info *, asection *, struct bfd_link_order *)
bfd_boolean _bfd_default_link_order (bfd *, struct bfd_link_info *, asection *, struct bfd_link_order *)
unsigned int _bfd_count_link_order_relocs (struct bfd_link_order *)
bfd_reloc_status_type _bfd_final_link_relocate (reloc_howto_type *, bfd *, asection *, bfd_byte *, bfd_vma, bfd_vma, bfd_vma)
bfd_reloc_status_type _bfd_relocate_contents (reloc_howto_type *, bfd *, bfd_vma, bfd_byte *)
void _bfd_clear_contents (reloc_howto_type *howto, bfd *input_bfd, bfd_byte *location)
bfd_boolean _bfd_link_section_stabs (bfd *, struct stab_info *, asection *, asection *, void **, bfd_size_type *)
bfd_boolean _bfd_discard_section_stabs (bfd *, asection *, void *, bfd_boolean(*)(bfd_vma, void *), void *)
bfd_boolean _bfd_write_section_stabs (bfd *, struct stab_info *, asection *, void **, bfd_byte *)
bfd_boolean _bfd_write_stab_strings (bfd *, struct stab_info *)
bfd_vma _bfd_stab_section_offset (asection *, void *, bfd_vma)
bfd_boolean _bfd_add_merge_section (bfd *, void **, asection *, void **)
bfd_boolean _bfd_merge_sections (bfd *, struct bfd_link_info *, void *, void(*)(bfd *, asection *))
bfd_boolean _bfd_write_merged_section (bfd *, asection *, void *)
bfd_vma _bfd_merged_section_offset (bfd *, asection **, void *, bfd_vma)
struct bfd_strtab_hash_bfd_stringtab_init (void)
struct bfd_strtab_hash_bfd_xcoff_stringtab_init (void)
void _bfd_stringtab_free (struct bfd_strtab_hash *)
bfd_size_type _bfd_stringtab_size (struct bfd_strtab_hash *)
bfd_size_type _bfd_stringtab_add (struct bfd_strtab_hash *, const char *, bfd_boolean hash, bfd_boolean copy)
bfd_boolean _bfd_stringtab_emit (bfd *, struct bfd_strtab_hash *)
bfd_boolean _bfd_generic_verify_endian_match (bfd *, bfd *)
void bfd_assert (const char *, int)
void _bfd_abort (const char *, int, const char *) ATTRIBUTE_NORETURN
file_ptr real_ftell (FILE *file)
int real_fseek (FILE *file, file_ptr offset, int whence)
FILE * real_fopen (const char *filename, const char *modes)
bfd_boolean _bfd_ecoff_locate_line (bfd *, asection *, bfd_vma, struct ecoff_debug_info *const, const struct ecoff_debug_swap *const, struct ecoff_find_line *, const char **, const char **, unsigned int *)
bfd_boolean _bfd_ecoff_get_accumulated_pdr (void *, bfd_byte *)
bfd_boolean _bfd_ecoff_get_accumulated_sym (void *, bfd_byte *)
bfd_boolean _bfd_ecoff_get_accumulated_ss (void *, bfd_byte *)
bfd_vma _bfd_get_gp_value (bfd *)
void _bfd_set_gp_value (bfd *, bfd_vma)
bfd_boolean _bfd_sh_align_load_span (bfd *, asection *, bfd_byte *, bfd_boolean(*)(bfd *, asection *, void *, bfd_byte *, bfd_vma), void *, bfd_vma **, bfd_vma *, bfd_vma, bfd_vma, bfd_boolean *)
struct
bfd_section_already_linked_hash_entry
bfd_section_already_linked_table_lookup (const char *)
void bfd_section_already_linked_table_insert (struct bfd_section_already_linked_hash_entry *, asection *)
void bfd_section_already_linked_table_traverse (bfd_boolean(*)(struct bfd_section_already_linked_hash_entry *, void *), void *)
bfd_vma read_unsigned_leb128 (bfd *, bfd_byte *, unsigned int *)
bfd_signed_vma read_signed_leb128 (bfd *, bfd_byte *, unsigned int *)
bfd_boolean bfd_write_bigendian_4byte_int (bfd *, unsigned int)
unsigned int bfd_log2 (bfd_vma x)
bfd_boolean bfd_cache_init (bfd *abfd)
bfd_boolean bfd_cache_close (bfd *abfd)
FILE * bfd_open_file (bfd *abfd)
reloc_howto_type * bfd_default_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code)
bfd_boolean bfd_generic_relax_section (bfd *abfd, asection *section, struct bfd_link_info *, bfd_boolean *)
bfd_boolean bfd_generic_gc_sections (bfd *, struct bfd_link_info *)
bfd_boolean bfd_generic_merge_sections (bfd *, struct bfd_link_info *)
bfd_bytebfd_generic_get_relocated_section_contents (bfd *abfd, struct bfd_link_info *link_info, struct bfd_link_order *link_order, bfd_byte *data, bfd_boolean relocatable, asymbol **symbols)
bfd_boolean bfd_default_set_arch_mach (bfd *abfd, enum bfd_architecture arch, unsigned long mach)
const bfd_arch_info_typebfd_default_compatible (const bfd_arch_info_type *a, const bfd_arch_info_type *b)
bfd_boolean bfd_default_scan (const struct bfd_arch_info *info, const char *string)
struct elf_internal_shdrbfd_elf_find_section (bfd *abfd, char *name)

Variables

bfd_error_handler_type _bfd_error_handler
const bfd_target *constbfd_target_vector
const bfd_targetbfd_default_vector []
const bfd_target *constbfd_associated_vector
const bfd_arch_info_type bfd_default_arch_struct

Class Documentation

struct bfd_in_memory

Definition at line 48 of file libbfd-in.h.

Class Members
bfd_byte * buffer
bfd_size_type size
struct section_hash_entry

Definition at line 56 of file libbfd-in.h.

Collaboration diagram for section_hash_entry:
Class Members
asection section
struct artdata

Definition at line 65 of file libbfd-in.h.

Collaboration diagram for artdata:
Class Members
bfd * archive_head
file_ptr armap_datepos
long armap_timestamp
htab_t cache
char * extended_names
bfd_size_type extended_names_size
file_ptr first_file_filepos
symindex symdef_count
carsym * symdefs
void * tdata
struct areltdata

Definition at line 89 of file libbfd-in.h.

Class Members
char * arch_header
char * filename
unsigned int parsed_size
struct bfd_section_already_linked_hash_entry

Definition at line 714 of file libbfd-in.h.

Collaboration diagram for bfd_section_already_linked_hash_entry:
Class Members
struct bfd_section_already_linked * entry
struct bfd_section_already_linked

Definition at line 720 of file libbfd-in.h.

Collaboration diagram for bfd_section_already_linked:
Class Members
struct bfd_section_already_linked * next
asection * sec
struct _bfd_window_internal

Definition at line 771 of file libbfd.h.

Collaboration diagram for _bfd_window_internal:
Class Members
void * data
unsigned mapped: 1
struct _bfd_window_internal * next
int refcount: 31
bfd_size_type size

Define Documentation

#define __PRETTY_FUNCTION__   ((char *) NULL)

Definition at line 662 of file libbfd.h.

Definition at line 298 of file libbfd.h.

Definition at line 297 of file libbfd.h.

Definition at line 295 of file libbfd.h.

Definition at line 294 of file libbfd.h.

Definition at line 287 of file libbfd.h.

Definition at line 288 of file libbfd.h.

Definition at line 292 of file libbfd.h.

Definition at line 293 of file libbfd.h.

Definition at line 317 of file libbfd.h.

Definition at line 316 of file libbfd.h.

Definition at line 314 of file libbfd.h.

Definition at line 313 of file libbfd.h.

Definition at line 306 of file libbfd.h.

Definition at line 307 of file libbfd.h.

Definition at line 311 of file libbfd.h.

Definition at line 319 of file libbfd.h.

Definition at line 312 of file libbfd.h.

Definition at line 235 of file libbfd.h.

Definition at line 245 of file libbfd.h.

Definition at line 241 of file libbfd.h.

Definition at line 243 of file libbfd.h.

Definition at line 224 of file libbfd.h.

Definition at line 237 of file libbfd.h.

Definition at line 247 of file libbfd.h.

Definition at line 239 of file libbfd.h.

Definition at line 223 of file libbfd.h.

Definition at line 377 of file libbfd.h.

Value:
((bfd_boolean (*) (bfd *, char **, bfd_size_type *, const char **)) \
   bfd_false)

Definition at line 268 of file libbfd.h.

Definition at line 281 of file libbfd.h.

Definition at line 279 of file libbfd.h.

Definition at line 277 of file libbfd.h.

Definition at line 276 of file libbfd.h.

Definition at line 266 of file libbfd.h.

Definition at line 267 of file libbfd.h.

#define _bfd_noarchive_truncate_arname   ((void (*) (bfd *, const char *, char *)) bfd_void)

Definition at line 271 of file libbfd.h.

Definition at line 282 of file libbfd.h.

Value:
((bfd_boolean (*) (bfd *, unsigned int, struct orl *, unsigned int, int)) \
   bfd_false)

Definition at line 273 of file libbfd.h.

Definition at line 431 of file libbfd.h.

Definition at line 426 of file libbfd.h.

Definition at line 430 of file libbfd.h.

Definition at line 425 of file libbfd.h.

Definition at line 428 of file libbfd.h.

Value:
((bfd_boolean (*) (bfd *, struct bfd_section *)) \
   bfd_false)

Definition at line 403 of file libbfd.h.

Definition at line 414 of file libbfd.h.

Value:
((bfd_boolean (*) (bfd *, struct bfd_link_info *)) \
   bfd_false)

Definition at line 394 of file libbfd.h.

Value:
((bfd_byte *(*) (bfd *, struct bfd_link_info *, struct bfd_link_order *, \
		   bfd_byte *, bfd_boolean, asymbol **)) \
   bfd_nullvoidptr)

Definition at line 386 of file libbfd.h.

Value:
((bfd_boolean (*) (bfd *, const struct bfd_section *)) \
   bfd_false)

Definition at line 400 of file libbfd.h.

Definition at line 410 of file libbfd.h.

Definition at line 406 of file libbfd.h.

Definition at line 408 of file libbfd.h.

Definition at line 412 of file libbfd.h.

Definition at line 416 of file libbfd.h.

Value:
((bfd_boolean (*) (bfd *, struct bfd_link_info *)) \
   bfd_false)

Definition at line 397 of file libbfd.h.

Value:
((bfd_boolean (*) \
    (bfd *, asection *, struct bfd_link_info *, bfd_boolean *)) \
   bfd_false)

Definition at line 390 of file libbfd.h.

Definition at line 418 of file libbfd.h.

Definition at line 384 of file libbfd.h.

#define _bfd_norelocs_bfd_reloc_name_lookup   ((reloc_howto_type *(*) (bfd *, const char *)) bfd_nullvoidptr)

Definition at line 361 of file libbfd.h.

Definition at line 359 of file libbfd.h.

Definition at line 332 of file libbfd.h.

Definition at line 334 of file libbfd.h.

Definition at line 345 of file libbfd.h.

Definition at line 325 of file libbfd.h.

Value:
((bfd_boolean (*) (bfd *, const char **, const char **, unsigned int *)) \
   bfd_false)

Definition at line 342 of file libbfd.h.

Value:
((bfd_boolean (*) (bfd *, asection *, asymbol **, bfd_vma, const char **, \
                   const char **, unsigned int *)) \
   bfd_false)

Definition at line 338 of file libbfd.h.

Definition at line 336 of file libbfd.h.

#define _bfd_nosymbols_get_symbol_info   ((void (*) (bfd *, asymbol *, symbol_info *)) bfd_void)

Definition at line 330 of file libbfd.h.

Definition at line 324 of file libbfd.h.

Definition at line 327 of file libbfd.h.

Value:
((asymbol *(*) (bfd *, bfd_boolean, const void *, asymbol *)) \
   bfd_nullvoidptr)

Definition at line 349 of file libbfd.h.

#define _bfd_nosymbols_print_symbol   ((void (*) (bfd *, void *, asymbol *, bfd_print_symbol_type)) bfd_void)

Definition at line 328 of file libbfd.h.

#define _bfd_nosymbols_read_minisymbols   ((long (*) (bfd *, bfd_boolean, void **, unsigned int *)) _bfd_n1)

Definition at line 347 of file libbfd.h.

Value:
((bfd_boolean (*) (bfd *, enum bfd_architecture, unsigned long)) \
   bfd_false)

Definition at line 367 of file libbfd.h.

Value:
((bfd_boolean (*) (bfd *, asection *, const void *, file_ptr, bfd_size_type)) \
   bfd_false)

Definition at line 370 of file libbfd.h.

#define _bfd_read_ar_hdr (   abfd)    BFD_SEND (abfd, _bfd_read_ar_hdr_fn, (abfd))

Definition at line 217 of file libbfd.h.

#define abort (   void)    _bfd_abort (__FILE__, __LINE__, __PRETTY_FUNCTION__)

Definition at line 666 of file libbfd.h.

#define arelt_size (   bfd)    (((struct areltdata *)((bfd)->arelt_data))->parsed_size)

Definition at line 100 of file libbfd.h.

#define BFD_ALIGN (   this,
  boundary 
)
Value:
((((bfd_vma) (this) + (boundary) - 1) >= (bfd_vma) (this))              \
   ? (((bfd_vma) (this) + ((boundary) - 1)) & ~ (bfd_vma) ((boundary)-1)) \
   : ~ (bfd_vma) 0)

Definition at line 37 of file libbfd.h.

#define bfd_ardata (   bfd)    ((bfd)->tdata.aout_ar_data)

Definition at line 91 of file libbfd.h.

#define BFD_ASSERT (   x)    do { if (!(x)) bfd_assert(__FILE__,__LINE__); } while (0)

Definition at line 651 of file libbfd.h.

#define BFD_FAIL ( )    do { bfd_assert(__FILE__,__LINE__); } while (0)

Definition at line 654 of file libbfd.h.

#define bfd_read_p (   abfd)    ((abfd)->direction == read_direction || (abfd)->direction == both_direction)

Definition at line 643 of file libbfd.h.

Definition at line 145 of file libbfd.h.

Definition at line 146 of file libbfd.h.

#define bfd_write_p (   abfd)    ((abfd)->direction == write_direction || (abfd)->direction == both_direction)

Definition at line 645 of file libbfd.h.

#define DEFAULT_BUFFERSIZE   8192

Definition at line 44 of file libbfd.h.

#define set_tdata (   bfd,
  v 
)    ((bfd)->tdata.any = (v))

Definition at line 48 of file libbfd.h.


Typedef Documentation

Definition at line 513 of file libbfd.h.


Function Documentation

void _bfd_abort ( const char *  ,
int  ,
const char *   
)

Definition at line 836 of file bfd.c.

{
  if (fn != NULL)
    (*_bfd_error_handler)
      (_("BFD %s internal error, aborting at %s line %d in %s\n"),
       BFD_VERSION_STRING, file, line, fn);
  else
    (*_bfd_error_handler)
      (_("BFD %s internal error, aborting at %s line %d\n"),
       BFD_VERSION_STRING, file, line);
  (*_bfd_error_handler) (_("Please report this bug.\n"));
  _exit (EXIT_FAILURE);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 305 of file archive.c.

{
  struct ar_cache *cache;
  htab_t hash_table = bfd_ardata (arch_bfd)->cache;

  /* If the hash table hasn't been created, create it.  */
  if (hash_table == NULL)
    {
      hash_table = htab_create_alloc (16, hash_file_ptr, eq_file_ptr,
                                  NULL, calloc, free);
      if (hash_table == NULL)
       return FALSE;
      bfd_ardata (arch_bfd)->cache = hash_table;
    }

  /* Insert new_elt into the hash table by filepos.  */
  cache = bfd_zalloc (arch_bfd, sizeof (struct ar_cache));
  cache->ptr = filepos;
  cache->arbfd = new_elt;
  *htab_find_slot (hash_table, (const void *) cache, INSERT) = cache;

  return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bfd_boolean _bfd_add_merge_section ( bfd ,
void **  ,
asection ,
void **   
)

Definition at line 346 of file merge.c.

{
  struct sec_merge_info *sinfo;
  struct sec_merge_sec_info *secinfo;
  unsigned int align;
  bfd_size_type amt;

  if ((abfd->flags & DYNAMIC) != 0
      || (sec->flags & SEC_MERGE) == 0)
    abort ();

  if (sec->size == 0
      || (sec->flags & SEC_EXCLUDE) != 0
      || sec->entsize == 0)
    return TRUE;

  if ((sec->flags & SEC_RELOC) != 0)
    {
      /* We aren't prepared to handle relocations in merged sections.  */
      return TRUE;
    }

  align = sec->alignment_power;
  if ((sec->entsize < (unsigned) 1 << align
       && ((sec->entsize & (sec->entsize - 1))
          || !(sec->flags & SEC_STRINGS)))
      || (sec->entsize > (unsigned) 1 << align
         && (sec->entsize & (((unsigned) 1 << align) - 1))))
    {
      /* Sanity check.  If string character size is smaller than
        alignment, then we require character size to be a power
        of 2, otherwise character size must be integer multiple
        of alignment.  For non-string constants, alignment must
        be smaller than or equal to entity size and entity size
        must be integer multiple of alignment.  */
      return TRUE;
    }

  for (sinfo = (struct sec_merge_info *) *psinfo; sinfo; sinfo = sinfo->next)
    if ((secinfo = sinfo->chain)
       && ! ((secinfo->sec->flags ^ sec->flags) & (SEC_MERGE | SEC_STRINGS))
       && secinfo->sec->entsize == sec->entsize
       && secinfo->sec->alignment_power == sec->alignment_power
       && secinfo->sec->output_section == sec->output_section)
      break;

  if (sinfo == NULL)
    {
      /* Initialize the information we need to keep track of.  */
      sinfo = bfd_alloc (abfd, sizeof (struct sec_merge_info));
      if (sinfo == NULL)
       goto error_return;
      sinfo->next = (struct sec_merge_info *) *psinfo;
      sinfo->chain = NULL;
      *psinfo = sinfo;
      sinfo->htab = sec_merge_init (sec->entsize, (sec->flags & SEC_STRINGS));
      if (sinfo->htab == NULL)
       goto error_return;
    }

  /* Read the section from abfd.  */

  amt = sizeof (struct sec_merge_sec_info) + sec->size - 1;
  *psecinfo = bfd_alloc (abfd, amt);
  if (*psecinfo == NULL)
    goto error_return;

  secinfo = (struct sec_merge_sec_info *) *psecinfo;
  if (sinfo->chain)
    {
      secinfo->next = sinfo->chain->next;
      sinfo->chain->next = secinfo;
    }
  else
    secinfo->next = secinfo;
  sinfo->chain = secinfo;
  secinfo->sec = sec;
  secinfo->psecinfo = psecinfo;
  secinfo->htab = sinfo->htab;
  secinfo->first_str = NULL;

  sec->rawsize = sec->size;
  if (! bfd_get_section_contents (sec->owner, sec, secinfo->contents,
                              0, sec->size))
    goto error_return;

  return TRUE;

 error_return:
  *psecinfo = NULL;
  return FALSE;
}

Here is the call graph for this function:

void _bfd_ar_spacepad ( char *  ,
size_t  ,
const char *  ,
long   
)

Definition at line 163 of file archive.c.

{
  static char buf[20];
  size_t len;
  snprintf (buf, sizeof (buf), fmt, val);
  len = strlen (buf);
  if (len < n)
    {
      memcpy (p, buf, len);
      memset (p + len, ' ', n - len);
    }
  else
    memcpy (p, buf, n);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1194 of file archive.c.

{
  *name = "ARFILENAMES/";
  return _bfd_construct_extended_name_table (abfd, FALSE, tabloc, tablen);
}

Here is the call graph for this function:

Definition at line 2010 of file archive.c.

{
  struct stat archstat;
  struct ar_hdr hdr;

  /* Flush writes, get last-write timestamp from file, and compare it
     to the timestamp IN the file.  */
  bfd_flush (arch);
  if (bfd_stat (arch, &archstat) == -1)
    {
      bfd_perror (_("Reading archive file mod timestamp"));

      /* Can't read mod time for some reason.  */
      return TRUE;
    }
  if (archstat.st_mtime <= bfd_ardata (arch)->armap_timestamp)
    /* OK by the linker's rules.  */
    return TRUE;

  /* Update the timestamp.  */
  bfd_ardata (arch)->armap_timestamp = archstat.st_mtime + ARMAP_TIME_OFFSET;

  /* Prepare an ASCII version suitable for writing.  */
  memset (hdr.ar_date, ' ', sizeof (hdr.ar_date));
  _bfd_ar_spacepad (hdr.ar_date, sizeof (hdr.ar_date), "%ld",
                    bfd_ardata (arch)->armap_timestamp);

  /* Write it into the file.  */
  bfd_ardata (arch)->armap_datepos = (SARMAG
                                  + offsetof (struct ar_hdr, ar_date[0]));
  if (bfd_seek (arch, bfd_ardata (arch)->armap_datepos, SEEK_SET) != 0
      || (bfd_bwrite (hdr.ar_date, sizeof (hdr.ar_date), arch)
         != sizeof (hdr.ar_date)))
    {
      bfd_perror (_("Writing updated armap timestamp"));

      /* Some error while writing.  */
      return TRUE;
    }

  /* We updated the timestamp successfully.  */
  return FALSE;
}

Here is the call graph for this function:

Definition at line 1206 of file archive.c.

{
  *name = "//";
  return _bfd_construct_extended_name_table (abfd, TRUE, tabloc, tablen);
}

Here is the call graph for this function:

void _bfd_clear_contents ( reloc_howto_type *  howto,
bfd input_bfd,
bfd_byte location 
)

Definition at line 1553 of file reloc.c.

{
  int size;
  bfd_vma x = 0;

  /* Get the value we are going to relocate.  */
  size = bfd_get_reloc_size (howto);
  switch (size)
    {
    default:
    case 0:
      abort ();
    case 1:
      x = bfd_get_8 (input_bfd, location);
      break;
    case 2:
      x = bfd_get_16 (input_bfd, location);
      break;
    case 4:
      x = bfd_get_32 (input_bfd, location);
      break;
    case 8:
#ifdef BFD64
      x = bfd_get_64 (input_bfd, location);
#else
      abort ();
#endif
      break;
    }

  /* Zero out the unwanted bits of X.  */
  x &= ~howto->dst_mask;

  /* Put the relocated value back in the object file.  */
  switch (size)
    {
    default:
    case 0:
      abort ();
    case 1:
      bfd_put_8 (input_bfd, x, location);
      break;
    case 2:
      bfd_put_16 (input_bfd, x, location);
      break;
    case 4:
      bfd_put_32 (input_bfd, x, location);
      break;
    case 8:
#ifdef BFD64
      bfd_put_64 (input_bfd, x, location);
#else
      abort ();
#endif
      break;
    }
}

Here is the call graph for this function:

Definition at line 1772 of file archive.c.

{
  char *first_name = NULL;
  bfd *current;
  file_ptr elt_no = 0;
  struct orl *map = NULL;
  unsigned int orl_max = 1024;            /* Fine initial default.  */
  unsigned int orl_count = 0;
  int stridx = 0;
  asymbol **syms = NULL;
  long syms_max = 0;
  bfd_boolean ret;
  bfd_size_type amt;

  /* Dunno if this is the best place for this info...  */
  if (elength != 0)
    elength += sizeof (struct ar_hdr);
  elength += elength % 2;

  amt = orl_max * sizeof (struct orl);
  map = bfd_malloc (amt);
  if (map == NULL)
    goto error_return;

  /* We put the symbol names on the arch objalloc, and then discard
     them when done.  */
  first_name = bfd_alloc (arch, 1);
  if (first_name == NULL)
    goto error_return;

  /* Drop all the files called __.SYMDEF, we're going to make our own.  */
  while (arch->archive_head &&
        strcmp (arch->archive_head->filename, "__.SYMDEF") == 0)
    arch->archive_head = arch->archive_head->next;

  /* Map over each element.  */
  for (current = arch->archive_head;
       current != NULL;
       current = current->next, elt_no++)
    {
      if (bfd_check_format (current, bfd_object)
         && (bfd_get_file_flags (current) & HAS_SYMS) != 0)
       {
         long storage;
         long symcount;
         long src_count;

         storage = bfd_get_symtab_upper_bound (current);
         if (storage < 0)
           goto error_return;

         if (storage != 0)
           {
             if (storage > syms_max)
              {
                if (syms_max > 0)
                  free (syms);
                syms_max = storage;
                syms = bfd_malloc (syms_max);
                if (syms == NULL)
                  goto error_return;
              }
             symcount = bfd_canonicalize_symtab (current, syms);
             if (symcount < 0)
              goto error_return;

             /* Now map over all the symbols, picking out the ones we
                 want.  */
             for (src_count = 0; src_count < symcount; src_count++)
              {
                flagword flags = (syms[src_count])->flags;
                asection *sec = syms[src_count]->section;

                if ((flags & BSF_GLOBAL ||
                     flags & BSF_WEAK ||
                     flags & BSF_INDIRECT ||
                     bfd_is_com_section (sec))
                    && ! bfd_is_und_section (sec))
                  {
                    bfd_size_type namelen;
                    struct orl *new_map;

                    /* This symbol will go into the archive header.  */
                    if (orl_count == orl_max)
                     {
                       orl_max *= 2;
                       amt = orl_max * sizeof (struct orl);
                       new_map = bfd_realloc (map, amt);
                       if (new_map == NULL)
                         goto error_return;

                       map = new_map;
                     }

                    namelen = strlen (syms[src_count]->name);
                    amt = sizeof (char *);
                    map[orl_count].name = bfd_alloc (arch, amt);
                    if (map[orl_count].name == NULL)
                     goto error_return;
                    *(map[orl_count].name) = bfd_alloc (arch, namelen + 1);
                    if (*(map[orl_count].name) == NULL)
                     goto error_return;
                    strcpy (*(map[orl_count].name), syms[src_count]->name);
                    map[orl_count].u.abfd = current;
                    map[orl_count].namidx = stridx;

                    stridx += namelen + 1;
                    ++orl_count;
                  }
              }
           }

         /* Now ask the BFD to free up any cached information, so we
            don't fill all of memory with symbol tables.  */
         if (! bfd_free_cached_info (current))
           goto error_return;
       }
    }

  /* OK, now we have collected all the data, let's write them out.  */
  ret = BFD_SEND (arch, write_armap,
                (arch, elength, map, orl_count, stridx));

  if (syms_max > 0)
    free (syms);
  if (map != NULL)
    free (map);
  if (first_name != NULL)
    bfd_release (arch, first_name);

  return ret;

 error_return:
  if (syms_max > 0)
    free (syms);
  if (map != NULL)
    free (map);
  if (first_name != NULL)
    bfd_release (arch, first_name);

  return FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1224 of file archive.c.

{
  unsigned int maxname = abfd->xvec->ar_max_namelen;
  bfd_size_type total_namelen = 0;
  bfd *current;
  char *strptr;

  *tablen = 0;

  /* Figure out how long the table should be.  */
  for (current = abfd->archive_head; current != NULL; current = current->next)
    {
      const char *normal;
      unsigned int thislen;

      normal = normalize (current, current->filename);
      if (normal == NULL)
       return FALSE;

      thislen = strlen (normal);

      if (thislen > maxname
         && (bfd_get_file_flags (abfd) & BFD_TRADITIONAL_FORMAT) != 0)
       thislen = maxname;

      if (thislen > maxname)
       {
         /* Add one to leave room for \n.  */
         total_namelen += thislen + 1;
         if (trailing_slash)
           {
             /* Leave room for trailing slash.  */
             ++total_namelen;
           }
       }
      else
       {
         struct ar_hdr *hdr = arch_hdr (current);
         if (strncmp (normal, hdr->ar_name, thislen) != 0
             || (thislen < sizeof hdr->ar_name
                && hdr->ar_name[thislen] != ar_padchar (current)))
           {
             /* Must have been using extended format even though it
                didn't need to.  Fix it to use normal format.  */
             memcpy (hdr->ar_name, normal, thislen);
             if (thislen < maxname
                || (thislen == maxname && thislen < sizeof hdr->ar_name))
              hdr->ar_name[thislen] = ar_padchar (current);
           }
       }
    }

  if (total_namelen == 0)
    return TRUE;

  *tabloc = bfd_zalloc (abfd, total_namelen);
  if (*tabloc == NULL)
    return FALSE;

  *tablen = total_namelen;
  strptr = *tabloc;

  for (current = abfd->archive_head; current != NULL; current =
       current->next)
    {
      const char *normal;
      unsigned int thislen;

      normal = normalize (current, current->filename);
      if (normal == NULL)
       return FALSE;

      thislen = strlen (normal);
      if (thislen > maxname)
       {
         /* Works for now; may need to be re-engineered if we
            encounter an oddball archive format and want to
            generalise this hack.  */
         struct ar_hdr *hdr = arch_hdr (current);
         strcpy (strptr, normal);
         if (! trailing_slash)
           strptr[thislen] = '\012';
         else
           {
             strptr[thislen] = '/';
             strptr[thislen + 1] = '\012';
           }
         hdr->ar_name[0] = ar_padchar (current);
          _bfd_ar_spacepad (hdr->ar_name + 1, maxname - 1, "%-ld",
                            strptr - *tabloc);
         strptr += thislen + 1;
         if (trailing_slash)
           ++strptr;
       }
    }

  return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2834 of file linker.c.

{
  register unsigned int c;
  register struct bfd_link_order *l;

  c = 0;
  for (l = link_order; l != NULL; l = l->next)
    {
      if (l->type == bfd_section_reloc_link_order
         || l->type == bfd_symbol_reloc_link_order)
       ++c;
    }

  return c;
}

Definition at line 243 of file archive.c.

{
  return _bfd_new_bfd_contained_in (obfd);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void _bfd_default_error_handler ( const char *  s,
  ... 
)

Definition at line 469 of file bfd.c.

{
  va_list ap;
  char *bufp;
  const char *new_fmt, *p;
  size_t avail = 1000;
  char buf[1000];

  if (_bfd_error_program_name != NULL)
    fprintf (stderr, "%s: ", _bfd_error_program_name);
  else
    fprintf (stderr, "BFD: ");

  va_start (ap, fmt);
  new_fmt = fmt;
  bufp = buf;

  /* Reserve enough space for the existing format string.  */
  avail -= strlen (fmt) + 1;
  if (avail > 1000)
    _exit (EXIT_FAILURE);

  p = fmt;
  while (1)
    {
      char *q;
      size_t len, extra, trim;

      p = strchr (p, '%');
      if (p == NULL || p[1] == '\0')
       {
         if (new_fmt == buf)
           {
             len = strlen (fmt);
             memcpy (bufp, fmt, len + 1);
           }
         break;
       }

      if (p[1] == 'A' || p[1] == 'B')
       {
         len = p - fmt;
         memcpy (bufp, fmt, len);
         bufp += len;
         fmt = p + 2;
         new_fmt = buf;

         /* If we run out of space, tough, you lose your ridiculously
            long file or section name.  It's not safe to try to alloc
            memory here;  We might be printing an out of memory message.  */
         if (avail == 0)
           {
             *bufp++ = '*';
             *bufp++ = '*';
             *bufp = '\0';
           }
         else
           {
             if (p[1] == 'B')
              {
                bfd *abfd = va_arg (ap, bfd *);

                if (abfd == NULL)
                  /* Invoking %B with a null bfd pointer is an internal error.  */
                  abort ();
                else if (abfd->my_archive)
                  snprintf (bufp, avail, "%s(%s)",
                           abfd->my_archive->filename, abfd->filename);
                else
                  snprintf (bufp, avail, "%s", abfd->filename);
              }
             else
              {
                asection *sec = va_arg (ap, asection *);
                bfd *abfd;
                const char *group = NULL;
                struct coff_comdat_info *ci;

                if (sec == NULL)
                  /* Invoking %A with a null section pointer is an internal error.  */
                  abort ();
                abfd = sec->owner;
                if (abfd != NULL
                    && bfd_get_flavour (abfd) == bfd_target_elf_flavour
                    && elf_next_in_group (sec) != NULL
                    && (sec->flags & SEC_GROUP) == 0)
                  group = elf_group_name (sec);
                else if (abfd != NULL
                        && bfd_get_flavour (abfd) == bfd_target_coff_flavour
                        && (ci = bfd_coff_get_comdat_section (sec->owner,
                                                         sec)) != NULL)
                  group = ci->name;
                if (group != NULL)
                  snprintf (bufp, avail, "%s[%s]", sec->name, group);
                else
                  snprintf (bufp, avail, "%s", sec->name);
              }
             len = strlen (bufp);
             avail = avail - len + 2;

             /* We need to replace any '%' we printed by "%%".
               First count how many.  */
             q = bufp;
             bufp += len;
             extra = 0;
             while ((q = strchr (q, '%')) != NULL)
              {
                ++q;
                ++extra;
              }

             /* If there isn't room, trim off the end of the string.  */
             q = bufp;
             bufp += extra;
             if (extra > avail)
              {
                trim = extra - avail;
                bufp -= trim;
                do
                  {
                    if (*--q == '%')
                     --extra;
                  }
                while (--trim != 0);
                *q = '\0';
                avail = extra;
              }
             avail -= extra;

             /* Now double all '%' chars, shuffling the string as we go.  */
             while (extra != 0)
              {
                while ((q[extra] = *q) != '%')
                  --q;
                q[--extra] = '%';
                --q;
              }
           }
       }
      p = p + 2;
    }

  vfprintf (stderr, new_fmt, ap);
  va_end (ap);

  putc ('\n', stderr);
}

Here is the call graph for this function:

Definition at line 2631 of file linker.c.

{
  switch (link_order->type)
    {
    case bfd_undefined_link_order:
    case bfd_section_reloc_link_order:
    case bfd_symbol_reloc_link_order:
    default:
      abort ();
    case bfd_indirect_link_order:
      return default_indirect_link_order (abfd, info, sec, link_order,
                                     FALSE);
    case bfd_data_link_order:
      return default_data_link_order (abfd, info, sec, link_order);
    }
}

Here is the call graph for this function:

void _bfd_delete_bfd ( bfd )

Definition at line 116 of file opncls.c.

{
  if (abfd->memory)
    {
      bfd_hash_table_free (&abfd->section_htab);
      objalloc_free ((struct objalloc *) abfd->memory);
    }
  free (abfd);
}

Here is the call graph for this function:

bfd_boolean _bfd_discard_section_stabs ( bfd ,
asection ,
void *  ,
bfd_boolean(*)(bfd_vma, void *)  ,
void *   
)

Definition at line 507 of file stabs.c.

{
  bfd_size_type count, amt;
  struct stab_section_info *secinfo;
  bfd_byte *stabbuf = NULL;
  bfd_byte *sym, *symend;
  bfd_size_type skip;
  bfd_size_type *pstridx;
  int deleting;

  if (stabsec->size == 0)
    /* This file does not contain stabs debugging information.  */
    return FALSE;

  if (stabsec->size % STABSIZE != 0)
    /* Something is wrong with the format of these stab symbols.
       Don't try to optimize them.  */
    return FALSE;

  if ((stabsec->output_section != NULL
       && bfd_is_abs_section (stabsec->output_section)))
    /* At least one of the sections is being discarded from the
       link, so we should just ignore them.  */
    return FALSE;

  /* We should have initialized our data in _bfd_link_stab_sections.
     If there was some bizarre error reading the string sections, though,
     we might not have.  Bail rather than asserting.  */
  if (psecinfo == NULL)
    return FALSE;

  count = stabsec->rawsize / STABSIZE;
  secinfo = (struct stab_section_info *) psecinfo;

  /* Read the stabs information from abfd.  */
  if (!bfd_malloc_and_get_section (abfd, stabsec, &stabbuf))
    goto error_return;

  /* Look through the stabs symbols and discard any information for
     discarded functions.  */
  skip = 0;
  deleting = -1;

  symend = stabbuf + stabsec->rawsize;
  for (sym = stabbuf, pstridx = secinfo->stridxs;
       sym < symend;
       sym += STABSIZE, ++pstridx)
    {
      int type;

      if (*pstridx == (bfd_size_type) -1)
       /* This stab was deleted in a previous pass.  */
       continue;

      type = sym[TYPEOFF];

      if (type == (int) N_FUN)
       {
         int strx = bfd_get_32 (abfd, sym + STRDXOFF);

         if (strx == 0)
           {
             if (deleting)
              {
                skip++;
                *pstridx = -1;
              }
             deleting = -1;
             continue;
           }
         deleting = 0;
         if ((*reloc_symbol_deleted_p) (sym + VALOFF - stabbuf, cookie))
           deleting = 1;
       }

      if (deleting == 1)
       {
         *pstridx = -1;
         skip++;
       }
      else if (deleting == -1)
       {
         /* Outside of a function.  Check for deleted variables.  */
         if (type == (int) N_STSYM || type == (int) N_LCSYM)
           if ((*reloc_symbol_deleted_p) (sym + VALOFF - stabbuf, cookie))
             {
              *pstridx = -1;
              skip ++;
             }
         /* We should also check for N_GSYM entries which reference a
            deleted global, but those are less harmful to debuggers
            and would require parsing the stab strings.  */
       }
    }

  free (stabbuf);
  stabbuf = NULL;

  /* Shrink the stabsec as needed.  */
  stabsec->size -= skip * STABSIZE;
  if (stabsec->size == 0)
    stabsec->flags |= SEC_EXCLUDE | SEC_KEEP;

  /* Recalculate the `cumulative_skips' array now that stabs have been
     deleted for this section.  */

  if (skip != 0)
    {
      bfd_size_type i, offset;
      bfd_size_type *pskips;

      if (secinfo->cumulative_skips == NULL)
       {
         amt = count * sizeof (bfd_size_type);
         secinfo->cumulative_skips = bfd_alloc (abfd, amt);
         if (secinfo->cumulative_skips == NULL)
           goto error_return;
       }

      pskips = secinfo->cumulative_skips;
      pstridx = secinfo->stridxs;
      offset = 0;

      for (i = 0; i < count; i++, pskips++, pstridx++)
       {
         *pskips = offset;
         if (*pstridx == (bfd_size_type) -1)
           offset += STABSIZE;
       }

      BFD_ASSERT (offset != 0);
    }

  return skip > 0;

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

Here is the call graph for this function:

bfd_boolean _bfd_dwarf1_find_nearest_line ( bfd ,
asection ,
asymbol **  ,
bfd_vma  ,
const char **  ,
const char **  ,
unsigned int  
)
bfd_boolean _bfd_dwarf2_find_inliner_info ( bfd ,
const char **  ,
const char **  ,
unsigned int ,
void **   
)
bfd_boolean _bfd_dwarf2_find_line ( bfd ,
asymbol **  ,
asymbol ,
const char **  ,
unsigned int ,
unsigned  int,
void **   
)

Definition at line 2538 of file dwarf2.c.

{
  /* Read each compilation unit from the section .debug_info, and check
     to see if it contains the address we are searching for.  If yes,
     lookup the address, and return the line number info.  If no, go
     on to the next compilation unit.

     We keep a list of all the previously read compilation units, and
     a pointer to the next un-read compilation unit.  Check the
     previously read units before reading more.  */
  struct dwarf2_debug *stash;

  /* What address are we looking for?  */
  bfd_vma addr;

  struct comp_unit* each;

  asection *section;

  bfd_boolean found = FALSE;

  section = bfd_get_section (symbol);

  stash = *pinfo;

  if (! stash)
    {
      bfd_size_type amt = sizeof (struct dwarf2_debug);

      stash = bfd_zalloc (abfd, amt);
      if (! stash)
       return FALSE;
    }

  /* In a relocatable file, 2 functions may have the same address.
     We change the section vma so that they won't overlap.  */
  if (!stash && (abfd->flags & (EXEC_P | DYNAMIC)) == 0)
    {
      if (! place_sections (abfd, stash))
       return FALSE;
    }

  addr = symbol->value;
  if (section->output_section)
    addr += section->output_section->vma + section->output_offset;
  else
    addr += section->vma;

  *filename_ptr = NULL;
  *filename_ptr = NULL;
  *linenumber_ptr = 0;

  if (! *pinfo)
    {
      bfd_size_type total_size;
      asection *msec;

      *pinfo = stash;

      msec = find_debug_info (abfd, NULL);
      if (! msec)
       /* No dwarf2 info.  Note that at this point the stash
          has been allocated, but contains zeros, this lets
          future calls to this function fail quicker.  */
       goto done;

      /* There can be more than one DWARF2 info section in a BFD these days.
        Read them all in and produce one large stash.  We do this in two
        passes - in the first pass we just accumulate the section sizes.
        In the second pass we read in the section's contents.  The allows
        us to avoid reallocing the data as we add sections to the stash.  */
      for (total_size = 0; msec; msec = find_debug_info (abfd, msec))
       total_size += msec->size;

      stash->info_ptr = bfd_alloc (abfd, total_size);
      if (stash->info_ptr == NULL)
       goto done;

      stash->info_ptr_end = stash->info_ptr;

      for (msec = find_debug_info (abfd, NULL);
          msec;
          msec = find_debug_info (abfd, msec))
       {
         bfd_size_type size;
         bfd_size_type start;

         size = msec->size;
         if (size == 0)
           continue;

         start = stash->info_ptr_end - stash->info_ptr;

         if ((bfd_simple_get_relocated_section_contents
              (abfd, msec, stash->info_ptr + start, symbols)) == NULL)
           continue;

         stash->info_ptr_end = stash->info_ptr + start + size;
       }

      BFD_ASSERT (stash->info_ptr_end == stash->info_ptr + total_size);

      stash->sec = find_debug_info (abfd, NULL);
      stash->sec_info_ptr = stash->info_ptr;
      stash->syms = symbols;
    }

  /* A null info_ptr indicates that there is no dwarf2 info
     (or that an error occured while setting up the stash).  */
  if (! stash->info_ptr)
    goto done;

  stash->inliner_chain = NULL;

  /* Check the previously read comp. units first.  */
  for (each = stash->all_comp_units; each; each = each->next_unit)
    if ((symbol->flags & BSF_FUNCTION) == 0
       || comp_unit_contains_address (each, addr))
      {
       found = comp_unit_find_line (each, symbol, addr, filename_ptr,
                                 linenumber_ptr, stash);
       if (found)
         goto done;
      }

  /* The DWARF2 spec says that the initial length field, and the
     offset of the abbreviation table, should both be 4-byte values.
     However, some compilers do things differently.  */
  if (addr_size == 0)
    addr_size = 4;
  BFD_ASSERT (addr_size == 4 || addr_size == 8);

  /* Read each remaining comp. units checking each as they are read.  */
  while (stash->info_ptr < stash->info_ptr_end)
    {
      bfd_vma length;
      unsigned int offset_size = addr_size;
      bfd_byte *info_ptr_unit = stash->info_ptr;

      length = read_4_bytes (abfd, stash->info_ptr);
      /* A 0xffffff length is the DWARF3 way of indicating we use
        64-bit offsets, instead of 32-bit offsets.  */
      if (length == 0xffffffff)
       {
         offset_size = 8;
         length = read_8_bytes (abfd, stash->info_ptr + 4);
         stash->info_ptr += 12;
       }
      /* A zero length is the IRIX way of indicating 64-bit offsets,
        mostly because the 64-bit length will generally fit in 32
        bits, and the endianness helps.  */
      else if (length == 0)
       {
         offset_size = 8;
         length = read_4_bytes (abfd, stash->info_ptr + 4);
         stash->info_ptr += 8;
       }
      /* In the absence of the hints above, we assume 32-bit DWARF2
        offsets even for targets with 64-bit addresses, because:
          a) most of the time these targets will not have generated
             more than 2Gb of debug info and so will not need 64-bit
             offsets,
        and
          b) if they do use 64-bit offsets but they are not using
             the size hints that are tested for above then they are
             not conforming to the DWARF3 standard anyway.  */
      else if (addr_size == 8)
       {
         offset_size = 4;
          stash->info_ptr += 4;
       }
      else
       stash->info_ptr += 4;

      if (length > 0)
       {
         each = parse_comp_unit (abfd, stash, length, info_ptr_unit,
                              offset_size);
         stash->info_ptr += length;

         if ((bfd_vma) (stash->info_ptr - stash->sec_info_ptr)
             == stash->sec->size)
           {
             stash->sec = find_debug_info (abfd, stash->sec);
             stash->sec_info_ptr = stash->info_ptr;
           }

         if (each)
           {
             each->next_unit = stash->all_comp_units;
             stash->all_comp_units = each;

             /* DW_AT_low_pc and DW_AT_high_pc are optional for
               compilation units.  If we don't have them (i.e.,
               unit->high == 0), we need to consult the line info
               table to see if a compilation unit contains the given
               address.  */
             found = (((symbol->flags & BSF_FUNCTION) == 0
                     || each->arange.high <= 0
                     || comp_unit_contains_address (each, addr))
                     && comp_unit_find_line (each, symbol, addr,
                                          filename_ptr,
                                          linenumber_ptr,
                                          stash));
             if (found)
              goto done;
           }
       }
    }

done:
  if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0)
    unset_sections (stash);

  return found;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bfd_boolean _bfd_dwarf2_find_nearest_line ( bfd ,
asection ,
asymbol **  ,
bfd_vma  ,
const char **  ,
const char **  ,
unsigned int ,
unsigned  int,
void **   
)

Definition at line 2312 of file dwarf2.c.

{
  /* Read each compilation unit from the section .debug_info, and check
     to see if it contains the address we are searching for.  If yes,
     lookup the address, and return the line number info.  If no, go
     on to the next compilation unit.

     We keep a list of all the previously read compilation units, and
     a pointer to the next un-read compilation unit.  Check the
     previously read units before reading more.  */
  struct dwarf2_debug *stash;

  /* What address are we looking for?  */
  bfd_vma addr;

  struct comp_unit* each;

  bfd_vma found = FALSE;

  stash = *pinfo;

  if (! stash)
    {
      bfd_size_type amt = sizeof (struct dwarf2_debug);

      stash = bfd_zalloc (abfd, amt);
      if (! stash)
       return FALSE;
    }

  /* In a relocatable file, 2 functions may have the same address.
     We change the section vma so that they won't overlap.  */
  if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0)
    {
      if (! place_sections (abfd, stash))
       return FALSE;
    }

  addr = offset;
  if (section->output_section)
    addr += section->output_section->vma + section->output_offset;
  else
    addr += section->vma;
  *filename_ptr = NULL;
  *functionname_ptr = NULL;
  *linenumber_ptr = 0;

  /* The DWARF2 spec says that the initial length field, and the
     offset of the abbreviation table, should both be 4-byte values.
     However, some compilers do things differently.  */
  if (addr_size == 0)
    addr_size = 4;
  BFD_ASSERT (addr_size == 4 || addr_size == 8);

  if (! *pinfo)
    {
      bfd_size_type total_size;
      asection *msec;

      *pinfo = stash;

      msec = find_debug_info (abfd, NULL);
      if (! msec)
       /* No dwarf2 info.  Note that at this point the stash
          has been allocated, but contains zeros, this lets
          future calls to this function fail quicker.  */
       goto done;

      /* There can be more than one DWARF2 info section in a BFD these days.
        Read them all in and produce one large stash.  We do this in two
        passes - in the first pass we just accumulate the section sizes.
        In the second pass we read in the section's contents.  The allows
        us to avoid reallocing the data as we add sections to the stash.  */
      for (total_size = 0; msec; msec = find_debug_info (abfd, msec))
       total_size += msec->size;

      stash->info_ptr = bfd_alloc (abfd, total_size);
      if (stash->info_ptr == NULL)
       goto done;

      stash->info_ptr_end = stash->info_ptr;

      for (msec = find_debug_info (abfd, NULL);
          msec;
          msec = find_debug_info (abfd, msec))
       {
         bfd_size_type size;
         bfd_size_type start;

         size = msec->size;
         if (size == 0)
           continue;

         start = stash->info_ptr_end - stash->info_ptr;

         if ((bfd_simple_get_relocated_section_contents
              (abfd, msec, stash->info_ptr + start, symbols)) == NULL)
           continue;

         stash->info_ptr_end = stash->info_ptr + start + size;
       }

      BFD_ASSERT (stash->info_ptr_end == stash->info_ptr + total_size);

      stash->sec = find_debug_info (abfd, NULL);
      stash->sec_info_ptr = stash->info_ptr;
      stash->syms = symbols;
    }

  /* A null info_ptr indicates that there is no dwarf2 info
     (or that an error occured while setting up the stash).  */
  if (! stash->info_ptr)
    goto done;

  stash->inliner_chain = NULL;

  /* Check the previously read comp. units first.  */
  for (each = stash->all_comp_units; each; each = each->next_unit)
    if (comp_unit_contains_address (each, addr)
       && comp_unit_find_nearest_line (each, addr, filename_ptr,
                                   functionname_ptr,
                                   linenumber_ptr, stash))
      {
       found = TRUE;
       goto done;
      }

  /* Read each remaining comp. units checking each as they are read.  */
  while (stash->info_ptr < stash->info_ptr_end)
    {
      bfd_vma length;
      unsigned int offset_size = addr_size;
      bfd_byte *info_ptr_unit = stash->info_ptr;

      length = read_4_bytes (abfd, stash->info_ptr);
      /* A 0xffffff length is the DWARF3 way of indicating we use
        64-bit offsets, instead of 32-bit offsets.  */
      if (length == 0xffffffff)
       {
         offset_size = 8;
         length = read_8_bytes (abfd, stash->info_ptr + 4);
         stash->info_ptr += 12;
       }
      /* A zero length is the IRIX way of indicating 64-bit offsets,
        mostly because the 64-bit length will generally fit in 32
        bits, and the endianness helps.  */
      else if (length == 0)
       {
         offset_size = 8;
         length = read_4_bytes (abfd, stash->info_ptr + 4);
         stash->info_ptr += 8;
       }
      /* In the absence of the hints above, we assume 32-bit DWARF2
        offsets even for targets with 64-bit addresses, because:
          a) most of the time these targets will not have generated
             more than 2Gb of debug info and so will not need 64-bit
             offsets,
        and
          b) if they do use 64-bit offsets but they are not using
             the size hints that are tested for above then they are
             not conforming to the DWARF3 standard anyway.  */
      else if (addr_size == 8)
       {
         offset_size = 4;
          stash->info_ptr += 4;
       }
      else
       stash->info_ptr += 4;

      if (length > 0)
       {
         each = parse_comp_unit (abfd, stash, length, info_ptr_unit,
                              offset_size);
         stash->info_ptr += length;

         if ((bfd_vma) (stash->info_ptr - stash->sec_info_ptr)
             == stash->sec->size)
           {
             stash->sec = find_debug_info (abfd, stash->sec);
             stash->sec_info_ptr = stash->info_ptr;
           }

         if (each)
           {
             each->next_unit = stash->all_comp_units;
             stash->all_comp_units = each;

             /* DW_AT_low_pc and DW_AT_high_pc are optional for
               compilation units.  If we don't have them (i.e.,
               unit->high == 0), we need to consult the line info
               table to see if a compilation unit contains the given
               address.  */
             if ((each->arange.high == 0
                 || comp_unit_contains_address (each, addr))
                && comp_unit_find_nearest_line (each, addr,
                                            filename_ptr,
                                            functionname_ptr,
                                            linenumber_ptr,
                                            stash))
              {
                found = TRUE;
                goto done;
              }
           }
       }
    }

done:
  if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0)
    unset_sections (stash);

  return found;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bfd_boolean _bfd_ecoff_locate_line ( bfd ,
asection ,
bfd_vma  ,
struct ecoff_debug_info const,
const struct ecoff_debug_swap const,
struct ecoff_find_line ,
const char **  ,
const char **  ,
unsigned int  
)

Definition at line 2419 of file ecofflink.c.

{
  offset += section->vma;

  if (line_info->cache.sect == NULL
      || line_info->cache.sect != section
      || offset < line_info->cache.start
      || offset >= line_info->cache.stop)
    {
      line_info->cache.sect = section;
      line_info->cache.start = offset;
      line_info->cache.stop = offset;
      if (! lookup_line (abfd, debug_info, debug_swap, line_info))
       {
         line_info->cache.sect = NULL;
         return FALSE;
       }
    }

  *filename_ptr = line_info->cache.filename;
  *functionname_ptr = line_info->cache.functionname;
  *retline_ptr = line_info->cache.line_num;

  return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bfd_reloc_status_type _bfd_final_link_relocate ( reloc_howto_type *  ,
bfd ,
asection ,
bfd_byte ,
bfd_vma  ,
bfd_vma  ,
bfd_vma   
)

Definition at line 1334 of file reloc.c.

{
  bfd_vma relocation;

  /* Sanity check the address.  */
  if (address > bfd_get_section_limit (input_bfd, input_section))
    return bfd_reloc_outofrange;

  /* This function assumes that we are dealing with a basic relocation
     against a symbol.  We want to compute the value of the symbol to
     relocate to.  This is just VALUE, the value of the symbol, plus
     ADDEND, any addend associated with the reloc.  */
  relocation = value + addend;

  /* If the relocation is PC relative, we want to set RELOCATION to
     the distance between the symbol (currently in RELOCATION) and the
     location we are relocating.  Some targets (e.g., i386-aout)
     arrange for the contents of the section to be the negative of the
     offset of the location within the section; for such targets
     pcrel_offset is FALSE.  Other targets (e.g., m88kbcs or ELF)
     simply leave the contents of the section as zero; for such
     targets pcrel_offset is TRUE.  If pcrel_offset is FALSE we do not
     need to subtract out the offset of the location within the
     section (which is just ADDRESS).  */
  if (howto->pc_relative)
    {
      relocation -= (input_section->output_section->vma
                   + input_section->output_offset);
      if (howto->pcrel_offset)
       relocation -= address;
    }

  return _bfd_relocate_contents (howto, input_bfd, relocation,
                             contents + address);
}

Here is the call graph for this function:

Definition at line 129 of file opncls.c.

{
  if (abfd->memory)
    {
      bfd_hash_table_free (&abfd->section_htab);
      objalloc_free ((struct objalloc *) abfd->memory);

      abfd->sections = NULL;
      abfd->section_last = NULL;
      abfd->outsymbols = NULL;
      abfd->tdata.any = NULL;
      abfd->usrdata = NULL;
      abfd->memory = NULL;
    }

  return TRUE;
}

Here is the call graph for this function:

Definition at line 2001 of file linker.c.

{
  bfd *sub;
  asection *o;
  struct bfd_link_order *p;
  size_t outsymalloc;
  struct generic_write_global_symbol_info wginfo;

  bfd_get_outsymbols (abfd) = NULL;
  bfd_get_symcount (abfd) = 0;
  outsymalloc = 0;

  /* Mark all sections which will be included in the output file.  */
  for (o = abfd->sections; o != NULL; o = o->next)
    for (p = o->map_head.link_order; p != NULL; p = p->next)
      if (p->type == bfd_indirect_link_order)
       p->u.indirect.section->linker_mark = TRUE;

  /* Build the output symbol table.  */
  for (sub = info->input_bfds; sub != NULL; sub = sub->link_next)
    if (! _bfd_generic_link_output_symbols (abfd, sub, info, &outsymalloc))
      return FALSE;

  /* Accumulate the global symbols.  */
  wginfo.info = info;
  wginfo.output_bfd = abfd;
  wginfo.psymalloc = &outsymalloc;
  _bfd_generic_link_hash_traverse (_bfd_generic_hash_table (info),
                               _bfd_generic_link_write_global_symbol,
                               &wginfo);

  /* Make sure we have a trailing NULL pointer on OUTSYMBOLS.  We
     shouldn't really need one, since we have SYMCOUNT, but some old
     code still expects one.  */
  if (! generic_add_output_symbol (abfd, &outsymalloc, NULL))
    return FALSE;

  if (info->relocatable)
    {
      /* Allocate space for the output relocs for each section.  */
      for (o = abfd->sections; o != NULL; o = o->next)
       {
         o->reloc_count = 0;
         for (p = o->map_head.link_order; p != NULL; p = p->next)
           {
             if (p->type == bfd_section_reloc_link_order
                || p->type == bfd_symbol_reloc_link_order)
              ++o->reloc_count;
             else if (p->type == bfd_indirect_link_order)
              {
                asection *input_section;
                bfd *input_bfd;
                long relsize;
                arelent **relocs;
                asymbol **symbols;
                long reloc_count;

                input_section = p->u.indirect.section;
                input_bfd = input_section->owner;
                relsize = bfd_get_reloc_upper_bound (input_bfd,
                                                 input_section);
                if (relsize < 0)
                  return FALSE;
                relocs = bfd_malloc (relsize);
                if (!relocs && relsize != 0)
                  return FALSE;
                symbols = _bfd_generic_link_get_symbols (input_bfd);
                reloc_count = bfd_canonicalize_reloc (input_bfd,
                                                 input_section,
                                                 relocs,
                                                 symbols);
                free (relocs);
                if (reloc_count < 0)
                  return FALSE;
                BFD_ASSERT ((unsigned long) reloc_count
                           == input_section->reloc_count);
                o->reloc_count += reloc_count;
              }
           }
         if (o->reloc_count > 0)
           {
             bfd_size_type amt;

             amt = o->reloc_count;
             amt *= sizeof (arelent *);
             o->orelocation = bfd_alloc (abfd, amt);
             if (!o->orelocation)
              return FALSE;
             o->flags |= SEC_RELOC;
             /* Reset the count so that it can be used as an index
               when putting in the output relocs.  */
             o->reloc_count = 0;
           }
       }
    }

  /* Handle all the link order information for the sections.  */
  for (o = abfd->sections; o != NULL; o = o->next)
    {
      for (p = o->map_head.link_order; p != NULL; p = p->next)
       {
         switch (p->type)
           {
           case bfd_section_reloc_link_order:
           case bfd_symbol_reloc_link_order:
             if (! _bfd_generic_reloc_link_order (abfd, info, o, p))
              return FALSE;
             break;
           case bfd_indirect_link_order:
             if (! default_indirect_link_order (abfd, info, o, p, TRUE))
              return FALSE;
             break;
           default:
             if (! _bfd_default_link_order (abfd, info, o, p))
              return FALSE;
             break;
           }
       }
    }

  return TRUE;
}

Here is the call graph for this function:

bfd_boolean _bfd_generic_find_line ( bfd ,
asymbol **  ,
asymbol ,
const char **  ,
unsigned int  
)

Definition at line 544 of file archive.c.

{
  carsym *entry;

  entry = bfd_ardata (abfd)->symdefs + index;
  return _bfd_get_elt_at_filepos (abfd, entry->file_offset);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 961 of file linker.c.

{
  carsym *arsyms;
  carsym *arsym_end;
  register carsym *arsym;
  int pass;
  struct archive_hash_table arsym_hash;
  unsigned int indx;
  struct bfd_link_hash_entry **pundef;

  if (! bfd_has_map (abfd))
    {
      /* An empty archive is a special case.  */
      if (bfd_openr_next_archived_file (abfd, NULL) == NULL)
       return TRUE;
      bfd_set_error (bfd_error_no_armap);
      return FALSE;
    }

  arsyms = bfd_ardata (abfd)->symdefs;
  arsym_end = arsyms + bfd_ardata (abfd)->symdef_count;

  /* In order to quickly determine whether an symbol is defined in
     this archive, we build a hash table of the symbols.  */
  if (! archive_hash_table_init (&arsym_hash, archive_hash_newfunc,
                             sizeof (struct archive_hash_entry)))
    return FALSE;
  for (arsym = arsyms, indx = 0; arsym < arsym_end; arsym++, indx++)
    {
      struct archive_hash_entry *arh;
      struct archive_list *l, **pp;

      arh = archive_hash_lookup (&arsym_hash, arsym->name, TRUE, FALSE);
      if (arh == NULL)
       goto error_return;
      l = ((struct archive_list *)
          archive_hash_allocate (&arsym_hash, sizeof (struct archive_list)));
      if (l == NULL)
       goto error_return;
      l->indx = indx;
      for (pp = &arh->defs; *pp != NULL; pp = &(*pp)->next)
       ;
      *pp = l;
      l->next = NULL;
    }

  /* The archive_pass field in the archive itself is used to
     initialize PASS, sine we may search the same archive multiple
     times.  */
  pass = abfd->archive_pass + 1;

  /* New undefined symbols are added to the end of the list, so we
     only need to look through it once.  */
  pundef = &info->hash->undefs;
  while (*pundef != NULL)
    {
      struct bfd_link_hash_entry *h;
      struct archive_hash_entry *arh;
      struct archive_list *l;

      h = *pundef;

      /* When a symbol is defined, it is not necessarily removed from
        the list.  */
      if (h->type != bfd_link_hash_undefined
         && h->type != bfd_link_hash_common)
       {
         /* Remove this entry from the list, for general cleanliness
            and because we are going to look through the list again
            if we search any more libraries.  We can't remove the
            entry if it is the tail, because that would lose any
            entries we add to the list later on (it would also cause
            us to lose track of whether the symbol has been
            referenced).  */
         if (*pundef != info->hash->undefs_tail)
           *pundef = (*pundef)->u.undef.next;
         else
           pundef = &(*pundef)->u.undef.next;
         continue;
       }

      /* Look for this symbol in the archive symbol map.  */
      arh = archive_hash_lookup (&arsym_hash, h->root.string, FALSE, FALSE);
      if (arh == NULL)
       {
         /* If we haven't found the exact symbol we're looking for,
            let's look for its import thunk */
         if (info->pei386_auto_import)
           {
             bfd_size_type amt = strlen (h->root.string) + 10;
             char *buf = bfd_malloc (amt);
             if (buf == NULL)
              return FALSE;

             sprintf (buf, "__imp_%s", h->root.string);
             arh = archive_hash_lookup (&arsym_hash, buf, FALSE, FALSE);
             free(buf);
           }
         if (arh == NULL)
           {
             pundef = &(*pundef)->u.undef.next;
             continue;
           }
       }
      /* Look at all the objects which define this symbol.  */
      for (l = arh->defs; l != NULL; l = l->next)
       {
         bfd *element;
         bfd_boolean needed;

         /* If the symbol has gotten defined along the way, quit.  */
         if (h->type != bfd_link_hash_undefined
             && h->type != bfd_link_hash_common)
           break;

         element = bfd_get_elt_at_index (abfd, l->indx);
         if (element == NULL)
           goto error_return;

         /* If we've already included this element, or if we've
            already checked it on this pass, continue.  */
         if (element->archive_pass == -1
             || element->archive_pass == pass)
           continue;

         /* If we can't figure this element out, just ignore it.  */
         if (! bfd_check_format (element, bfd_object))
           {
             element->archive_pass = -1;
             continue;
           }

         /* CHECKFN will see if this element should be included, and
            go ahead and include it if appropriate.  */
         if (! (*checkfn) (element, info, &needed))
           goto error_return;

         if (! needed)
           element->archive_pass = pass;
         else
           {
             element->archive_pass = -1;

             /* Increment the pass count to show that we may need to
               recheck object files which were already checked.  */
             ++pass;
           }
       }

      pundef = &(*pundef)->u.undef.next;
    }

  archive_hash_table_free (&arsym_hash);

  /* Save PASS in case we are called again.  */
  abfd->archive_pass = pass;

  return TRUE;

 error_return:
  archive_hash_table_free (&arsym_hash);
  return FALSE;
}

Here is the call graph for this function:

bfd_boolean _bfd_generic_link_add_one_symbol ( struct bfd_link_info ,
bfd ,
const char *  name,
flagword  ,
asection ,
bfd_vma  ,
const char *  ,
bfd_boolean  copy,
bfd_boolean  constructor,
struct bfd_link_hash_entry **   
)

Definition at line 1523 of file linker.c.

{
  enum link_row row;
  struct bfd_link_hash_entry *h;
  bfd_boolean cycle;

  if (bfd_is_ind_section (section)
      || (flags & BSF_INDIRECT) != 0)
    row = INDR_ROW;
  else if ((flags & BSF_WARNING) != 0)
    row = WARN_ROW;
  else if ((flags & BSF_CONSTRUCTOR) != 0)
    row = SET_ROW;
  else if (bfd_is_und_section (section))
    {
      if ((flags & BSF_WEAK) != 0)
       row = UNDEFW_ROW;
      else
       row = UNDEF_ROW;
    }
  else if ((flags & BSF_WEAK) != 0)
    row = DEFW_ROW;
  else if (bfd_is_com_section (section))
    row = COMMON_ROW;
  else
    row = DEF_ROW;

  if (hashp != NULL && *hashp != NULL)
    h = *hashp;
  else
    {
      if (row == UNDEF_ROW || row == UNDEFW_ROW)
       h = bfd_wrapped_link_hash_lookup (abfd, info, name, TRUE, copy, FALSE);
      else
       h = bfd_link_hash_lookup (info->hash, name, TRUE, copy, FALSE);
      if (h == NULL)
       {
         if (hashp != NULL)
           *hashp = NULL;
         return FALSE;
       }
    }

  if (info->notice_all
      || (info->notice_hash != NULL
         && bfd_hash_lookup (info->notice_hash, name, FALSE, FALSE) != NULL))
    {
      if (! (*info->callbacks->notice) (info, h->root.string, abfd, section,
                                   value))
       return FALSE;
    }

  if (hashp != NULL)
    *hashp = h;

  do
    {
      enum link_action action;

      cycle = FALSE;
      action = link_action[(int) row][(int) h->type];
      switch (action)
       {
       case FAIL:
         abort ();

       case NOACT:
         /* Do nothing.  */
         break;

       case UND:
         /* Make a new undefined symbol.  */
         h->type = bfd_link_hash_undefined;
         h->u.undef.abfd = abfd;
         bfd_link_add_undef (info->hash, h);
         break;

       case WEAK:
         /* Make a new weak undefined symbol.  */
         h->type = bfd_link_hash_undefweak;
         h->u.undef.abfd = abfd;
         h->u.undef.weak = abfd;
         break;

       case CDEF:
         /* We have found a definition for a symbol which was
            previously common.  */
         BFD_ASSERT (h->type == bfd_link_hash_common);
         if (! ((*info->callbacks->multiple_common)
               (info, h->root.string,
                h->u.c.p->section->owner, bfd_link_hash_common, h->u.c.size,
                abfd, bfd_link_hash_defined, 0)))
           return FALSE;
         /* Fall through.  */
       case DEF:
       case DEFW:
         {
           enum bfd_link_hash_type oldtype;

           /* Define a symbol.  */
           oldtype = h->type;
           if (action == DEFW)
             h->type = bfd_link_hash_defweak;
           else
             h->type = bfd_link_hash_defined;
           h->u.def.section = section;
           h->u.def.value = value;

           /* If we have been asked to, we act like collect2 and
              identify all functions that might be global
              constructors and destructors and pass them up in a
              callback.  We only do this for certain object file
              types, since many object file types can handle this
              automatically.  */
           if (collect && name[0] == '_')
             {
              const char *s;

              /* A constructor or destructor name starts like this:
                 _+GLOBAL_[_.$][ID][_.$] where the first [_.$] and
                 the second are the same character (we accept any
                 character there, in case a new object file format
                 comes along with even worse naming restrictions).  */

#define CONS_PREFIX "GLOBAL_"
#define CONS_PREFIX_LEN (sizeof CONS_PREFIX - 1)

              s = name + 1;
              while (*s == '_')
                ++s;
              if (s[0] == 'G' && CONST_STRNEQ (s, CONS_PREFIX))
                {
                  char c;

                  c = s[CONS_PREFIX_LEN + 1];
                  if ((c == 'I' || c == 'D')
                     && s[CONS_PREFIX_LEN] == s[CONS_PREFIX_LEN + 2])
                    {
                     /* If this is a definition of a symbol which
                           was previously weakly defined, we are in
                           trouble.  We have already added a
                           constructor entry for the weak defined
                           symbol, and now we are trying to add one
                           for the new symbol.  Fortunately, this case
                           should never arise in practice.  */
                     if (oldtype == bfd_link_hash_defweak)
                       abort ();

                     if (! ((*info->callbacks->constructor)
                            (info, c == 'I',
                            h->root.string, abfd, section, value)))
                       return FALSE;
                    }
                }
             }
         }

         break;

       case COM:
         /* We have found a common definition for a symbol.  */
         if (h->type == bfd_link_hash_new)
           bfd_link_add_undef (info->hash, h);
         h->type = bfd_link_hash_common;
         h->u.c.p =
           bfd_hash_allocate (&info->hash->table,
                            sizeof (struct bfd_link_hash_common_entry));
         if (h->u.c.p == NULL)
           return FALSE;

         h->u.c.size = value;

         /* Select a default alignment based on the size.  This may
             be overridden by the caller.  */
         {
           unsigned int power;

           power = bfd_log2 (value);
           if (power > 4)
             power = 4;
           h->u.c.p->alignment_power = power;
         }

         /* The section of a common symbol is only used if the common
             symbol is actually allocated.  It basically provides a
             hook for the linker script to decide which output section
             the common symbols should be put in.  In most cases, the
             section of a common symbol will be bfd_com_section_ptr,
             the code here will choose a common symbol section named
             "COMMON", and the linker script will contain *(COMMON) in
             the appropriate place.  A few targets use separate common
             sections for small symbols, and they require special
             handling.  */
         if (section == bfd_com_section_ptr)
           {
             h->u.c.p->section = bfd_make_section_old_way (abfd, "COMMON");
             h->u.c.p->section->flags = SEC_ALLOC;
           }
         else if (section->owner != abfd)
           {
             h->u.c.p->section = bfd_make_section_old_way (abfd,
                                                     section->name);
             h->u.c.p->section->flags = SEC_ALLOC;
           }
         else
           h->u.c.p->section = section;
         break;

       case REF:
         /* A reference to a defined symbol.  */
         if (h->u.undef.next == NULL && info->hash->undefs_tail != h)
           h->u.undef.next = h;
         break;

       case BIG:
         /* We have found a common definition for a symbol which
            already had a common definition.  Use the maximum of the
            two sizes, and use the section required by the larger symbol.  */
         BFD_ASSERT (h->type == bfd_link_hash_common);
         if (! ((*info->callbacks->multiple_common)
               (info, h->root.string,
                h->u.c.p->section->owner, bfd_link_hash_common, h->u.c.size,
                abfd, bfd_link_hash_common, value)))
           return FALSE;
         if (value > h->u.c.size)
           {
             unsigned int power;

             h->u.c.size = value;

             /* Select a default alignment based on the size.  This may
               be overridden by the caller.  */
             power = bfd_log2 (value);
             if (power > 4)
              power = 4;
             h->u.c.p->alignment_power = power;

             /* Some systems have special treatment for small commons,
               hence we want to select the section used by the larger
               symbol.  This makes sure the symbol does not go in a
               small common section if it is now too large.  */
             if (section == bfd_com_section_ptr)
              {
                h->u.c.p->section
                  = bfd_make_section_old_way (abfd, "COMMON");
                h->u.c.p->section->flags = SEC_ALLOC;
              }
             else if (section->owner != abfd)
              {
                h->u.c.p->section
                  = bfd_make_section_old_way (abfd, section->name);
                h->u.c.p->section->flags = SEC_ALLOC;
              }
             else
              h->u.c.p->section = section;
           }
         break;

       case CREF:
         {
           bfd *obfd;

           /* We have found a common definition for a symbol which
              was already defined.  FIXME: It would nice if we could
              report the BFD which defined an indirect symbol, but we
              don't have anywhere to store the information.  */
           if (h->type == bfd_link_hash_defined
              || h->type == bfd_link_hash_defweak)
             obfd = h->u.def.section->owner;
           else
             obfd = NULL;
           if (! ((*info->callbacks->multiple_common)
                 (info, h->root.string, obfd, h->type, 0,
                  abfd, bfd_link_hash_common, value)))
             return FALSE;
         }
         break;

       case MIND:
         /* Multiple indirect symbols.  This is OK if they both point
            to the same symbol.  */
         if (strcmp (h->u.i.link->root.string, string) == 0)
           break;
         /* Fall through.  */
       case MDEF:
         /* Handle a multiple definition.  */
         if (!info->allow_multiple_definition)
           {
             asection *msec = NULL;
             bfd_vma mval = 0;

             switch (h->type)
              {
              case bfd_link_hash_defined:
                msec = h->u.def.section;
                mval = h->u.def.value;
                break;
               case bfd_link_hash_indirect:
                msec = bfd_ind_section_ptr;
                mval = 0;
                break;
              default:
                abort ();
              }

             /* Ignore a redefinition of an absolute symbol to the
               same value; it's harmless.  */
             if (h->type == bfd_link_hash_defined
                && bfd_is_abs_section (msec)
                && bfd_is_abs_section (section)
                && value == mval)
              break;

             if (! ((*info->callbacks->multiple_definition)
                   (info, h->root.string, msec->owner, msec, mval,
                    abfd, section, value)))
              return FALSE;
           }
         break;

       case CIND:
         /* Create an indirect symbol from an existing common symbol.  */
         BFD_ASSERT (h->type == bfd_link_hash_common);
         if (! ((*info->callbacks->multiple_common)
               (info, h->root.string,
                h->u.c.p->section->owner, bfd_link_hash_common, h->u.c.size,
                abfd, bfd_link_hash_indirect, 0)))
           return FALSE;
         /* Fall through.  */
       case IND:
         /* Create an indirect symbol.  */
         {
           struct bfd_link_hash_entry *inh;

           /* STRING is the name of the symbol we want to indirect
              to.  */
           inh = bfd_wrapped_link_hash_lookup (abfd, info, string, TRUE,
                                          copy, FALSE);
           if (inh == NULL)
             return FALSE;
           if (inh->type == bfd_link_hash_indirect
              && inh->u.i.link == h)
             {
              (*_bfd_error_handler)
                (_("%B: indirect symbol `%s' to `%s' is a loop"),
                 abfd, name, string);
              bfd_set_error (bfd_error_invalid_operation);
              return FALSE;
             }
           if (inh->type == bfd_link_hash_new)
             {
              inh->type = bfd_link_hash_undefined;
              inh->u.undef.abfd = abfd;
              bfd_link_add_undef (info->hash, inh);
             }

           /* If the indirect symbol has been referenced, we need to
              push the reference down to the symbol we are
              referencing.  */
           if (h->type != bfd_link_hash_new)
             {
              row = UNDEF_ROW;
              cycle = TRUE;
             }

           h->type = bfd_link_hash_indirect;
           h->u.i.link = inh;
         }
         break;

       case SET:
         /* Add an entry to a set.  */
         if (! (*info->callbacks->add_to_set) (info, h, BFD_RELOC_CTOR,
                                          abfd, section, value))
           return FALSE;
         break;

       case WARNC:
         /* Issue a warning and cycle.  */
         if (h->u.i.warning != NULL)
           {
             if (! (*info->callbacks->warning) (info, h->u.i.warning,
                                           h->root.string, abfd,
                                           NULL, 0))
              return FALSE;
             /* Only issue a warning once.  */
             h->u.i.warning = NULL;
           }
         /* Fall through.  */
       case CYCLE:
         /* Try again with the referenced symbol.  */
         h = h->u.i.link;
         cycle = TRUE;
         break;

       case REFC:
         /* A reference to an indirect symbol.  */
         if (h->u.undef.next == NULL && info->hash->undefs_tail != h)
           h->u.undef.next = h;
         h = h->u.i.link;
         cycle = TRUE;
         break;

       case WARN:
         /* Issue a warning.  */
         if (! (*info->callbacks->warning) (info, string, h->root.string,
                                        hash_entry_bfd (h), NULL, 0))
           return FALSE;
         break;

       case CWARN:
         /* Warn if this symbol has been referenced already,
            otherwise add a warning.  A symbol has been referenced if
            the u.undef.next field is not NULL, or it is the tail of the
            undefined symbol list.  The REF case above helps to
            ensure this.  */
         if (h->u.undef.next != NULL || info->hash->undefs_tail == h)
           {
             if (! (*info->callbacks->warning) (info, string, h->root.string,
                                           hash_entry_bfd (h), NULL, 0))
              return FALSE;
             break;
           }
         /* Fall through.  */
       case MWARN:
         /* Make a warning symbol.  */
         {
           struct bfd_link_hash_entry *sub;

           /* STRING is the warning to give.  */
           sub = ((struct bfd_link_hash_entry *)
                 ((*info->hash->table.newfunc)
                  (NULL, &info->hash->table, h->root.string)));
           if (sub == NULL)
             return FALSE;
           *sub = *h;
           sub->type = bfd_link_hash_warning;
           sub->u.i.link = h;
           if (! copy)
             sub->u.i.warning = string;
           else
             {
              char *w;
              size_t len = strlen (string) + 1;

              w = bfd_hash_allocate (&info->hash->table, len);
              if (w == NULL)
                return FALSE;
              memcpy (w, string, len);
              sub->u.i.warning = w;
             }

           bfd_hash_replace (&info->hash->table,
                           (struct bfd_hash_entry *) h,
                           (struct bfd_hash_entry *) sub);
           if (hashp != NULL)
             *hashp = sub;
         }
         break;
       }
    }
  while (cycle);

  return TRUE;
}

Here is the call graph for this function:

Definition at line 767 of file linker.c.

Here is the call graph for this function:

Definition at line 780 of file linker.c.

Here is the call graph for this function:

Definition at line 704 of file linker.c.

{
  struct generic_link_hash_table *ret;
  bfd_size_type amt = sizeof (struct generic_link_hash_table);

  ret = bfd_malloc (amt);
  if (ret == NULL)
    return NULL;
  if (! _bfd_link_hash_table_init (&ret->root, abfd,
                               _bfd_generic_link_hash_newfunc,
                               sizeof (struct generic_link_hash_entry)))
    {
      free (ret);
      return NULL;
    }
  return &ret->root;
}

Here is the call graph for this function:

Definition at line 723 of file linker.c.

{
  struct generic_link_hash_table *ret
    = (struct generic_link_hash_table *) hash;

  bfd_hash_table_free (&ret->root.table);
  free (ret);
}

Here is the call graph for this function:

Definition at line 179 of file archive.c.

{
  bfd_size_type amt = sizeof (struct artdata);

  abfd->tdata.aout_ar_data = bfd_zalloc (abfd, amt);
  if (bfd_ardata (abfd) == NULL)
    return FALSE;

  /* Already cleared by bfd_zalloc above.
     bfd_ardata (abfd)->cache = NULL;
     bfd_ardata (abfd)->archive_head = NULL;
     bfd_ardata (abfd)->symdefs = NULL;
     bfd_ardata (abfd)->extended_names = NULL;
     bfd_ardata (abfd)->extended_names_size = 0;
     bfd_ardata (abfd)->tdata = NULL;  */

  return TRUE;
}

Here is the call graph for this function:

Definition at line 743 of file section.c.

{
  newsect->symbol = bfd_make_empty_symbol (abfd);
  if (newsect->symbol == NULL)
    return FALSE;

  newsect->symbol->name = newsect->name;
  newsect->symbol->value = 0;
  newsect->symbol->section = newsect;
  newsect->symbol->flags = BSF_SECTION_SYM;

  newsect->symbol_ptr_ptr = &newsect->symbol;
  return TRUE;
}

Definition at line 360 of file archive.c.

Here is the call graph for this function:

void* _bfd_generic_read_ar_hdr_mag ( bfd ,
const char *   
)

Definition at line 369 of file archive.c.

{
  struct ar_hdr hdr;
  char *hdrp = (char *) &hdr;
  size_t parsed_size;
  struct areltdata *ared;
  char *filename = NULL;
  bfd_size_type namelen = 0;
  bfd_size_type allocsize = sizeof (struct areltdata) + sizeof (struct ar_hdr);
  char *allocptr = 0;

  if (bfd_bread (hdrp, sizeof (struct ar_hdr), abfd) != sizeof (struct ar_hdr))
    {
      if (bfd_get_error () != bfd_error_system_call)
       bfd_set_error (bfd_error_no_more_archived_files);
      return NULL;
    }
  if (strncmp (hdr.ar_fmag, ARFMAG, 2) != 0
      && (mag == NULL
         || strncmp (hdr.ar_fmag, mag, 2) != 0))
    {
      bfd_set_error (bfd_error_malformed_archive);
      return NULL;
    }

  errno = 0;
  parsed_size = strtol (hdr.ar_size, NULL, 10);
  if (errno != 0)
    {
      bfd_set_error (bfd_error_malformed_archive);
      return NULL;
    }

  /* Extract the filename from the archive - there are two ways to
     specify an extended name table, either the first char of the
     name is a space, or it's a slash.  */
  if ((hdr.ar_name[0] == '/'
       || (hdr.ar_name[0] == ' '
          && memchr (hdr.ar_name, '/', ar_maxnamelen (abfd)) == NULL))
      && bfd_ardata (abfd)->extended_names != NULL)
    {
      filename = get_extended_arelt_filename (abfd, hdr.ar_name);
      if (filename == NULL)
       return NULL;
    }
  /* BSD4.4-style long filename.
     Only implemented for reading, so far!  */
  else if (hdr.ar_name[0] == '#'
          && hdr.ar_name[1] == '1'
          && hdr.ar_name[2] == '/'
          && ISDIGIT (hdr.ar_name[3]))
    {
      /* BSD-4.4 extended name */
      namelen = atoi (&hdr.ar_name[3]);
      allocsize += namelen + 1;
      parsed_size -= namelen;

      allocptr = bfd_zalloc (abfd, allocsize);
      if (allocptr == NULL)
       return NULL;
      filename = (allocptr
                + sizeof (struct areltdata)
                + sizeof (struct ar_hdr));
      if (bfd_bread (filename, namelen, abfd) != namelen)
       {
         if (bfd_get_error () != bfd_error_system_call)
           bfd_set_error (bfd_error_no_more_archived_files);
         return NULL;
       }
      filename[namelen] = '\0';
    }
  else
    {
      /* We judge the end of the name by looking for '/' or ' '.
        Note:  The SYSV format (terminated by '/') allows embedded
        spaces, so only look for ' ' if we don't find '/'.  */

      char *e;
      e = memchr (hdr.ar_name, '\0', ar_maxnamelen (abfd));
      if (e == NULL)
       {
         e = memchr (hdr.ar_name, '/', ar_maxnamelen (abfd));
         if (e == NULL)
           e = memchr (hdr.ar_name, ' ', ar_maxnamelen (abfd));
       }

      if (e != NULL)
       namelen = e - hdr.ar_name;
      else
       {
         /* If we didn't find a termination character, then the name
            must be the entire field.  */
         namelen = ar_maxnamelen (abfd);
       }

      allocsize += namelen + 1;
    }

  if (!allocptr)
    {
      allocptr = bfd_zalloc (abfd, allocsize);
      if (allocptr == NULL)
       return NULL;
    }

  ared = (struct areltdata *) allocptr;

  ared->arch_header = allocptr + sizeof (struct areltdata);
  memcpy (ared->arch_header, &hdr, sizeof (struct ar_hdr));
  ared->parsed_size = parsed_size;

  if (filename != NULL)
    ared->filename = filename;
  else
    {
      ared->filename = allocptr + (sizeof (struct areltdata) +
                               sizeof (struct ar_hdr));
      if (namelen)
       memcpy (ared->filename, hdr.ar_name, namelen);
      ared->filename[namelen] = '\0';
    }

  return ared;
}

Here is the call graph for this function:

Here is the caller graph for this function:

long _bfd_generic_read_minisymbols ( bfd ,
bfd_boolean  ,
void **  ,
unsigned int  
)

Definition at line 780 of file syms.c.

{
  long storage;
  asymbol **syms = NULL;
  long symcount;

  if (dynamic)
    storage = bfd_get_dynamic_symtab_upper_bound (abfd);
  else
    storage = bfd_get_symtab_upper_bound (abfd);
  if (storage < 0)
    goto error_return;
  if (storage == 0)
    return 0;

  syms = bfd_malloc (storage);
  if (syms == NULL)
    goto error_return;

  if (dynamic)
    symcount = bfd_canonicalize_dynamic_symtab (abfd, syms);
  else
    symcount = bfd_canonicalize_symtab (abfd, syms);
  if (symcount < 0)
    goto error_return;

  *minisymsp = syms;
  *sizep = sizeof (asymbol *);
  return symcount;

 error_return:
  bfd_set_error (bfd_error_no_symbols);
  if (syms != NULL)
    free (syms);
  return -1;
}

Here is the call graph for this function:

Definition at line 2501 of file linker.c.

{
  arelent *r;

  if (! info->relocatable)
    abort ();
  if (sec->orelocation == NULL)
    abort ();

  r = bfd_alloc (abfd, sizeof (arelent));
  if (r == NULL)
    return FALSE;

  r->address = link_order->offset;
  r->howto = bfd_reloc_type_lookup (abfd, link_order->u.reloc.p->reloc);
  if (r->howto == 0)
    {
      bfd_set_error (bfd_error_bad_value);
      return FALSE;
    }

  /* Get the symbol to use for the relocation.  */
  if (link_order->type == bfd_section_reloc_link_order)
    r->sym_ptr_ptr = link_order->u.reloc.p->u.section->symbol_ptr_ptr;
  else
    {
      struct generic_link_hash_entry *h;

      h = ((struct generic_link_hash_entry *)
          bfd_wrapped_link_hash_lookup (abfd, info,
                                    link_order->u.reloc.p->u.name,
                                    FALSE, FALSE, TRUE));
      if (h == NULL
         || ! h->written)
       {
         if (! ((*info->callbacks->unattached_reloc)
               (info, link_order->u.reloc.p->u.name, NULL, NULL, 0)))
           return FALSE;
         bfd_set_error (bfd_error_bad_value);
         return FALSE;
       }
      r->sym_ptr_ptr = &h->sym;
    }

  /* If this is an inplace reloc, write the addend to the object file.
     Otherwise, store it in the reloc addend.  */
  if (! r->howto->partial_inplace)
    r->addend = link_order->u.reloc.p->addend;
  else
    {
      bfd_size_type size;
      bfd_reloc_status_type rstat;
      bfd_byte *buf;
      bfd_boolean ok;
      file_ptr loc;

      size = bfd_get_reloc_size (r->howto);
      buf = bfd_zmalloc (size);
      if (buf == NULL)
       return FALSE;
      rstat = _bfd_relocate_contents (r->howto, abfd,
                                  (bfd_vma) link_order->u.reloc.p->addend,
                                  buf);
      switch (rstat)
       {
       case bfd_reloc_ok:
         break;
       default:
       case bfd_reloc_outofrange:
         abort ();
       case bfd_reloc_overflow:
         if (! ((*info->callbacks->reloc_overflow)
               (info, NULL,
                (link_order->type == bfd_section_reloc_link_order
                 ? bfd_section_name (abfd, link_order->u.reloc.p->u.section)
                 : link_order->u.reloc.p->u.name),
                r->howto->name, link_order->u.reloc.p->addend,
                NULL, NULL, 0)))
           {
             free (buf);
             return FALSE;
           }
         break;
       }
      loc = link_order->offset * bfd_octets_per_byte (abfd);
      ok = bfd_set_section_contents (abfd, sec, buf, loc, size);
      free (buf);
      if (! ok)
       return FALSE;

      r->addend = 0;
    }

  sec->orelocation[sec->reloc_count] = r;
  ++sec->reloc_count;

  return TRUE;
}

Here is the call graph for this function:

Definition at line 939 of file libbfd.c.

{
  if (ibfd->xvec->byteorder != obfd->xvec->byteorder
      && ibfd->xvec->byteorder != BFD_ENDIAN_UNKNOWN
      && obfd->xvec->byteorder != BFD_ENDIAN_UNKNOWN)
    {
      const char *msg;

      if (bfd_big_endian (ibfd))
       msg = _("%B: compiled for a big endian system and target is little endian");
      else
       msg = _("%B: compiled for a little endian system and target is big endian");

      (*_bfd_error_handler) (msg, ibfd);

      bfd_set_error (bfd_error_wrong_format);
      return FALSE;
    }

  return TRUE;
}

Here is the call graph for this function:

bfd* _bfd_get_elt_at_filepos ( bfd archive,
file_ptr  filepos 
)

Definition at line 499 of file archive.c.

{
  struct areltdata *new_areldata;
  bfd *n_nfd;

  if (archive->my_archive)
    {
      filepos += archive->origin;
      archive = archive->my_archive;
    }

  n_nfd = _bfd_look_for_bfd_in_cache (archive, filepos);
  if (n_nfd)
    return n_nfd;

  if (0 > bfd_seek (archive, filepos, SEEK_SET))
    return NULL;

  if ((new_areldata = _bfd_read_ar_hdr (archive)) == NULL)
    return NULL;

  n_nfd = _bfd_create_empty_archive_element_shell (archive);
  if (n_nfd == NULL)
    {
      bfd_release (archive, new_areldata);
      return NULL;
    }

  n_nfd->origin = bfd_tell (archive);
  n_nfd->arelt_data = new_areldata;
  n_nfd->filename = new_areldata->filename;

  if (_bfd_add_bfd_to_archive_cache (archive, filepos, n_nfd))
    return n_nfd;

  /* Huh?  */
  bfd_release (archive, n_nfd);
  bfd_release (archive, new_areldata);
  return NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1000 of file bfd.c.

{
  if (! abfd)
    return 0;
  if (abfd->format != bfd_object)
    return 0;

  if (abfd->xvec->flavour == bfd_target_ecoff_flavour)
    return ecoff_data (abfd)->gp;
  else if (abfd->xvec->flavour == bfd_target_elf_flavour)
    return elf_gp (abfd);

  return 0;
}

Here is the caller graph for this function:

struct bfd_hash_entry* _bfd_link_hash_newfunc ( struct bfd_hash_entry entry,
struct bfd_hash_table table,
const char *  string 
) [read]

Definition at line 437 of file linker.c.

{
  /* Allocate the structure if it has not already been allocated by a
     subclass.  */
  if (entry == NULL)
    {
      entry = bfd_hash_allocate (table, sizeof (struct bfd_link_hash_entry));
      if (entry == NULL)
       return entry;
    }

  /* Call the allocation method of the superclass.  */
  entry = bfd_hash_newfunc (entry, table, string);
  if (entry)
    {
      struct bfd_link_hash_entry *h = (struct bfd_link_hash_entry *) entry;

      /* Initialize the local fields.  */
      h->type = bfd_link_hash_new;
      memset (&h->u.undef.next, 0,
             (sizeof (struct bfd_link_hash_entry)
              - offsetof (struct bfd_link_hash_entry, u.undef.next)));
    }

  return entry;
}

Here is the call graph for this function:

bfd_boolean _bfd_link_hash_table_init ( struct bfd_link_hash_table ,
bfd ,
struct bfd_hash_entry *)(struct bfd_hash_entry *, struct bfd_hash_table *, const char *,
unsigned  int 
)
bfd_boolean _bfd_link_section_stabs ( bfd ,
struct stab_info ,
asection ,
asection ,
void **  ,
bfd_size_type  
)

Definition at line 147 of file stabs.c.

{
  bfd_boolean first;
  bfd_size_type count, amt;
  struct stab_section_info *secinfo;
  bfd_byte *stabbuf = NULL;
  bfd_byte *stabstrbuf = NULL;
  bfd_byte *sym, *symend;
  bfd_size_type stroff, next_stroff, skip;
  bfd_size_type *pstridx;

  if (stabsec->size == 0
      || stabstrsec->size == 0)
    /* This file does not contain stabs debugging information.  */
    return TRUE;

  if (stabsec->size % STABSIZE != 0)
    /* Something is wrong with the format of these stab symbols.
       Don't try to optimize them.  */
    return TRUE;

  if ((stabstrsec->flags & SEC_RELOC) != 0)
    /* We shouldn't see relocations in the strings, and we aren't
       prepared to handle them.  */
    return TRUE;

  if (bfd_is_abs_section (stabsec->output_section)
      || bfd_is_abs_section (stabstrsec->output_section))
    /* At least one of the sections is being discarded from the
       link, so we should just ignore them.  */
    return TRUE;

  first = FALSE;

  if (sinfo->stabstr == NULL)
    {
      flagword flags;

      /* Initialize the stabs information we need to keep track of.  */
      first = TRUE;
      sinfo->strings = _bfd_stringtab_init ();
      if (sinfo->strings == NULL)
       goto error_return;
      /* Make sure the first byte is zero.  */
      (void) _bfd_stringtab_add (sinfo->strings, "", TRUE, TRUE);
      if (! bfd_hash_table_init (&sinfo->includes,
                             stab_link_includes_newfunc,
                             sizeof (struct stab_link_includes_entry)))
       goto error_return;
      flags = (SEC_HAS_CONTENTS | SEC_READONLY | SEC_DEBUGGING
              | SEC_LINKER_CREATED);
      sinfo->stabstr = bfd_make_section_anyway_with_flags (abfd, ".stabstr",
                                                    flags);
      if (sinfo->stabstr == NULL)
       goto error_return;
    }

  /* Initialize the information we are going to store for this .stab
     section.  */
  count = stabsec->size / STABSIZE;

  amt = sizeof (struct stab_section_info);
  amt += (count - 1) * sizeof (bfd_size_type);
  *psecinfo = bfd_alloc (abfd, amt);
  if (*psecinfo == NULL)
    goto error_return;

  secinfo = (struct stab_section_info *) *psecinfo;
  secinfo->excls = NULL;
  stabsec->rawsize = stabsec->size;
  secinfo->cumulative_skips = NULL;
  memset (secinfo->stridxs, 0, (size_t) count * sizeof (bfd_size_type));

  /* Read the stabs information from abfd.  */
  if (!bfd_malloc_and_get_section (abfd, stabsec, &stabbuf)
      || !bfd_malloc_and_get_section (abfd, stabstrsec, &stabstrbuf))
    goto error_return;

  /* Look through the stabs symbols, work out the new string indices,
     and identify N_BINCL symbols which can be eliminated.  */
  stroff = 0;
  /* The stabs sections can be split when
     -split-by-reloc/-split-by-file is used.  We must keep track of
     each stab section's place in the single concatenated string
     table.  */
  next_stroff = pstring_offset ? *pstring_offset : 0;
  skip = 0;

  symend = stabbuf + stabsec->size;
  for (sym = stabbuf, pstridx = secinfo->stridxs;
       sym < symend;
       sym += STABSIZE, ++pstridx)
    {
      bfd_size_type symstroff;
      int type;
      const char *string;

      if (*pstridx != 0)
       /* This symbol has already been handled by an N_BINCL pass.  */
       continue;

      type = sym[TYPEOFF];

      if (type == 0)
       {
         /* Special type 0 stabs indicate the offset to the next
            string table.  We only copy the very first one.  */
         stroff = next_stroff;
         next_stroff += bfd_get_32 (abfd, sym + 8);
         if (pstring_offset)
           *pstring_offset = next_stroff;
         if (! first)
           {
             *pstridx = (bfd_size_type) -1;
             ++skip;
             continue;
           }
         first = FALSE;
       }

      /* Store the string in the hash table, and record the index.  */
      symstroff = stroff + bfd_get_32 (abfd, sym + STRDXOFF);
      if (symstroff >= stabstrsec->size)
       {
         (*_bfd_error_handler)
           (_("%B(%A+0x%lx): Stabs entry has invalid string index."),
            abfd, stabsec, (long) (sym - stabbuf));
         bfd_set_error (bfd_error_bad_value);
         goto error_return;
       }
      string = (char *) stabstrbuf + symstroff;
      *pstridx = _bfd_stringtab_add (sinfo->strings, string, TRUE, TRUE);

      /* An N_BINCL symbol indicates the start of the stabs entries
        for a header file.  We need to scan ahead to the next N_EINCL
        symbol, ignoring nesting, adding up all the characters in the
        symbol names, not including the file numbers in types (the
        first number after an open parenthesis).  */
      if (type == (int) N_BINCL)
       {
         bfd_vma sum_chars;
         bfd_vma num_chars;
         bfd_vma buf_len = 0;
         char * symb;
         char * symb_rover;
         int nest;
         bfd_byte * incl_sym;
         struct stab_link_includes_entry * incl_entry;
         struct stab_link_includes_totals * t;
         struct stab_excl_list * ne;

         symb = symb_rover = NULL;
         sum_chars = num_chars = 0;
         nest = 0;

         for (incl_sym = sym + STABSIZE;
              incl_sym < symend;
              incl_sym += STABSIZE)
           {
             int incl_type;

             incl_type = incl_sym[TYPEOFF];
             if (incl_type == 0)
              break;
             else if (incl_type == (int) N_EXCL)
              continue;
             else if (incl_type == (int) N_EINCL)
              {
                if (nest == 0)
                  break;
                --nest;
              }
             else if (incl_type == (int) N_BINCL)
              ++nest;
             else if (nest == 0)
              {
                const char *str;

                str = ((char *) stabstrbuf
                      + stroff
                      + bfd_get_32 (abfd, incl_sym + STRDXOFF));
                for (; *str != '\0'; str++)
                  {
                    if (num_chars >= buf_len)
                     {
                       buf_len += 32 * 1024;
                       symb = bfd_realloc (symb, buf_len);
                       if (symb == NULL)
                         goto error_return;
                       symb_rover = symb + num_chars;
                     }
                    * symb_rover ++ = * str;
                    sum_chars += *str;
                    num_chars ++;
                    if (*str == '(')
                     {
                       /* Skip the file number.  */
                       ++str;
                       while (ISDIGIT (*str))
                         ++str;
                       --str;
                     }
                  }
              }
           }

         BFD_ASSERT (num_chars == (bfd_vma) (symb_rover - symb));

         /* If we have already included a header file with the same
            value, then replaced this one with an N_EXCL symbol.  */
         incl_entry = (struct stab_link_includes_entry * )
           bfd_hash_lookup (&sinfo->includes, string, TRUE, TRUE);
         if (incl_entry == NULL)
           goto error_return;

         for (t = incl_entry->totals; t != NULL; t = t->next)
           if (t->sum_chars == sum_chars
              && t->num_chars == num_chars
              && memcmp (t->symb, symb, num_chars) == 0)
             break;

         /* Record this symbol, so that we can set the value
            correctly.  */
         amt = sizeof *ne;
         ne = bfd_alloc (abfd, amt);
         if (ne == NULL)
           goto error_return;
         ne->offset = sym - stabbuf;
         ne->val = sum_chars;
         ne->type = (int) N_BINCL;
         ne->next = secinfo->excls;
         secinfo->excls = ne;

         if (t == NULL)
           {
             /* This is the first time we have seen this header file
               with this set of stabs strings.  */
             t = bfd_hash_allocate (&sinfo->includes, sizeof *t);
             if (t == NULL)
              goto error_return;
             t->sum_chars = sum_chars;
             t->num_chars = num_chars;
             t->symb = bfd_realloc (symb, num_chars); /* Trim data down.  */
             t->next = incl_entry->totals;
             incl_entry->totals = t;
           }
         else
           {
             bfd_size_type *incl_pstridx;

             /* We have seen this header file before.  Tell the final
               pass to change the type to N_EXCL.  */
             ne->type = (int) N_EXCL;

             /* Free off superfluous symbols.  */
             free (symb);

             /* Mark the skipped symbols.  */

             nest = 0;
             for (incl_sym = sym + STABSIZE, incl_pstridx = pstridx + 1;
                 incl_sym < symend;
                 incl_sym += STABSIZE, ++incl_pstridx)
              {
                int incl_type;

                incl_type = incl_sym[TYPEOFF];

                if (incl_type == (int) N_EINCL)
                  {
                    if (nest == 0)
                     {
                       *incl_pstridx = (bfd_size_type) -1;
                       ++skip;
                       break;
                     }
                    --nest;
                  }
                else if (incl_type == (int) N_BINCL)
                  ++nest;
                else if (incl_type == (int) N_EXCL)
                  /* Keep existing exclusion marks.  */
                  continue;
                else if (nest == 0)
                  {
                    *incl_pstridx = (bfd_size_type) -1;
                    ++skip;
                  }
              }
           }
       }
    }

  free (stabbuf);
  stabbuf = NULL;
  free (stabstrbuf);
  stabstrbuf = NULL;

  /* We need to set the section sizes such that the linker will
     compute the output section sizes correctly.  We set the .stab
     size to not include the entries we don't want.  We set
     SEC_EXCLUDE for the .stabstr section, so that it will be dropped
     from the link.  We record the size of the strtab in the first
     .stabstr section we saw, and make sure we don't set SEC_EXCLUDE
     for that section.  */
  stabsec->size = (count - skip) * STABSIZE;
  if (stabsec->size == 0)
    stabsec->flags |= SEC_EXCLUDE | SEC_KEEP;
  stabstrsec->flags |= SEC_EXCLUDE | SEC_KEEP;
  sinfo->stabstr->size = _bfd_stringtab_size (sinfo->strings);

  /* Calculate the `cumulative_skips' array now that stabs have been
     deleted for this section.  */

  if (skip != 0)
    {
      bfd_size_type i, offset;
      bfd_size_type *pskips;

      amt = count * sizeof (bfd_size_type);
      secinfo->cumulative_skips = bfd_alloc (abfd, amt);
      if (secinfo->cumulative_skips == NULL)
       goto error_return;

      pskips = secinfo->cumulative_skips;
      pstridx = secinfo->stridxs;
      offset = 0;

      for (i = 0; i < count; i++, pskips++, pstridx++)
       {
         *pskips = offset;
         if (*pstridx == (bfd_size_type) -1)
           offset += STABSIZE;
       }

      BFD_ASSERT (offset != 0);
    }

  return TRUE;

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

Here is the call graph for this function:

Definition at line 268 of file archive.c.

{
  htab_t hash_table = bfd_ardata (arch_bfd)->cache;
  struct ar_cache m;
  m.ptr = filepos;

  if (hash_table)
    {
      struct ar_cache *entry = (struct ar_cache *) htab_find (hash_table, &m);
      if (!entry)
       return NULL;
      else
       return entry->arbfd;
    }
  else
    return NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bfd_boolean _bfd_merge_sections ( bfd ,
struct bfd_link_info ,
void *  ,
void(*)(bfd *, asection *)   
)
bfd_vma _bfd_merged_section_offset ( bfd ,
asection **  ,
void *  ,
bfd_vma   
)
long _bfd_n1 ( bfd ignore)
bfd* _bfd_new_bfd ( void  )

Definition at line 50 of file opncls.c.

{
  bfd *nbfd;

  nbfd = bfd_zmalloc (sizeof (bfd));
  if (nbfd == NULL)
    return NULL;

  nbfd->id = _bfd_id_counter++;

  nbfd->memory = objalloc_create ();
  if (nbfd->memory == NULL)
    {
      bfd_set_error (bfd_error_no_memory);
      free (nbfd);
      return NULL;
    }

  nbfd->arch_info = &bfd_default_arch_struct;

  nbfd->direction = no_direction;
  nbfd->iostream = NULL;
  nbfd->where = 0;
  if (!bfd_hash_table_init_n (& nbfd->section_htab, bfd_section_hash_newfunc,
                           sizeof (struct section_hash_entry), 251))
    {
      free (nbfd);
      return NULL;
    }
  nbfd->sections = NULL;
  nbfd->section_last = NULL;
  nbfd->format = bfd_unknown;
  nbfd->my_archive = NULL;
  nbfd->origin = 0;
  nbfd->opened_once = FALSE;
  nbfd->output_has_begun = FALSE;
  nbfd->section_count = 0;
  nbfd->usrdata = NULL;
  nbfd->cacheable = FALSE;
  nbfd->flags = BFD_NO_FLAGS;
  nbfd->mtime_set = FALSE;

  return nbfd;
}

Here is the call graph for this function:

Definition at line 98 of file opncls.c.

{
  bfd *nbfd;

  nbfd = _bfd_new_bfd ();
  if (nbfd == NULL)
    return NULL;
  nbfd->xvec = obfd->xvec;
  nbfd->iovec = obfd->iovec;
  nbfd->my_archive = obfd;
  nbfd->direction = read_direction;
  nbfd->target_defaulted = obfd->target_defaulted;
  return nbfd;
}

Here is the call graph for this function:

bfd_reloc_status_type _bfd_relocate_contents ( reloc_howto_type *  ,
bfd ,
bfd_vma  ,
bfd_byte  
)

Definition at line 1379 of file reloc.c.

{
  int size;
  bfd_vma x = 0;
  bfd_reloc_status_type flag;
  unsigned int rightshift = howto->rightshift;
  unsigned int bitpos = howto->bitpos;

  /* If the size is negative, negate RELOCATION.  This isn't very
     general.  */
  if (howto->size < 0)
    relocation = -relocation;

  /* Get the value we are going to relocate.  */
  size = bfd_get_reloc_size (howto);
  switch (size)
    {
    default:
    case 0:
      abort ();
    case 1:
      x = bfd_get_8 (input_bfd, location);
      break;
    case 2:
      x = bfd_get_16 (input_bfd, location);
      break;
    case 4:
      x = bfd_get_32 (input_bfd, location);
      break;
    case 8:
#ifdef BFD64
      x = bfd_get_64 (input_bfd, location);
#else
      abort ();
#endif
      break;
    }

  /* Check for overflow.  FIXME: We may drop bits during the addition
     which we don't check for.  We must either check at every single
     operation, which would be tedious, or we must do the computations
     in a type larger than bfd_vma, which would be inefficient.  */
  flag = bfd_reloc_ok;
  if (howto->complain_on_overflow != complain_overflow_dont)
    {
      bfd_vma addrmask, fieldmask, signmask, ss;
      bfd_vma a, b, sum;

      /* Get the values to be added together.  For signed and unsigned
         relocations, we assume that all values should be truncated to
         the size of an address.  For bitfields, all the bits matter.
         See also bfd_check_overflow.  */
      fieldmask = N_ONES (howto->bitsize);
      signmask = ~fieldmask;
      addrmask = N_ONES (bfd_arch_bits_per_address (input_bfd)) | fieldmask;
      a = (relocation & addrmask) >> rightshift;
      b = (x & howto->src_mask & addrmask) >> bitpos;

      switch (howto->complain_on_overflow)
       {
       case complain_overflow_signed:
         /* If any sign bits are set, all sign bits must be set.
            That is, A must be a valid negative address after
            shifting.  */
         signmask = ~(fieldmask >> 1);
         /* Fall thru */

       case complain_overflow_bitfield:
         /* Much like the signed check, but for a field one bit
            wider.  We allow a bitfield to represent numbers in the
            range -2**n to 2**n-1, where n is the number of bits in the
            field.  Note that when bfd_vma is 32 bits, a 32-bit reloc
            can't overflow, which is exactly what we want.  */
         ss = a & signmask;
         if (ss != 0 && ss != ((addrmask >> rightshift) & signmask))
           flag = bfd_reloc_overflow;

         /* We only need this next bit of code if the sign bit of B
             is below the sign bit of A.  This would only happen if
             SRC_MASK had fewer bits than BITSIZE.  Note that if
             SRC_MASK has more bits than BITSIZE, we can get into
             trouble; we would need to verify that B is in range, as
             we do for A above.  */
         ss = ((~howto->src_mask) >> 1) & howto->src_mask;
         ss >>= bitpos;

         /* Set all the bits above the sign bit.  */
         b = (b ^ ss) - ss;

         /* Now we can do the addition.  */
         sum = a + b;

         /* See if the result has the correct sign.  Bits above the
             sign bit are junk now; ignore them.  If the sum is
             positive, make sure we did not have all negative inputs;
             if the sum is negative, make sure we did not have all
             positive inputs.  The test below looks only at the sign
             bits, and it really just
                SIGN (A) == SIGN (B) && SIGN (A) != SIGN (SUM)

            We mask with addrmask here to explicitly allow an address
            wrap-around.  The Linux kernel relies on it, and it is
            the only way to write assembler code which can run when
            loaded at a location 0x80000000 away from the location at
            which it is linked.  */
         if (((~(a ^ b)) & (a ^ sum)) & signmask & addrmask)
           flag = bfd_reloc_overflow;
         break;

       case complain_overflow_unsigned:
         /* Checking for an unsigned overflow is relatively easy:
             trim the addresses and add, and trim the result as well.
             Overflow is normally indicated when the result does not
             fit in the field.  However, we also need to consider the
             case when, e.g., fieldmask is 0x7fffffff or smaller, an
             input is 0x80000000, and bfd_vma is only 32 bits; then we
             will get sum == 0, but there is an overflow, since the
             inputs did not fit in the field.  Instead of doing a
             separate test, we can check for this by or-ing in the
             operands when testing for the sum overflowing its final
             field.  */
         sum = (a + b) & addrmask;
         if ((a | b | sum) & signmask)
           flag = bfd_reloc_overflow;
         break;

       default:
         abort ();
       }
    }

  /* Put RELOCATION in the right bits.  */
  relocation >>= (bfd_vma) rightshift;
  relocation <<= (bfd_vma) bitpos;

  /* Add RELOCATION to the right bits of X.  */
  x = ((x & ~howto->dst_mask)
       | (((x & howto->src_mask) + relocation) & howto->dst_mask));

  /* Put the relocated value back in the object file.  */
  switch (size)
    {
    default:
      abort ();
    case 1:
      bfd_put_8 (input_bfd, x, location);
      break;
    case 2:
      bfd_put_16 (input_bfd, x, location);
      break;
    case 4:
      bfd_put_32 (input_bfd, x, location);
      break;
    case 8:
#ifdef BFD64
      bfd_put_64 (input_bfd, x, location);
#else
      abort ();
#endif
      break;
    }

  return flag;
}

Here is the call graph for this function:

void _bfd_set_gp_value ( bfd ,
bfd_vma   
)

Definition at line 1018 of file bfd.c.

{
  if (! abfd)
    BFD_FAIL ();
  if (abfd->format != bfd_object)
    return;

  if (abfd->xvec->flavour == bfd_target_ecoff_flavour)
    ecoff_data (abfd)->gp = v;
  else if (abfd->xvec->flavour == bfd_target_elf_flavour)
    elf_gp (abfd) = v;
}

Here is the caller graph for this function:

bfd_boolean _bfd_sh_align_load_span ( bfd ,
asection ,
bfd_byte ,
bfd_boolean(*)(bfd *, asection *, void *, bfd_byte *, bfd_vma ,
void *  ,
bfd_vma **  ,
bfd_vma ,
bfd_vma  ,
bfd_vma  ,
bfd_boolean  
)

Extended name table.

Normally archives support only 14-character filenames.

Intel has extended the format: longer names are stored in a special element (the first in the archive, or second if there is an armap); the name in the ar_hdr is replaced by <space><index into="" filename="" element>="">. Index is the P.R. of an int (decimal). Data General have extended the format by using the prefix // for the special element.

Definition at line 1052 of file archive.c.

{
  char nextname[17];
  struct areltdata *namedata;
  bfd_size_type amt;

  /* FIXME:  Formatting sucks here, and in case of failure of BFD_READ,
     we probably don't want to return TRUE.  */
  bfd_seek (abfd, bfd_ardata (abfd)->first_file_filepos, SEEK_SET);
  if (bfd_bread (nextname, 16, abfd) == 16)
    {
      if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0)
       return FALSE;

      if (! CONST_STRNEQ (nextname, "ARFILENAMES/    ")
         && ! CONST_STRNEQ (nextname, "//              "))
       {
         bfd_ardata (abfd)->extended_names = NULL;
         bfd_ardata (abfd)->extended_names_size = 0;
         return TRUE;
       }

      namedata = _bfd_read_ar_hdr (abfd);
      if (namedata == NULL)
       return FALSE;

      amt = namedata->parsed_size;
      if (amt + 1 == 0)
        goto byebye;

      bfd_ardata (abfd)->extended_names_size = amt;
      bfd_ardata (abfd)->extended_names = bfd_zalloc (abfd, amt + 1);
      if (bfd_ardata (abfd)->extended_names == NULL)
       {
       byebye:
         bfd_release (abfd, namedata);
         return FALSE;
       }

      if (bfd_bread (bfd_ardata (abfd)->extended_names, amt, abfd) != amt)
       {
         if (bfd_get_error () != bfd_error_system_call)
           bfd_set_error (bfd_error_malformed_archive);
         bfd_release (abfd, (bfd_ardata (abfd)->extended_names));
         bfd_ardata (abfd)->extended_names = NULL;
         goto byebye;
       }

      /* Since the archive is supposed to be printable if it contains
        text, the entries in the list are newline-padded, not null
        padded. In SVR4-style archives, the names also have a
        trailing '/'.  DOS/NT created archive often have \ in them
        We'll fix all problems here..  */
      {
        char *ext_names = bfd_ardata (abfd)->extended_names;
       char *temp = ext_names;
       char *limit = temp + namedata->parsed_size;
       for (; temp < limit; ++temp)
         {
           if (*temp == '\012')
             temp[temp > ext_names && temp[-1] == '/' ? -1 : 0] = '\0';
           if (*temp == '\\')
             *temp = '/';
         }
       *limit = '\0';
      }

      /* Pad to an even boundary if you have to.  */
      bfd_ardata (abfd)->first_file_filepos = bfd_tell (abfd);
      bfd_ardata (abfd)->first_file_filepos +=
       (bfd_ardata (abfd)->first_file_filepos) % 2;

      /* FIXME, we can't release namedata here because it was allocated
        below extended_names on the objalloc...  */
    }
  return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bfd_boolean _bfd_stab_section_find_nearest_line ( bfd ,
asymbol **  ,
asection ,
bfd_vma  ,
bfd_boolean ,
const char **  ,
const char **  ,
unsigned int ,
void **   
)

Definition at line 907 of file syms.c.

{
  struct stab_find_info *info;
  bfd_size_type stabsize, strsize;
  bfd_byte *stab, *str;
  bfd_byte *last_stab = NULL;
  bfd_size_type stroff;
  struct indexentry *indexentry;
  char *file_name;
  char *directory_name;
  int saw_fun;
  bfd_boolean saw_line, saw_func;

  *pfound = FALSE;
  *pfilename = bfd_get_filename (abfd);
  *pfnname = NULL;
  *pline = 0;

  /* Stabs entries use a 12 byte format:
       4 byte string table index
       1 byte stab type
       1 byte stab other field
       2 byte stab desc field
       4 byte stab value
     FIXME: This will have to change for a 64 bit object format.

     The stabs symbols are divided into compilation units.  For the
     first entry in each unit, the type of 0, the value is the length
     of the string table for this unit, and the desc field is the
     number of stabs symbols for this unit.  */

#define STRDXOFF (0)
#define TYPEOFF (4)
#define OTHEROFF (5)
#define DESCOFF (6)
#define VALOFF (8)
#define STABSIZE (12)

  info = *pinfo;
  if (info != NULL)
    {
      if (info->stabsec == NULL || info->strsec == NULL)
       {
         /* No stabs debugging information.  */
         return TRUE;
       }

      stabsize = (info->stabsec->rawsize
                ? info->stabsec->rawsize
                : info->stabsec->size);
      strsize = (info->strsec->rawsize
               ? info->strsec->rawsize
               : info->strsec->size);
    }
  else
    {
      long reloc_size, reloc_count;
      arelent **reloc_vector;
      int i;
      char *name;
      char *function_name;
      bfd_size_type amt = sizeof *info;

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

      /* FIXME: When using the linker --split-by-file or
        --split-by-reloc options, it is possible for the .stab and
        .stabstr sections to be split.  We should handle that.  */

      info->stabsec = bfd_get_section_by_name (abfd, ".stab");
      info->strsec = bfd_get_section_by_name (abfd, ".stabstr");

      if (info->stabsec == NULL || info->strsec == NULL)
       {
         /* No stabs debugging information.  Set *pinfo so that we
             can return quickly in the info != NULL case above.  */
         *pinfo = info;
         return TRUE;
       }

      stabsize = (info->stabsec->rawsize
                ? info->stabsec->rawsize
                : info->stabsec->size);
      strsize = (info->strsec->rawsize
               ? info->strsec->rawsize
               : info->strsec->size);

      info->stabs = bfd_alloc (abfd, stabsize);
      info->strs = bfd_alloc (abfd, strsize);
      if (info->stabs == NULL || info->strs == NULL)
       return FALSE;

      if (! bfd_get_section_contents (abfd, info->stabsec, info->stabs,
                                  0, stabsize)
         || ! bfd_get_section_contents (abfd, info->strsec, info->strs,
                                    0, strsize))
       return FALSE;

      /* If this is a relocatable object file, we have to relocate
        the entries in .stab.  This should always be simple 32 bit
        relocations against symbols defined in this object file, so
        this should be no big deal.  */
      reloc_size = bfd_get_reloc_upper_bound (abfd, info->stabsec);
      if (reloc_size < 0)
       return FALSE;
      reloc_vector = bfd_malloc (reloc_size);
      if (reloc_vector == NULL && reloc_size != 0)
       return FALSE;
      reloc_count = bfd_canonicalize_reloc (abfd, info->stabsec, reloc_vector,
                                       symbols);
      if (reloc_count < 0)
       {
         if (reloc_vector != NULL)
           free (reloc_vector);
         return FALSE;
       }
      if (reloc_count > 0)
       {
         arelent **pr;

         for (pr = reloc_vector; *pr != NULL; pr++)
           {
             arelent *r;
             unsigned long val;
             asymbol *sym;

             r = *pr;
             /* Ignore R_*_NONE relocs.  */
             if (r->howto->dst_mask == 0)
              continue;

             if (r->howto->rightshift != 0
                || r->howto->size != 2
                || r->howto->bitsize != 32
                || r->howto->pc_relative
                || r->howto->bitpos != 0
                || r->howto->dst_mask != 0xffffffff)
              {
                (*_bfd_error_handler)
                  (_("Unsupported .stab relocation"));
                bfd_set_error (bfd_error_invalid_operation);
                if (reloc_vector != NULL)
                  free (reloc_vector);
                return FALSE;
              }

             val = bfd_get_32 (abfd, info->stabs + r->address);
             val &= r->howto->src_mask;
             sym = *r->sym_ptr_ptr;
             val += sym->value + sym->section->vma + r->addend;
             bfd_put_32 (abfd, (bfd_vma) val, info->stabs + r->address);
           }
       }

      if (reloc_vector != NULL)
       free (reloc_vector);

      /* First time through this function, build a table matching
        function VM addresses to stabs, then sort based on starting
        VM address.  Do this in two passes: once to count how many
        table entries we'll need, and a second to actually build the
        table.  */

      info->indextablesize = 0;
      saw_fun = 1;
      for (stab = info->stabs; stab < info->stabs + stabsize; stab += STABSIZE)
       {
         if (stab[TYPEOFF] == (bfd_byte) N_SO)
           {
             /* N_SO with null name indicates EOF */
             if (bfd_get_32 (abfd, stab + STRDXOFF) == 0)
              continue;

             /* if we did not see a function def, leave space for one.  */
             if (saw_fun == 0)
              ++info->indextablesize;

             saw_fun = 0;

             /* two N_SO's in a row is a filename and directory. Skip */
             if (stab + STABSIZE < info->stabs + stabsize
                && *(stab + STABSIZE + TYPEOFF) == (bfd_byte) N_SO)
              {
                stab += STABSIZE;
              }
           }
         else if (stab[TYPEOFF] == (bfd_byte) N_FUN)
           {
             saw_fun = 1;
             ++info->indextablesize;
           }
       }

      if (saw_fun == 0)
       ++info->indextablesize;

      if (info->indextablesize == 0)
       return TRUE;
      ++info->indextablesize;

      amt = info->indextablesize;
      amt *= sizeof (struct indexentry);
      info->indextable = bfd_alloc (abfd, amt);
      if (info->indextable == NULL)
       return FALSE;

      file_name = NULL;
      directory_name = NULL;
      saw_fun = 1;

      for (i = 0, stroff = 0, stab = info->stabs, str = info->strs;
          i < info->indextablesize && stab < info->stabs + stabsize;
          stab += STABSIZE)
       {
         switch (stab[TYPEOFF])
           {
           case 0:
             /* This is the first entry in a compilation unit.  */
             if ((bfd_size_type) ((info->strs + strsize) - str) < stroff)
              break;
             str += stroff;
             stroff = bfd_get_32 (abfd, stab + VALOFF);
             break;

           case N_SO:
             /* The main file name.  */

             /* The following code creates a new indextable entry with
                a NULL function name if there were no N_FUNs in a file.
                Note that a N_SO without a file name is an EOF and
                there could be 2 N_SO following it with the new filename
                and directory.  */
             if (saw_fun == 0)
              {
                info->indextable[i].val = bfd_get_32 (abfd, last_stab + VALOFF);
                info->indextable[i].stab = last_stab;
                info->indextable[i].str = str;
                info->indextable[i].directory_name = directory_name;
                info->indextable[i].file_name = file_name;
                info->indextable[i].function_name = NULL;
                ++i;
              }
             saw_fun = 0;

             file_name = (char *) str + bfd_get_32 (abfd, stab + STRDXOFF);
             if (*file_name == '\0')
              {
                directory_name = NULL;
                file_name = NULL;
                saw_fun = 1;
              }
             else
              {
                last_stab = stab;
                if (stab + STABSIZE >= info->stabs + stabsize
                    || *(stab + STABSIZE + TYPEOFF) != (bfd_byte) N_SO)
                  {
                    directory_name = NULL;
                  }
                else
                  {
                    /* Two consecutive N_SOs are a directory and a
                      file name.  */
                    stab += STABSIZE;
                    directory_name = file_name;
                    file_name = ((char *) str
                               + bfd_get_32 (abfd, stab + STRDXOFF));
                  }
              }
             break;

           case N_SOL:
             /* The name of an include file.  */
             file_name = (char *) str + bfd_get_32 (abfd, stab + STRDXOFF);
             break;

           case N_FUN:
             /* A function name.  */
             saw_fun = 1;
             name = (char *) str + bfd_get_32 (abfd, stab + STRDXOFF);

             if (*name == '\0')
              name = NULL;

             function_name = name;

             if (name == NULL)
              continue;

             info->indextable[i].val = bfd_get_32 (abfd, stab + VALOFF);
             info->indextable[i].stab = stab;
             info->indextable[i].str = str;
             info->indextable[i].directory_name = directory_name;
             info->indextable[i].file_name = file_name;
             info->indextable[i].function_name = function_name;
             ++i;
             break;
           }
       }

      if (saw_fun == 0)
       {
         info->indextable[i].val = bfd_get_32 (abfd, last_stab + VALOFF);
         info->indextable[i].stab = last_stab;
         info->indextable[i].str = str;
         info->indextable[i].directory_name = directory_name;
         info->indextable[i].file_name = file_name;
         info->indextable[i].function_name = NULL;
         ++i;
       }

      info->indextable[i].val = (bfd_vma) -1;
      info->indextable[i].stab = info->stabs + stabsize;
      info->indextable[i].str = str;
      info->indextable[i].directory_name = NULL;
      info->indextable[i].file_name = NULL;
      info->indextable[i].function_name = NULL;
      ++i;

      info->indextablesize = i;
      qsort (info->indextable, (size_t) i, sizeof (struct indexentry),
            cmpindexentry);

      *pinfo = info;
    }

  /* We are passed a section relative offset.  The offsets in the
     stabs information are absolute.  */
  offset += bfd_get_section_vma (abfd, section);

#ifdef ENABLE_CACHING
  if (info->cached_indexentry != NULL
      && offset >= info->cached_offset
      && offset < (info->cached_indexentry + 1)->val)
    {
      stab = info->cached_stab;
      indexentry = info->cached_indexentry;
      file_name = info->cached_file_name;
    }
  else
#endif
    {
      long low, high;
      long mid = -1;

      /* Cache non-existent or invalid.  Do binary search on
         indextable.  */
      indexentry = NULL;

      low = 0;
      high = info->indextablesize - 1;
      while (low != high)
       {
         mid = (high + low) / 2;
         if (offset >= info->indextable[mid].val
             && offset < info->indextable[mid + 1].val)
           {
             indexentry = &info->indextable[mid];
             break;
           }

         if (info->indextable[mid].val > offset)
           high = mid;
         else
           low = mid + 1;
       }

      if (indexentry == NULL)
       return TRUE;

      stab = indexentry->stab + STABSIZE;
      file_name = indexentry->file_name;
    }

  directory_name = indexentry->directory_name;
  str = indexentry->str;

  saw_line = FALSE;
  saw_func = FALSE;
  for (; stab < (indexentry+1)->stab; stab += STABSIZE)
    {
      bfd_boolean done;
      bfd_vma val;

      done = FALSE;

      switch (stab[TYPEOFF])
       {
       case N_SOL:
         /* The name of an include file.  */
         val = bfd_get_32 (abfd, stab + VALOFF);
         if (val <= offset)
           {
             file_name = (char *) str + bfd_get_32 (abfd, stab + STRDXOFF);
             *pline = 0;
           }
         break;

       case N_SLINE:
       case N_DSLINE:
       case N_BSLINE:
         /* A line number.  If the function was specified, then the value
            is relative to the start of the function.  Otherwise, the
            value is an absolute address.  */
         val = ((indexentry->function_name ? indexentry->val : 0)
               + bfd_get_32 (abfd, stab + VALOFF));
         /* If this line starts before our desired offset, or if it's
            the first line we've been able to find, use it.  The
            !saw_line check works around a bug in GCC 2.95.3, which emits
            the first N_SLINE late.  */
         if (!saw_line || val <= offset)
           {
             *pline = bfd_get_16 (abfd, stab + DESCOFF);

#ifdef ENABLE_CACHING
             info->cached_stab = stab;
             info->cached_offset = val;
             info->cached_file_name = file_name;
             info->cached_indexentry = indexentry;
#endif
           }
         if (val > offset)
           done = TRUE;
         saw_line = TRUE;
         break;

       case N_FUN:
       case N_SO:
         if (saw_func || saw_line)
           done = TRUE;
         saw_func = TRUE;
         break;
       }

      if (done)
       break;
    }

  *pfound = TRUE;

  if (file_name == NULL || IS_ABSOLUTE_PATH (file_name)
      || directory_name == NULL)
    *pfilename = file_name;
  else
    {
      size_t dirlen;

      dirlen = strlen (directory_name);
      if (info->filename == NULL
         || strncmp (info->filename, directory_name, dirlen) != 0
         || strcmp (info->filename + dirlen, file_name) != 0)
       {
         size_t len;

         if (info->filename != NULL)
           free (info->filename);
         len = strlen (file_name) + 1;
         info->filename = bfd_malloc (dirlen + len);
         if (info->filename == NULL)
           return FALSE;
         memcpy (info->filename, directory_name, dirlen);
         memcpy (info->filename + dirlen, file_name, len);
       }

      *pfilename = info->filename;
    }

  if (indexentry->function_name != NULL)
    {
      char *s;

      /* This will typically be something like main:F(0,1), so we want
         to clobber the colon.  It's OK to change the name, since the
         string is in our own local storage anyhow.  */
      s = strchr (indexentry->function_name, ':');
      if (s != NULL)
       *s = '\0';

      *pfnname = indexentry->function_name;
    }

  return TRUE;
}

Here is the call graph for this function:

bfd_vma _bfd_stab_section_offset ( asection ,
void *  ,
bfd_vma   
)

Definition at line 758 of file stabs.c.

{
  struct stab_section_info *secinfo;

  secinfo = (struct stab_section_info *) psecinfo;

  if (secinfo == NULL)
    return offset;

  if (offset >= stabsec->rawsize)
    return offset - stabsec->rawsize + stabsec->size;

  if (secinfo->cumulative_skips)
    {
      bfd_vma i;

      i = offset / STABSIZE;

      if (secinfo->stridxs [i] == (bfd_size_type) -1)
       return (bfd_vma) -1;

      return offset - secinfo->cumulative_skips [i];
    }

  return offset;
}

Definition at line 738 of file hash.c.

{
  struct strtab_hash_entry *entry;

  if (hash)
    {
      entry = strtab_hash_lookup (tab, str, TRUE, copy);
      if (entry == NULL)
       return (bfd_size_type) -1;
    }
  else
    {
      entry = bfd_hash_allocate (&tab->table, sizeof (* entry));
      if (entry == NULL)
       return (bfd_size_type) -1;
      if (! copy)
       entry->root.string = str;
      else
       {
         char *n;

         n = bfd_hash_allocate (&tab->table, strlen (str) + 1);
         if (n == NULL)
           return (bfd_size_type) -1;
         entry->root.string = n;
       }
      entry->index = (bfd_size_type) -1;
      entry->next = NULL;
    }

  if (entry->index == (bfd_size_type) -1)
    {
      entry->index = tab->size;
      tab->size += strlen (str) + 1;
      if (tab->xcoff)
       {
         entry->index += 2;
         tab->size += 2;
       }
      if (tab->first == NULL)
       tab->first = entry;
      else
       tab->last->next = entry;
      tab->last = entry;
    }

  return entry->index;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 802 of file hash.c.

{
  bfd_boolean xcoff;
  struct strtab_hash_entry *entry;

  xcoff = tab->xcoff;

  for (entry = tab->first; entry != NULL; entry = entry->next)
    {
      const char *str;
      size_t len;

      str = entry->root.string;
      len = strlen (str) + 1;

      if (xcoff)
       {
         bfd_byte buf[2];

         /* The output length includes the null byte.  */
         bfd_put_16 (abfd, (bfd_vma) len, buf);
         if (bfd_bwrite ((void *) buf, (bfd_size_type) 2, abfd) != 2)
           return FALSE;
       }

      if (bfd_bwrite ((void *) str, (bfd_size_type) len, abfd) != len)
       return FALSE;
    }

  return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 727 of file hash.c.

{
  bfd_hash_table_free (&table->table);
  free (table);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 685 of file hash.c.

{
  struct bfd_strtab_hash *table;
  bfd_size_type amt = sizeof (* table);

  table = bfd_malloc (amt);
  if (table == NULL)
    return NULL;

  if (!bfd_hash_table_init (&table->table, strtab_hash_newfunc,
                         sizeof (struct strtab_hash_entry)))
    {
      free (table);
      return NULL;
    }

  table->size = 0;
  table->first = NULL;
  table->last = NULL;
  table->xcoff = FALSE;

  return table;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 793 of file hash.c.

{
  return tab->size;
}

Here is the caller graph for this function:

Definition at line 1625 of file archive.c.

{
  bfd *current;
  char *etable = NULL;
  bfd_size_type elength = 0;
  const char *ename = NULL;
  bfd_boolean makemap = bfd_has_map (arch);
  /* If no .o's, don't bother to make a map.  */
  bfd_boolean hasobjects = FALSE;
  bfd_size_type wrote;
  int tries;

  /* Verify the viability of all entries; if any of them live in the
     filesystem (as opposed to living in an archive open for input)
     then construct a fresh ar_hdr for them.  */
  for (current = arch->archive_head; current; current = current->next)
    {
      /* This check is checking the bfds for the objects we're reading
        from (which are usually either an object file or archive on
        disk), not the archive entries we're writing to.  We don't
        actually create bfds for the archive members, we just copy
        them byte-wise when we write out the archive.  */
      if (bfd_write_p (current))
       {
         bfd_set_error (bfd_error_invalid_operation);
         goto input_err;
       }
      if (!current->arelt_data)
       {
         current->arelt_data =
           bfd_ar_hdr_from_filesystem (arch, current->filename, current);
         if (!current->arelt_data)
           goto input_err;

         /* Put in the file name.  */
         BFD_SEND (arch, _bfd_truncate_arname,
                  (arch, current->filename, (char *) arch_hdr (current)));
       }

      if (makemap && ! hasobjects)
       {                    /* Don't bother if we won't make a map!  */
         if ((bfd_check_format (current, bfd_object)))
           hasobjects = TRUE;
       }
    }

  if (!BFD_SEND (arch, _bfd_construct_extended_name_table,
               (arch, &etable, &elength, &ename)))
    return FALSE;

  if (bfd_seek (arch, (file_ptr) 0, SEEK_SET) != 0)
    return FALSE;
  wrote = bfd_bwrite (ARMAG, SARMAG, arch);
  if (wrote != SARMAG)
    return FALSE;

  if (makemap && hasobjects)
    {
      if (! _bfd_compute_and_write_armap (arch, (unsigned int) elength))
       return FALSE;
    }

  if (elength != 0)
    {
      struct ar_hdr hdr;

      memset (&hdr, ' ', sizeof (struct ar_hdr));
      memcpy (hdr.ar_name, ename, strlen (ename));
      /* Round size up to even number in archive header.  */
      _bfd_ar_spacepad (hdr.ar_size, sizeof (hdr.ar_size), "%-10ld",
                        (elength + 1) & ~(bfd_size_type) 1);
      memcpy (hdr.ar_fmag, ARFMAG, 2);
      if ((bfd_bwrite (&hdr, sizeof (struct ar_hdr), arch)
          != sizeof (struct ar_hdr))
         || bfd_bwrite (etable, elength, arch) != elength)
       return FALSE;
      if ((elength % 2) == 1)
       {
         if (bfd_bwrite ("\012", 1, arch) != 1)
           return FALSE;
       }
    }

  for (current = arch->archive_head; current; current = current->next)
    {
      char buffer[DEFAULT_BUFFERSIZE];
      unsigned int remaining = arelt_size (current);
      struct ar_hdr *hdr = arch_hdr (current);

      /* Write ar header.  */
      if (bfd_bwrite (hdr, sizeof (*hdr), arch)
         != sizeof (*hdr))
       return FALSE;
      if (bfd_seek (current, (file_ptr) 0, SEEK_SET) != 0)
       goto input_err;
      while (remaining)
       {
         unsigned int amt = DEFAULT_BUFFERSIZE;
         if (amt > remaining)
           amt = remaining;
         errno = 0;
         if (bfd_bread (buffer, amt, current) != amt)
           {
             if (bfd_get_error () != bfd_error_system_call)
              bfd_set_error (bfd_error_file_truncated);
             goto input_err;
           }
         if (bfd_bwrite (buffer, amt, arch) != amt)
           return FALSE;
         remaining -= amt;
       }
      if ((arelt_size (current) % 2) == 1)
       {
         if (bfd_bwrite ("\012", 1, arch) != 1)
           return FALSE;
       }
    }

  if (makemap && hasobjects)
    {
      /* Verify the timestamp in the archive file.  If it would not be
        accepted by the linker, rewrite it until it would be.  If
        anything odd happens, break out and just return.  (The
        Berkeley linker checks the timestamp and refuses to read the
        table-of-contents if it is >60 seconds less than the file's
        modified-time.  That painful hack requires this painful hack.  */
      tries = 1;
      do
       {
         if (bfd_update_armap_timestamp (arch))
           break;
         (*_bfd_error_handler)
           (_("Warning: writing archive was slow: rewriting timestamp\n"));
       }
      while (++tries < 6);
    }

  return TRUE;

 input_err:
  bfd_set_error (bfd_error_on_input, current, bfd_get_error ());
  return FALSE;
}

Here is the call graph for this function:

bfd_boolean _bfd_write_merged_section ( bfd ,
asection ,
void *   
)

Definition at line 778 of file merge.c.

{
  struct sec_merge_sec_info *secinfo;
  file_ptr pos;

  secinfo = (struct sec_merge_sec_info *) psecinfo;

  if (secinfo->first_str == NULL)
    return TRUE;

  pos = sec->output_section->filepos + sec->output_offset;
  if (bfd_seek (output_bfd, pos, SEEK_SET) != 0)
    return FALSE;

  if (! sec_merge_emit (output_bfd, secinfo->first_str))
    return FALSE;

  return TRUE;
}

Here is the call graph for this function:

bfd_boolean _bfd_write_section_stabs ( bfd ,
struct stab_info ,
asection ,
void **  ,
bfd_byte  
)

Definition at line 656 of file stabs.c.

{
  struct stab_section_info *secinfo;
  struct stab_excl_list *e;
  bfd_byte *sym, *tosym, *symend;
  bfd_size_type *pstridx;

  secinfo = (struct stab_section_info *) *psecinfo;

  if (secinfo == NULL)
    return bfd_set_section_contents (output_bfd, stabsec->output_section,
                                 contents, stabsec->output_offset,
                                 stabsec->size);

  /* Handle each N_BINCL entry.  */
  for (e = secinfo->excls; e != NULL; e = e->next)
    {
      bfd_byte *excl_sym;

      BFD_ASSERT (e->offset < stabsec->rawsize);
      excl_sym = contents + e->offset;
      bfd_put_32 (output_bfd, e->val, excl_sym + VALOFF);
      excl_sym[TYPEOFF] = e->type;
    }

  /* Copy over all the stabs symbols, omitting the ones we don't want,
     and correcting the string indices for those we do want.  */
  tosym = contents;
  symend = contents + stabsec->rawsize;
  for (sym = contents, pstridx = secinfo->stridxs;
       sym < symend;
       sym += STABSIZE, ++pstridx)
    {
      if (*pstridx != (bfd_size_type) -1)
       {
         if (tosym != sym)
           memcpy (tosym, sym, STABSIZE);
         bfd_put_32 (output_bfd, *pstridx, tosym + STRDXOFF);

         if (sym[TYPEOFF] == 0)
           {
             /* This is the header symbol for the stabs section.  We
               don't really need one, since we have merged all the
               input stabs sections into one, but we generate one
               for the benefit of readers which expect to see one.  */
             BFD_ASSERT (sym == contents);
             bfd_put_32 (output_bfd, _bfd_stringtab_size (sinfo->strings),
                       tosym + VALOFF);
             bfd_put_16 (output_bfd,
                       stabsec->output_section->size / STABSIZE - 1,
                       tosym + DESCOFF);
           }

         tosym += STABSIZE;
       }
    }

  BFD_ASSERT ((bfd_size_type) (tosym - contents) == stabsec->size);

  return bfd_set_section_contents (output_bfd, stabsec->output_section,
                               contents, (file_ptr) stabsec->output_offset,
                               stabsec->size);
}

Here is the call graph for this function:

Definition at line 727 of file stabs.c.

{
  if (bfd_is_abs_section (sinfo->stabstr->output_section))
    /* The section was discarded from the link.  */
    return TRUE;

  BFD_ASSERT ((sinfo->stabstr->output_offset
              + _bfd_stringtab_size (sinfo->strings))
             <= sinfo->stabstr->output_section->size);

  if (bfd_seek (output_bfd,
              (file_ptr) (sinfo->stabstr->output_section->filepos
                         + sinfo->stabstr->output_offset),
              SEEK_SET) != 0)
    return FALSE;

  if (! _bfd_stringtab_emit (output_bfd, sinfo->strings))
    return FALSE;

  /* We no longer need the stabs information.  */
  _bfd_stringtab_free (sinfo->strings);
  bfd_hash_table_free (&sinfo->includes);

  return TRUE;
}

Here is the call graph for this function:

Definition at line 714 of file hash.c.

{
  struct bfd_strtab_hash *ret;

  ret = _bfd_stringtab_init ();
  if (ret != NULL)
    ret->xcoff = TRUE;
  return ret;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int bfd_0 ( bfd ignore)
long bfd_0l ( bfd ignore)
unsigned int bfd_0u ( bfd ignore)
void* bfd_alloc ( bfd ,
bfd_size_type   
)

Definition at line 886 of file opncls.c.

{
  void *ret;

  if (size != (unsigned long) size)
    {
      bfd_set_error (bfd_error_no_memory);
      return NULL;
    }

  ret = objalloc_alloc (abfd->memory, (unsigned long) size);
  if (ret == NULL)
    bfd_set_error (bfd_error_no_memory);
  return ret;
}

Here is the call graph for this function:

void* bfd_alloc2 ( bfd ,
bfd_size_type  ,
bfd_size_type   
)

Definition at line 915 of file opncls.c.

{
  void *ret;

  if ((nmemb | size) >= HALF_BFD_SIZE_TYPE
      && size != 0
      && nmemb > ~(bfd_size_type) 0 / size)
    {
      bfd_set_error (bfd_error_no_memory);
      return NULL;
    }

  size *= nmemb;

  if (size != (unsigned long) size)
    {
      bfd_set_error (bfd_error_no_memory);
      return NULL;
    }

  ret = objalloc_alloc (abfd->memory, (unsigned long) size);
  if (ret == NULL)
    bfd_set_error (bfd_error_no_memory);
  return ret;
}

Here is the call graph for this function:

void bfd_assert ( const char *  ,
int   
)

Definition at line 826 of file bfd.c.

{
  (*_bfd_error_handler) (_("BFD %s assertion fail %s:%d"),
                      BFD_VERSION_STRING, file, line);
}
void bfd_bsd_truncate_arname ( bfd abfd,
const char *  filename,
char *  hdr 
)

Definition at line 1532 of file archive.c.

{
  struct ar_hdr *hdr = (struct ar_hdr *) arhdr;
  size_t length;
  const char *filename = strrchr (pathname, '/');
  size_t maxlen = ar_maxnamelen (abfd);

#ifdef HAVE_DOS_BASED_FILE_SYSTEM
  {
    /* We could have foo/bar\\baz, or foo\\bar, or d:bar.  */
    char *bslash = strrchr (pathname, '\\');
    if (filename == NULL || (bslash != NULL && bslash > filename))
      filename = bslash;
    if (filename == NULL && pathname[0] != '\0' && pathname[1] == ':')
      filename = pathname + 1;
  }
#endif

  if (filename == NULL)
    filename = pathname;
  else
    ++filename;

  length = strlen (filename);

  if (length <= maxlen)
    memcpy (hdr->ar_name, filename, length);
  else
    {
      /* pathname: meet procrustes */
      memcpy (hdr->ar_name, filename, maxlen);
      length = maxlen;
    }

  if (length < maxlen)
    (hdr->ar_name)[length] = ar_padchar (abfd);
}

Here is the call graph for this function:

Here is the caller graph for this function:

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 call graph for this function:

Definition at line 379 of file cache.c.

{
  BFD_ASSERT (abfd->iostream != NULL);
  if (open_files >= BFD_CACHE_MAX_OPEN)
    {
      if (! close_one ())
       return FALSE;
    }
  abfd->iovec = &cache_iovec;
  insert (abfd);
  ++open_files;
  return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 864 of file archures.c.

{
  if (a->arch != b->arch)
    return NULL;

  if (a->bits_per_word != b->bits_per_word)
    return NULL;

  if (a->mach > b->mach)
    return a;

  if (b->mach > a->mach)
    return b;

  return a;
}

Here is the caller graph for this function:

reloc_howto_type* bfd_default_reloc_type_lookup ( bfd abfd,
bfd_reloc_code_real_type  code 
)

Definition at line 4989 of file reloc.c.

{
  switch (code)
    {
    case BFD_RELOC_CTOR:
      /* The type of reloc used in a ctor, which will be as wide as the
        address - so either a 64, 32, or 16 bitter.  */
      switch (bfd_get_arch_info (abfd)->bits_per_address)
       {
       case 64:
         BFD_FAIL ();
       case 32:
         return &bfd_howto_32;
       case 16:
         BFD_FAIL ();
       default:
         BFD_FAIL ();
       }
    default:
      BFD_FAIL ();
    }
  return NULL;
}

Here is the call graph for this function:

bfd_boolean bfd_default_scan ( const struct bfd_arch_info info,
const char *  string 
)

Definition at line 766 of file archures.c.

{
  abfd->arch_info = bfd_lookup_arch (arch, mach);
  if (abfd->arch_info != NULL)
    return TRUE;

  abfd->arch_info = &bfd_default_arch_struct;
  bfd_set_error (bfd_error_bad_value);
  return FALSE;
}

Here is the call graph for this function:

void bfd_dont_truncate_arname ( bfd abfd,
const char *  filename,
char *  hdr 
)

Definition at line 1495 of file archive.c.

{
  /* FIXME: This interacts unpleasantly with ar's quick-append option.
     Fortunately ic960 users will never use that option.  Fixing this
     is very hard; fortunately I know how to do it and will do so once
     intel's release is out the door.  */

  struct ar_hdr *hdr = (struct ar_hdr *) arhdr;
  size_t length;
  const char *filename;
  size_t maxlen = ar_maxnamelen (abfd);

  if ((bfd_get_file_flags (abfd) & BFD_TRADITIONAL_FORMAT) != 0)
    {
      bfd_bsd_truncate_arname (abfd, pathname, arhdr);
      return;
    }

  filename = normalize (abfd, pathname);
  if (filename == NULL)
    {
      /* FIXME */
      abort ();
    }

  length = strlen (filename);

  if (length <= maxlen)
    memcpy (hdr->ar_name, filename, length);

  /* Add the padding character if there is room for it.  */
  if (length < maxlen
      || (length == maxlen && length < sizeof hdr->ar_name))
    (hdr->ar_name)[length] = ar_padchar (abfd);
}

Here is the call graph for this function:

struct elf_internal_shdr* bfd_elf_find_section ( bfd abfd,
char *  name 
) [read]

Definition at line 979 of file elf.c.

{
  Elf_Internal_Shdr **i_shdrp;
  char *shstrtab;
  unsigned int max;
  unsigned int i;

  i_shdrp = elf_elfsections (abfd);
  if (i_shdrp != NULL)
    {
      shstrtab = bfd_elf_get_str_section (abfd,
                                     elf_elfheader (abfd)->e_shstrndx);
      if (shstrtab != NULL)
       {
         max = elf_numsections (abfd);
         for (i = 1; i < max; i++)
           if (!strcmp (&shstrtab[i_shdrp[i]->sh_name], name))
             return i_shdrp[i];
       }
    }
  return 0;
}

Here is the call graph for this function:

bfd_boolean bfd_false ( bfd ignore)

Definition at line 605 of file archive.c.

{
  struct artdata *tdata_hold;
  char armag[SARMAG + 1];
  bfd_size_type amt;

  if (bfd_bread (armag, SARMAG, abfd) != SARMAG)
    {
      if (bfd_get_error () != bfd_error_system_call)
       bfd_set_error (bfd_error_wrong_format);
      return NULL;
    }

  if (strncmp (armag, ARMAG, SARMAG) != 0 &&
      strncmp (armag, ARMAGB, SARMAG) != 0)
    return 0;

  tdata_hold = bfd_ardata (abfd);

  amt = sizeof (struct artdata);
  bfd_ardata (abfd) = bfd_zalloc (abfd, amt);
  if (bfd_ardata (abfd) == NULL)
    {
      bfd_ardata (abfd) = tdata_hold;
      return NULL;
    }

  bfd_ardata (abfd)->first_file_filepos = SARMAG;
  /* Cleared by bfd_zalloc above.
     bfd_ardata (abfd)->cache = NULL;
     bfd_ardata (abfd)->archive_head = NULL;
     bfd_ardata (abfd)->symdefs = NULL;
     bfd_ardata (abfd)->extended_names = NULL;
     bfd_ardata (abfd)->extended_names_size = 0;
     bfd_ardata (abfd)->tdata = NULL;  */

  if (!BFD_SEND (abfd, _bfd_slurp_armap, (abfd))
      || !BFD_SEND (abfd, _bfd_slurp_extended_name_table, (abfd)))
    {
      if (bfd_get_error () != bfd_error_system_call)
       bfd_set_error (bfd_error_wrong_format);
      bfd_release (abfd, bfd_ardata (abfd));
      bfd_ardata (abfd) = tdata_hold;
      return NULL;
    }

  if (bfd_has_map (abfd))
    {
      bfd *first;

      /* This archive has a map, so we may presume that the contents
        are object files.  Make sure that if the first file in the
        archive can be recognized as an object file, it is for this
        target.  If not, assume that this is the wrong format.  If
        the first file is not an object file, somebody is doing
        something weird, and we permit it so that ar -t will work.

        This is done because any normal format will recognize any
        normal archive, regardless of the format of the object files.
        We do accept an empty archive.  */

      first = bfd_openr_next_archived_file (abfd, NULL);
      if (first != NULL)
       {
         first->target_defaulted = FALSE;
         if (bfd_check_format (first, bfd_object)
             && first->xvec != abfd->xvec)
           {
             bfd_set_error (bfd_error_wrong_object_format);
             bfd_ardata (abfd) = tdata_hold;
             return NULL;
           }
         /* And we ought to close `first' here too.  */
       }
    }

  return abfd->xvec;
}

Here is the call graph for this function:

bfd_byte* bfd_generic_get_relocated_section_contents ( bfd abfd,
struct bfd_link_info link_info,
struct bfd_link_order link_order,
bfd_byte data,
bfd_boolean  relocatable,
asymbol **  symbols 
)

Definition at line 5119 of file reloc.c.

{
  /* Get enough memory to hold the stuff.  */
  bfd *input_bfd = link_order->u.indirect.section->owner;
  asection *input_section = link_order->u.indirect.section;

  long reloc_size = bfd_get_reloc_upper_bound (input_bfd, input_section);
  arelent **reloc_vector = NULL;
  long reloc_count;
  bfd_size_type sz;

  if (reloc_size < 0)
    goto error_return;

  reloc_vector = bfd_malloc (reloc_size);
  if (reloc_vector == NULL && reloc_size != 0)
    goto error_return;

  /* Read in the section.  */
  sz = input_section->rawsize ? input_section->rawsize : input_section->size;
  if (!bfd_get_section_contents (input_bfd, input_section, data, 0, sz))
    goto error_return;

  reloc_count = bfd_canonicalize_reloc (input_bfd,
                                   input_section,
                                   reloc_vector,
                                   symbols);
  if (reloc_count < 0)
    goto error_return;

  if (reloc_count > 0)
    {
      arelent **parent;
      for (parent = reloc_vector; *parent != NULL; parent++)
       {
         char *error_message = NULL;
         asymbol *symbol;
         bfd_reloc_status_type r;

         symbol = *(*parent)->sym_ptr_ptr;
         if (symbol->section && elf_discarded_section (symbol->section))
           {
             bfd_byte *p;
             static reloc_howto_type none_howto
              = HOWTO (0, 0, 0, 0, FALSE, 0, complain_overflow_dont, NULL,
                      "unused", FALSE, 0, 0, FALSE);

             p = data + (*parent)->address * bfd_octets_per_byte (input_bfd);
             _bfd_clear_contents ((*parent)->howto, input_bfd, p);
             (*parent)->sym_ptr_ptr = bfd_abs_section.symbol_ptr_ptr;
             (*parent)->addend = 0;
             (*parent)->howto = &none_howto;
             r = bfd_reloc_ok;
           }
         else
           r = bfd_perform_relocation (input_bfd,
                                   *parent,
                                   data,
                                   input_section,
                                   relocatable ? abfd : NULL,
                                   &error_message);

         if (relocatable)
           {
             asection *os = input_section->output_section;

             /* A partial link, so keep the relocs.  */
             os->orelocation[os->reloc_count] = *parent;
             os->reloc_count++;
           }

         if (r != bfd_reloc_ok)
           {
             switch (r)
              {
              case bfd_reloc_undefined:
                if (!((*link_info->callbacks->undefined_symbol)
                     (link_info, bfd_asymbol_name (*(*parent)->sym_ptr_ptr),
                      input_bfd, input_section, (*parent)->address,
                      TRUE)))
                  goto error_return;
                break;
              case bfd_reloc_dangerous:
                BFD_ASSERT (error_message != NULL);
                if (!((*link_info->callbacks->reloc_dangerous)
                     (link_info, error_message, input_bfd, input_section,
                      (*parent)->address)))
                  goto error_return;
                break;
              case bfd_reloc_overflow:
                if (!((*link_info->callbacks->reloc_overflow)
                     (link_info, NULL,
                      bfd_asymbol_name (*(*parent)->sym_ptr_ptr),
                      (*parent)->howto->name, (*parent)->addend,
                      input_bfd, input_section, (*parent)->address)))
                  goto error_return;
                break;
              case bfd_reloc_outofrange:
              default:
                abort ();
                break;
              }

           }
       }
    }
  if (reloc_vector != NULL)
    free (reloc_vector);
  return data;

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

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 928 of file libbfd.c.

{
  char locals_prefix = (bfd_get_symbol_leading_char (abfd) == '_') ? 'L' : '.';

  return name[0] == locals_prefix;
}
bfd* bfd_generic_openr_next_archived_file ( bfd archive,
bfd last_file 
)

Definition at line 583 of file archive.c.

{
  file_ptr filestart;

  if (!last_file)
    filestart = bfd_ardata (archive)->first_file_filepos;
  else
    {
      unsigned int size = arelt_size (last_file);
      filestart = last_file->origin + size;
      if (archive->my_archive)
       filestart -= archive->origin;
      /* Pad to an even boundary...
        Note that last_file->origin can be odd in the case of
        BSD-4.4-style element with a long odd size.  */
      filestart += filestart % 2;
    }

  return _bfd_get_elt_at_filepos (archive, filestart);
}

Here is the call graph for this function:

Definition at line 1440 of file archive.c.

{
  struct ar_hdr *hdr;
  char *aloser;

  if (abfd->arelt_data == NULL)
    {
      bfd_set_error (bfd_error_invalid_operation);
      return -1;
    }

  hdr = arch_hdr (abfd);

#define foo(arelt, stelt, size)                         \
  buf->stelt = strtol (hdr->arelt, &aloser, size);      \
  if (aloser == hdr->arelt)                      \
    return -1;

  /* Some platforms support special notations for large IDs.  */
#ifdef HPUX_LARGE_AR_IDS
# define foo2(arelt, stelt, size)                              \
  if (hdr->arelt[5] == ' ')                                    \
    {                                                          \
      foo (arelt, stelt, size);                                       \
    }                                                          \
  else                                                         \
    {                                                          \
      int cnt;                                                        \
      for (buf->stelt = cnt = 0; cnt < 5; ++cnt)               \
       {                                                       \
         if (hdr->arelt[cnt] < ' ' || hdr->arelt[cnt] > ' ' + 0x3f)   \
           return -1;                                                 \
         buf->stelt <<= 6;                                     \
         buf->stelt += hdr->arelt[cnt] - ' ';                         \
       }                                                       \
      if (hdr->arelt[5] < '@' || hdr->arelt[5] > '@' + 3)             \
       return -1;                                              \
      buf->stelt <<= 2;                                               \
      buf->stelt += hdr->arelt[5] - '@';                       \
    }
#else
# define foo2(arelt, stelt, size) foo (arelt, stelt, size)
#endif

  foo (ar_date, st_mtime, 10);
  foo2 (ar_uid, st_uid, 10);
  foo2 (ar_gid, st_gid, 10);
  foo (ar_mode, st_mode, 8);

  buf->st_size = arch_eltdata (abfd)->parsed_size;

  return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void bfd_gnu_truncate_arname ( bfd abfd,
const char *  filename,
char *  hdr 
)

Definition at line 1580 of file archive.c.

{
  struct ar_hdr *hdr = (struct ar_hdr *) arhdr;
  size_t length;
  const char *filename = strrchr (pathname, '/');
  size_t maxlen = ar_maxnamelen (abfd);

#ifdef HAVE_DOS_BASED_FILE_SYSTEM
  {
    /* We could have foo/bar\\baz, or foo\\bar, or d:bar.  */
    char *bslash = strrchr (pathname, '\\');
    if (filename == NULL || (bslash != NULL && bslash > filename))
      filename = bslash;
    if (filename == NULL && pathname[0] != '\0' && pathname[1] == ':')
      filename = pathname + 1;
  }
#endif

  if (filename == NULL)
    filename = pathname;
  else
    ++filename;

  length = strlen (filename);

  if (length <= maxlen)
    memcpy (hdr->ar_name, filename, length);
  else
    {                       /* pathname: meet procrustes */
      memcpy (hdr->ar_name, filename, maxlen);
      if ((filename[length - 2] == '.') && (filename[length - 1] == 'o'))
       {
         hdr->ar_name[maxlen - 2] = '.';
         hdr->ar_name[maxlen - 1] = 'o';
       }
      length = maxlen;
    }

  if (length < 16)
    (hdr->ar_name)[length] = ar_padchar (abfd);
}

Here is the call graph for this function:

Definition at line 918 of file libbfd.c.

{
  unsigned int result = 0;

  while ((x = (x >> 1)) != 0)
    ++result;
  return result;
}

Here is the caller graph for this function:

Definition at line 162 of file libbfd.c.

{
  void *ptr;

  if (size != (size_t) size)
    {
      bfd_set_error (bfd_error_no_memory);
      return NULL;
    }

  ptr = malloc ((size_t) size);
  if (ptr == NULL && (size_t) size != 0)
    bfd_set_error (bfd_error_no_memory);

  return ptr;
}

Here is the call graph for this function:

Definition at line 182 of file libbfd.c.

{
  void *ptr;

  if ((nmemb | size) >= HALF_BFD_SIZE_TYPE
      && size != 0
      && nmemb > ~(bfd_size_type) 0 / size)
    {
      bfd_set_error (bfd_error_no_memory);
      return NULL;
    }

  size *= nmemb;

  if (size != (size_t) size)
    {
      bfd_set_error (bfd_error_no_memory);
      return NULL;
    }

  ptr = malloc ((size_t) size);
  if (ptr == NULL && (size_t) size != 0)
    bfd_set_error (bfd_error_no_memory);

  return ptr;
}

Here is the call graph for this function:

void* bfd_nullvoidptr ( bfd ignore)
FILE* bfd_open_file ( bfd abfd)

Definition at line 465 of file cache.c.

{
  abfd->cacheable = TRUE;   /* Allow it to be closed later.  */

  if (open_files >= BFD_CACHE_MAX_OPEN)
    {
      if (! close_one ())
       return NULL;
    }

  switch (abfd->direction)
    {
    case read_direction:
    case no_direction:
      abfd->iostream = (PTR) real_fopen (abfd->filename, FOPEN_RB);
      break;
    case both_direction:
    case write_direction:
      if (abfd->opened_once)
       {
         abfd->iostream = (PTR) real_fopen (abfd->filename, FOPEN_RUB);
         if (abfd->iostream == NULL)
           abfd->iostream = (PTR) real_fopen (abfd->filename, FOPEN_WUB);
       }
      else
       {
         /* Create the file.

            Some operating systems won't let us overwrite a running
            binary.  For them, we want to unlink the file first.

            However, gcc 2.95 will create temporary files using
            O_EXCL and tight permissions to prevent other users from
            substituting other .o files during the compilation.  gcc
            will then tell the assembler to use the newly created
            file as an output file.  If we unlink the file here, we
            open a brief window when another user could still
            substitute a file.

            So we unlink the output file if and only if it has
            non-zero size.  */
#ifndef __MSDOS__
         /* Don't do this for MSDOS: it doesn't care about overwriting
            a running binary, but if this file is already open by
            another BFD, we will be in deep trouble if we delete an
            open file.  In fact, objdump does just that if invoked with
            the --info option.  */
         struct stat s;

         if (stat (abfd->filename, &s) == 0 && s.st_size != 0)
           unlink_if_ordinary (abfd->filename);
#endif
         abfd->iostream = (PTR) real_fopen (abfd->filename, FOPEN_WUB);
         abfd->opened_once = TRUE;
       }
      break;
    }

  if (abfd->iostream == NULL)
    bfd_set_error (bfd_error_system_call);
  else
    {
      if (! bfd_cache_init (abfd))
       return NULL;
    }

  return (FILE *) abfd->iostream;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void* bfd_realloc ( void *  ,
bfd_size_type   
)

Definition at line 212 of file libbfd.c.

{
  void *ret;

  if (size != (size_t) size)
    {
      bfd_set_error (bfd_error_no_memory);
      return NULL;
    }

  if (ptr == NULL)
    ret = malloc ((size_t) size);
  else
    ret = realloc (ptr, (size_t) size);

  if (ret == NULL && (size_t) size != 0)
    bfd_set_error (bfd_error_no_memory);

  return ret;
}

Here is the call graph for this function:

void* bfd_realloc2 ( void *  ,
bfd_size_type  ,
bfd_size_type   
)

Definition at line 236 of file libbfd.c.

{
  void *ret;

  if ((nmemb | size) >= HALF_BFD_SIZE_TYPE
      && size != 0
      && nmemb > ~(bfd_size_type) 0 / size)
    {
      bfd_set_error (bfd_error_no_memory);
      return NULL;
    }

  size *= nmemb;

  if (size != (size_t) size)
    {
      bfd_set_error (bfd_error_no_memory);
      return NULL;
    }

  if (ptr == NULL)
    ret = malloc ((size_t) size);
  else
    ret = realloc (ptr, (size_t) size);

  if (ret == NULL && (size_t) size != 0)
    bfd_set_error (bfd_error_no_memory);

  return ret;
}

Here is the call graph for this function:

void bfd_release ( bfd ,
void *   
)

Definition at line 1001 of file opncls.c.

Here is the call graph for this function:

Definition at line 2929 of file linker.c.

{
  struct bfd_section_already_linked *l;

  /* Allocate the memory from the same obstack as the hash table is
     kept in.  */
  l = bfd_hash_allocate (&_bfd_section_already_linked_table, sizeof *l);
  l->sec = sec;
  l->next = already_linked_list->entry;
  already_linked_list->entry = l;
}

Here is the call graph for this function:

Definition at line 2920 of file linker.c.

{
  return ((struct bfd_section_already_linked_hash_entry *)
         bfd_hash_lookup (&_bfd_section_already_linked_table, name,
                        TRUE, FALSE));
}

Here is the call graph for this function:

Definition at line 2910 of file linker.c.

{
  bfd_hash_traverse (&_bfd_section_already_linked_table,
                   (bfd_boolean (*) (struct bfd_hash_entry *,
                                   void *)) func,
                   info);
}

Here is the call graph for this function:

Definition at line 711 of file section.c.

{
  /* Allocate the structure if it has not already been allocated by a
     subclass.  */
  if (entry == NULL)
    {
      entry = (struct bfd_hash_entry *)
       bfd_hash_allocate (table, sizeof (struct section_hash_entry));
      if (entry == NULL)
       return entry;
    }

  /* Call the allocation method of the superclass.  */
  entry = bfd_hash_newfunc (entry, table, string);
  if (entry != NULL)
    memset (&((struct section_hash_entry *) entry)->section, 0,
           sizeof (asection));

  return entry;
}

Here is the call graph for this function:

Definition at line 902 of file archive.c.

{
  char nextname[17];
  int i = bfd_bread (nextname, 16, abfd);

  if (i == 0)
    return TRUE;
  if (i != 16)
    return FALSE;

  if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0)
    return FALSE;

  if (CONST_STRNEQ (nextname, "__.SYMDEF       ")
      || CONST_STRNEQ (nextname, "__.SYMDEF/      ")) /* Old Linux archives.  */
    return do_slurp_bsd_armap (abfd);
  else if (CONST_STRNEQ (nextname, "/               "))
    return do_slurp_coff_armap (abfd);
  else if (CONST_STRNEQ (nextname, "/SYM64/         "))
    {
      /* 64bit ELF (Irix 6) archive.  */
#ifdef BFD64
      extern bfd_boolean bfd_elf64_archive_slurp_armap (bfd *);
      return bfd_elf64_archive_slurp_armap (abfd);
#else
      bfd_set_error (bfd_error_wrong_format);
      return FALSE;
#endif
    }

  bfd_has_map (abfd) = FALSE;
  return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 944 of file archive.c.

{
  struct areltdata *mapdata;
  char nextname[17];
  unsigned int counter;
  bfd_byte *raw_armap, *rbase;
  struct artdata *ardata = bfd_ardata (abfd);
  char *stringbase;
  unsigned int stringsize;
  bfd_size_type amt;
  carsym *set;
  int i = bfd_bread (nextname, 16, abfd);

  if (i == 0)
    return TRUE;
  if (i != 16)
    return FALSE;

  /* The archive has at least 16 bytes in it.  */
  if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0)
    return FALSE;

  if (