Home | History | Annotate | Line # | Download | only in bfd
libbfd-in.h revision 1.9
      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.9  christos    Copyright (C) 1990-2024 Free Software Foundation, Inc.
      5  1.1  christos 
      6  1.1  christos    Written by Cygnus Support.
      7  1.1  christos 
      8  1.1  christos    This file is part of BFD, the Binary File Descriptor library.
      9  1.1  christos 
     10  1.1  christos    This program is free software; you can redistribute it and/or modify
     11  1.1  christos    it under the terms of the GNU General Public License as published by
     12  1.1  christos    the Free Software Foundation; either version 3 of the License, or
     13  1.1  christos    (at your option) any later version.
     14  1.1  christos 
     15  1.1  christos    This program is distributed in the hope that it will be useful,
     16  1.1  christos    but WITHOUT ANY WARRANTY; without even the implied warranty of
     17  1.1  christos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     18  1.1  christos    GNU General Public License for more details.
     19  1.1  christos 
     20  1.1  christos    You should have received a copy of the GNU General Public License
     21  1.1  christos    along with this program; if not, write to the Free Software
     22  1.1  christos    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
     23  1.1  christos    MA 02110-1301, USA.  */
     24  1.1  christos 
     25  1.6  christos #ifndef _LIBBFD_H
     26  1.6  christos #define _LIBBFD_H 1
     27  1.6  christos 
     28  1.6  christos #ifndef ATTRIBUTE_HIDDEN
     29  1.6  christos #if HAVE_HIDDEN
     30  1.6  christos #define ATTRIBUTE_HIDDEN __attribute__ ((__visibility__ ("hidden")))
     31  1.6  christos #else
     32  1.6  christos #define ATTRIBUTE_HIDDEN
     33  1.6  christos #endif
     34  1.6  christos #endif
     35  1.6  christos 
     36  1.1  christos #include "hashtab.h"
     37  1.1  christos 
     38  1.3  christos #ifdef __cplusplus
     39  1.3  christos extern "C" {
     40  1.3  christos #endif
     41  1.3  christos 
     42  1.1  christos /* Set a tdata field.  Can't use the other macros for this, since they
     43  1.1  christos    do casts, and casting to the left of assignment isn't portable.  */
     44  1.1  christos #define set_tdata(bfd, v) ((bfd)->tdata.any = (v))
     45  1.1  christos 
     46  1.1  christos /* If BFD_IN_MEMORY is set for a BFD, then the iostream fields points
     47  1.1  christos    to an instance of this structure.  */
     48  1.1  christos 
     49  1.1  christos struct bfd_in_memory
     50  1.1  christos {
     51  1.1  christos   /* Size of buffer.  */
     52  1.1  christos   bfd_size_type size;
     53  1.1  christos   /* Buffer holding contents of BFD.  */
     54  1.1  christos   bfd_byte *buffer;
     55  1.1  christos };
     56  1.1  christos 
     57  1.1  christos struct section_hash_entry
     58  1.1  christos {
     59  1.1  christos   struct bfd_hash_entry root;
     60  1.1  christos   asection section;
     61  1.1  christos };
     62  1.1  christos 
     63  1.6  christos /* Unique section id.  */
     64  1.6  christos extern unsigned int _bfd_section_id ATTRIBUTE_HIDDEN;
     65  1.6  christos 
     66  1.1  christos /* tdata for an archive.  For an input archive, cache
     67  1.1  christos    needs to be free()'d.  For an output archive, symdefs do.  */
     68  1.1  christos 
     69  1.1  christos struct artdata
     70  1.1  christos {
     71  1.9  christos   ufile_ptr first_file_filepos;
     72  1.1  christos   /* Speed up searching the armap */
     73  1.1  christos   htab_t cache;
     74  1.1  christos   carsym *symdefs;		/* The symdef entries.  */
     75  1.1  christos   symindex symdef_count;	/* How many there are.  */
     76  1.1  christos   char *extended_names;		/* Clever intel extension.  */
     77  1.1  christos   bfd_size_type extended_names_size; /* Size of extended names.  */
     78  1.1  christos   /* When more compilers are standard C, this can be a time_t.  */
     79  1.1  christos   long  armap_timestamp;	/* Timestamp value written into armap.
     80  1.1  christos 				   This is used for BSD archives to check
     81  1.1  christos 				   that the timestamp is recent enough
     82  1.1  christos 				   for the BSD linker to not complain,
     83  1.1  christos 				   just before we finish writing an
     84  1.1  christos 				   archive.  */
     85  1.1  christos   file_ptr armap_datepos;	/* Position within archive to seek to
     86  1.1  christos 				   rewrite the date field.  */
     87  1.1  christos   void *tdata;			/* Backend specific information.  */
     88  1.1  christos };
     89  1.1  christos 
     90  1.1  christos #define bfd_ardata(bfd) ((bfd)->tdata.aout_ar_data)
     91  1.1  christos 
     92  1.1  christos /* Goes in bfd's arelt_data slot */
     93  1.1  christos struct areltdata
     94  1.1  christos {
     95  1.1  christos   char * arch_header;		/* It's actually a string.  */
     96  1.1  christos   bfd_size_type parsed_size;	/* Octets of filesize not including ar_hdr.  */
     97  1.1  christos   bfd_size_type extra_size;	/* BSD4.4: extra bytes after the header.  */
     98  1.1  christos   char *filename;		/* Null-terminated.  */
     99  1.1  christos   file_ptr origin;		/* For element of a thin archive.  */
    100  1.3  christos   void *parent_cache;		/* Where and how to find this member.  */
    101  1.3  christos   file_ptr key;
    102  1.1  christos };
    103  1.1  christos 
    104  1.1  christos #define arelt_size(bfd) (((struct areltdata *)((bfd)->arelt_data))->parsed_size)
    105  1.1  christos 
    106  1.1  christos extern void *bfd_malloc
    107  1.6  christos   (bfd_size_type) ATTRIBUTE_HIDDEN;
    108  1.1  christos 
    109  1.7  christos static inline char *
    110  1.7  christos bfd_strdup (const char *str)
    111  1.7  christos {
    112  1.7  christos   size_t len = strlen (str) + 1;
    113  1.7  christos   char *buf = bfd_malloc (len);
    114  1.7  christos   if (buf != NULL)
    115  1.7  christos     memcpy (buf, str, len);
    116  1.7  christos   return buf;
    117  1.7  christos }
    118  1.1  christos 
    119  1.6  christos extern bfd * _bfd_create_empty_archive_element_shell
    120  1.6  christos   (bfd *) ATTRIBUTE_HIDDEN;
    121  1.6  christos extern bfd * _bfd_look_for_bfd_in_cache
    122  1.6  christos   (bfd *, file_ptr) ATTRIBUTE_HIDDEN;
    123  1.8  christos extern bool _bfd_add_bfd_to_archive_cache
    124  1.6  christos   (bfd *, file_ptr, bfd *) ATTRIBUTE_HIDDEN;
    125  1.8  christos extern bool _bfd_generic_mkarchive
    126  1.6  christos   (bfd *) ATTRIBUTE_HIDDEN;
    127  1.6  christos extern char *_bfd_append_relative_path
    128  1.6  christos   (bfd *, char *) ATTRIBUTE_HIDDEN;
    129  1.8  christos extern bfd_cleanup bfd_generic_archive_p
    130  1.6  christos   (bfd *) ATTRIBUTE_HIDDEN;
    131  1.8  christos extern bool bfd_slurp_armap
    132  1.6  christos   (bfd *) ATTRIBUTE_HIDDEN;
    133  1.1  christos #define bfd_slurp_bsd_armap bfd_slurp_armap
    134  1.1  christos #define bfd_slurp_coff_armap bfd_slurp_armap
    135  1.8  christos extern bool _bfd_archive_64_bit_slurp_armap
    136  1.6  christos   (bfd *) ATTRIBUTE_HIDDEN;
    137  1.8  christos extern bool _bfd_archive_64_bit_write_armap
    138  1.6  christos   (bfd *, unsigned int, struct orl *, unsigned int, int) ATTRIBUTE_HIDDEN;
    139  1.5  christos #define _bfd_archive_64_bit_slurp_extended_name_table \
    140  1.5  christos   _bfd_slurp_extended_name_table
    141  1.5  christos #define _bfd_archive_64_bit_construct_extended_name_table \
    142  1.5  christos   _bfd_archive_coff_construct_extended_name_table
    143  1.5  christos #define _bfd_archive_64_bit_truncate_arname \
    144  1.5  christos   bfd_dont_truncate_arname
    145  1.5  christos #define _bfd_archive_64_bit_read_ar_hdr \
    146  1.5  christos   _bfd_generic_read_ar_hdr
    147  1.5  christos #define _bfd_archive_64_bit_write_ar_hdr \
    148  1.5  christos   _bfd_generic_write_ar_hdr
    149  1.5  christos #define _bfd_archive_64_bit_openr_next_archived_file \
    150  1.5  christos   bfd_generic_openr_next_archived_file
    151  1.5  christos #define _bfd_archive_64_bit_get_elt_at_index \
    152  1.5  christos   _bfd_generic_get_elt_at_index
    153  1.5  christos #define _bfd_archive_64_bit_generic_stat_arch_elt \
    154  1.5  christos   bfd_generic_stat_arch_elt
    155  1.6  christos #define _bfd_archive_64_bit_update_armap_timestamp _bfd_bool_bfd_true
    156  1.5  christos 
    157  1.8  christos extern bool _bfd_slurp_extended_name_table
    158  1.6  christos   (bfd *) ATTRIBUTE_HIDDEN;
    159  1.8  christos extern bool _bfd_construct_extended_name_table
    160  1.8  christos   (bfd *, bool, char **, bfd_size_type *) ATTRIBUTE_HIDDEN;
    161  1.8  christos extern bool _bfd_write_archive_contents
    162  1.6  christos   (bfd *) ATTRIBUTE_HIDDEN;
    163  1.8  christos extern bool _bfd_compute_and_write_armap
    164  1.6  christos   (bfd *, unsigned int) ATTRIBUTE_HIDDEN;
    165  1.6  christos extern bfd *_bfd_get_elt_at_filepos
    166  1.8  christos   (bfd *, file_ptr, struct bfd_link_info *) ATTRIBUTE_HIDDEN;
    167  1.1  christos extern bfd *_bfd_generic_get_elt_at_index
    168  1.6  christos   (bfd *, symindex) ATTRIBUTE_HIDDEN;
    169  1.6  christos 
    170  1.8  christos extern bool _bfd_bool_bfd_false
    171  1.6  christos   (bfd *) ATTRIBUTE_HIDDEN;
    172  1.8  christos extern bool _bfd_bool_bfd_asymbol_false
    173  1.6  christos   (bfd *, asymbol *) ATTRIBUTE_HIDDEN;
    174  1.8  christos extern bool _bfd_bool_bfd_false_error
    175  1.6  christos   (bfd *) ATTRIBUTE_HIDDEN;
    176  1.8  christos extern bool _bfd_bool_bfd_link_false_error
    177  1.6  christos   (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN;
    178  1.8  christos extern bool _bfd_bool_bfd_true
    179  1.6  christos   (bfd *) ATTRIBUTE_HIDDEN;
    180  1.8  christos extern bool _bfd_bool_bfd_link_true
    181  1.6  christos   (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN;
    182  1.8  christos extern bool _bfd_bool_bfd_bfd_true
    183  1.6  christos   (bfd *, bfd *) ATTRIBUTE_HIDDEN;
    184  1.8  christos extern bool _bfd_bool_bfd_uint_true
    185  1.6  christos   (bfd *, unsigned int) ATTRIBUTE_HIDDEN;
    186  1.8  christos extern bool _bfd_bool_bfd_asection_bfd_asection_true
    187  1.6  christos   (bfd *, asection *, bfd *, asection *) ATTRIBUTE_HIDDEN;
    188  1.8  christos extern bool _bfd_bool_bfd_asymbol_bfd_asymbol_true
    189  1.6  christos   (bfd *, asymbol *, bfd *, asymbol *) ATTRIBUTE_HIDDEN;
    190  1.8  christos extern bool _bfd_bool_bfd_ptr_true
    191  1.6  christos   (bfd *, void *) ATTRIBUTE_HIDDEN;
    192  1.6  christos extern void *_bfd_ptr_bfd_null_error
    193  1.6  christos   (bfd *) ATTRIBUTE_HIDDEN;
    194  1.6  christos extern int _bfd_int_bfd_0
    195  1.6  christos   (bfd *) ATTRIBUTE_HIDDEN;
    196  1.6  christos extern unsigned int _bfd_uint_bfd_0
    197  1.6  christos   (bfd *) ATTRIBUTE_HIDDEN;
    198  1.6  christos extern long _bfd_long_bfd_0
    199  1.6  christos   (bfd *) ATTRIBUTE_HIDDEN;
    200  1.6  christos extern long _bfd_long_bfd_n1_error
    201  1.6  christos   (bfd *) ATTRIBUTE_HIDDEN;
    202  1.6  christos extern void _bfd_void_bfd
    203  1.6  christos   (bfd *) ATTRIBUTE_HIDDEN;
    204  1.6  christos extern void _bfd_void_bfd_link
    205  1.6  christos   (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN;
    206  1.6  christos extern void _bfd_void_bfd_asection
    207  1.6  christos   (bfd *, asection *) ATTRIBUTE_HIDDEN;
    208  1.6  christos 
    209  1.8  christos extern bfd_cleanup _bfd_dummy_target
    210  1.6  christos   (bfd *) ATTRIBUTE_HIDDEN;
    211  1.8  christos #define _bfd_no_cleanup _bfd_void_bfd
    212  1.6  christos 
    213  1.6  christos extern void bfd_dont_truncate_arname
    214  1.6  christos   (bfd *, const char *, char *) ATTRIBUTE_HIDDEN;
    215  1.6  christos extern void bfd_bsd_truncate_arname
    216  1.6  christos   (bfd *, const char *, char *) ATTRIBUTE_HIDDEN;
    217  1.6  christos extern void bfd_gnu_truncate_arname
    218  1.6  christos   (bfd *, const char *, char *) ATTRIBUTE_HIDDEN;
    219  1.6  christos 
    220  1.8  christos extern bool _bfd_bsd_write_armap
    221  1.6  christos   (bfd *, unsigned int, struct orl *, unsigned int, int) ATTRIBUTE_HIDDEN;
    222  1.6  christos 
    223  1.8  christos extern bool _bfd_coff_write_armap
    224  1.6  christos   (bfd *, unsigned int, struct orl *, unsigned int, int) ATTRIBUTE_HIDDEN;
    225  1.1  christos 
    226  1.1  christos extern void *_bfd_generic_read_ar_hdr
    227  1.6  christos   (bfd *) ATTRIBUTE_HIDDEN;
    228  1.1  christos extern void _bfd_ar_spacepad
    229  1.6  christos   (char *, size_t, const char *, long) ATTRIBUTE_HIDDEN;
    230  1.8  christos extern bool _bfd_ar_sizepad
    231  1.6  christos   (char *, size_t, bfd_size_type) ATTRIBUTE_HIDDEN;
    232  1.1  christos 
    233  1.1  christos extern void *_bfd_generic_read_ar_hdr_mag
    234  1.6  christos   (bfd *, const char *) ATTRIBUTE_HIDDEN;
    235  1.1  christos 
    236  1.8  christos extern bool _bfd_generic_write_ar_hdr
    237  1.6  christos   (bfd *, bfd *) ATTRIBUTE_HIDDEN;
    238  1.1  christos 
    239  1.8  christos extern bool _bfd_bsd44_write_ar_hdr
    240  1.6  christos   (bfd *, bfd *) ATTRIBUTE_HIDDEN;
    241  1.1  christos 
    242  1.6  christos extern bfd * bfd_generic_openr_next_archived_file
    243  1.6  christos   (bfd *, bfd *) ATTRIBUTE_HIDDEN;
    244  1.1  christos 
    245  1.6  christos extern int bfd_generic_stat_arch_elt
    246  1.6  christos   (bfd *, struct stat *) ATTRIBUTE_HIDDEN;
    247  1.1  christos 
    248  1.1  christos #define _bfd_read_ar_hdr(abfd) \
    249  1.6  christos 	BFD_SEND (abfd, _bfd_read_ar_hdr_fn, (abfd))
    250  1.6  christos #define _bfd_write_ar_hdr(archive, abfd)	 \
    251  1.6  christos 	BFD_SEND (abfd, _bfd_write_ar_hdr_fn, (archive, abfd))
    252  1.1  christos 
    253  1.1  christos /* Generic routines to use for BFD_JUMP_TABLE_GENERIC.  Use
    255  1.1  christos    BFD_JUMP_TABLE_GENERIC (_bfd_generic).  */
    256  1.3  christos 
    257  1.8  christos #define _bfd_generic_close_and_cleanup _bfd_archive_close_and_cleanup
    258  1.6  christos extern bool _bfd_archive_close_and_cleanup
    259  1.7  christos   (bfd *) ATTRIBUTE_HIDDEN;
    260  1.9  christos extern void _bfd_unlink_from_archive_parent (bfd *) ATTRIBUTE_HIDDEN;
    261  1.8  christos #define _bfd_generic_bfd_free_cached_info _bfd_free_cached_info
    262  1.6  christos extern bool _bfd_generic_new_section_hook
    263  1.8  christos   (bfd *, asection *) ATTRIBUTE_HIDDEN;
    264  1.6  christos extern bool _bfd_generic_get_section_contents
    265  1.8  christos   (bfd *, asection *, void *, file_ptr, bfd_size_type) ATTRIBUTE_HIDDEN;
    266  1.6  christos extern bool _bfd_generic_get_section_contents_in_window
    267  1.1  christos   (bfd *, asection *, bfd_window *, file_ptr, bfd_size_type) ATTRIBUTE_HIDDEN;
    268  1.1  christos 
    269  1.1  christos /* Generic routines to use for BFD_JUMP_TABLE_COPY.  Use
    270  1.1  christos    BFD_JUMP_TABLE_COPY (_bfd_generic).  */
    271  1.6  christos 
    272  1.1  christos #define _bfd_generic_bfd_copy_private_bfd_data _bfd_bool_bfd_bfd_true
    273  1.6  christos #define _bfd_generic_bfd_merge_private_bfd_data \
    274  1.6  christos   _bfd_bool_bfd_link_true
    275  1.1  christos #define _bfd_generic_bfd_set_private_flags _bfd_bool_bfd_uint_true
    276  1.6  christos #define _bfd_generic_bfd_copy_private_section_data \
    277  1.1  christos   _bfd_bool_bfd_asection_bfd_asection_true
    278  1.6  christos #define _bfd_generic_bfd_copy_private_symbol_data \
    279  1.6  christos   _bfd_bool_bfd_asymbol_bfd_asymbol_true
    280  1.6  christos #define _bfd_generic_bfd_copy_private_header_data _bfd_bool_bfd_bfd_true
    281  1.1  christos #define _bfd_generic_bfd_print_private_bfd_data _bfd_bool_bfd_ptr_true
    282  1.8  christos 
    283  1.6  christos extern bool _bfd_generic_init_private_section_data
    284  1.6  christos   (bfd *, asection *, bfd *, asection *, struct bfd_link_info *)
    285  1.1  christos   ATTRIBUTE_HIDDEN;
    286  1.1  christos 
    287  1.1  christos /* Routines to use for BFD_JUMP_TABLE_CORE when there is no core file
    288  1.1  christos    support.  Use BFD_JUMP_TABLE_CORE (_bfd_nocore).  */
    289  1.1  christos 
    290  1.6  christos extern char *_bfd_nocore_core_file_failing_command
    291  1.1  christos   (bfd *) ATTRIBUTE_HIDDEN;
    292  1.6  christos extern int _bfd_nocore_core_file_failing_signal
    293  1.8  christos   (bfd *) ATTRIBUTE_HIDDEN;
    294  1.6  christos extern bool _bfd_nocore_core_file_matches_executable_p
    295  1.1  christos   (bfd *, bfd *) ATTRIBUTE_HIDDEN;
    296  1.6  christos extern int _bfd_nocore_core_file_pid
    297  1.1  christos   (bfd *) ATTRIBUTE_HIDDEN;
    298  1.1  christos 
    299  1.1  christos /* Routines to use for BFD_JUMP_TABLE_ARCHIVE when there is no archive
    300  1.1  christos    file support.  Use BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive).  */
    301  1.6  christos 
    302  1.6  christos #define _bfd_noarchive_slurp_armap _bfd_bool_bfd_false_error
    303  1.8  christos #define _bfd_noarchive_slurp_extended_name_table _bfd_bool_bfd_false_error
    304  1.6  christos extern bool _bfd_noarchive_construct_extended_name_table
    305  1.6  christos   (bfd *, char **, bfd_size_type *, const char **) ATTRIBUTE_HIDDEN;
    306  1.6  christos extern void _bfd_noarchive_truncate_arname
    307  1.8  christos   (bfd *, const char *, char *) ATTRIBUTE_HIDDEN;
    308  1.6  christos extern bool _bfd_noarchive_write_armap
    309  1.6  christos   (bfd *, unsigned int, struct orl *, unsigned int, int) ATTRIBUTE_HIDDEN;
    310  1.8  christos #define _bfd_noarchive_read_ar_hdr _bfd_ptr_bfd_null_error
    311  1.6  christos extern bool _bfd_noarchive_write_ar_hdr
    312  1.6  christos   (bfd *, bfd *) ATTRIBUTE_HIDDEN;
    313  1.6  christos extern bfd *
    314  1.6  christos _bfd_noarchive_openr_next_archived_file
    315  1.6  christos   (bfd *, bfd *) ATTRIBUTE_HIDDEN;
    316  1.6  christos extern bfd * _bfd_noarchive_get_elt_at_index
    317  1.1  christos   (bfd *, symindex) ATTRIBUTE_HIDDEN;
    318  1.6  christos #define _bfd_noarchive_generic_stat_arch_elt bfd_generic_stat_arch_elt
    319  1.1  christos #define _bfd_noarchive_update_armap_timestamp _bfd_bool_bfd_false_error
    320  1.1  christos 
    321  1.1  christos /* Routines to use for BFD_JUMP_TABLE_ARCHIVE to get BSD style
    322  1.1  christos    archives.  Use BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_bsd).  */
    323  1.1  christos 
    324  1.1  christos #define _bfd_archive_bsd_slurp_armap bfd_slurp_bsd_armap
    325  1.1  christos #define _bfd_archive_bsd_slurp_extended_name_table \
    326  1.8  christos   _bfd_slurp_extended_name_table
    327  1.6  christos extern bool _bfd_archive_bsd_construct_extended_name_table
    328  1.1  christos   (bfd *, char **, bfd_size_type *, const char **) ATTRIBUTE_HIDDEN;
    329  1.6  christos #define _bfd_archive_bsd_truncate_arname bfd_bsd_truncate_arname
    330  1.1  christos #define _bfd_archive_bsd_write_armap _bfd_bsd_write_armap
    331  1.1  christos #define _bfd_archive_bsd_read_ar_hdr _bfd_generic_read_ar_hdr
    332  1.1  christos #define _bfd_archive_bsd_write_ar_hdr _bfd_generic_write_ar_hdr
    333  1.1  christos #define _bfd_archive_bsd_openr_next_archived_file \
    334  1.1  christos   bfd_generic_openr_next_archived_file
    335  1.1  christos #define _bfd_archive_bsd_get_elt_at_index _bfd_generic_get_elt_at_index
    336  1.1  christos #define _bfd_archive_bsd_generic_stat_arch_elt \
    337  1.8  christos   bfd_generic_stat_arch_elt
    338  1.6  christos extern bool _bfd_archive_bsd_update_armap_timestamp
    339  1.1  christos   (bfd *) ATTRIBUTE_HIDDEN;
    340  1.1  christos 
    341  1.1  christos /* Routines to use for BFD_JUMP_TABLE_ARCHIVE to get COFF style
    342  1.1  christos    archives.  Use BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff).  */
    343  1.1  christos 
    344  1.1  christos #define _bfd_archive_coff_slurp_armap bfd_slurp_coff_armap
    345  1.1  christos #define _bfd_archive_coff_slurp_extended_name_table \
    346  1.8  christos   _bfd_slurp_extended_name_table
    347  1.6  christos extern bool _bfd_archive_coff_construct_extended_name_table
    348  1.1  christos   (bfd *, char **, bfd_size_type *, const char **) ATTRIBUTE_HIDDEN;
    349  1.6  christos #define _bfd_archive_coff_truncate_arname bfd_dont_truncate_arname
    350  1.1  christos #define _bfd_archive_coff_write_armap _bfd_coff_write_armap
    351  1.1  christos #define _bfd_archive_coff_read_ar_hdr _bfd_generic_read_ar_hdr
    352  1.1  christos #define _bfd_archive_coff_write_ar_hdr _bfd_generic_write_ar_hdr
    353  1.1  christos #define _bfd_archive_coff_openr_next_archived_file \
    354  1.1  christos   bfd_generic_openr_next_archived_file
    355  1.1  christos #define _bfd_archive_coff_get_elt_at_index _bfd_generic_get_elt_at_index
    356  1.1  christos #define _bfd_archive_coff_generic_stat_arch_elt \
    357  1.6  christos   bfd_generic_stat_arch_elt
    358  1.1  christos #define _bfd_archive_coff_update_armap_timestamp _bfd_bool_bfd_true
    359  1.1  christos 
    360  1.1  christos /* Routines to use for BFD_JUMP_TABLE_ARCHIVE to get BSD4.4 style
    361  1.1  christos    archives.  Use BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_bsd44).  */
    362  1.1  christos 
    363  1.1  christos #define _bfd_archive_bsd44_slurp_armap bfd_slurp_bsd_armap
    364  1.1  christos #define _bfd_archive_bsd44_slurp_extended_name_table \
    365  1.8  christos   _bfd_slurp_extended_name_table
    366  1.6  christos extern bool _bfd_archive_bsd44_construct_extended_name_table
    367  1.1  christos   (bfd *, char **, bfd_size_type *, const char **) ATTRIBUTE_HIDDEN;
    368  1.6  christos #define _bfd_archive_bsd44_truncate_arname bfd_bsd_truncate_arname
    369  1.1  christos #define _bfd_archive_bsd44_write_armap _bfd_bsd_write_armap
    370  1.1  christos #define _bfd_archive_bsd44_read_ar_hdr _bfd_generic_read_ar_hdr
    371  1.1  christos #define _bfd_archive_bsd44_write_ar_hdr _bfd_bsd44_write_ar_hdr
    372  1.1  christos #define _bfd_archive_bsd44_openr_next_archived_file \
    373  1.1  christos   bfd_generic_openr_next_archived_file
    374  1.1  christos #define _bfd_archive_bsd44_get_elt_at_index _bfd_generic_get_elt_at_index
    375  1.1  christos #define _bfd_archive_bsd44_generic_stat_arch_elt \
    376  1.1  christos   bfd_generic_stat_arch_elt
    377  1.1  christos #define _bfd_archive_bsd44_update_armap_timestamp \
    378  1.1  christos   _bfd_archive_bsd_update_armap_timestamp
    379  1.1  christos 
    380  1.1  christos /* Routines to use for BFD_JUMP_TABLE_ARCHIVE to get VMS style
    381  1.6  christos    archives.  Use BFD_JUMP_TABLE_ARCHIVE (_bfd_vms_lib).  Some of them
    382  1.1  christos    are irrelevant.  */
    383  1.8  christos 
    384  1.6  christos extern bool _bfd_vms_lib_write_archive_contents
    385  1.6  christos   (bfd *) ATTRIBUTE_HIDDEN;
    386  1.6  christos #define _bfd_vms_lib_slurp_armap _bfd_noarchive_slurp_armap
    387  1.6  christos #define _bfd_vms_lib_slurp_extended_name_table \
    388  1.6  christos   _bfd_noarchive_slurp_extended_name_table
    389  1.6  christos #define _bfd_vms_lib_construct_extended_name_table \
    390  1.6  christos   _bfd_noarchive_construct_extended_name_table
    391  1.6  christos #define _bfd_vms_lib_truncate_arname _bfd_noarchive_truncate_arname
    392  1.6  christos #define _bfd_vms_lib_write_armap _bfd_noarchive_write_armap
    393  1.6  christos #define _bfd_vms_lib_read_ar_hdr _bfd_noarchive_read_ar_hdr
    394  1.6  christos #define _bfd_vms_lib_write_ar_hdr _bfd_noarchive_write_ar_hdr
    395  1.6  christos extern bfd *_bfd_vms_lib_openr_next_archived_file
    396  1.6  christos   (bfd *, bfd *) ATTRIBUTE_HIDDEN;
    397  1.6  christos extern bfd *_bfd_vms_lib_get_elt_at_index
    398  1.6  christos   (bfd *, symindex) ATTRIBUTE_HIDDEN;
    399  1.6  christos extern int _bfd_vms_lib_generic_stat_arch_elt
    400  1.6  christos   (bfd *, struct stat *) ATTRIBUTE_HIDDEN;
    401  1.1  christos #define _bfd_vms_lib_update_armap_timestamp _bfd_bool_bfd_true
    402  1.1  christos 
    403  1.1  christos /* Extra routines for VMS style archives.  */
    404  1.6  christos 
    405  1.6  christos extern symindex _bfd_vms_lib_find_symbol
    406  1.6  christos   (bfd *, const char *) ATTRIBUTE_HIDDEN;
    407  1.6  christos extern bfd *_bfd_vms_lib_get_imagelib_file
    408  1.8  christos   (bfd *) ATTRIBUTE_HIDDEN;
    409  1.6  christos extern bfd_cleanup _bfd_vms_lib_alpha_archive_p
    410  1.8  christos   (bfd *) ATTRIBUTE_HIDDEN;
    411  1.6  christos extern bfd_cleanup _bfd_vms_lib_ia64_archive_p
    412  1.8  christos   (bfd *) ATTRIBUTE_HIDDEN;
    413  1.6  christos extern bool _bfd_vms_lib_alpha_mkarchive
    414  1.8  christos   (bfd *) ATTRIBUTE_HIDDEN;
    415  1.6  christos extern bool _bfd_vms_lib_ia64_mkarchive
    416  1.1  christos   (bfd *) ATTRIBUTE_HIDDEN;
    417  1.1  christos 
    418  1.1  christos /* Routines to use for BFD_JUMP_TABLE_SYMBOLS where there is no symbol
    419  1.1  christos    support.  Use BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols).  */
    420  1.6  christos 
    421  1.6  christos #define _bfd_nosymbols_get_symtab_upper_bound _bfd_long_bfd_n1_error
    422  1.6  christos extern long _bfd_nosymbols_canonicalize_symtab
    423  1.1  christos   (bfd *, asymbol **) ATTRIBUTE_HIDDEN;
    424  1.6  christos #define _bfd_nosymbols_make_empty_symbol _bfd_generic_make_empty_symbol
    425  1.6  christos extern void _bfd_nosymbols_print_symbol
    426  1.6  christos   (bfd *, void *, asymbol *, bfd_print_symbol_type) ATTRIBUTE_HIDDEN;
    427  1.6  christos extern void _bfd_nosymbols_get_symbol_info
    428  1.6  christos   (bfd *, asymbol *, symbol_info *) ATTRIBUTE_HIDDEN;
    429  1.8  christos extern const char * _bfd_nosymbols_get_symbol_version_string
    430  1.8  christos   (bfd *, asymbol *, bool, bool *) ATTRIBUTE_HIDDEN;
    431  1.6  christos extern bool _bfd_nosymbols_bfd_is_local_label_name
    432  1.6  christos   (bfd *, const char *) ATTRIBUTE_HIDDEN;
    433  1.6  christos #define _bfd_nosymbols_bfd_is_target_special_symbol _bfd_bool_bfd_asymbol_false
    434  1.6  christos extern alent *_bfd_nosymbols_get_lineno
    435  1.8  christos   (bfd *, asymbol *) ATTRIBUTE_HIDDEN;
    436  1.6  christos extern bool _bfd_nosymbols_find_nearest_line
    437  1.6  christos   (bfd *, asymbol **, asection *, bfd_vma,
    438  1.6  christos    const char **, const char **, unsigned int *, unsigned int *)
    439  1.9  christos   ATTRIBUTE_HIDDEN;
    440  1.9  christos extern bool _bfd_nosymbols_find_nearest_line_with_alt
    441  1.9  christos   (bfd *, const char *, asymbol **, asection *, bfd_vma,
    442  1.9  christos    const char **, const char **, unsigned int *, unsigned int *)
    443  1.8  christos   ATTRIBUTE_HIDDEN;
    444  1.6  christos extern bool _bfd_nosymbols_find_line
    445  1.6  christos   (bfd *, asymbol **, asymbol *, const char **, unsigned int *)
    446  1.8  christos   ATTRIBUTE_HIDDEN;
    447  1.6  christos extern bool _bfd_nosymbols_find_inliner_info
    448  1.6  christos   (bfd *, const char **, const char **, unsigned int *) ATTRIBUTE_HIDDEN;
    449  1.9  christos extern asymbol *_bfd_nosymbols_bfd_make_debug_symbol
    450  1.6  christos   (bfd *) ATTRIBUTE_HIDDEN;
    451  1.8  christos extern long _bfd_nosymbols_read_minisymbols
    452  1.6  christos   (bfd *, bool, void **, unsigned int *) ATTRIBUTE_HIDDEN;
    453  1.8  christos extern asymbol *_bfd_nosymbols_minisymbol_to_symbol
    454  1.1  christos   (bfd *, bool, const void *, asymbol *) ATTRIBUTE_HIDDEN;
    455  1.1  christos 
    456  1.1  christos /* Routines to use for BFD_JUMP_TABLE_RELOCS when there is no reloc
    457  1.1  christos    support.  Use BFD_JUMP_TABLE_RELOCS (_bfd_norelocs).  */
    458  1.6  christos 
    459  1.6  christos extern long _bfd_norelocs_get_reloc_upper_bound
    460  1.6  christos   (bfd *, asection *) ATTRIBUTE_HIDDEN;
    461  1.6  christos extern long _bfd_norelocs_canonicalize_reloc
    462  1.6  christos   (bfd *, asection *, arelent **, asymbol **) ATTRIBUTE_HIDDEN;
    463  1.6  christos extern void _bfd_norelocs_set_reloc
    464  1.6  christos   (bfd *, asection *, arelent **, unsigned int) ATTRIBUTE_HIDDEN;
    465  1.6  christos extern reloc_howto_type *_bfd_norelocs_bfd_reloc_type_lookup
    466  1.6  christos   (bfd *, bfd_reloc_code_real_type) ATTRIBUTE_HIDDEN;
    467  1.6  christos extern reloc_howto_type *_bfd_norelocs_bfd_reloc_name_lookup
    468  1.1  christos   (bfd *, const char *) ATTRIBUTE_HIDDEN;
    469  1.1  christos 
    470  1.1  christos /* Routines to use for BFD_JUMP_TABLE_WRITE for targets which may not
    471  1.1  christos    be written.  Use BFD_JUMP_TABLE_WRITE (_bfd_nowrite).  */
    472  1.8  christos 
    473  1.6  christos extern bool _bfd_nowrite_set_arch_mach
    474  1.8  christos   (bfd *, enum bfd_architecture, unsigned long) ATTRIBUTE_HIDDEN;
    475  1.6  christos extern bool _bfd_nowrite_set_section_contents
    476  1.1  christos   (bfd *, asection *, const void *, file_ptr, bfd_size_type) ATTRIBUTE_HIDDEN;
    477  1.1  christos 
    478  1.1  christos /* Generic routines to use for BFD_JUMP_TABLE_WRITE.  Use
    479  1.1  christos    BFD_JUMP_TABLE_WRITE (_bfd_generic).  */
    480  1.1  christos 
    481  1.8  christos #define _bfd_generic_set_arch_mach bfd_default_set_arch_mach
    482  1.6  christos extern bool _bfd_generic_set_section_contents
    483  1.1  christos   (bfd *, asection *, const void *, file_ptr, bfd_size_type) ATTRIBUTE_HIDDEN;
    484  1.1  christos 
    485  1.1  christos /* Routines to use for BFD_JUMP_TABLE_LINK for targets which do not
    486  1.1  christos    support linking.  Use BFD_JUMP_TABLE_LINK (_bfd_nolink).  */
    487  1.6  christos 
    488  1.6  christos extern int _bfd_nolink_sizeof_headers
    489  1.6  christos   (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN;
    490  1.6  christos extern bfd_byte *_bfd_nolink_bfd_get_relocated_section_contents
    491  1.8  christos   (bfd *, struct bfd_link_info *, struct bfd_link_order *,
    492  1.8  christos    bfd_byte *, bool, asymbol **) ATTRIBUTE_HIDDEN;
    493  1.8  christos extern bool _bfd_nolink_bfd_relax_section
    494  1.6  christos   (bfd *, asection *, struct bfd_link_info *, bool *) ATTRIBUTE_HIDDEN;
    495  1.8  christos #define _bfd_nolink_bfd_gc_sections _bfd_bool_bfd_link_false_error
    496  1.6  christos extern bool _bfd_nolink_bfd_lookup_section_flags
    497  1.6  christos   (struct bfd_link_info *, struct flag_info *, asection *) ATTRIBUTE_HIDDEN;
    498  1.8  christos #define _bfd_nolink_bfd_merge_sections _bfd_bool_bfd_link_false_error
    499  1.6  christos extern bool _bfd_nolink_bfd_is_group_section
    500  1.7  christos   (bfd *, const asection *) ATTRIBUTE_HIDDEN;
    501  1.7  christos extern const char *_bfd_nolink_bfd_group_name
    502  1.8  christos   (bfd *, const asection *) ATTRIBUTE_HIDDEN;
    503  1.6  christos extern bool _bfd_nolink_bfd_discard_group
    504  1.6  christos   (bfd *, asection *) ATTRIBUTE_HIDDEN;
    505  1.6  christos extern struct bfd_link_hash_table *_bfd_nolink_bfd_link_hash_table_create
    506  1.6  christos   (bfd *) ATTRIBUTE_HIDDEN;
    507  1.6  christos #define _bfd_nolink_bfd_link_add_symbols _bfd_bool_bfd_link_false_error
    508  1.6  christos extern void _bfd_nolink_bfd_link_just_syms
    509  1.6  christos   (asection *, struct bfd_link_info *) ATTRIBUTE_HIDDEN;
    510  1.6  christos extern void _bfd_nolink_bfd_copy_link_hash_symbol_type
    511  1.6  christos   (bfd *, struct bfd_link_hash_entry *, struct bfd_link_hash_entry *)
    512  1.6  christos   ATTRIBUTE_HIDDEN;
    513  1.8  christos #define _bfd_nolink_bfd_final_link _bfd_bool_bfd_link_false_error
    514  1.6  christos extern bool _bfd_nolink_bfd_link_split_section
    515  1.8  christos   (bfd *, struct bfd_section *) ATTRIBUTE_HIDDEN;
    516  1.6  christos extern bool _bfd_nolink_section_already_linked
    517  1.8  christos   (bfd *, asection *, struct bfd_link_info *) ATTRIBUTE_HIDDEN;
    518  1.6  christos extern bool _bfd_nolink_bfd_define_common_symbol
    519  1.6  christos   (bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *)
    520  1.6  christos   ATTRIBUTE_HIDDEN;
    521  1.6  christos #define _bfd_nolink_bfd_link_hide_symbol \
    522  1.6  christos   _bfd_generic_link_hide_symbol
    523  1.6  christos extern struct bfd_link_hash_entry *_bfd_nolink_bfd_define_start_stop
    524  1.5  christos   (struct bfd_link_info *, const char *, asection *) ATTRIBUTE_HIDDEN;
    525  1.5  christos #define _bfd_nolink_bfd_link_check_relocs \
    526  1.1  christos   _bfd_generic_link_check_relocs
    527  1.1  christos 
    528  1.1  christos /* Routines to use for BFD_JUMP_TABLE_DYNAMIC for targets which do not
    529  1.1  christos    have dynamic symbols or relocs.  Use BFD_JUMP_TABLE_DYNAMIC
    530  1.1  christos    (_bfd_nodynamic).  */
    531  1.6  christos 
    532  1.1  christos #define _bfd_nodynamic_get_dynamic_symtab_upper_bound _bfd_long_bfd_n1_error
    533  1.6  christos #define _bfd_nodynamic_canonicalize_dynamic_symtab \
    534  1.6  christos   _bfd_nosymbols_canonicalize_symtab
    535  1.6  christos extern long _bfd_nodynamic_get_synthetic_symtab
    536  1.6  christos   (bfd *, long, asymbol **, long, asymbol **, asymbol **) ATTRIBUTE_HIDDEN;
    537  1.6  christos #define _bfd_nodynamic_get_dynamic_reloc_upper_bound _bfd_long_bfd_n1_error
    538  1.6  christos extern long _bfd_nodynamic_canonicalize_dynamic_reloc
    539  1.1  christos   (bfd *, arelent **, asymbol **) ATTRIBUTE_HIDDEN;
    540  1.1  christos 
    541  1.1  christos /* Generic routine to determine of the given symbol is a local
    543  1.6  christos    label.  */
    544  1.1  christos extern bool bfd_generic_is_local_label_name
    545  1.1  christos   (bfd *, const char *) ATTRIBUTE_HIDDEN;
    546  1.1  christos 
    547  1.8  christos /* Generic minisymbol routines.  */
    548  1.1  christos extern long _bfd_generic_read_minisymbols
    549  1.8  christos   (bfd *, bool, void **, unsigned int *) ATTRIBUTE_HIDDEN;
    550  1.1  christos extern asymbol *_bfd_generic_minisymbol_to_symbol
    551  1.1  christos   (bfd *, bool, const void *, asymbol *) ATTRIBUTE_HIDDEN;
    552  1.8  christos 
    553  1.8  christos /* Find the nearest line using .stab/.stabstr sections.  */
    554  1.6  christos extern bool _bfd_stab_section_find_nearest_line
    555  1.1  christos   (bfd *, asymbol **, asection *, bfd_vma, bool *,
    556  1.1  christos    const char **, const char **, unsigned int *, void **) ATTRIBUTE_HIDDEN;
    557  1.8  christos 
    558  1.3  christos /* Find the nearest line using DWARF 1 debugging information.  */
    559  1.6  christos extern bool _bfd_dwarf1_find_nearest_line
    560  1.1  christos   (bfd *, asymbol **, asection *, bfd_vma,
    561  1.9  christos    const char **, const char **, unsigned int *) ATTRIBUTE_HIDDEN;
    562  1.9  christos 
    563  1.9  christos /* Clean up the data used to handle DWARF 1 debugging information. */
    564  1.9  christos extern void _bfd_dwarf1_cleanup_debug_info
    565  1.1  christos   (bfd *, void **) ATTRIBUTE_HIDDEN;
    566  1.1  christos 
    567  1.6  christos struct dwarf_debug_section
    568  1.6  christos {
    569  1.1  christos   const char * uncompressed_name;
    570  1.1  christos   const char * compressed_name;
    571  1.1  christos };
    572  1.1  christos 
    573  1.1  christos /* Map of uncompressed DWARF debug section name to compressed one.  It
    574  1.6  christos    is terminated by NULL uncompressed_name.  */
    575  1.1  christos 
    576  1.1  christos extern const struct dwarf_debug_section dwarf_debug_sections[] ATTRIBUTE_HIDDEN;
    577  1.7  christos 
    578  1.3  christos /* Find the nearest line using DWARF 2 debugging information.  */
    579  1.3  christos extern int _bfd_dwarf2_find_nearest_line
    580  1.7  christos   (bfd *, asymbol **, asymbol *, asection *, bfd_vma,
    581  1.3  christos    const char **, const char **, unsigned int *, unsigned int *,
    582  1.9  christos    const struct dwarf_debug_section *, void **) ATTRIBUTE_HIDDEN;
    583  1.9  christos 
    584  1.9  christos /* Find the nearest line using DWARF 2 debugging information, with
    585  1.9  christos    the option of specifying a .gnu_debugaltlink file.  */
    586  1.9  christos extern int _bfd_dwarf2_find_nearest_line_with_alt
    587  1.9  christos   (bfd *, const char *, asymbol **, asymbol *, asection *, bfd_vma,
    588  1.9  christos    const char **, const char **, unsigned int *, unsigned int *,
    589  1.3  christos    const struct dwarf_debug_section *, void **) ATTRIBUTE_HIDDEN;
    590  1.3  christos 
    591  1.6  christos /* Find the bias between DWARF addresses and real addresses.  */
    592  1.1  christos extern bfd_signed_vma _bfd_dwarf2_find_symbol_bias
    593  1.1  christos   (asymbol **, void **) ATTRIBUTE_HIDDEN;
    594  1.8  christos 
    595  1.6  christos /* Find inliner info after calling bfd_find_nearest_line. */
    596  1.6  christos extern bool _bfd_dwarf2_find_inliner_info
    597  1.1  christos   (bfd *, const char **, const char **, unsigned int *, void **)
    598  1.1  christos   ATTRIBUTE_HIDDEN;
    599  1.8  christos 
    600  1.3  christos /* Read DWARF 2 debugging information. */
    601  1.8  christos extern bool _bfd_dwarf2_slurp_debug_info
    602  1.1  christos   (bfd *, bfd *, const struct dwarf_debug_section *, asymbol **, void **,
    603  1.1  christos    bool) ATTRIBUTE_HIDDEN;
    604  1.1  christos 
    605  1.6  christos /* Clean up the data used to handle DWARF 2 debugging information. */
    606  1.1  christos extern void _bfd_dwarf2_cleanup_debug_info
    607  1.9  christos   (bfd *, void **) ATTRIBUTE_HIDDEN;
    608  1.9  christos 
    609  1.9  christos extern void _bfd_stab_cleanup
    610  1.1  christos   (bfd *, void **) ATTRIBUTE_HIDDEN;
    611  1.1  christos 
    612  1.6  christos /* Create a new section entry.  */
    613  1.6  christos extern struct bfd_hash_entry *bfd_section_hash_newfunc
    614  1.1  christos   (struct bfd_hash_entry *, struct bfd_hash_table *, const char *)
    615  1.1  christos   ATTRIBUTE_HIDDEN;
    616  1.1  christos 
    617  1.1  christos /* A routine to create entries for a bfd_link_hash_table.  */
    618  1.6  christos extern struct bfd_hash_entry *_bfd_link_hash_newfunc
    619  1.1  christos   (struct bfd_hash_entry *entry, struct bfd_hash_table *table,
    620  1.1  christos    const char *string) ATTRIBUTE_HIDDEN;
    621  1.8  christos 
    622  1.1  christos /* Initialize a bfd_link_hash_table.  */
    623  1.1  christos extern bool _bfd_link_hash_table_init
    624  1.1  christos   (struct bfd_link_hash_table *, bfd *,
    625  1.1  christos    struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
    626  1.6  christos 			       struct bfd_hash_table *,
    627  1.1  christos 			       const char *),
    628  1.1  christos    unsigned int) ATTRIBUTE_HIDDEN;
    629  1.1  christos 
    630  1.6  christos /* Generic link hash table creation routine.  */
    631  1.1  christos extern struct bfd_link_hash_table *_bfd_generic_link_hash_table_create
    632  1.1  christos   (bfd *) ATTRIBUTE_HIDDEN;
    633  1.1  christos 
    634  1.6  christos /* Generic link hash table destruction routine.  */
    635  1.1  christos extern void _bfd_generic_link_hash_table_free
    636  1.1  christos   (bfd *) ATTRIBUTE_HIDDEN;
    637  1.8  christos 
    638  1.6  christos /* Generic add symbol routine.  */
    639  1.1  christos extern bool _bfd_generic_link_add_symbols
    640  1.1  christos   (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN;
    641  1.8  christos 
    642  1.1  christos /* Generic archive add symbol routine.  */
    643  1.8  christos extern bool _bfd_generic_link_add_archive_symbols
    644  1.3  christos   (bfd *, struct bfd_link_info *,
    645  1.8  christos    bool (*) (bfd *, struct bfd_link_info *,
    646  1.1  christos 		    struct bfd_link_hash_entry *, const char *,
    647  1.1  christos 		    bool *)) ATTRIBUTE_HIDDEN;
    648  1.1  christos 
    649  1.1  christos /* Forward declaration to avoid prototype errors.  */
    650  1.1  christos typedef struct bfd_link_hash_entry _bfd_link_hash_entry;
    651  1.8  christos 
    652  1.1  christos /* Generic routine to add a single symbol.  */
    653  1.8  christos extern bool _bfd_generic_link_add_one_symbol
    654  1.8  christos   (struct bfd_link_info *, bfd *, const char *name, flagword,
    655  1.1  christos    asection *, bfd_vma, const char *, bool copy,
    656  1.1  christos    bool constructor, struct bfd_link_hash_entry **) ATTRIBUTE_HIDDEN;
    657  1.1  christos 
    658  1.6  christos /* Generic routine to mark section as supplying symbols only.  */
    659  1.1  christos extern void _bfd_generic_link_just_syms
    660  1.1  christos   (asection *, struct bfd_link_info *) ATTRIBUTE_HIDDEN;
    661  1.1  christos 
    662  1.6  christos /* Generic routine that does nothing.  */
    663  1.6  christos extern void _bfd_generic_copy_link_hash_symbol_type
    664  1.1  christos   (bfd *, struct bfd_link_hash_entry *, struct bfd_link_hash_entry *)
    665  1.1  christos   ATTRIBUTE_HIDDEN;
    666  1.8  christos 
    667  1.6  christos /* Generic link routine.  */
    668  1.1  christos extern bool _bfd_generic_final_link
    669  1.8  christos   (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN;
    670  1.6  christos 
    671  1.1  christos extern bool _bfd_generic_link_split_section
    672  1.8  christos   (bfd *, struct bfd_section *) ATTRIBUTE_HIDDEN;
    673  1.6  christos 
    674  1.1  christos extern bool _bfd_generic_section_already_linked
    675  1.1  christos   (bfd *, asection *, struct bfd_link_info *) ATTRIBUTE_HIDDEN;
    676  1.8  christos 
    677  1.6  christos /* Generic reloc_link_order processing routine.  */
    678  1.6  christos extern bool _bfd_generic_reloc_link_order
    679  1.1  christos   (bfd *, struct bfd_link_info *, asection *, struct bfd_link_order *)
    680  1.1  christos   ATTRIBUTE_HIDDEN;
    681  1.8  christos 
    682  1.6  christos /* Default link order processing routine.  */
    683  1.6  christos extern bool _bfd_default_link_order
    684  1.1  christos   (bfd *, struct bfd_link_info *, asection *, struct bfd_link_order *)
    685  1.1  christos   ATTRIBUTE_HIDDEN;
    686  1.1  christos 
    687  1.6  christos /* Count the number of reloc entries in a link order list.  */
    688  1.1  christos extern unsigned int _bfd_count_link_order_relocs
    689  1.1  christos   (struct bfd_link_order *) ATTRIBUTE_HIDDEN;
    690  1.1  christos 
    691  1.1  christos /* Final link relocation routine.  */
    692  1.6  christos extern bfd_reloc_status_type _bfd_final_link_relocate
    693  1.1  christos   (reloc_howto_type *, bfd *, asection *, bfd_byte *,
    694  1.1  christos    bfd_vma, bfd_vma, bfd_vma) ATTRIBUTE_HIDDEN;
    695  1.1  christos 
    696  1.6  christos /* Relocate a particular location by a howto and a value.  */
    697  1.1  christos extern bfd_reloc_status_type _bfd_relocate_contents
    698  1.1  christos   (reloc_howto_type *, bfd *, bfd_vma, bfd_byte *) ATTRIBUTE_HIDDEN;
    699  1.7  christos 
    700  1.7  christos /* Clear a given location using a given howto.  */
    701  1.1  christos extern bfd_reloc_status_type _bfd_clear_contents
    702  1.1  christos   (reloc_howto_type *, bfd *, asection *, bfd_byte *, bfd_vma) ATTRIBUTE_HIDDEN;
    703  1.1  christos 
    704  1.8  christos /* Register a SEC_MERGE section as a candidate for merging.  */
    705  1.6  christos 
    706  1.1  christos extern bool _bfd_add_merge_section
    707  1.1  christos   (bfd *, void **, asection *, void **) ATTRIBUTE_HIDDEN;
    708  1.1  christos 
    709  1.8  christos /* Attempt to merge SEC_MERGE sections.  */
    710  1.6  christos 
    711  1.6  christos extern bool _bfd_merge_sections
    712  1.1  christos   (bfd *, struct bfd_link_info *, void *, void (*) (bfd *, asection *))
    713  1.1  christos   ATTRIBUTE_HIDDEN;
    714  1.1  christos 
    715  1.8  christos /* Write out a merged section.  */
    716  1.6  christos 
    717  1.1  christos extern bool _bfd_write_merged_section
    718  1.1  christos   (bfd *, asection *, void *) ATTRIBUTE_HIDDEN;
    719  1.1  christos 
    720  1.1  christos /* Find an offset within a modified SEC_MERGE section.  */
    721  1.6  christos 
    722  1.1  christos extern bfd_vma _bfd_merged_section_offset
    723  1.3  christos   (bfd *, asection **, void *, bfd_vma) ATTRIBUTE_HIDDEN;
    724  1.3  christos 
    725  1.6  christos /* Tidy up when done.  */
    726  1.3  christos 
    727  1.1  christos extern void _bfd_merge_sections_free (void *) ATTRIBUTE_HIDDEN;
    728  1.1  christos 
    729  1.1  christos /* Macros to tell if bfds are read or write enabled.
    730  1.1  christos 
    731  1.1  christos    Note that bfds open for read may be scribbled into if the fd passed
    732  1.1  christos    to bfd_fdopenr is actually open both for read and write
    733  1.1  christos    simultaneously.  However an output bfd will never be open for
    734  1.1  christos    read.  Therefore sometimes you want to check bfd_read_p or
    735  1.1  christos    !bfd_read_p, and only sometimes bfd_write_p.
    736  1.1  christos */
    737  1.1  christos 
    738  1.1  christos #define	bfd_read_p(abfd) \
    739  1.1  christos   ((abfd)->direction == read_direction || (abfd)->direction == both_direction)
    740  1.1  christos #define	bfd_write_p(abfd) \
    741  1.6  christos   ((abfd)->direction == write_direction || (abfd)->direction == both_direction)
    742  1.6  christos 
    743  1.1  christos extern void bfd_assert
    744  1.1  christos   (const char*,int) ATTRIBUTE_HIDDEN;
    745  1.1  christos 
    746  1.1  christos #define BFD_ASSERT(x) \
    747  1.1  christos   do { if (!(x)) bfd_assert(__FILE__,__LINE__); } while (0)
    748  1.1  christos 
    749  1.1  christos #define BFD_FAIL() \
    750  1.1  christos   do { bfd_assert(__FILE__,__LINE__); } while (0)
    751  1.6  christos 
    752  1.1  christos extern void _bfd_abort
    753  1.1  christos   (const char *, int, const char *) ATTRIBUTE_NORETURN ATTRIBUTE_HIDDEN;
    754  1.1  christos 
    755  1.1  christos /* if gcc >= 2.6, we can give a function name, too */
    756  1.1  christos #if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 6)
    757  1.1  christos #define __PRETTY_FUNCTION__  ((char *) NULL)
    758  1.1  christos #endif
    759  1.1  christos 
    760  1.1  christos #undef abort
    761  1.1  christos #define abort() _bfd_abort (__FILE__, __LINE__, __PRETTY_FUNCTION__)
    762  1.1  christos 
    763  1.6  christos /* Manipulate a system FILE but using BFD's "file_ptr", rather than
    764  1.6  christos    the system "off_t" or "off64_t", as the offset.  */
    765  1.6  christos extern file_ptr _bfd_real_ftell
    766  1.6  christos   (FILE *) ATTRIBUTE_HIDDEN;
    767  1.6  christos extern int _bfd_real_fseek
    768  1.6  christos   (FILE *, file_ptr, int) ATTRIBUTE_HIDDEN;
    769  1.1  christos extern FILE *_bfd_real_fopen
    770  1.1  christos   (const char *, const char *) ATTRIBUTE_HIDDEN;
    771  1.1  christos 
    772  1.8  christos /* List of supported target vectors, and the default vector (if
    773  1.6  christos    bfd_default_vector[0] is NULL, there is no default).  */
    774  1.1  christos extern const bfd_target *const *const bfd_target_vector ATTRIBUTE_HIDDEN;
    775  1.1  christos extern const bfd_target *bfd_default_vector[] ATTRIBUTE_HIDDEN;
    776  1.8  christos 
    777  1.1  christos /* List of associated target vectors.  */
    778  1.1  christos extern const bfd_target *const *const bfd_associated_vector ATTRIBUTE_HIDDEN;
    779  1.1  christos 
    780  1.1  christos /* Functions shared by the ECOFF and MIPS ELF backends, which have no
    781  1.9  christos    other common header files.  */
    782  1.9  christos 
    783  1.9  christos struct ecoff_debug_info;
    784  1.1  christos struct ecoff_debug_swap;
    785  1.1  christos struct ecoff_extr;
    786  1.9  christos struct ecoff_find_line;
    787  1.9  christos 
    788  1.8  christos extern void _bfd_ecoff_free_ecoff_debug_info
    789  1.1  christos   (struct ecoff_debug_info *debug);
    790  1.1  christos extern bool _bfd_ecoff_locate_line
    791  1.6  christos   (bfd *, asection *, bfd_vma, struct ecoff_debug_info * const,
    792  1.8  christos    const struct ecoff_debug_swap * const, struct ecoff_find_line *,
    793  1.6  christos    const char **, const char **, unsigned int *) ATTRIBUTE_HIDDEN;
    794  1.8  christos extern bool _bfd_ecoff_get_accumulated_pdr
    795  1.6  christos   (void *, bfd_byte *) ATTRIBUTE_HIDDEN;
    796  1.8  christos extern bool _bfd_ecoff_get_accumulated_sym
    797  1.6  christos   (void *, bfd_byte *) ATTRIBUTE_HIDDEN;
    798  1.1  christos extern bool _bfd_ecoff_get_accumulated_ss
    799  1.1  christos   (void *, bfd_byte *) ATTRIBUTE_HIDDEN;
    800  1.6  christos 
    801  1.1  christos extern bfd_vma _bfd_get_gp_value
    802  1.6  christos   (bfd *) ATTRIBUTE_HIDDEN;
    803  1.1  christos extern void _bfd_set_gp_value
    804  1.1  christos   (bfd *, bfd_vma) ATTRIBUTE_HIDDEN;
    805  1.1  christos 
    806  1.1  christos /* Function shared by the COFF and ELF SH backends, which have no
    807  1.1  christos    other common header files.  */
    808  1.8  christos 
    809  1.1  christos #ifndef _bfd_sh_align_load_span
    810  1.8  christos extern bool _bfd_sh_align_load_span
    811  1.8  christos   (bfd *, asection *, bfd_byte *,
    812  1.1  christos    bool (*) (bfd *, asection *, void *, bfd_byte *, bfd_vma),
    813  1.1  christos    void *, bfd_vma **, bfd_vma *, bfd_vma, bfd_vma, bool *) ATTRIBUTE_HIDDEN;
    814  1.1  christos #endif
    815  1.1  christos 
    816  1.1  christos /* This is the shape of the elements inside the already_linked hash
    817  1.1  christos    table. It maps a name onto a list of already_linked elements with
    818  1.1  christos    the same name.  */
    819  1.1  christos 
    820  1.1  christos struct bfd_section_already_linked_hash_entry
    821  1.1  christos {
    822  1.1  christos   struct bfd_hash_entry root;
    823  1.1  christos   struct bfd_section_already_linked *entry;
    824  1.1  christos };
    825  1.1  christos 
    826  1.1  christos struct bfd_section_already_linked
    827  1.1  christos {
    828  1.1  christos   struct bfd_section_already_linked *next;
    829  1.1  christos   asection *sec;
    830  1.1  christos };
    831  1.6  christos 
    832  1.8  christos extern struct bfd_section_already_linked_hash_entry *
    833  1.6  christos   bfd_section_already_linked_table_lookup (const char *) ATTRIBUTE_HIDDEN;
    834  1.6  christos extern bool bfd_section_already_linked_table_insert
    835  1.1  christos   (struct bfd_section_already_linked_hash_entry *, asection *)
    836  1.8  christos   ATTRIBUTE_HIDDEN;
    837  1.6  christos extern void bfd_section_already_linked_table_traverse
    838  1.1  christos   (bool (*) (struct bfd_section_already_linked_hash_entry *,
    839  1.6  christos 		    void *), void *) ATTRIBUTE_HIDDEN;
    840  1.6  christos 
    841  1.6  christos extern bfd_vma _bfd_read_unsigned_leb128
    842  1.6  christos   (bfd *, bfd_byte *, unsigned int *) ATTRIBUTE_HIDDEN;
    843  1.6  christos extern bfd_signed_vma _bfd_read_signed_leb128
    844  1.8  christos   (bfd *, bfd_byte *, unsigned int *) ATTRIBUTE_HIDDEN;
    845  1.8  christos extern bfd_vma _bfd_safe_read_leb128
    846  1.8  christos   (bfd *, bfd_byte **, bool, const bfd_byte * const) ATTRIBUTE_HIDDEN;
    847  1.8  christos extern bfd_byte * _bfd_write_unsigned_leb128
    848  1.8  christos   (bfd_byte *, bfd_byte *, bfd_vma) ATTRIBUTE_HIDDEN;
    849  1.8  christos 
    850  1.8  christos extern struct bfd_link_info *_bfd_get_link_info (bfd *);
    851  1.6  christos 
    852  1.8  christos extern bool _bfd_link_keep_memory (struct bfd_link_info *)
    853  1.8  christos   ATTRIBUTE_HIDDEN;
    854  1.8  christos 
    855  1.8  christos #if GCC_VERSION >= 7000
    856  1.8  christos #define _bfd_mul_overflow(a, b, res) __builtin_mul_overflow (a, b, res)
    857  1.8  christos #else
    858  1.8  christos /* Assumes unsigned values.  Careful!  Args evaluated multiple times.  */
    859  1.8  christos #define _bfd_mul_overflow(a, b, res) \
    860  1.8  christos   ((*res) = (a), (*res) *= (b), (b) != 0 && (*res) / (b) != (a))
    861  1.8  christos #endif
    862  1.8  christos 
    863  1.8  christos #ifdef __GNUC__
    864  1.8  christos #define _bfd_constant_p(v) __builtin_constant_p (v)
    865  1.8  christos #else
    866  1.8  christos #define _bfd_constant_p(v) 0
    867  1.9  christos #endif
    868  1.8  christos 
    869  1.8  christos static inline void *
    870  1.9  christos _bfd_alloc_and_read (bfd *abfd, bfd_size_type asize, bfd_size_type rsize)
    871  1.8  christos {
    872  1.8  christos   void *mem;
    873  1.8  christos   if (!_bfd_constant_p (rsize))
    874  1.8  christos     {
    875  1.8  christos       ufile_ptr filesize = bfd_get_file_size (abfd);
    876  1.8  christos       if (filesize != 0 && rsize > filesize)
    877  1.8  christos 	{
    878  1.8  christos 	  bfd_set_error (bfd_error_file_truncated);
    879  1.8  christos 	  return NULL;
    880  1.8  christos 	}
    881  1.8  christos     }
    882  1.8  christos   mem = bfd_alloc (abfd, asize);
    883  1.9  christos   if (mem != NULL)
    884  1.8  christos     {
    885  1.8  christos       if (bfd_read (mem, rsize, abfd) == rsize)
    886  1.8  christos 	return mem;
    887  1.8  christos       bfd_release (abfd, mem);
    888  1.8  christos     }
    889  1.8  christos   return NULL;
    890  1.9  christos }
    891  1.8  christos 
    892  1.8  christos static inline void *
    893  1.9  christos _bfd_malloc_and_read (bfd *abfd, bfd_size_type asize, bfd_size_type rsize)
    894  1.8  christos {
    895  1.8  christos   void *mem;
    896  1.8  christos   if (!_bfd_constant_p (rsize))
    897  1.8  christos     {
    898  1.8  christos       ufile_ptr filesize = bfd_get_file_size (abfd);
    899  1.8  christos       if (filesize != 0 && rsize > filesize)
    900  1.8  christos 	{
    901  1.8  christos 	  bfd_set_error (bfd_error_file_truncated);
    902  1.8  christos 	  return NULL;
    903  1.8  christos 	}
    904  1.8  christos     }
    905  1.8  christos   mem = bfd_malloc (asize);
    906  1.9  christos   if (mem != NULL)
    907  1.8  christos     {
    908  1.8  christos       if (bfd_read (mem, rsize, abfd) == rsize)
    909  1.8  christos 	return mem;
    910  1.8  christos       free (mem);
    911  1.8  christos     }
    912                  return NULL;
    913                }
    914