Home | History | Annotate | Line # | Download | only in bfd
libbfd-in.h revision 1.1
      1  1.1  christos /* libbfd.h -- Declarations used by bfd library *implementation*.
      2  1.1  christos    (This include file is not for users of the library.)
      3  1.1  christos 
      4  1.1  christos    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
      5  1.1  christos    1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
      6  1.1  christos    2010
      7  1.1  christos    Free Software Foundation, Inc.
      8  1.1  christos 
      9  1.1  christos    Written by Cygnus Support.
     10  1.1  christos 
     11  1.1  christos    This file is part of BFD, the Binary File Descriptor library.
     12  1.1  christos 
     13  1.1  christos    This program is free software; you can redistribute it and/or modify
     14  1.1  christos    it under the terms of the GNU General Public License as published by
     15  1.1  christos    the Free Software Foundation; either version 3 of the License, or
     16  1.1  christos    (at your option) any later version.
     17  1.1  christos 
     18  1.1  christos    This program is distributed in the hope that it will be useful,
     19  1.1  christos    but WITHOUT ANY WARRANTY; without even the implied warranty of
     20  1.1  christos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     21  1.1  christos    GNU General Public License for more details.
     22  1.1  christos 
     23  1.1  christos    You should have received a copy of the GNU General Public License
     24  1.1  christos    along with this program; if not, write to the Free Software
     25  1.1  christos    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
     26  1.1  christos    MA 02110-1301, USA.  */
     27  1.1  christos 
     28  1.1  christos #include "hashtab.h"
     29  1.1  christos 
     30  1.1  christos /* Align an address upward to a boundary, expressed as a number of bytes.
     31  1.1  christos    E.g. align to an 8-byte boundary with argument of 8.  Take care never
     32  1.1  christos    to wrap around if the address is within boundary-1 of the end of the
     33  1.1  christos    address space.  */
     34  1.1  christos #define BFD_ALIGN(this, boundary)					  \
     35  1.1  christos   ((((bfd_vma) (this) + (boundary) - 1) >= (bfd_vma) (this))		  \
     36  1.1  christos    ? (((bfd_vma) (this) + ((boundary) - 1)) & ~ (bfd_vma) ((boundary)-1)) \
     37  1.1  christos    : ~ (bfd_vma) 0)
     38  1.1  christos 
     39  1.1  christos /* If you want to read and write large blocks, you might want to do it
     40  1.1  christos    in quanta of this amount */
     41  1.1  christos #define DEFAULT_BUFFERSIZE 8192
     42  1.1  christos 
     43  1.1  christos /* Set a tdata field.  Can't use the other macros for this, since they
     44  1.1  christos    do casts, and casting to the left of assignment isn't portable.  */
     45  1.1  christos #define set_tdata(bfd, v) ((bfd)->tdata.any = (v))
     46  1.1  christos 
     47  1.1  christos /* If BFD_IN_MEMORY is set for a BFD, then the iostream fields points
     48  1.1  christos    to an instance of this structure.  */
     49  1.1  christos 
     50  1.1  christos struct bfd_in_memory
     51  1.1  christos {
     52  1.1  christos   /* Size of buffer.  */
     53  1.1  christos   bfd_size_type size;
     54  1.1  christos   /* Buffer holding contents of BFD.  */
     55  1.1  christos   bfd_byte *buffer;
     56  1.1  christos };
     57  1.1  christos 
     58  1.1  christos struct section_hash_entry
     59  1.1  christos {
     60  1.1  christos   struct bfd_hash_entry root;
     61  1.1  christos   asection section;
     62  1.1  christos };
     63  1.1  christos 
     64  1.1  christos /* tdata for an archive.  For an input archive, cache
     65  1.1  christos    needs to be free()'d.  For an output archive, symdefs do.  */
     66  1.1  christos 
     67  1.1  christos struct artdata {
     68  1.1  christos   file_ptr first_file_filepos;
     69  1.1  christos   /* Speed up searching the armap */
     70  1.1  christos   htab_t cache;
     71  1.1  christos   bfd *archive_head;		/* Only interesting in output routines */
     72  1.1  christos   carsym *symdefs;		/* the symdef entries */
     73  1.1  christos   symindex symdef_count;	/* how many there are */
     74  1.1  christos   char *extended_names;		/* clever intel extension */
     75  1.1  christos   bfd_size_type extended_names_size; /* Size of extended names */
     76  1.1  christos   /* when more compilers are standard C, this can be a time_t */
     77  1.1  christos   long  armap_timestamp;	/* Timestamp value written into armap.
     78  1.1  christos 				   This is used for BSD archives to check
     79  1.1  christos 				   that the timestamp is recent enough
     80  1.1  christos 				   for the BSD linker to not complain,
     81  1.1  christos 				   just before we finish writing an
     82  1.1  christos 				   archive.  */
     83  1.1  christos   file_ptr armap_datepos;	/* Position within archive to seek to
     84  1.1  christos 				   rewrite the date field.  */
     85  1.1  christos   void *tdata;			/* Backend specific information.  */
     86  1.1  christos };
     87  1.1  christos 
     88  1.1  christos #define bfd_ardata(bfd) ((bfd)->tdata.aout_ar_data)
     89  1.1  christos 
     90  1.1  christos /* Goes in bfd's arelt_data slot */
     91  1.1  christos struct areltdata {
     92  1.1  christos   char * arch_header;		/* it's actually a string */
     93  1.1  christos   unsigned int parsed_size;	/* octets of filesize not including ar_hdr */
     94  1.1  christos   unsigned int extra_size;	/* BSD4.4: extra bytes after the header.  */
     95  1.1  christos   char *filename;		/* null-terminated */
     96  1.1  christos   file_ptr origin;		/* for element of a thin archive */
     97  1.1  christos };
     98  1.1  christos 
     99  1.1  christos #define arelt_size(bfd) (((struct areltdata *)((bfd)->arelt_data))->parsed_size)
    100  1.1  christos 
    101  1.1  christos extern void *bfd_malloc
    102  1.1  christos   (bfd_size_type);
    103  1.1  christos extern void *bfd_realloc
    104  1.1  christos   (void *, bfd_size_type);
    105  1.1  christos extern void *bfd_realloc_or_free
    106  1.1  christos   (void *, bfd_size_type);
    107  1.1  christos extern void *bfd_zmalloc
    108  1.1  christos   (bfd_size_type);
    109  1.1  christos extern void *bfd_malloc2
    110  1.1  christos   (bfd_size_type, bfd_size_type);
    111  1.1  christos extern void *bfd_realloc2
    112  1.1  christos   (void *, bfd_size_type, bfd_size_type);
    113  1.1  christos extern void *bfd_zmalloc2
    114  1.1  christos   (bfd_size_type, bfd_size_type);
    115  1.1  christos 
    116  1.1  christos extern void _bfd_default_error_handler (const char *s, ...);
    117  1.1  christos extern bfd_error_handler_type _bfd_error_handler;
    118  1.1  christos 
    119  1.1  christos /* These routines allocate and free things on the BFD's objalloc.  */
    120  1.1  christos 
    121  1.1  christos extern void *bfd_alloc2
    122  1.1  christos   (bfd *, bfd_size_type, bfd_size_type);
    123  1.1  christos extern void *bfd_zalloc2
    124  1.1  christos   (bfd *, bfd_size_type, bfd_size_type);
    125  1.1  christos extern void bfd_release
    126  1.1  christos   (bfd *, void *);
    127  1.1  christos 
    128  1.1  christos bfd * _bfd_create_empty_archive_element_shell
    129  1.1  christos   (bfd *obfd);
    130  1.1  christos bfd * _bfd_look_for_bfd_in_cache
    131  1.1  christos   (bfd *, file_ptr);
    132  1.1  christos bfd_boolean _bfd_add_bfd_to_archive_cache
    133  1.1  christos   (bfd *, file_ptr, bfd *);
    134  1.1  christos bfd_boolean _bfd_generic_mkarchive
    135  1.1  christos   (bfd *abfd);
    136  1.1  christos char *_bfd_append_relative_path
    137  1.1  christos   (bfd *arch, char *elt_name);
    138  1.1  christos const bfd_target *bfd_generic_archive_p
    139  1.1  christos   (bfd *abfd);
    140  1.1  christos bfd_boolean bfd_slurp_armap
    141  1.1  christos   (bfd *abfd);
    142  1.1  christos bfd_boolean bfd_slurp_bsd_armap_f2
    143  1.1  christos   (bfd *abfd);
    144  1.1  christos #define bfd_slurp_bsd_armap bfd_slurp_armap
    145  1.1  christos #define bfd_slurp_coff_armap bfd_slurp_armap
    146  1.1  christos bfd_boolean _bfd_slurp_extended_name_table
    147  1.1  christos   (bfd *abfd);
    148  1.1  christos extern bfd_boolean _bfd_construct_extended_name_table
    149  1.1  christos   (bfd *, bfd_boolean, char **, bfd_size_type *);
    150  1.1  christos bfd_boolean _bfd_write_archive_contents
    151  1.1  christos   (bfd *abfd);
    152  1.1  christos bfd_boolean _bfd_compute_and_write_armap
    153  1.1  christos   (bfd *, unsigned int elength);
    154  1.1  christos bfd *_bfd_get_elt_at_filepos
    155  1.1  christos   (bfd *archive, file_ptr filepos);
    156  1.1  christos extern bfd *_bfd_generic_get_elt_at_index
    157  1.1  christos   (bfd *, symindex);
    158  1.1  christos bfd * _bfd_new_bfd
    159  1.1  christos   (void);
    160  1.1  christos void _bfd_delete_bfd
    161  1.1  christos   (bfd *);
    162  1.1  christos bfd_boolean _bfd_free_cached_info
    163  1.1  christos   (bfd *);
    164  1.1  christos 
    165  1.1  christos bfd_boolean bfd_false
    166  1.1  christos   (bfd *ignore);
    167  1.1  christos bfd_boolean bfd_true
    168  1.1  christos   (bfd *ignore);
    169  1.1  christos void *bfd_nullvoidptr
    170  1.1  christos   (bfd *ignore);
    171  1.1  christos int bfd_0
    172  1.1  christos   (bfd *ignore);
    173  1.1  christos unsigned int bfd_0u
    174  1.1  christos   (bfd *ignore);
    175  1.1  christos long bfd_0l
    176  1.1  christos   (bfd *ignore);
    177  1.1  christos long _bfd_n1
    178  1.1  christos   (bfd *ignore);
    179  1.1  christos void bfd_void
    180  1.1  christos   (bfd *ignore);
    181  1.1  christos 
    182  1.1  christos bfd *_bfd_new_bfd_contained_in
    183  1.1  christos   (bfd *);
    184  1.1  christos const bfd_target *_bfd_dummy_target
    185  1.1  christos   (bfd *abfd);
    186  1.1  christos 
    187  1.1  christos void bfd_dont_truncate_arname
    188  1.1  christos   (bfd *abfd, const char *filename, char *hdr);
    189  1.1  christos void bfd_bsd_truncate_arname
    190  1.1  christos   (bfd *abfd, const char *filename, char *hdr);
    191  1.1  christos void bfd_gnu_truncate_arname
    192  1.1  christos   (bfd *abfd, const char *filename, char *hdr);
    193  1.1  christos 
    194  1.1  christos bfd_boolean bsd_write_armap
    195  1.1  christos   (bfd *arch, unsigned int elength, struct orl *map, unsigned int orl_count,
    196  1.1  christos    int stridx);
    197  1.1  christos 
    198  1.1  christos bfd_boolean coff_write_armap
    199  1.1  christos   (bfd *arch, unsigned int elength, struct orl *map, unsigned int orl_count,
    200  1.1  christos    int stridx);
    201  1.1  christos 
    202  1.1  christos extern void *_bfd_generic_read_ar_hdr
    203  1.1  christos   (bfd *);
    204  1.1  christos extern void _bfd_ar_spacepad
    205  1.1  christos   (char *, size_t, const char *, long);
    206  1.1  christos 
    207  1.1  christos extern void *_bfd_generic_read_ar_hdr_mag
    208  1.1  christos   (bfd *, const char *);
    209  1.1  christos 
    210  1.1  christos extern bfd_boolean _bfd_generic_write_ar_hdr
    211  1.1  christos   (bfd *, bfd *);
    212  1.1  christos 
    213  1.1  christos extern bfd_boolean _bfd_bsd44_write_ar_hdr
    214  1.1  christos   (bfd *, bfd *);
    215  1.1  christos 
    216  1.1  christos bfd * bfd_generic_openr_next_archived_file
    217  1.1  christos   (bfd *archive, bfd *last_file);
    218  1.1  christos 
    219  1.1  christos int bfd_generic_stat_arch_elt
    220  1.1  christos   (bfd *, struct stat *);
    221  1.1  christos 
    222  1.1  christos #define _bfd_read_ar_hdr(abfd) \
    223  1.1  christos   BFD_SEND (abfd, _bfd_read_ar_hdr_fn, (abfd))
    224  1.1  christos #define _bfd_write_ar_hdr(archive, abfd)         \
    225  1.1  christos   BFD_SEND (abfd, _bfd_write_ar_hdr_fn, (archive, abfd))
    226  1.1  christos 
    227  1.1  christos /* Generic routines to use for BFD_JUMP_TABLE_GENERIC.  Use
    229  1.1  christos    BFD_JUMP_TABLE_GENERIC (_bfd_generic).  */
    230  1.1  christos 
    231  1.1  christos #define _bfd_generic_close_and_cleanup bfd_true
    232  1.1  christos #define _bfd_generic_bfd_free_cached_info bfd_true
    233  1.1  christos extern bfd_boolean _bfd_generic_new_section_hook
    234  1.1  christos   (bfd *, asection *);
    235  1.1  christos extern bfd_boolean _bfd_generic_get_section_contents
    236  1.1  christos   (bfd *, asection *, void *, file_ptr, bfd_size_type);
    237  1.1  christos extern bfd_boolean _bfd_generic_get_section_contents_in_window
    238  1.1  christos   (bfd *, asection *, bfd_window *, file_ptr, bfd_size_type);
    239  1.1  christos 
    240  1.1  christos /* Generic routines to use for BFD_JUMP_TABLE_COPY.  Use
    241  1.1  christos    BFD_JUMP_TABLE_COPY (_bfd_generic).  */
    242  1.1  christos 
    243  1.1  christos #define _bfd_generic_bfd_copy_private_bfd_data \
    244  1.1  christos   ((bfd_boolean (*) (bfd *, bfd *)) bfd_true)
    245  1.1  christos #define _bfd_generic_bfd_merge_private_bfd_data \
    246  1.1  christos   ((bfd_boolean (*) (bfd *, bfd *)) bfd_true)
    247  1.1  christos #define _bfd_generic_bfd_set_private_flags \
    248  1.1  christos   ((bfd_boolean (*) (bfd *, flagword)) bfd_true)
    249  1.1  christos #define _bfd_generic_bfd_copy_private_section_data \
    250  1.1  christos   ((bfd_boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true)
    251  1.1  christos #define _bfd_generic_bfd_copy_private_symbol_data \
    252  1.1  christos   ((bfd_boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true)
    253  1.1  christos #define _bfd_generic_bfd_copy_private_header_data \
    254  1.1  christos   ((bfd_boolean (*) (bfd *, bfd *)) bfd_true)
    255  1.1  christos #define _bfd_generic_bfd_print_private_bfd_data \
    256  1.1  christos   ((bfd_boolean (*) (bfd *, void *)) bfd_true)
    257  1.1  christos 
    258  1.1  christos extern bfd_boolean _bfd_generic_init_private_section_data
    259  1.1  christos   (bfd *, asection *, bfd *, asection *, struct bfd_link_info *);
    260  1.1  christos 
    261  1.1  christos /* Routines to use for BFD_JUMP_TABLE_CORE when there is no core file
    262  1.1  christos    support.  Use BFD_JUMP_TABLE_CORE (_bfd_nocore).  */
    263  1.1  christos 
    264  1.1  christos extern char *_bfd_nocore_core_file_failing_command
    265  1.1  christos   (bfd *);
    266  1.1  christos extern int _bfd_nocore_core_file_failing_signal
    267  1.1  christos   (bfd *);
    268  1.1  christos extern bfd_boolean _bfd_nocore_core_file_matches_executable_p
    269  1.1  christos   (bfd *, bfd *);
    270  1.1  christos extern int _bfd_nocore_core_file_pid
    271  1.1  christos   (bfd *);
    272  1.1  christos 
    273  1.1  christos /* Routines to use for BFD_JUMP_TABLE_ARCHIVE when there is no archive
    274  1.1  christos    file support.  Use BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive).  */
    275  1.1  christos 
    276  1.1  christos #define _bfd_noarchive_slurp_armap bfd_false
    277  1.1  christos #define _bfd_noarchive_slurp_extended_name_table bfd_false
    278  1.1  christos #define _bfd_noarchive_construct_extended_name_table \
    279  1.1  christos   ((bfd_boolean (*) (bfd *, char **, bfd_size_type *, const char **)) \
    280  1.1  christos    bfd_false)
    281  1.1  christos #define _bfd_noarchive_truncate_arname \
    282  1.1  christos   ((void (*) (bfd *, const char *, char *)) bfd_void)
    283  1.1  christos #define _bfd_noarchive_write_armap \
    284  1.1  christos   ((bfd_boolean (*) (bfd *, unsigned int, struct orl *, unsigned int, int)) \
    285  1.1  christos    bfd_false)
    286  1.1  christos #define _bfd_noarchive_read_ar_hdr bfd_nullvoidptr
    287  1.1  christos #define _bfd_noarchive_write_ar_hdr \
    288  1.1  christos   ((bfd_boolean (*) (bfd *, bfd *)) bfd_false)
    289  1.1  christos #define _bfd_noarchive_openr_next_archived_file \
    290  1.1  christos   ((bfd *(*) (bfd *, bfd *)) bfd_nullvoidptr)
    291  1.1  christos #define _bfd_noarchive_get_elt_at_index \
    292  1.1  christos   ((bfd *(*) (bfd *, symindex)) bfd_nullvoidptr)
    293  1.1  christos #define _bfd_noarchive_generic_stat_arch_elt bfd_generic_stat_arch_elt
    294  1.1  christos #define _bfd_noarchive_update_armap_timestamp bfd_false
    295  1.1  christos 
    296  1.1  christos /* Routines to use for BFD_JUMP_TABLE_ARCHIVE to get BSD style
    297  1.1  christos    archives.  Use BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_bsd).  */
    298  1.1  christos 
    299  1.1  christos #define _bfd_archive_bsd_slurp_armap bfd_slurp_bsd_armap
    300  1.1  christos #define _bfd_archive_bsd_slurp_extended_name_table \
    301  1.1  christos   _bfd_slurp_extended_name_table
    302  1.1  christos extern bfd_boolean _bfd_archive_bsd_construct_extended_name_table
    303  1.1  christos   (bfd *, char **, bfd_size_type *, const char **);
    304  1.1  christos #define _bfd_archive_bsd_truncate_arname bfd_bsd_truncate_arname
    305  1.1  christos #define _bfd_archive_bsd_write_armap bsd_write_armap
    306  1.1  christos #define _bfd_archive_bsd_read_ar_hdr _bfd_generic_read_ar_hdr
    307  1.1  christos #define _bfd_archive_bsd_write_ar_hdr _bfd_generic_write_ar_hdr
    308  1.1  christos #define _bfd_archive_bsd_openr_next_archived_file \
    309  1.1  christos   bfd_generic_openr_next_archived_file
    310  1.1  christos #define _bfd_archive_bsd_get_elt_at_index _bfd_generic_get_elt_at_index
    311  1.1  christos #define _bfd_archive_bsd_generic_stat_arch_elt \
    312  1.1  christos   bfd_generic_stat_arch_elt
    313  1.1  christos extern bfd_boolean _bfd_archive_bsd_update_armap_timestamp
    314  1.1  christos   (bfd *);
    315  1.1  christos 
    316  1.1  christos /* Routines to use for BFD_JUMP_TABLE_ARCHIVE to get COFF style
    317  1.1  christos    archives.  Use BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff).  */
    318  1.1  christos 
    319  1.1  christos #define _bfd_archive_coff_slurp_armap bfd_slurp_coff_armap
    320  1.1  christos #define _bfd_archive_coff_slurp_extended_name_table \
    321  1.1  christos   _bfd_slurp_extended_name_table
    322  1.1  christos extern bfd_boolean _bfd_archive_coff_construct_extended_name_table
    323  1.1  christos   (bfd *, char **, bfd_size_type *, const char **);
    324  1.1  christos #define _bfd_archive_coff_truncate_arname bfd_dont_truncate_arname
    325  1.1  christos #define _bfd_archive_coff_write_armap coff_write_armap
    326  1.1  christos #define _bfd_archive_coff_read_ar_hdr _bfd_generic_read_ar_hdr
    327  1.1  christos #define _bfd_archive_coff_write_ar_hdr _bfd_generic_write_ar_hdr
    328  1.1  christos #define _bfd_archive_coff_openr_next_archived_file \
    329  1.1  christos   bfd_generic_openr_next_archived_file
    330  1.1  christos #define _bfd_archive_coff_get_elt_at_index _bfd_generic_get_elt_at_index
    331  1.1  christos #define _bfd_archive_coff_generic_stat_arch_elt \
    332  1.1  christos   bfd_generic_stat_arch_elt
    333  1.1  christos #define _bfd_archive_coff_update_armap_timestamp bfd_true
    334  1.1  christos 
    335  1.1  christos /* Routines to use for BFD_JUMP_TABLE_ARCHIVE to get BSD4.4 style
    336  1.1  christos    archives.  Use BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_bsd44).  */
    337  1.1  christos 
    338  1.1  christos #define _bfd_archive_bsd44_slurp_armap bfd_slurp_bsd_armap
    339  1.1  christos #define _bfd_archive_bsd44_slurp_extended_name_table \
    340  1.1  christos   _bfd_slurp_extended_name_table
    341  1.1  christos extern bfd_boolean _bfd_archive_bsd44_construct_extended_name_table
    342  1.1  christos   (bfd *, char **, bfd_size_type *, const char **);
    343  1.1  christos #define _bfd_archive_bsd44_truncate_arname bfd_bsd_truncate_arname
    344  1.1  christos #define _bfd_archive_bsd44_write_armap bsd_write_armap
    345  1.1  christos #define _bfd_archive_bsd44_read_ar_hdr _bfd_generic_read_ar_hdr
    346  1.1  christos #define _bfd_archive_bsd44_write_ar_hdr _bfd_bsd44_write_ar_hdr
    347  1.1  christos #define _bfd_archive_bsd44_openr_next_archived_file \
    348  1.1  christos   bfd_generic_openr_next_archived_file
    349  1.1  christos #define _bfd_archive_bsd44_get_elt_at_index _bfd_generic_get_elt_at_index
    350  1.1  christos #define _bfd_archive_bsd44_generic_stat_arch_elt \
    351  1.1  christos   bfd_generic_stat_arch_elt
    352  1.1  christos #define _bfd_archive_bsd44_update_armap_timestamp \
    353  1.1  christos   _bfd_archive_bsd_update_armap_timestamp
    354  1.1  christos 
    355  1.1  christos /* Routines to use for BFD_JUMP_TABLE_ARCHIVE to get VMS style
    356  1.1  christos    archives.  Use BFD_JUMP_TABLE_ARCHIVE (_bfd_vms_lib).  Some of them
    357  1.1  christos    are irrelevant and never called, so defined as NULL.  */
    358  1.1  christos 
    359  1.1  christos extern bfd_boolean _bfd_vms_lib_write_archive_contents (bfd *arch);
    360  1.1  christos #define _bfd_vms_lib_slurp_armap NULL
    361  1.1  christos #define _bfd_vms_lib_slurp_extended_name_table NULL
    362  1.1  christos #define _bfd_vms_lib_construct_extended_name_table NULL
    363  1.1  christos #define _bfd_vms_lib_truncate_arname NULL
    364  1.1  christos #define _bfd_vms_lib_write_armap NULL
    365  1.1  christos #define _bfd_vms_lib_read_ar_hdr NULL
    366  1.1  christos #define _bfd_vms_lib_write_ar_hdr NULL
    367  1.1  christos extern bfd *_bfd_vms_lib_openr_next_archived_file (bfd *, bfd *);
    368  1.1  christos extern bfd *_bfd_vms_lib_get_elt_at_index (bfd *, symindex);
    369  1.1  christos extern int _bfd_vms_lib_generic_stat_arch_elt (bfd *, struct stat *);
    370  1.1  christos #define _bfd_vms_lib_update_armap_timestamp bfd_true
    371  1.1  christos 
    372  1.1  christos /* Extra routines for VMS style archives.  */
    373  1.1  christos 
    374  1.1  christos extern symindex _bfd_vms_lib_find_symbol (bfd *, const char *);
    375  1.1  christos extern bfd *_bfd_vms_lib_get_imagelib_file (bfd *);
    376  1.1  christos extern const bfd_target *_bfd_vms_lib_alpha_archive_p (bfd *abfd);
    377  1.1  christos extern const bfd_target *_bfd_vms_lib_ia64_archive_p (bfd *abfd);
    378  1.1  christos extern bfd_boolean _bfd_vms_lib_alpha_mkarchive (bfd *abfd);
    379  1.1  christos extern bfd_boolean _bfd_vms_lib_ia64_mkarchive (bfd *abfd);
    380  1.1  christos 
    381  1.1  christos /* Routines to use for BFD_JUMP_TABLE_SYMBOLS where there is no symbol
    382  1.1  christos    support.  Use BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols).  */
    383  1.1  christos 
    384  1.1  christos #define _bfd_nosymbols_get_symtab_upper_bound _bfd_n1
    385  1.1  christos #define _bfd_nosymbols_canonicalize_symtab \
    386  1.1  christos   ((long (*) (bfd *, asymbol **)) _bfd_n1)
    387  1.1  christos #define _bfd_nosymbols_make_empty_symbol _bfd_generic_make_empty_symbol
    388  1.1  christos #define _bfd_nosymbols_print_symbol \
    389  1.1  christos   ((void (*) (bfd *, void *, asymbol *, bfd_print_symbol_type)) bfd_void)
    390  1.1  christos #define _bfd_nosymbols_get_symbol_info \
    391  1.1  christos   ((void (*) (bfd *, asymbol *, symbol_info *)) bfd_void)
    392  1.1  christos #define _bfd_nosymbols_bfd_is_local_label_name \
    393  1.1  christos   ((bfd_boolean (*) (bfd *, const char *)) bfd_false)
    394  1.1  christos #define _bfd_nosymbols_bfd_is_target_special_symbol \
    395  1.1  christos   ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
    396  1.1  christos #define _bfd_nosymbols_get_lineno \
    397  1.1  christos   ((alent *(*) (bfd *, asymbol *)) bfd_nullvoidptr)
    398  1.1  christos #define _bfd_nosymbols_find_nearest_line \
    399  1.1  christos   ((bfd_boolean (*) (bfd *, asection *, asymbol **, bfd_vma, const char **, \
    400  1.1  christos 		     const char **, unsigned int *)) \
    401  1.1  christos    bfd_false)
    402  1.1  christos #define _bfd_nosymbols_find_inliner_info \
    403  1.1  christos   ((bfd_boolean (*) (bfd *, const char **, const char **, unsigned int *)) \
    404  1.1  christos    bfd_false)
    405  1.1  christos #define _bfd_nosymbols_bfd_make_debug_symbol \
    406  1.1  christos   ((asymbol *(*) (bfd *, void *, unsigned long)) bfd_nullvoidptr)
    407  1.1  christos #define _bfd_nosymbols_read_minisymbols \
    408  1.1  christos   ((long (*) (bfd *, bfd_boolean, void **, unsigned int *)) _bfd_n1)
    409  1.1  christos #define _bfd_nosymbols_minisymbol_to_symbol \
    410  1.1  christos   ((asymbol *(*) (bfd *, bfd_boolean, const void *, asymbol *)) \
    411  1.1  christos    bfd_nullvoidptr)
    412  1.1  christos 
    413  1.1  christos /* Routines to use for BFD_JUMP_TABLE_RELOCS when there is no reloc
    414  1.1  christos    support.  Use BFD_JUMP_TABLE_RELOCS (_bfd_norelocs).  */
    415  1.1  christos 
    416  1.1  christos extern long _bfd_norelocs_get_reloc_upper_bound (bfd *, asection *);
    417  1.1  christos extern long _bfd_norelocs_canonicalize_reloc (bfd *, asection *,
    418  1.1  christos 					      arelent **, asymbol **);
    419  1.1  christos #define _bfd_norelocs_bfd_reloc_type_lookup \
    420  1.1  christos   ((reloc_howto_type *(*) (bfd *, bfd_reloc_code_real_type)) bfd_nullvoidptr)
    421  1.1  christos #define _bfd_norelocs_bfd_reloc_name_lookup \
    422  1.1  christos   ((reloc_howto_type *(*) (bfd *, const char *)) bfd_nullvoidptr)
    423  1.1  christos 
    424  1.1  christos /* Routines to use for BFD_JUMP_TABLE_WRITE for targets which may not
    425  1.1  christos    be written.  Use BFD_JUMP_TABLE_WRITE (_bfd_nowrite).  */
    426  1.1  christos 
    427  1.1  christos #define _bfd_nowrite_set_arch_mach \
    428  1.1  christos   ((bfd_boolean (*) (bfd *, enum bfd_architecture, unsigned long)) \
    429  1.1  christos    bfd_false)
    430  1.1  christos #define _bfd_nowrite_set_section_contents \
    431  1.1  christos   ((bfd_boolean (*) (bfd *, asection *, const void *, file_ptr, bfd_size_type)) \
    432  1.1  christos    bfd_false)
    433  1.1  christos 
    434  1.1  christos /* Generic routines to use for BFD_JUMP_TABLE_WRITE.  Use
    435  1.1  christos    BFD_JUMP_TABLE_WRITE (_bfd_generic).  */
    436  1.1  christos 
    437  1.1  christos #define _bfd_generic_set_arch_mach bfd_default_set_arch_mach
    438  1.1  christos extern bfd_boolean _bfd_generic_set_section_contents
    439  1.1  christos   (bfd *, asection *, const void *, file_ptr, bfd_size_type);
    440  1.1  christos 
    441  1.1  christos /* Routines to use for BFD_JUMP_TABLE_LINK for targets which do not
    442  1.1  christos    support linking.  Use BFD_JUMP_TABLE_LINK (_bfd_nolink).  */
    443  1.1  christos 
    444  1.1  christos #define _bfd_nolink_sizeof_headers \
    445  1.1  christos   ((int (*) (bfd *, struct bfd_link_info *)) bfd_0)
    446  1.1  christos #define _bfd_nolink_bfd_get_relocated_section_contents \
    447  1.1  christos   ((bfd_byte *(*) (bfd *, struct bfd_link_info *, struct bfd_link_order *, \
    448  1.1  christos 		   bfd_byte *, bfd_boolean, asymbol **)) \
    449  1.1  christos    bfd_nullvoidptr)
    450  1.1  christos #define _bfd_nolink_bfd_relax_section \
    451  1.1  christos   ((bfd_boolean (*) \
    452  1.1  christos     (bfd *, asection *, struct bfd_link_info *, bfd_boolean *)) \
    453  1.1  christos    bfd_false)
    454  1.1  christos #define _bfd_nolink_bfd_gc_sections \
    455  1.1  christos   ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) \
    456  1.1  christos    bfd_false)
    457  1.1  christos #define _bfd_nolink_bfd_merge_sections \
    458  1.1  christos   ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) \
    459  1.1  christos    bfd_false)
    460  1.1  christos #define _bfd_nolink_bfd_is_group_section \
    461  1.1  christos   ((bfd_boolean (*) (bfd *, const struct bfd_section *)) \
    462  1.1  christos    bfd_false)
    463  1.1  christos #define _bfd_nolink_bfd_discard_group \
    464  1.1  christos   ((bfd_boolean (*) (bfd *, struct bfd_section *)) \
    465  1.1  christos    bfd_false)
    466  1.1  christos #define _bfd_nolink_bfd_link_hash_table_create \
    467  1.1  christos   ((struct bfd_link_hash_table *(*) (bfd *)) bfd_nullvoidptr)
    468  1.1  christos #define _bfd_nolink_bfd_link_hash_table_free \
    469  1.1  christos   ((void (*) (struct bfd_link_hash_table *)) bfd_void)
    470  1.1  christos #define _bfd_nolink_bfd_link_add_symbols \
    471  1.1  christos   ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) bfd_false)
    472  1.1  christos #define _bfd_nolink_bfd_link_just_syms \
    473  1.1  christos   ((void (*) (asection *, struct bfd_link_info *)) bfd_void)
    474  1.1  christos #define _bfd_nolink_bfd_copy_link_hash_symbol_type \
    475  1.1  christos   ((void (*) (bfd *, struct bfd_link_hash_entry *, \
    476  1.1  christos 	      struct bfd_link_hash_entry *)) bfd_void)
    477  1.1  christos #define _bfd_nolink_bfd_final_link \
    478  1.1  christos   ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) bfd_false)
    479  1.1  christos #define _bfd_nolink_bfd_link_split_section \
    480  1.1  christos   ((bfd_boolean (*) (bfd *, struct bfd_section *)) bfd_false)
    481  1.1  christos #define _bfd_nolink_section_already_linked \
    482  1.1  christos   ((void (*) (bfd *, struct bfd_section *, struct bfd_link_info *)) bfd_void)
    483  1.1  christos #define _bfd_nolink_bfd_define_common_symbol \
    484  1.1  christos   ((bfd_boolean (*) (bfd *, struct bfd_link_info *, \
    485  1.1  christos 		     struct bfd_link_hash_entry *)) bfd_false)
    486  1.1  christos 
    487  1.1  christos /* Routines to use for BFD_JUMP_TABLE_DYNAMIC for targets which do not
    488  1.1  christos    have dynamic symbols or relocs.  Use BFD_JUMP_TABLE_DYNAMIC
    489  1.1  christos    (_bfd_nodynamic).  */
    490  1.1  christos 
    491  1.1  christos #define _bfd_nodynamic_get_dynamic_symtab_upper_bound _bfd_n1
    492  1.1  christos #define _bfd_nodynamic_canonicalize_dynamic_symtab \
    493  1.1  christos   ((long (*) (bfd *, asymbol **)) _bfd_n1)
    494  1.1  christos #define _bfd_nodynamic_get_synthetic_symtab \
    495  1.1  christos   ((long (*) (bfd *, long, asymbol **, long, asymbol **, asymbol **)) _bfd_n1)
    496  1.1  christos #define _bfd_nodynamic_get_dynamic_reloc_upper_bound _bfd_n1
    497  1.1  christos #define _bfd_nodynamic_canonicalize_dynamic_reloc \
    498  1.1  christos   ((long (*) (bfd *, arelent **, asymbol **)) _bfd_n1)
    499  1.1  christos 
    500  1.1  christos /* Generic routine to determine of the given symbol is a local
    502  1.1  christos    label.  */
    503  1.1  christos extern bfd_boolean bfd_generic_is_local_label_name
    504  1.1  christos   (bfd *, const char *);
    505  1.1  christos 
    506  1.1  christos /* Generic minisymbol routines.  */
    507  1.1  christos extern long _bfd_generic_read_minisymbols
    508  1.1  christos   (bfd *, bfd_boolean, void **, unsigned int *);
    509  1.1  christos extern asymbol *_bfd_generic_minisymbol_to_symbol
    510  1.1  christos   (bfd *, bfd_boolean, const void *, asymbol *);
    511  1.1  christos 
    512  1.1  christos /* Find the nearest line using .stab/.stabstr sections.  */
    513  1.1  christos extern bfd_boolean _bfd_stab_section_find_nearest_line
    514  1.1  christos   (bfd *, asymbol **, asection *, bfd_vma, bfd_boolean *,
    515  1.1  christos    const char **, const char **, unsigned int *, void **);
    516  1.1  christos 
    517  1.1  christos /* Find the nearest line using DWARF 1 debugging information.  */
    518  1.1  christos extern bfd_boolean _bfd_dwarf1_find_nearest_line
    519  1.1  christos   (bfd *, asection *, asymbol **, bfd_vma, const char **,
    520  1.1  christos    const char **, unsigned int *);
    521  1.1  christos 
    522  1.1  christos /* Find the nearest line using DWARF 2 debugging information.  */
    523  1.1  christos extern bfd_boolean _bfd_dwarf2_find_nearest_line
    524  1.1  christos   (bfd *, asection *, asymbol **, bfd_vma, const char **, const char **,
    525  1.1  christos    unsigned int *, unsigned int, void **);
    526  1.1  christos 
    527  1.1  christos /* Find the line using DWARF 2 debugging information.  */
    528  1.1  christos extern bfd_boolean _bfd_dwarf2_find_line
    529  1.1  christos   (bfd *, asymbol **, asymbol *, const char **,
    530  1.1  christos    unsigned int *, unsigned int, void **);
    531  1.1  christos 
    532  1.1  christos bfd_boolean _bfd_generic_find_line
    533  1.1  christos   (bfd *, asymbol **, asymbol *, const char **, unsigned int *);
    534  1.1  christos 
    535  1.1  christos /* Find inliner info after calling bfd_find_nearest_line. */
    536  1.1  christos extern bfd_boolean _bfd_dwarf2_find_inliner_info
    537  1.1  christos   (bfd *, const char **, const char **, unsigned int *, void **);
    538  1.1  christos 
    539  1.1  christos /* Create a new section entry.  */
    540  1.1  christos extern struct bfd_hash_entry *bfd_section_hash_newfunc
    541  1.1  christos   (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
    542  1.1  christos 
    543  1.1  christos /* A routine to create entries for a bfd_link_hash_table.  */
    544  1.1  christos extern struct bfd_hash_entry *_bfd_link_hash_newfunc
    545  1.1  christos   (struct bfd_hash_entry *entry, struct bfd_hash_table *table,
    546  1.1  christos    const char *string);
    547  1.1  christos 
    548  1.1  christos /* Initialize a bfd_link_hash_table.  */
    549  1.1  christos extern bfd_boolean _bfd_link_hash_table_init
    550  1.1  christos   (struct bfd_link_hash_table *, bfd *,
    551  1.1  christos    struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
    552  1.1  christos 			       struct bfd_hash_table *,
    553  1.1  christos 			       const char *),
    554  1.1  christos    unsigned int);
    555  1.1  christos 
    556  1.1  christos /* Generic link hash table creation routine.  */
    557  1.1  christos extern struct bfd_link_hash_table *_bfd_generic_link_hash_table_create
    558  1.1  christos   (bfd *);
    559  1.1  christos 
    560  1.1  christos /* Generic link hash table destruction routine.  */
    561  1.1  christos extern void _bfd_generic_link_hash_table_free
    562  1.1  christos   (struct bfd_link_hash_table *);
    563  1.1  christos 
    564  1.1  christos /* Generic add symbol routine.  */
    565  1.1  christos extern bfd_boolean _bfd_generic_link_add_symbols
    566  1.1  christos   (bfd *, struct bfd_link_info *);
    567  1.1  christos 
    568  1.1  christos /* Generic add symbol routine.  This version is used by targets for
    569  1.1  christos    which the linker must collect constructors and destructors by name,
    570  1.1  christos    as the collect2 program does.  */
    571  1.1  christos extern bfd_boolean _bfd_generic_link_add_symbols_collect
    572  1.1  christos   (bfd *, struct bfd_link_info *);
    573  1.1  christos 
    574  1.1  christos /* Generic archive add symbol routine.  */
    575  1.1  christos extern bfd_boolean _bfd_generic_link_add_archive_symbols
    576  1.1  christos   (bfd *, struct bfd_link_info *,
    577  1.1  christos    bfd_boolean (*) (bfd *, struct bfd_link_info *, bfd_boolean *));
    578  1.1  christos 
    579  1.1  christos /* Forward declaration to avoid prototype errors.  */
    580  1.1  christos typedef struct bfd_link_hash_entry _bfd_link_hash_entry;
    581  1.1  christos 
    582  1.1  christos /* Generic routine to add a single symbol.  */
    583  1.1  christos extern bfd_boolean _bfd_generic_link_add_one_symbol
    584  1.1  christos   (struct bfd_link_info *, bfd *, const char *name, flagword,
    585  1.1  christos    asection *, bfd_vma, const char *, bfd_boolean copy,
    586  1.1  christos    bfd_boolean constructor, struct bfd_link_hash_entry **);
    587  1.1  christos 
    588  1.1  christos /* Generic routine to mark section as supplying symbols only.  */
    589  1.1  christos extern void _bfd_generic_link_just_syms
    590  1.1  christos   (asection *, struct bfd_link_info *);
    591  1.1  christos 
    592  1.1  christos /* Generic routine that does nothing.  */
    593  1.1  christos extern void _bfd_generic_copy_link_hash_symbol_type
    594  1.1  christos   (bfd *, struct bfd_link_hash_entry *, struct bfd_link_hash_entry *);
    595  1.1  christos 
    596  1.1  christos /* Generic link routine.  */
    597  1.1  christos extern bfd_boolean _bfd_generic_final_link
    598  1.1  christos   (bfd *, struct bfd_link_info *);
    599  1.1  christos 
    600  1.1  christos extern bfd_boolean _bfd_generic_link_split_section
    601  1.1  christos   (bfd *, struct bfd_section *);
    602  1.1  christos 
    603  1.1  christos extern void _bfd_generic_section_already_linked
    604  1.1  christos   (bfd *, struct bfd_section *, struct bfd_link_info *);
    605  1.1  christos 
    606  1.1  christos /* Generic reloc_link_order processing routine.  */
    607  1.1  christos extern bfd_boolean _bfd_generic_reloc_link_order
    608  1.1  christos   (bfd *, struct bfd_link_info *, asection *, struct bfd_link_order *);
    609  1.1  christos 
    610  1.1  christos /* Default link order processing routine.  */
    611  1.1  christos extern bfd_boolean _bfd_default_link_order
    612  1.1  christos   (bfd *, struct bfd_link_info *, asection *, struct bfd_link_order *);
    613  1.1  christos 
    614  1.1  christos /* Count the number of reloc entries in a link order list.  */
    615  1.1  christos extern unsigned int _bfd_count_link_order_relocs
    616  1.1  christos   (struct bfd_link_order *);
    617  1.1  christos 
    618  1.1  christos /* Final link relocation routine.  */
    619  1.1  christos extern bfd_reloc_status_type _bfd_final_link_relocate
    620  1.1  christos   (reloc_howto_type *, bfd *, asection *, bfd_byte *,
    621  1.1  christos    bfd_vma, bfd_vma, bfd_vma);
    622  1.1  christos 
    623  1.1  christos /* Relocate a particular location by a howto and a value.  */
    624  1.1  christos extern bfd_reloc_status_type _bfd_relocate_contents
    625  1.1  christos   (reloc_howto_type *, bfd *, bfd_vma, bfd_byte *);
    626  1.1  christos 
    627  1.1  christos /* Clear a given location using a given howto.  */
    628  1.1  christos extern void _bfd_clear_contents (reloc_howto_type *howto, bfd *input_bfd,
    629  1.1  christos 				 asection *input_section, bfd_byte *location);
    630  1.1  christos 
    631  1.1  christos /* Link stabs in sections in the first pass.  */
    632  1.1  christos 
    633  1.1  christos extern bfd_boolean _bfd_link_section_stabs
    634  1.1  christos   (bfd *, struct stab_info *, asection *, asection *, void **,
    635  1.1  christos    bfd_size_type *);
    636  1.1  christos 
    637  1.1  christos /* Eliminate stabs for discarded functions and symbols.  */
    638  1.1  christos extern bfd_boolean _bfd_discard_section_stabs
    639  1.1  christos   (bfd *, asection *, void *, bfd_boolean (*) (bfd_vma, void *), void *);
    640  1.1  christos 
    641  1.1  christos /* Write out the .stab section when linking stabs in sections.  */
    642  1.1  christos 
    643  1.1  christos extern bfd_boolean _bfd_write_section_stabs
    644  1.1  christos   (bfd *, struct stab_info *, asection *, void **, bfd_byte *);
    645  1.1  christos 
    646  1.1  christos /* Write out the .stabstr string table when linking stabs in sections.  */
    647  1.1  christos 
    648  1.1  christos extern bfd_boolean _bfd_write_stab_strings
    649  1.1  christos   (bfd *, struct stab_info *);
    650  1.1  christos 
    651  1.1  christos /* Find an offset within a .stab section when linking stabs in
    652  1.1  christos    sections.  */
    653  1.1  christos 
    654  1.1  christos extern bfd_vma _bfd_stab_section_offset
    655  1.1  christos   (asection *, void *, bfd_vma);
    656  1.1  christos 
    657  1.1  christos /* Register a SEC_MERGE section as a candidate for merging.  */
    658  1.1  christos 
    659  1.1  christos extern bfd_boolean _bfd_add_merge_section
    660  1.1  christos   (bfd *, void **, asection *, void **);
    661  1.1  christos 
    662  1.1  christos /* Attempt to merge SEC_MERGE sections.  */
    663  1.1  christos 
    664  1.1  christos extern bfd_boolean _bfd_merge_sections
    665  1.1  christos   (bfd *, struct bfd_link_info *, void *, void (*) (bfd *, asection *));
    666  1.1  christos 
    667  1.1  christos /* Write out a merged section.  */
    668  1.1  christos 
    669  1.1  christos extern bfd_boolean _bfd_write_merged_section
    670  1.1  christos   (bfd *, asection *, void *);
    671  1.1  christos 
    672  1.1  christos /* Find an offset within a modified SEC_MERGE section.  */
    673  1.1  christos 
    674  1.1  christos extern bfd_vma _bfd_merged_section_offset
    675  1.1  christos   (bfd *, asection **, void *, bfd_vma);
    676  1.1  christos 
    677  1.1  christos /* Create a string table.  */
    678  1.1  christos extern struct bfd_strtab_hash *_bfd_stringtab_init
    679  1.1  christos   (void);
    680  1.1  christos 
    681  1.1  christos /* Create an XCOFF .debug section style string table.  */
    682  1.1  christos extern struct bfd_strtab_hash *_bfd_xcoff_stringtab_init
    683  1.1  christos   (void);
    684  1.1  christos 
    685  1.1  christos /* Free a string table.  */
    686  1.1  christos extern void _bfd_stringtab_free
    687  1.1  christos   (struct bfd_strtab_hash *);
    688  1.1  christos 
    689  1.1  christos /* Get the size of a string table.  */
    690  1.1  christos extern bfd_size_type _bfd_stringtab_size
    691  1.1  christos   (struct bfd_strtab_hash *);
    692  1.1  christos 
    693  1.1  christos /* Add a string to a string table.  */
    694  1.1  christos extern bfd_size_type _bfd_stringtab_add
    695  1.1  christos   (struct bfd_strtab_hash *, const char *, bfd_boolean hash, bfd_boolean copy);
    696  1.1  christos 
    697  1.1  christos /* Write out a string table.  */
    698  1.1  christos extern bfd_boolean _bfd_stringtab_emit
    699  1.1  christos   (bfd *, struct bfd_strtab_hash *);
    700  1.1  christos 
    701  1.1  christos /* Check that endianness of input and output file match.  */
    702  1.1  christos extern bfd_boolean _bfd_generic_verify_endian_match
    703  1.1  christos   (bfd *, bfd *);
    704  1.1  christos 
    705  1.1  christos /* Macros to tell if bfds are read or write enabled.
    707  1.1  christos 
    708  1.1  christos    Note that bfds open for read may be scribbled into if the fd passed
    709  1.1  christos    to bfd_fdopenr is actually open both for read and write
    710  1.1  christos    simultaneously.  However an output bfd will never be open for
    711  1.1  christos    read.  Therefore sometimes you want to check bfd_read_p or
    712  1.1  christos    !bfd_read_p, and only sometimes bfd_write_p.
    713  1.1  christos */
    714  1.1  christos 
    715  1.1  christos #define	bfd_read_p(abfd) \
    716  1.1  christos   ((abfd)->direction == read_direction || (abfd)->direction == both_direction)
    717  1.1  christos #define	bfd_write_p(abfd) \
    718  1.1  christos   ((abfd)->direction == write_direction || (abfd)->direction == both_direction)
    719  1.1  christos 
    720  1.1  christos void bfd_assert
    721  1.1  christos   (const char*,int);
    722  1.1  christos 
    723  1.1  christos #define BFD_ASSERT(x) \
    724  1.1  christos   do { if (!(x)) bfd_assert(__FILE__,__LINE__); } while (0)
    725  1.1  christos 
    726  1.1  christos #define BFD_FAIL() \
    727  1.1  christos   do { bfd_assert(__FILE__,__LINE__); } while (0)
    728  1.1  christos 
    729  1.1  christos extern void _bfd_abort
    730  1.1  christos   (const char *, int, const char *) ATTRIBUTE_NORETURN;
    731  1.1  christos 
    732  1.1  christos /* if gcc >= 2.6, we can give a function name, too */
    733  1.1  christos #if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 6)
    734  1.1  christos #define __PRETTY_FUNCTION__  ((char *) NULL)
    735  1.1  christos #endif
    736  1.1  christos 
    737  1.1  christos #undef abort
    738  1.1  christos #define abort() _bfd_abort (__FILE__, __LINE__, __PRETTY_FUNCTION__)
    739  1.1  christos 
    740  1.1  christos /* Manipulate a system FILE but using BFD's "file_ptr", rather than
    741  1.1  christos    the system "off_t" or "off64_t", as the offset.  */
    742  1.1  christos extern file_ptr real_ftell (FILE *file);
    743  1.1  christos extern int real_fseek (FILE *file, file_ptr offset, int whence);
    744  1.1  christos extern FILE *real_fopen (const char *filename, const char *modes);
    745  1.1  christos 
    746  1.1  christos /* List of supported target vectors, and the default vector (if
    747  1.1  christos    bfd_default_vector[0] is NULL, there is no default).  */
    748  1.1  christos extern const bfd_target * const *bfd_target_vector;
    749  1.1  christos extern const bfd_target *bfd_default_vector[];
    750  1.1  christos 
    751  1.1  christos /* List of associated target vectors.  */
    752  1.1  christos extern const bfd_target * const *bfd_associated_vector;
    753  1.1  christos 
    754  1.1  christos /* Functions shared by the ECOFF and MIPS ELF backends, which have no
    755  1.1  christos    other common header files.  */
    756  1.1  christos 
    757  1.1  christos #if defined(__STDC__) || defined(ALMOST_STDC)
    758  1.1  christos struct ecoff_find_line;
    759  1.1  christos #endif
    760  1.1  christos 
    761  1.1  christos extern bfd_boolean _bfd_ecoff_locate_line
    762  1.1  christos   (bfd *, asection *, bfd_vma, struct ecoff_debug_info * const,
    763  1.1  christos    const struct ecoff_debug_swap * const, struct ecoff_find_line *,
    764  1.1  christos    const char **, const char **, unsigned int *);
    765  1.1  christos extern bfd_boolean _bfd_ecoff_get_accumulated_pdr
    766  1.1  christos   (void *, bfd_byte *);
    767  1.1  christos extern bfd_boolean _bfd_ecoff_get_accumulated_sym
    768  1.1  christos   (void *, bfd_byte *);
    769  1.1  christos extern bfd_boolean _bfd_ecoff_get_accumulated_ss
    770  1.1  christos   (void *, bfd_byte *);
    771  1.1  christos 
    772  1.1  christos extern bfd_vma _bfd_get_gp_value
    773  1.1  christos   (bfd *);
    774  1.1  christos extern void _bfd_set_gp_value
    775  1.1  christos   (bfd *, bfd_vma);
    776  1.1  christos 
    777  1.1  christos /* Function shared by the COFF and ELF SH backends, which have no
    778  1.1  christos    other common header files.  */
    779  1.1  christos 
    780  1.1  christos #ifndef _bfd_sh_align_load_span
    781  1.1  christos extern bfd_boolean _bfd_sh_align_load_span
    782  1.1  christos   (bfd *, asection *, bfd_byte *,
    783  1.1  christos    bfd_boolean (*) (bfd *, asection *, void *, bfd_byte *, bfd_vma),
    784  1.1  christos    void *, bfd_vma **, bfd_vma *, bfd_vma, bfd_vma, bfd_boolean *);
    785  1.1  christos #endif
    786  1.1  christos 
    787  1.1  christos /* This is the shape of the elements inside the already_linked hash
    788  1.1  christos    table. It maps a name onto a list of already_linked elements with
    789  1.1  christos    the same name.  */
    790  1.1  christos 
    791  1.1  christos struct bfd_section_already_linked_hash_entry
    792  1.1  christos {
    793  1.1  christos   struct bfd_hash_entry root;
    794  1.1  christos   struct bfd_section_already_linked *entry;
    795  1.1  christos };
    796  1.1  christos 
    797  1.1  christos struct bfd_section_already_linked
    798  1.1  christos {
    799  1.1  christos   struct bfd_section_already_linked *next;
    800  1.1  christos   asection *sec;
    801  1.1  christos };
    802  1.1  christos 
    803  1.1  christos extern struct bfd_section_already_linked_hash_entry *
    804  1.1  christos   bfd_section_already_linked_table_lookup (const char *);
    805  1.1  christos extern bfd_boolean bfd_section_already_linked_table_insert
    806  1.1  christos   (struct bfd_section_already_linked_hash_entry *, asection *);
    807  1.1  christos extern void bfd_section_already_linked_table_traverse
    808  1.1  christos   (bfd_boolean (*) (struct bfd_section_already_linked_hash_entry *,
    809  1.1  christos 		    void *), void *);
    810  1.1  christos 
    811  1.1  christos extern bfd_vma read_unsigned_leb128 (bfd *, bfd_byte *, unsigned int *);
    812  1.1  christos extern bfd_signed_vma read_signed_leb128 (bfd *, bfd_byte *, unsigned int *);
    813  1.1  christos 
    814  1.1  christos struct dwarf_debug_section
    815  1.1  christos {
    816  1.1  christos   const char *uncompressed_name;
    817  1.1  christos   const char *compressed_name;
    818  1.1  christos };
    819  1.1  christos 
    820  1.1  christos /* Map of uncompressed DWARF debug section name to compressed one.  It
    821                   is terminated by NULL uncompressed_name.  */
    822                
    823                extern struct dwarf_debug_section dwarf_debug_sections[];
    824