Home | History | Annotate | Line # | Download | only in bfd
bfd-in.h revision 1.1
      1  1.1  christos /* Main header file for the bfd library -- portable access to object files.
      2  1.1  christos 
      3  1.1  christos    Copyright 1990-2013 Free Software Foundation, Inc.
      4  1.1  christos 
      5  1.1  christos    Contributed by Cygnus Support.
      6  1.1  christos 
      7  1.1  christos    This file is part of BFD, the Binary File Descriptor library.
      8  1.1  christos 
      9  1.1  christos    This program is free software; you can redistribute it and/or modify
     10  1.1  christos    it under the terms of the GNU General Public License as published by
     11  1.1  christos    the Free Software Foundation; either version 3 of the License, or
     12  1.1  christos    (at your option) any later version.
     13  1.1  christos 
     14  1.1  christos    This program is distributed in the hope that it will be useful,
     15  1.1  christos    but WITHOUT ANY WARRANTY; without even the implied warranty of
     16  1.1  christos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     17  1.1  christos    GNU General Public License for more details.
     18  1.1  christos 
     19  1.1  christos    You should have received a copy of the GNU General Public License
     20  1.1  christos    along with this program; if not, write to the Free Software
     21  1.1  christos    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
     22  1.1  christos 
     23  1.1  christos #ifndef __BFD_H_SEEN__
     24  1.1  christos #define __BFD_H_SEEN__
     25  1.1  christos 
     26  1.1  christos /* PR 14072: Ensure that config.h is included first.  */
     27  1.1  christos #if !defined PACKAGE && !defined PACKAGE_VERSION
     28  1.1  christos #error config.h must be included before this header
     29  1.1  christos #endif
     30  1.1  christos 
     31  1.1  christos #ifdef __cplusplus
     32  1.1  christos extern "C" {
     33  1.1  christos #endif
     34  1.1  christos 
     35  1.1  christos #include "ansidecl.h"
     36  1.1  christos #include "symcat.h"
     37  1.1  christos #include <sys/stat.h>
     38  1.1  christos 
     39  1.1  christos #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
     40  1.1  christos #ifndef SABER
     41  1.1  christos /* This hack is to avoid a problem with some strict ANSI C preprocessors.
     42  1.1  christos    The problem is, "32_" is not a valid preprocessing token, and we don't
     43  1.1  christos    want extra underscores (e.g., "nlm_32_").  The XCONCAT2 macro will
     44  1.1  christos    cause the inner CONCAT2 macros to be evaluated first, producing
     45  1.1  christos    still-valid pp-tokens.  Then the final concatenation can be done.  */
     46  1.1  christos #undef CONCAT4
     47  1.1  christos #define CONCAT4(a,b,c,d) XCONCAT2(CONCAT2(a,b),CONCAT2(c,d))
     48  1.1  christos #endif
     49  1.1  christos #endif
     50  1.1  christos 
     51  1.1  christos /* This is a utility macro to handle the situation where the code
     52  1.1  christos    wants to place a constant string into the code, followed by a
     53  1.1  christos    comma and then the length of the string.  Doing this by hand
     54  1.1  christos    is error prone, so using this macro is safer.  */
     55  1.1  christos #define STRING_COMMA_LEN(STR) (STR), (sizeof (STR) - 1)
     56  1.1  christos /* Unfortunately it is not possible to use the STRING_COMMA_LEN macro
     57  1.1  christos    to create the arguments to another macro, since the preprocessor
     58  1.1  christos    will mis-count the number of arguments to the outer macro (by not
     59  1.1  christos    evaluating STRING_COMMA_LEN and so missing the comma).  This is a
     60  1.1  christos    problem for example when trying to use STRING_COMMA_LEN to build
     61  1.1  christos    the arguments to the strncmp() macro.  Hence this alternative
     62  1.1  christos    definition of strncmp is provided here.
     63  1.1  christos 
     64  1.1  christos    Note - these macros do NOT work if STR2 is not a constant string.  */
     65  1.1  christos #define CONST_STRNEQ(STR1,STR2) (strncmp ((STR1), (STR2), sizeof (STR2) - 1) == 0)
     66  1.1  christos   /* strcpy() can have a similar problem, but since we know we are
     67  1.1  christos      copying a constant string, we can use memcpy which will be faster
     68  1.1  christos      since there is no need to check for a NUL byte inside STR.  We
     69  1.1  christos      can also save time if we do not need to copy the terminating NUL.  */
     70  1.1  christos #define LITMEMCPY(DEST,STR2) memcpy ((DEST), (STR2), sizeof (STR2) - 1)
     71  1.1  christos #define LITSTRCPY(DEST,STR2) memcpy ((DEST), (STR2), sizeof (STR2))
     72  1.1  christos 
     73  1.1  christos 
     74  1.1  christos #define BFD_SUPPORTS_PLUGINS @supports_plugins@
     75  1.1  christos 
     76  1.1  christos /* The word size used by BFD on the host.  This may be 64 with a 32
     77  1.1  christos    bit target if the host is 64 bit, or if other 64 bit targets have
     78  1.1  christos    been selected with --enable-targets, or if --enable-64-bit-bfd.  */
     79  1.1  christos #define BFD_ARCH_SIZE @wordsize@
     80  1.1  christos 
     81  1.1  christos /* The word size of the default bfd target.  */
     82  1.1  christos #define BFD_DEFAULT_TARGET_SIZE @bfd_default_target_size@
     83  1.1  christos 
     84  1.1  christos #define BFD_HOST_64BIT_LONG @BFD_HOST_64BIT_LONG@
     85  1.1  christos #define BFD_HOST_64BIT_LONG_LONG @BFD_HOST_64BIT_LONG_LONG@
     86  1.1  christos #if @BFD_HOST_64_BIT_DEFINED@
     87  1.1  christos #define BFD_HOST_64_BIT @BFD_HOST_64_BIT@
     88  1.1  christos #define BFD_HOST_U_64_BIT @BFD_HOST_U_64_BIT@
     89  1.1  christos typedef BFD_HOST_64_BIT bfd_int64_t;
     90  1.1  christos typedef BFD_HOST_U_64_BIT bfd_uint64_t;
     91  1.1  christos #endif
     92  1.1  christos 
     93  1.1  christos #if BFD_ARCH_SIZE >= 64
     94  1.1  christos #define BFD64
     95  1.1  christos #endif
     96  1.1  christos 
     97  1.1  christos #ifndef INLINE
     98  1.1  christos #if __GNUC__ >= 2
     99  1.1  christos #define INLINE __inline__
    100  1.1  christos #else
    101  1.1  christos #define INLINE
    102  1.1  christos #endif
    103  1.1  christos #endif
    104  1.1  christos 
    105  1.1  christos /* Declaring a type wide enough to hold a host long and a host pointer.  */
    106  1.1  christos #define BFD_HOSTPTR_T	@BFD_HOSTPTR_T@
    107  1.1  christos typedef BFD_HOSTPTR_T bfd_hostptr_t;
    108  1.1  christos 
    109  1.1  christos /* Forward declaration.  */
    110  1.1  christos typedef struct bfd bfd;
    111  1.1  christos 
    112  1.1  christos /* Boolean type used in bfd.  Too many systems define their own
    113  1.1  christos    versions of "boolean" for us to safely typedef a "boolean" of
    114  1.1  christos    our own.  Using an enum for "bfd_boolean" has its own set of
    115  1.1  christos    problems, with strange looking casts required to avoid warnings
    116  1.1  christos    on some older compilers.  Thus we just use an int.
    117  1.1  christos 
    118  1.1  christos    General rule: Functions which are bfd_boolean return TRUE on
    119  1.1  christos    success and FALSE on failure (unless they're a predicate).  */
    120  1.1  christos 
    121  1.1  christos typedef int bfd_boolean;
    122  1.1  christos #undef FALSE
    123  1.1  christos #undef TRUE
    124  1.1  christos #define FALSE 0
    125  1.1  christos #define TRUE 1
    126  1.1  christos 
    127  1.1  christos #ifdef BFD64
    128  1.1  christos 
    129  1.1  christos #ifndef BFD_HOST_64_BIT
    130  1.1  christos  #error No 64 bit integer type available
    131  1.1  christos #endif /* ! defined (BFD_HOST_64_BIT) */
    132  1.1  christos 
    133  1.1  christos typedef BFD_HOST_U_64_BIT bfd_vma;
    134  1.1  christos typedef BFD_HOST_64_BIT bfd_signed_vma;
    135  1.1  christos typedef BFD_HOST_U_64_BIT bfd_size_type;
    136  1.1  christos typedef BFD_HOST_U_64_BIT symvalue;
    137  1.1  christos 
    138  1.1  christos #if BFD_HOST_64BIT_LONG
    139  1.1  christos #define BFD_VMA_FMT "l"
    140  1.1  christos #elif defined (__MSVCRT__)
    141  1.1  christos #define BFD_VMA_FMT "I64"
    142  1.1  christos #else
    143  1.1  christos #define BFD_VMA_FMT "ll"
    144  1.1  christos #endif
    145  1.1  christos 
    146  1.1  christos #ifndef fprintf_vma
    147  1.1  christos #define sprintf_vma(s,x) sprintf (s, "%016" BFD_VMA_FMT "x", x)
    148  1.1  christos #define fprintf_vma(f,x) fprintf (f, "%016" BFD_VMA_FMT "x", x)
    149  1.1  christos #endif
    150  1.1  christos 
    151  1.1  christos #else /* not BFD64  */
    152  1.1  christos 
    153  1.1  christos /* Represent a target address.  Also used as a generic unsigned type
    154  1.1  christos    which is guaranteed to be big enough to hold any arithmetic types
    155  1.1  christos    we need to deal with.  */
    156  1.1  christos typedef unsigned long bfd_vma;
    157  1.1  christos 
    158  1.1  christos /* A generic signed type which is guaranteed to be big enough to hold any
    159  1.1  christos    arithmetic types we need to deal with.  Can be assumed to be compatible
    160  1.1  christos    with bfd_vma in the same way that signed and unsigned ints are compatible
    161  1.1  christos    (as parameters, in assignment, etc).  */
    162  1.1  christos typedef long bfd_signed_vma;
    163  1.1  christos 
    164  1.1  christos typedef unsigned long symvalue;
    165  1.1  christos typedef unsigned long bfd_size_type;
    166  1.1  christos 
    167  1.1  christos /* Print a bfd_vma x on stream s.  */
    168  1.1  christos #define BFD_VMA_FMT "l"
    169  1.1  christos #define fprintf_vma(s,x) fprintf (s, "%08" BFD_VMA_FMT "x", x)
    170  1.1  christos #define sprintf_vma(s,x) sprintf (s, "%08" BFD_VMA_FMT "x", x)
    171  1.1  christos 
    172  1.1  christos #endif /* not BFD64  */
    173  1.1  christos 
    174  1.1  christos #define HALF_BFD_SIZE_TYPE \
    175  1.1  christos   (((bfd_size_type) 1) << (8 * sizeof (bfd_size_type) / 2))
    176  1.1  christos 
    177  1.1  christos #ifndef BFD_HOST_64_BIT
    178  1.1  christos /* Fall back on a 32 bit type.  The idea is to make these types always
    179  1.1  christos    available for function return types, but in the case that
    180  1.1  christos    BFD_HOST_64_BIT is undefined such a function should abort or
    181  1.1  christos    otherwise signal an error.  */
    182  1.1  christos typedef bfd_signed_vma bfd_int64_t;
    183  1.1  christos typedef bfd_vma bfd_uint64_t;
    184  1.1  christos #endif
    185  1.1  christos 
    186  1.1  christos /* An offset into a file.  BFD always uses the largest possible offset
    187  1.1  christos    based on the build time availability of fseek, fseeko, or fseeko64.  */
    188  1.1  christos typedef @bfd_file_ptr@ file_ptr;
    189  1.1  christos typedef unsigned @bfd_file_ptr@ ufile_ptr;
    190  1.1  christos 
    191  1.1  christos extern void bfd_sprintf_vma (bfd *, char *, bfd_vma);
    192  1.1  christos extern void bfd_fprintf_vma (bfd *, void *, bfd_vma);
    193  1.1  christos 
    194  1.1  christos #define printf_vma(x) fprintf_vma(stdout,x)
    195  1.1  christos #define bfd_printf_vma(abfd,x) bfd_fprintf_vma (abfd,stdout,x)
    196  1.1  christos 
    197  1.1  christos typedef unsigned int flagword;	/* 32 bits of flags */
    198  1.1  christos typedef unsigned char bfd_byte;
    199  1.1  christos 
    200  1.1  christos /* File formats.  */
    202  1.1  christos 
    203  1.1  christos typedef enum bfd_format
    204  1.1  christos {
    205  1.1  christos   bfd_unknown = 0,	/* File format is unknown.  */
    206  1.1  christos   bfd_object,		/* Linker/assembler/compiler output.  */
    207  1.1  christos   bfd_archive,		/* Object archive file.  */
    208  1.1  christos   bfd_core,		/* Core dump.  */
    209  1.1  christos   bfd_type_end		/* Marks the end; don't use it!  */
    210  1.1  christos }
    211  1.1  christos bfd_format;
    212  1.1  christos 
    213  1.1  christos /* Symbols and relocation.  */
    215  1.1  christos 
    216  1.1  christos /* A count of carsyms (canonical archive symbols).  */
    217  1.1  christos typedef unsigned long symindex;
    218  1.1  christos 
    219  1.1  christos /* How to perform a relocation.  */
    220  1.1  christos typedef const struct reloc_howto_struct reloc_howto_type;
    221  1.1  christos 
    222  1.1  christos #define BFD_NO_MORE_SYMBOLS ((symindex) ~0)
    223  1.1  christos 
    224  1.1  christos /* General purpose part of a symbol X;
    225  1.1  christos    target specific parts are in libcoff.h, libaout.h, etc.  */
    226  1.1  christos 
    227  1.1  christos #define bfd_get_section(x) ((x)->section)
    228  1.1  christos #define bfd_get_output_section(x) ((x)->section->output_section)
    229  1.1  christos #define bfd_set_section(x,y) ((x)->section) = (y)
    230  1.1  christos #define bfd_asymbol_base(x) ((x)->section->vma)
    231  1.1  christos #define bfd_asymbol_value(x) (bfd_asymbol_base(x) + (x)->value)
    232  1.1  christos #define bfd_asymbol_name(x) ((x)->name)
    233  1.1  christos /*Perhaps future: #define bfd_asymbol_bfd(x) ((x)->section->owner)*/
    234  1.1  christos #define bfd_asymbol_bfd(x) ((x)->the_bfd)
    235  1.1  christos #define bfd_asymbol_flavour(x)			\
    236  1.1  christos   (((x)->flags & BSF_SYNTHETIC) != 0		\
    237  1.1  christos    ? bfd_target_unknown_flavour			\
    238  1.1  christos    : bfd_asymbol_bfd (x)->xvec->flavour)
    239  1.1  christos 
    240  1.1  christos /* A canonical archive symbol.  */
    241  1.1  christos /* This is a type pun with struct ranlib on purpose!  */
    242  1.1  christos typedef struct carsym
    243  1.1  christos {
    244  1.1  christos   char *name;
    245  1.1  christos   file_ptr file_offset;	/* Look here to find the file.  */
    246  1.1  christos }
    247  1.1  christos carsym;			/* To make these you call a carsymogen.  */
    248  1.1  christos 
    249  1.1  christos /* Used in generating armaps (archive tables of contents).
    250  1.1  christos    Perhaps just a forward definition would do?  */
    251  1.1  christos struct orl 			/* Output ranlib.  */
    252  1.1  christos {
    253  1.1  christos   char **name;		/* Symbol name.  */
    254  1.1  christos   union
    255  1.1  christos   {
    256  1.1  christos     file_ptr pos;
    257  1.1  christos     bfd *abfd;
    258  1.1  christos   } u;			/* bfd* or file position.  */
    259  1.1  christos   int namidx;		/* Index into string table.  */
    260  1.1  christos };
    261  1.1  christos 
    262  1.1  christos /* Linenumber stuff.  */
    264  1.1  christos typedef struct lineno_cache_entry
    265  1.1  christos {
    266  1.1  christos   unsigned int line_number;	/* Linenumber from start of function.  */
    267  1.1  christos   union
    268  1.1  christos   {
    269  1.1  christos     struct bfd_symbol *sym;	/* Function name.  */
    270  1.1  christos     bfd_vma offset;	    		/* Offset into section.  */
    271  1.1  christos   } u;
    272  1.1  christos }
    273  1.1  christos alent;
    274  1.1  christos 
    275  1.1  christos /* Object and core file sections.  */
    277  1.1  christos 
    278  1.1  christos #define	align_power(addr, align)	\
    279  1.1  christos   (((addr) + ((bfd_vma) 1 << (align)) - 1) & ((bfd_vma) -1 << (align)))
    280  1.1  christos 
    281  1.1  christos typedef struct bfd_section *sec_ptr;
    282  1.1  christos 
    283  1.1  christos #define bfd_get_section_name(bfd, ptr) ((void) bfd, (ptr)->name)
    284  1.1  christos #define bfd_get_section_vma(bfd, ptr) ((void) bfd, (ptr)->vma)
    285  1.1  christos #define bfd_get_section_lma(bfd, ptr) ((void) bfd, (ptr)->lma)
    286  1.1  christos #define bfd_get_section_alignment(bfd, ptr) ((void) bfd, \
    287  1.1  christos 					     (ptr)->alignment_power)
    288  1.1  christos #define bfd_section_name(bfd, ptr) ((ptr)->name)
    289  1.1  christos #define bfd_section_size(bfd, ptr) ((ptr)->size)
    290  1.1  christos #define bfd_get_section_size(ptr) ((ptr)->size)
    291  1.1  christos #define bfd_section_vma(bfd, ptr) ((ptr)->vma)
    292  1.1  christos #define bfd_section_lma(bfd, ptr) ((ptr)->lma)
    293  1.1  christos #define bfd_section_alignment(bfd, ptr) ((ptr)->alignment_power)
    294  1.1  christos #define bfd_get_section_flags(bfd, ptr) ((void) bfd, (ptr)->flags)
    295  1.1  christos #define bfd_get_section_userdata(bfd, ptr) ((void) bfd, (ptr)->userdata)
    296  1.1  christos 
    297  1.1  christos #define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0)
    298  1.1  christos 
    299  1.1  christos /* Find the address one past the end of SEC.  */
    300  1.1  christos #define bfd_get_section_limit(bfd, sec) \
    301  1.1  christos   (((bfd)->direction != write_direction && (sec)->rawsize != 0	\
    302  1.1  christos     ? (sec)->rawsize : (sec)->size) / bfd_octets_per_byte (bfd))
    303  1.1  christos 
    304  1.1  christos /* Return TRUE if input section SEC has been discarded.  */
    305  1.1  christos #define discarded_section(sec)				\
    306  1.1  christos   (!bfd_is_abs_section (sec)					\
    307  1.1  christos    && bfd_is_abs_section ((sec)->output_section)		\
    308  1.1  christos    && (sec)->sec_info_type != SEC_INFO_TYPE_MERGE		\
    309  1.1  christos    && (sec)->sec_info_type != SEC_INFO_TYPE_JUST_SYMS)
    310  1.1  christos 
    311  1.1  christos typedef enum bfd_print_symbol
    313  1.1  christos {
    314  1.1  christos   bfd_print_symbol_name,
    315  1.1  christos   bfd_print_symbol_more,
    316  1.1  christos   bfd_print_symbol_all
    317  1.1  christos } bfd_print_symbol_type;
    318  1.1  christos 
    319  1.1  christos /* Information about a symbol that nm needs.  */
    320  1.1  christos 
    321  1.1  christos typedef struct _symbol_info
    322  1.1  christos {
    323  1.1  christos   symvalue value;
    324  1.1  christos   char type;
    325  1.1  christos   const char *name;            /* Symbol name.  */
    326  1.1  christos   unsigned char stab_type;     /* Stab type.  */
    327  1.1  christos   char stab_other;             /* Stab other.  */
    328  1.1  christos   short stab_desc;             /* Stab desc.  */
    329  1.1  christos   const char *stab_name;       /* String for stab type.  */
    330  1.1  christos } symbol_info;
    331  1.1  christos 
    332  1.1  christos /* Get the name of a stabs type code.  */
    333  1.1  christos 
    334  1.1  christos extern const char *bfd_get_stab_name (int);
    335  1.1  christos 
    336  1.1  christos /* Hash table routines.  There is no way to free up a hash table.  */
    338  1.1  christos 
    339  1.1  christos /* An element in the hash table.  Most uses will actually use a larger
    340  1.1  christos    structure, and an instance of this will be the first field.  */
    341  1.1  christos 
    342  1.1  christos struct bfd_hash_entry
    343  1.1  christos {
    344  1.1  christos   /* Next entry for this hash code.  */
    345  1.1  christos   struct bfd_hash_entry *next;
    346  1.1  christos   /* String being hashed.  */
    347  1.1  christos   const char *string;
    348  1.1  christos   /* Hash code.  This is the full hash code, not the index into the
    349  1.1  christos      table.  */
    350  1.1  christos   unsigned long hash;
    351  1.1  christos };
    352  1.1  christos 
    353  1.1  christos /* A hash table.  */
    354  1.1  christos 
    355  1.1  christos struct bfd_hash_table
    356  1.1  christos {
    357  1.1  christos   /* The hash array.  */
    358  1.1  christos   struct bfd_hash_entry **table;
    359  1.1  christos   /* A function used to create new elements in the hash table.  The
    360  1.1  christos      first entry is itself a pointer to an element.  When this
    361  1.1  christos      function is first invoked, this pointer will be NULL.  However,
    362  1.1  christos      having the pointer permits a hierarchy of method functions to be
    363  1.1  christos      built each of which calls the function in the superclass.  Thus
    364  1.1  christos      each function should be written to allocate a new block of memory
    365  1.1  christos      only if the argument is NULL.  */
    366  1.1  christos   struct bfd_hash_entry *(*newfunc)
    367  1.1  christos     (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
    368  1.1  christos    /* An objalloc for this hash table.  This is a struct objalloc *,
    369  1.1  christos      but we use void * to avoid requiring the inclusion of objalloc.h.  */
    370  1.1  christos   void *memory;
    371  1.1  christos   /* The number of slots in the hash table.  */
    372  1.1  christos   unsigned int size;
    373  1.1  christos   /* The number of entries in the hash table.  */
    374  1.1  christos   unsigned int count;
    375  1.1  christos   /* The size of elements.  */
    376  1.1  christos   unsigned int entsize;
    377  1.1  christos   /* If non-zero, don't grow the hash table.  */
    378  1.1  christos   unsigned int frozen:1;
    379  1.1  christos };
    380  1.1  christos 
    381  1.1  christos /* Initialize a hash table.  */
    382  1.1  christos extern bfd_boolean bfd_hash_table_init
    383  1.1  christos   (struct bfd_hash_table *,
    384  1.1  christos    struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
    385  1.1  christos 			       struct bfd_hash_table *,
    386  1.1  christos 			       const char *),
    387  1.1  christos    unsigned int);
    388  1.1  christos 
    389  1.1  christos /* Initialize a hash table specifying a size.  */
    390  1.1  christos extern bfd_boolean bfd_hash_table_init_n
    391  1.1  christos   (struct bfd_hash_table *,
    392  1.1  christos    struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
    393  1.1  christos 			       struct bfd_hash_table *,
    394  1.1  christos 			       const char *),
    395  1.1  christos    unsigned int, unsigned int);
    396  1.1  christos 
    397  1.1  christos /* Free up a hash table.  */
    398  1.1  christos extern void bfd_hash_table_free
    399  1.1  christos   (struct bfd_hash_table *);
    400  1.1  christos 
    401  1.1  christos /* Look up a string in a hash table.  If CREATE is TRUE, a new entry
    402  1.1  christos    will be created for this string if one does not already exist.  The
    403  1.1  christos    COPY argument must be TRUE if this routine should copy the string
    404  1.1  christos    into newly allocated memory when adding an entry.  */
    405  1.1  christos extern struct bfd_hash_entry *bfd_hash_lookup
    406  1.1  christos   (struct bfd_hash_table *, const char *, bfd_boolean create,
    407  1.1  christos    bfd_boolean copy);
    408  1.1  christos 
    409  1.1  christos /* Insert an entry in a hash table.  */
    410  1.1  christos extern struct bfd_hash_entry *bfd_hash_insert
    411  1.1  christos   (struct bfd_hash_table *, const char *, unsigned long);
    412  1.1  christos 
    413  1.1  christos /* Rename an entry in a hash table.  */
    414  1.1  christos extern void bfd_hash_rename
    415  1.1  christos   (struct bfd_hash_table *, const char *, struct bfd_hash_entry *);
    416  1.1  christos 
    417  1.1  christos /* Replace an entry in a hash table.  */
    418  1.1  christos extern void bfd_hash_replace
    419  1.1  christos   (struct bfd_hash_table *, struct bfd_hash_entry *old,
    420  1.1  christos    struct bfd_hash_entry *nw);
    421  1.1  christos 
    422  1.1  christos /* Base method for creating a hash table entry.  */
    423  1.1  christos extern struct bfd_hash_entry *bfd_hash_newfunc
    424  1.1  christos   (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
    425  1.1  christos 
    426  1.1  christos /* Grab some space for a hash table entry.  */
    427  1.1  christos extern void *bfd_hash_allocate
    428  1.1  christos   (struct bfd_hash_table *, unsigned int);
    429  1.1  christos 
    430  1.1  christos /* Traverse a hash table in a random order, calling a function on each
    431  1.1  christos    element.  If the function returns FALSE, the traversal stops.  The
    432  1.1  christos    INFO argument is passed to the function.  */
    433  1.1  christos extern void bfd_hash_traverse
    434  1.1  christos   (struct bfd_hash_table *,
    435  1.1  christos    bfd_boolean (*) (struct bfd_hash_entry *, void *),
    436  1.1  christos    void *info);
    437  1.1  christos 
    438  1.1  christos /* Allows the default size of a hash table to be configured. New hash
    439  1.1  christos    tables allocated using bfd_hash_table_init will be created with
    440  1.1  christos    this size.  */
    441  1.1  christos extern unsigned long bfd_hash_set_default_size (unsigned long);
    442  1.1  christos 
    443  1.1  christos /* This structure is used to keep track of stabs in sections
    444  1.1  christos    information while linking.  */
    445  1.1  christos 
    446  1.1  christos struct stab_info
    447  1.1  christos {
    448  1.1  christos   /* A hash table used to hold stabs strings.  */
    449  1.1  christos   struct bfd_strtab_hash *strings;
    450  1.1  christos   /* The header file hash table.  */
    451  1.1  christos   struct bfd_hash_table includes;
    452  1.1  christos   /* The first .stabstr section.  */
    453  1.1  christos   struct bfd_section *stabstr;
    454  1.1  christos };
    455  1.1  christos 
    456  1.1  christos #define COFF_SWAP_TABLE (void *) &bfd_coff_std_swap_table
    457  1.1  christos 
    458  1.1  christos /* User program access to BFD facilities.  */
    459  1.1  christos 
    460  1.1  christos /* Direct I/O routines, for programs which know more about the object
    461  1.1  christos    file than BFD does.  Use higher level routines if possible.  */
    462  1.1  christos 
    463  1.1  christos extern bfd_size_type bfd_bread (void *, bfd_size_type, bfd *);
    464  1.1  christos extern bfd_size_type bfd_bwrite (const void *, bfd_size_type, bfd *);
    465  1.1  christos extern int bfd_seek (bfd *, file_ptr, int);
    466  1.1  christos extern file_ptr bfd_tell (bfd *);
    467  1.1  christos extern int bfd_flush (bfd *);
    468  1.1  christos extern int bfd_stat (bfd *, struct stat *);
    469  1.1  christos 
    470  1.1  christos /* Deprecated old routines.  */
    471  1.1  christos #if __GNUC__
    472  1.1  christos #define bfd_read(BUF, ELTSIZE, NITEMS, ABFD)				\
    473  1.1  christos   (warn_deprecated ("bfd_read", __FILE__, __LINE__, __FUNCTION__),	\
    474  1.1  christos    bfd_bread ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
    475  1.1  christos #define bfd_write(BUF, ELTSIZE, NITEMS, ABFD)				\
    476  1.1  christos   (warn_deprecated ("bfd_write", __FILE__, __LINE__, __FUNCTION__),	\
    477  1.1  christos    bfd_bwrite ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
    478  1.1  christos #else
    479  1.1  christos #define bfd_read(BUF, ELTSIZE, NITEMS, ABFD)				\
    480  1.1  christos   (warn_deprecated ("bfd_read", (const char *) 0, 0, (const char *) 0), \
    481  1.1  christos    bfd_bread ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
    482  1.1  christos #define bfd_write(BUF, ELTSIZE, NITEMS, ABFD)				\
    483  1.1  christos   (warn_deprecated ("bfd_write", (const char *) 0, 0, (const char *) 0),\
    484  1.1  christos    bfd_bwrite ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
    485  1.1  christos #endif
    486  1.1  christos extern void warn_deprecated (const char *, const char *, int, const char *);
    487  1.1  christos 
    488  1.1  christos /* Cast from const char * to char * so that caller can assign to
    489  1.1  christos    a char * without a warning.  */
    490  1.1  christos #define bfd_get_filename(abfd) ((char *) (abfd)->filename)
    491  1.1  christos #define bfd_get_cacheable(abfd) ((abfd)->cacheable)
    492  1.1  christos #define bfd_get_format(abfd) ((abfd)->format)
    493  1.1  christos #define bfd_get_target(abfd) ((abfd)->xvec->name)
    494  1.1  christos #define bfd_get_flavour(abfd) ((abfd)->xvec->flavour)
    495  1.1  christos #define bfd_family_coff(abfd) \
    496  1.1  christos   (bfd_get_flavour (abfd) == bfd_target_coff_flavour || \
    497  1.1  christos    bfd_get_flavour (abfd) == bfd_target_xcoff_flavour)
    498  1.1  christos #define bfd_big_endian(abfd) ((abfd)->xvec->byteorder == BFD_ENDIAN_BIG)
    499  1.1  christos #define bfd_little_endian(abfd) ((abfd)->xvec->byteorder == BFD_ENDIAN_LITTLE)
    500  1.1  christos #define bfd_header_big_endian(abfd) \
    501  1.1  christos   ((abfd)->xvec->header_byteorder == BFD_ENDIAN_BIG)
    502  1.1  christos #define bfd_header_little_endian(abfd) \
    503  1.1  christos   ((abfd)->xvec->header_byteorder == BFD_ENDIAN_LITTLE)
    504  1.1  christos #define bfd_get_file_flags(abfd) ((abfd)->flags)
    505  1.1  christos #define bfd_applicable_file_flags(abfd) ((abfd)->xvec->object_flags)
    506  1.1  christos #define bfd_applicable_section_flags(abfd) ((abfd)->xvec->section_flags)
    507  1.1  christos #define bfd_my_archive(abfd) ((abfd)->my_archive)
    508  1.1  christos #define bfd_has_map(abfd) ((abfd)->has_armap)
    509  1.1  christos #define bfd_is_thin_archive(abfd) ((abfd)->is_thin_archive)
    510  1.1  christos 
    511  1.1  christos #define bfd_valid_reloc_types(abfd) ((abfd)->xvec->valid_reloc_types)
    512  1.1  christos #define bfd_usrdata(abfd) ((abfd)->usrdata)
    513  1.1  christos 
    514  1.1  christos #define bfd_get_start_address(abfd) ((abfd)->start_address)
    515  1.1  christos #define bfd_get_symcount(abfd) ((abfd)->symcount)
    516  1.1  christos #define bfd_get_outsymbols(abfd) ((abfd)->outsymbols)
    517  1.1  christos #define bfd_count_sections(abfd) ((abfd)->section_count)
    518  1.1  christos 
    519  1.1  christos #define bfd_get_dynamic_symcount(abfd) ((abfd)->dynsymcount)
    520  1.1  christos 
    521  1.1  christos #define bfd_get_symbol_leading_char(abfd) ((abfd)->xvec->symbol_leading_char)
    522  1.1  christos 
    523  1.1  christos extern bfd_boolean bfd_cache_close
    524  1.1  christos   (bfd *abfd);
    525  1.1  christos /* NB: This declaration should match the autogenerated one in libbfd.h.  */
    526  1.1  christos 
    527  1.1  christos extern bfd_boolean bfd_cache_close_all (void);
    528  1.1  christos 
    529  1.1  christos extern bfd_boolean bfd_record_phdr
    530  1.1  christos   (bfd *, unsigned long, bfd_boolean, flagword, bfd_boolean, bfd_vma,
    531  1.1  christos    bfd_boolean, bfd_boolean, unsigned int, struct bfd_section **);
    532  1.1  christos 
    533  1.1  christos /* Byte swapping routines.  */
    534  1.1  christos 
    535  1.1  christos bfd_uint64_t bfd_getb64 (const void *);
    536  1.1  christos bfd_uint64_t bfd_getl64 (const void *);
    537  1.1  christos bfd_int64_t bfd_getb_signed_64 (const void *);
    538  1.1  christos bfd_int64_t bfd_getl_signed_64 (const void *);
    539  1.1  christos bfd_vma bfd_getb32 (const void *);
    540  1.1  christos bfd_vma bfd_getl32 (const void *);
    541  1.1  christos bfd_signed_vma bfd_getb_signed_32 (const void *);
    542  1.1  christos bfd_signed_vma bfd_getl_signed_32 (const void *);
    543  1.1  christos bfd_vma bfd_getb16 (const void *);
    544  1.1  christos bfd_vma bfd_getl16 (const void *);
    545  1.1  christos bfd_signed_vma bfd_getb_signed_16 (const void *);
    546  1.1  christos bfd_signed_vma bfd_getl_signed_16 (const void *);
    547  1.1  christos void bfd_putb64 (bfd_uint64_t, void *);
    548  1.1  christos void bfd_putl64 (bfd_uint64_t, void *);
    549  1.1  christos void bfd_putb32 (bfd_vma, void *);
    550  1.1  christos void bfd_putl32 (bfd_vma, void *);
    551  1.1  christos void bfd_putb16 (bfd_vma, void *);
    552  1.1  christos void bfd_putl16 (bfd_vma, void *);
    553  1.1  christos 
    554  1.1  christos /* Byte swapping routines which take size and endiannes as arguments.  */
    555  1.1  christos 
    556  1.1  christos bfd_uint64_t bfd_get_bits (const void *, int, bfd_boolean);
    557  1.1  christos void bfd_put_bits (bfd_uint64_t, void *, int, bfd_boolean);
    558  1.1  christos 
    559  1.1  christos #if defined(__STDC__) || defined(ALMOST_STDC)
    560  1.1  christos struct ecoff_debug_info;
    561  1.1  christos struct ecoff_debug_swap;
    562  1.1  christos struct ecoff_extr;
    563  1.1  christos struct bfd_symbol;
    564  1.1  christos struct bfd_link_info;
    565  1.1  christos struct bfd_link_hash_entry;
    566  1.1  christos struct bfd_section_already_linked;
    567  1.1  christos struct bfd_elf_version_tree;
    568  1.1  christos #endif
    569  1.1  christos 
    570  1.1  christos extern bfd_boolean bfd_section_already_linked_table_init (void);
    571  1.1  christos extern void bfd_section_already_linked_table_free (void);
    572  1.1  christos extern bfd_boolean _bfd_handle_already_linked
    573  1.1  christos   (struct bfd_section *, struct bfd_section_already_linked *,
    574  1.1  christos    struct bfd_link_info *);
    575  1.1  christos 
    576  1.1  christos /* Externally visible ECOFF routines.  */
    578  1.1  christos 
    579  1.1  christos extern bfd_vma bfd_ecoff_get_gp_value
    580  1.1  christos   (bfd * abfd);
    581  1.1  christos extern bfd_boolean bfd_ecoff_set_gp_value
    582  1.1  christos   (bfd *abfd, bfd_vma gp_value);
    583  1.1  christos extern bfd_boolean bfd_ecoff_set_regmasks
    584  1.1  christos   (bfd *abfd, unsigned long gprmask, unsigned long fprmask,
    585  1.1  christos    unsigned long *cprmask);
    586  1.1  christos extern void *bfd_ecoff_debug_init
    587  1.1  christos   (bfd *output_bfd, struct ecoff_debug_info *output_debug,
    588  1.1  christos    const struct ecoff_debug_swap *output_swap, struct bfd_link_info *);
    589  1.1  christos extern void bfd_ecoff_debug_free
    590  1.1  christos   (void *handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
    591  1.1  christos    const struct ecoff_debug_swap *output_swap, struct bfd_link_info *);
    592  1.1  christos extern bfd_boolean bfd_ecoff_debug_accumulate
    593  1.1  christos   (void *handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
    594  1.1  christos    const struct ecoff_debug_swap *output_swap, bfd *input_bfd,
    595  1.1  christos    struct ecoff_debug_info *input_debug,
    596  1.1  christos    const struct ecoff_debug_swap *input_swap, struct bfd_link_info *);
    597  1.1  christos extern bfd_boolean bfd_ecoff_debug_accumulate_other
    598  1.1  christos   (void *handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
    599  1.1  christos    const struct ecoff_debug_swap *output_swap, bfd *input_bfd,
    600  1.1  christos    struct bfd_link_info *);
    601  1.1  christos extern bfd_boolean bfd_ecoff_debug_externals
    602  1.1  christos   (bfd *abfd, struct ecoff_debug_info *debug,
    603  1.1  christos    const struct ecoff_debug_swap *swap, bfd_boolean relocatable,
    604  1.1  christos    bfd_boolean (*get_extr) (struct bfd_symbol *, struct ecoff_extr *),
    605  1.1  christos    void (*set_index) (struct bfd_symbol *, bfd_size_type));
    606  1.1  christos extern bfd_boolean bfd_ecoff_debug_one_external
    607  1.1  christos   (bfd *abfd, struct ecoff_debug_info *debug,
    608  1.1  christos    const struct ecoff_debug_swap *swap, const char *name,
    609  1.1  christos    struct ecoff_extr *esym);
    610  1.1  christos extern bfd_size_type bfd_ecoff_debug_size
    611  1.1  christos   (bfd *abfd, struct ecoff_debug_info *debug,
    612  1.1  christos    const struct ecoff_debug_swap *swap);
    613  1.1  christos extern bfd_boolean bfd_ecoff_write_debug
    614  1.1  christos   (bfd *abfd, struct ecoff_debug_info *debug,
    615  1.1  christos    const struct ecoff_debug_swap *swap, file_ptr where);
    616  1.1  christos extern bfd_boolean bfd_ecoff_write_accumulated_debug
    617  1.1  christos   (void *handle, bfd *abfd, struct ecoff_debug_info *debug,
    618  1.1  christos    const struct ecoff_debug_swap *swap,
    619  1.1  christos    struct bfd_link_info *info, file_ptr where);
    620  1.1  christos 
    621  1.1  christos /* Externally visible ELF routines.  */
    622  1.1  christos 
    623  1.1  christos struct bfd_link_needed_list
    624  1.1  christos {
    625  1.1  christos   struct bfd_link_needed_list *next;
    626  1.1  christos   bfd *by;
    627  1.1  christos   const char *name;
    628  1.1  christos };
    629  1.1  christos 
    630  1.1  christos enum dynamic_lib_link_class {
    631  1.1  christos   DYN_NORMAL = 0,
    632  1.1  christos   DYN_AS_NEEDED = 1,
    633  1.1  christos   DYN_DT_NEEDED = 2,
    634  1.1  christos   DYN_NO_ADD_NEEDED = 4,
    635  1.1  christos   DYN_NO_NEEDED = 8
    636  1.1  christos };
    637  1.1  christos 
    638  1.1  christos enum notice_asneeded_action {
    639  1.1  christos   notice_as_needed,
    640  1.1  christos   notice_not_needed,
    641  1.1  christos   notice_needed
    642  1.1  christos };
    643  1.1  christos 
    644  1.1  christos extern bfd_boolean bfd_elf_record_link_assignment
    645  1.1  christos   (bfd *, struct bfd_link_info *, const char *, bfd_boolean,
    646  1.1  christos    bfd_boolean);
    647  1.1  christos extern struct bfd_link_needed_list *bfd_elf_get_needed_list
    648  1.1  christos   (bfd *, struct bfd_link_info *);
    649  1.1  christos extern bfd_boolean bfd_elf_get_bfd_needed_list
    650  1.1  christos   (bfd *, struct bfd_link_needed_list **);
    651  1.1  christos extern bfd_boolean bfd_elf_stack_segment_size (bfd *, struct bfd_link_info *,
    652  1.1  christos 					       const char *, bfd_vma);
    653  1.1  christos extern bfd_boolean bfd_elf_size_dynamic_sections
    654  1.1  christos   (bfd *, const char *, const char *, const char *, const char *, const char *,
    655  1.1  christos    const char * const *, struct bfd_link_info *, struct bfd_section **);
    656  1.1  christos extern bfd_boolean bfd_elf_size_dynsym_hash_dynstr
    657  1.1  christos   (bfd *, struct bfd_link_info *);
    658  1.1  christos extern void bfd_elf_set_dt_needed_name
    659  1.1  christos   (bfd *, const char *);
    660  1.1  christos extern const char *bfd_elf_get_dt_soname
    661  1.1  christos   (bfd *);
    662  1.1  christos extern void bfd_elf_set_dyn_lib_class
    663  1.1  christos   (bfd *, enum dynamic_lib_link_class);
    664  1.1  christos extern int bfd_elf_get_dyn_lib_class
    665  1.1  christos   (bfd *);
    666  1.1  christos extern struct bfd_link_needed_list *bfd_elf_get_runpath_list
    667  1.1  christos   (bfd *, struct bfd_link_info *);
    668  1.1  christos extern bfd_boolean bfd_elf_discard_info
    669  1.1  christos   (bfd *, struct bfd_link_info *);
    670  1.1  christos extern unsigned int _bfd_elf_default_action_discarded
    671  1.1  christos   (struct bfd_section *);
    672  1.1  christos 
    673  1.1  christos /* Return an upper bound on the number of bytes required to store a
    674  1.1  christos    copy of ABFD's program header table entries.  Return -1 if an error
    675  1.1  christos    occurs; bfd_get_error will return an appropriate code.  */
    676  1.1  christos extern long bfd_get_elf_phdr_upper_bound
    677  1.1  christos   (bfd *abfd);
    678  1.1  christos 
    679  1.1  christos /* Copy ABFD's program header table entries to *PHDRS.  The entries
    680  1.1  christos    will be stored as an array of Elf_Internal_Phdr structures, as
    681  1.1  christos    defined in include/elf/internal.h.  To find out how large the
    682  1.1  christos    buffer needs to be, call bfd_get_elf_phdr_upper_bound.
    683  1.1  christos 
    684  1.1  christos    Return the number of program header table entries read, or -1 if an
    685  1.1  christos    error occurs; bfd_get_error will return an appropriate code.  */
    686  1.1  christos extern int bfd_get_elf_phdrs
    687  1.1  christos   (bfd *abfd, void *phdrs);
    688  1.1  christos 
    689  1.1  christos /* Create a new BFD as if by bfd_openr.  Rather than opening a file,
    690  1.1  christos    reconstruct an ELF file by reading the segments out of remote memory
    691  1.1  christos    based on the ELF file header at EHDR_VMA and the ELF program headers it
    692  1.1  christos    points to.  If not null, *LOADBASEP is filled in with the difference
    693  1.1  christos    between the VMAs from which the segments were read, and the VMAs the
    694  1.1  christos    file headers (and hence BFD's idea of each section's VMA) put them at.
    695  1.1  christos 
    696  1.1  christos    The function TARGET_READ_MEMORY is called to copy LEN bytes from the
    697  1.1  christos    remote memory at target address VMA into the local buffer at MYADDR; it
    698  1.1  christos    should return zero on success or an `errno' code on failure.  TEMPL must
    699  1.1  christos    be a BFD for an ELF target with the word size and byte order found in
    700  1.1  christos    the remote memory.  */
    701  1.1  christos extern bfd *bfd_elf_bfd_from_remote_memory
    702  1.1  christos   (bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep,
    703  1.1  christos    int (*target_read_memory) (bfd_vma vma, bfd_byte *myaddr,
    704  1.1  christos 			      bfd_size_type len));
    705  1.1  christos 
    706  1.1  christos extern struct bfd_section *_bfd_elf_tls_setup
    707  1.1  christos   (bfd *, struct bfd_link_info *);
    708  1.1  christos 
    709  1.1  christos extern struct bfd_section *
    710  1.1  christos _bfd_nearby_section (bfd *, struct bfd_section *, bfd_vma);
    711  1.1  christos 
    712  1.1  christos extern void _bfd_fix_excluded_sec_syms
    713  1.1  christos   (bfd *, struct bfd_link_info *);
    714  1.1  christos 
    715  1.1  christos extern unsigned bfd_m68k_mach_to_features (int);
    716  1.1  christos 
    717  1.1  christos extern int bfd_m68k_features_to_mach (unsigned);
    718  1.1  christos 
    719  1.1  christos extern bfd_boolean bfd_m68k_elf32_create_embedded_relocs
    720  1.1  christos   (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *,
    721  1.1  christos    char **);
    722  1.1  christos 
    723  1.1  christos extern void bfd_elf_m68k_set_target_options (struct bfd_link_info *, int);
    724  1.1  christos 
    725  1.1  christos extern bfd_boolean bfd_bfin_elf32_create_embedded_relocs
    726  1.1  christos   (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *,
    727  1.1  christos    char **);
    728  1.1  christos 
    729  1.1  christos extern bfd_boolean bfd_cr16_elf32_create_embedded_relocs
    730  1.1  christos   (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *,
    731  1.1  christos    char **);
    732  1.1  christos 
    733  1.1  christos /* SunOS shared library support routines for the linker.  */
    734  1.1  christos 
    735  1.1  christos extern struct bfd_link_needed_list *bfd_sunos_get_needed_list
    736  1.1  christos   (bfd *, struct bfd_link_info *);
    737  1.1  christos extern bfd_boolean bfd_sunos_record_link_assignment
    738  1.1  christos   (bfd *, struct bfd_link_info *, const char *);
    739  1.1  christos extern bfd_boolean bfd_sunos_size_dynamic_sections
    740  1.1  christos   (bfd *, struct bfd_link_info *, struct bfd_section **,
    741  1.1  christos    struct bfd_section **, struct bfd_section **);
    742  1.1  christos 
    743  1.1  christos /* Linux shared library support routines for the linker.  */
    744  1.1  christos 
    745  1.1  christos extern bfd_boolean bfd_i386linux_size_dynamic_sections
    746  1.1  christos   (bfd *, struct bfd_link_info *);
    747  1.1  christos extern bfd_boolean bfd_m68klinux_size_dynamic_sections
    748  1.1  christos   (bfd *, struct bfd_link_info *);
    749  1.1  christos extern bfd_boolean bfd_sparclinux_size_dynamic_sections
    750  1.1  christos   (bfd *, struct bfd_link_info *);
    751  1.1  christos 
    752  1.1  christos /* mmap hacks */
    753  1.1  christos 
    754  1.1  christos struct _bfd_window_internal;
    755  1.1  christos typedef struct _bfd_window_internal bfd_window_internal;
    756  1.1  christos 
    757  1.1  christos typedef struct _bfd_window
    758  1.1  christos {
    759  1.1  christos   /* What the user asked for.  */
    760  1.1  christos   void *data;
    761  1.1  christos   bfd_size_type size;
    762  1.1  christos   /* The actual window used by BFD.  Small user-requested read-only
    763  1.1  christos      regions sharing a page may share a single window into the object
    764  1.1  christos      file.  Read-write versions shouldn't until I've fixed things to
    765  1.1  christos      keep track of which portions have been claimed by the
    766  1.1  christos      application; don't want to give the same region back when the
    767  1.1  christos      application wants two writable copies!  */
    768  1.1  christos   struct _bfd_window_internal *i;
    769  1.1  christos }
    770  1.1  christos bfd_window;
    771  1.1  christos 
    772  1.1  christos extern void bfd_init_window
    773  1.1  christos   (bfd_window *);
    774  1.1  christos extern void bfd_free_window
    775  1.1  christos   (bfd_window *);
    776  1.1  christos extern bfd_boolean bfd_get_file_window
    777  1.1  christos   (bfd *, file_ptr, bfd_size_type, bfd_window *, bfd_boolean);
    778  1.1  christos 
    779  1.1  christos /* XCOFF support routines for the linker.  */
    780  1.1  christos 
    781  1.1  christos extern bfd_boolean bfd_xcoff_split_import_path
    782  1.1  christos   (bfd *, const char *, const char **, const char **);
    783  1.1  christos extern bfd_boolean bfd_xcoff_set_archive_import_path
    784  1.1  christos   (struct bfd_link_info *, bfd *, const char *);
    785  1.1  christos extern bfd_boolean bfd_xcoff_link_record_set
    786  1.1  christos   (bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *, bfd_size_type);
    787  1.1  christos extern bfd_boolean bfd_xcoff_import_symbol
    788  1.1  christos   (bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *, bfd_vma,
    789  1.1  christos    const char *, const char *, const char *, unsigned int);
    790  1.1  christos extern bfd_boolean bfd_xcoff_export_symbol
    791  1.1  christos   (bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *);
    792  1.1  christos extern bfd_boolean bfd_xcoff_link_count_reloc
    793  1.1  christos   (bfd *, struct bfd_link_info *, const char *);
    794  1.1  christos extern bfd_boolean bfd_xcoff_record_link_assignment
    795  1.1  christos   (bfd *, struct bfd_link_info *, const char *);
    796  1.1  christos extern bfd_boolean bfd_xcoff_size_dynamic_sections
    797  1.1  christos   (bfd *, struct bfd_link_info *, const char *, const char *,
    798  1.1  christos    unsigned long, unsigned long, unsigned long, bfd_boolean,
    799  1.1  christos    int, bfd_boolean, unsigned int, struct bfd_section **, bfd_boolean);
    800  1.1  christos extern bfd_boolean bfd_xcoff_link_generate_rtinit
    801  1.1  christos   (bfd *, const char *, const char *, bfd_boolean);
    802  1.1  christos 
    803  1.1  christos /* XCOFF support routines for ar.  */
    804  1.1  christos extern bfd_boolean bfd_xcoff_ar_archive_set_magic
    805  1.1  christos   (bfd *, char *);
    806  1.1  christos 
    807  1.1  christos /* Externally visible COFF routines.  */
    808  1.1  christos 
    809  1.1  christos #if defined(__STDC__) || defined(ALMOST_STDC)
    810  1.1  christos struct internal_syment;
    811  1.1  christos union internal_auxent;
    812  1.1  christos #endif
    813  1.1  christos 
    814  1.1  christos extern bfd_boolean bfd_coff_get_syment
    815  1.1  christos   (bfd *, struct bfd_symbol *, struct internal_syment *);
    816  1.1  christos 
    817  1.1  christos extern bfd_boolean bfd_coff_get_auxent
    818  1.1  christos   (bfd *, struct bfd_symbol *, int, union internal_auxent *);
    819  1.1  christos 
    820  1.1  christos extern bfd_boolean bfd_coff_set_symbol_class
    821  1.1  christos   (bfd *, struct bfd_symbol *, unsigned int);
    822  1.1  christos 
    823  1.1  christos extern bfd_boolean bfd_m68k_coff_create_embedded_relocs
    824  1.1  christos   (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **);
    825  1.1  christos 
    826  1.1  christos /* ARM VFP11 erratum workaround support.  */
    827  1.1  christos typedef enum
    828  1.1  christos {
    829  1.1  christos   BFD_ARM_VFP11_FIX_DEFAULT,
    830  1.1  christos   BFD_ARM_VFP11_FIX_NONE,
    831  1.1  christos   BFD_ARM_VFP11_FIX_SCALAR,
    832  1.1  christos   BFD_ARM_VFP11_FIX_VECTOR
    833  1.1  christos } bfd_arm_vfp11_fix;
    834  1.1  christos 
    835  1.1  christos extern void bfd_elf32_arm_init_maps
    836  1.1  christos   (bfd *);
    837  1.1  christos 
    838  1.1  christos extern void bfd_elf32_arm_set_vfp11_fix
    839  1.1  christos   (bfd *, struct bfd_link_info *);
    840  1.1  christos 
    841  1.1  christos extern void bfd_elf32_arm_set_cortex_a8_fix
    842  1.1  christos   (bfd *, struct bfd_link_info *);
    843  1.1  christos 
    844  1.1  christos extern bfd_boolean bfd_elf32_arm_vfp11_erratum_scan
    845  1.1  christos   (bfd *, struct bfd_link_info *);
    846  1.1  christos 
    847  1.1  christos extern void bfd_elf32_arm_vfp11_fix_veneer_locations
    848  1.1  christos   (bfd *, struct bfd_link_info *);
    849  1.1  christos 
    850  1.1  christos /* ARM Interworking support.  Called from linker.  */
    851  1.1  christos extern bfd_boolean bfd_arm_allocate_interworking_sections
    852  1.1  christos   (struct bfd_link_info *);
    853  1.1  christos 
    854  1.1  christos extern bfd_boolean bfd_arm_process_before_allocation
    855  1.1  christos   (bfd *, struct bfd_link_info *, int);
    856  1.1  christos 
    857  1.1  christos extern bfd_boolean bfd_arm_get_bfd_for_interworking
    858  1.1  christos   (bfd *, struct bfd_link_info *);
    859  1.1  christos 
    860  1.1  christos /* PE ARM Interworking support.  Called from linker.  */
    861  1.1  christos extern bfd_boolean bfd_arm_pe_allocate_interworking_sections
    862  1.1  christos   (struct bfd_link_info *);
    863  1.1  christos 
    864  1.1  christos extern bfd_boolean bfd_arm_pe_process_before_allocation
    865  1.1  christos   (bfd *, struct bfd_link_info *, int);
    866  1.1  christos 
    867  1.1  christos extern bfd_boolean bfd_arm_pe_get_bfd_for_interworking
    868  1.1  christos   (bfd *, struct bfd_link_info *);
    869  1.1  christos 
    870  1.1  christos /* ELF ARM Interworking support.  Called from linker.  */
    871  1.1  christos extern bfd_boolean bfd_elf32_arm_allocate_interworking_sections
    872  1.1  christos   (struct bfd_link_info *);
    873  1.1  christos 
    874  1.1  christos extern bfd_boolean bfd_elf32_arm_process_before_allocation
    875  1.1  christos   (bfd *, struct bfd_link_info *);
    876  1.1  christos 
    877  1.1  christos void bfd_elf32_arm_set_target_relocs
    878  1.1  christos   (bfd *, struct bfd_link_info *, int, char *, int, int, bfd_arm_vfp11_fix,
    879  1.1  christos    int, int, int, int, int);
    880  1.1  christos 
    881  1.1  christos extern bfd_boolean bfd_elf32_arm_get_bfd_for_interworking
    882  1.1  christos   (bfd *, struct bfd_link_info *);
    883  1.1  christos 
    884  1.1  christos extern bfd_boolean bfd_elf32_arm_add_glue_sections_to_bfd
    885  1.1  christos   (bfd *, struct bfd_link_info *);
    886  1.1  christos 
    887  1.1  christos /* ELF ARM mapping symbol support */
    888  1.1  christos #define BFD_ARM_SPECIAL_SYM_TYPE_MAP	(1 << 0)
    889  1.1  christos #define BFD_ARM_SPECIAL_SYM_TYPE_TAG	(1 << 1)
    890  1.1  christos #define BFD_ARM_SPECIAL_SYM_TYPE_OTHER  (1 << 2)
    891  1.1  christos #define BFD_ARM_SPECIAL_SYM_TYPE_ANY	(~0)
    892  1.1  christos extern bfd_boolean bfd_is_arm_special_symbol_name
    893  1.1  christos   (const char * name, int type);
    894  1.1  christos 
    895  1.1  christos extern void bfd_elf32_arm_set_byteswap_code (struct bfd_link_info *, int);
    896  1.1  christos 
    897  1.1  christos /* ARM Note section processing.  */
    898  1.1  christos extern bfd_boolean bfd_arm_merge_machines
    899  1.1  christos   (bfd *, bfd *);
    900  1.1  christos 
    901  1.1  christos extern bfd_boolean bfd_arm_update_notes
    902  1.1  christos   (bfd *, const char *);
    903  1.1  christos 
    904  1.1  christos extern unsigned int bfd_arm_get_mach_from_notes
    905  1.1  christos   (bfd *, const char *);
    906  1.1  christos 
    907  1.1  christos /* ARM stub generation support.  Called from the linker.  */
    908  1.1  christos extern int elf32_arm_setup_section_lists
    909  1.1  christos   (bfd *, struct bfd_link_info *);
    910  1.1  christos extern void elf32_arm_next_input_section
    911  1.1  christos   (struct bfd_link_info *, struct bfd_section *);
    912  1.1  christos extern bfd_boolean elf32_arm_size_stubs
    913  1.1  christos   (bfd *, bfd *, struct bfd_link_info *, bfd_signed_vma,
    914  1.1  christos    struct bfd_section * (*) (const char *, struct bfd_section *, unsigned int),
    915  1.1  christos    void (*) (void));
    916  1.1  christos extern bfd_boolean elf32_arm_build_stubs
    917  1.1  christos   (struct bfd_link_info *);
    918  1.1  christos 
    919  1.1  christos /* ARM unwind section editing support.  */
    920  1.1  christos extern bfd_boolean elf32_arm_fix_exidx_coverage
    921  1.1  christos (struct bfd_section **, unsigned int, struct bfd_link_info *, bfd_boolean);
    922  1.1  christos 
    923  1.1  christos /* C6x unwind section editing support.  */
    924  1.1  christos extern bfd_boolean elf32_tic6x_fix_exidx_coverage
    925  1.1  christos (struct bfd_section **, unsigned int, struct bfd_link_info *, bfd_boolean);
    926  1.1  christos 
    927  1.1  christos /* PowerPC @tls opcode transform/validate.  */
    928  1.1  christos extern unsigned int _bfd_elf_ppc_at_tls_transform
    929  1.1  christos   (unsigned int, unsigned int);
    930  1.1  christos /* PowerPC @tprel opcode transform/validate.  */
    931  1.1  christos extern unsigned int _bfd_elf_ppc_at_tprel_transform
    932  1.1  christos   (unsigned int, unsigned int);
    933  1.1  christos 
    934  1.1  christos extern void bfd_elf64_aarch64_init_maps
    935  1.1  christos   (bfd *);
    936  1.1  christos 
    937  1.1  christos extern void bfd_elf32_aarch64_init_maps
    938  1.1  christos   (bfd *);
    939  1.1  christos 
    940  1.1  christos extern void bfd_elf64_aarch64_set_options
    941  1.1  christos   (bfd *, struct bfd_link_info *, int, int, int);
    942  1.1  christos 
    943  1.1  christos extern void bfd_elf32_aarch64_set_options
    944  1.1  christos   (bfd *, struct bfd_link_info *, int, int, int);
    945  1.1  christos 
    946  1.1  christos /* ELF AArch64 mapping symbol support.  */
    947  1.1  christos #define BFD_AARCH64_SPECIAL_SYM_TYPE_MAP	(1 << 0)
    948  1.1  christos #define BFD_AARCH64_SPECIAL_SYM_TYPE_TAG	(1 << 1)
    949  1.1  christos #define BFD_AARCH64_SPECIAL_SYM_TYPE_OTHER	(1 << 2)
    950  1.1  christos #define BFD_AARCH64_SPECIAL_SYM_TYPE_ANY	(~0)
    951  1.1  christos extern bfd_boolean bfd_is_aarch64_special_symbol_name
    952  1.1  christos   (const char * name, int type);
    953  1.1  christos 
    954  1.1  christos /* AArch64 stub generation support for ELF64.  Called from the linker.  */
    955  1.1  christos extern int elf64_aarch64_setup_section_lists
    956  1.1  christos   (bfd *, struct bfd_link_info *);
    957  1.1  christos extern void elf64_aarch64_next_input_section
    958  1.1  christos   (struct bfd_link_info *, struct bfd_section *);
    959  1.1  christos extern bfd_boolean elf64_aarch64_size_stubs
    960  1.1  christos   (bfd *, bfd *, struct bfd_link_info *, bfd_signed_vma,
    961  1.1  christos    struct bfd_section * (*) (const char *, struct bfd_section *),
    962  1.1  christos    void (*) (void));
    963  1.1  christos extern bfd_boolean elf64_aarch64_build_stubs
    964  1.1  christos   (struct bfd_link_info *);
    965  1.1  christos /* AArch64 stub generation support for ELF32.  Called from the linker.  */
    966  1.1  christos extern int elf32_aarch64_setup_section_lists
    967  1.1  christos   (bfd *, struct bfd_link_info *);
    968  1.1  christos extern void elf32_aarch64_next_input_section
    969  1.1  christos   (struct bfd_link_info *, struct bfd_section *);
    970  1.1  christos extern bfd_boolean elf32_aarch64_size_stubs
    971  1.1  christos   (bfd *, bfd *, struct bfd_link_info *, bfd_signed_vma,
    972  1.1  christos    struct bfd_section * (*) (const char *, struct bfd_section *),
    973  1.1  christos    void (*) (void));
    974  1.1  christos extern bfd_boolean elf32_aarch64_build_stubs
    975  1.1  christos   (struct bfd_link_info *);
    976  1.1  christos 
    977  1.1  christos 
    978  1.1  christos /* TI COFF load page support.  */
    979  1.1  christos extern void bfd_ticoff_set_section_load_page
    980  1.1  christos   (struct bfd_section *, int);
    981  1.1  christos 
    982  1.1  christos extern int bfd_ticoff_get_section_load_page
    983  1.1  christos   (struct bfd_section *);
    984  1.1  christos 
    985  1.1  christos /* H8/300 functions.  */
    986  1.1  christos extern bfd_vma bfd_h8300_pad_address
    987  1.1  christos   (bfd *, bfd_vma);
    988  1.1  christos 
    989  1.1  christos /* IA64 Itanium code generation.  Called from linker.  */
    990  1.1  christos extern void bfd_elf32_ia64_after_parse
    991  1.1  christos   (int);
    992  1.1  christos 
    993  1.1  christos extern void bfd_elf64_ia64_after_parse
    994  1.1  christos   (int);
    995  1.1  christos 
    996  1.1  christos /* This structure is used for a comdat section, as in PE.  A comdat
    997  1.1  christos    section is associated with a particular symbol.  When the linker
    998  1.1  christos    sees a comdat section, it keeps only one of the sections with a
    999  1.1  christos    given name and associated with a given symbol.  */
   1000  1.1  christos 
   1001  1.1  christos struct coff_comdat_info
   1002  1.1  christos {
   1003  1.1  christos   /* The name of the symbol associated with a comdat section.  */
   1004  1.1  christos   const char *name;
   1005  1.1  christos 
   1006  1.1  christos   /* The local symbol table index of the symbol associated with a
   1007  1.1  christos      comdat section.  This is only meaningful to the object file format
   1008                     specific code; it is not an index into the list returned by
   1009                     bfd_canonicalize_symtab.  */
   1010                  long symbol;
   1011                };
   1012                
   1013                extern struct coff_comdat_info * bfd_coff_get_comdat_section
   1014                  (bfd *, struct bfd_section *);
   1015