home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / binutils-2.7-src.tgz / tar.out / fsf / binutils / bfd / bfd-in2.h < prev    next >
C/C++ Source or Header  |  1996-09-28  |  89KB  |  2,556 lines

  1. /* Main header file for the bfd library -- portable access to object files.
  2.    Copyright 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
  3.    Contributed by Cygnus Support.
  4.  
  5. ** NOTE: bfd.h and bfd-in2.h are GENERATED files.  Don't change them;
  6. ** instead, change bfd-in.h or the other BFD source files processed to
  7. ** generate these files.
  8.  
  9. This file is part of BFD, the Binary File Descriptor library.
  10.  
  11. This program is free software; you can redistribute it and/or modify
  12. it under the terms of the GNU General Public License as published by
  13. the Free Software Foundation; either version 2 of the License, or
  14. (at your option) any later version.
  15.  
  16. This program is distributed in the hope that it will be useful,
  17. but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  19. GNU General Public License for more details.
  20.  
  21. You should have received a copy of the GNU General Public License
  22. along with this program; if not, write to the Free Software
  23. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
  24.  
  25. /* bfd.h -- The only header file required by users of the bfd library 
  26.  
  27. The bfd.h file is generated from bfd-in.h and various .c files; if you
  28. change it, your changes will probably be lost.
  29.  
  30. All the prototypes and definitions following the comment "THE FOLLOWING
  31. IS EXTRACTED FROM THE SOURCE" are extracted from the source files for
  32. BFD.  If you change it, someone oneday will extract it from the source
  33. again, and your changes will be lost.  To save yourself from this bind,
  34. change the definitions in the source in the bfd directory.  Type "make
  35. docs" and then "make headers" in that directory, and magically this file
  36. will change to reflect your changes.
  37.  
  38. If you don't have the tools to perform the extraction, then you are
  39. safe from someone on your system trampling over your header files.
  40. You should still maintain the equivalence between the source and this
  41. file though; every change you make to the .c file should be reflected
  42. here.  */
  43.  
  44. #ifndef __BFD_H_SEEN__
  45. #define __BFD_H_SEEN__
  46.  
  47. #ifdef __cplusplus
  48. extern "C" {
  49. #endif
  50.  
  51. #include "ansidecl.h"
  52. #include "obstack.h"
  53.  
  54. /* These two lines get substitutions done by commands in Makefile.in.  */
  55. #define BFD_VERSION  "@VERSION@"
  56. #define BFD_ARCH_SIZE @WORDSIZE@
  57. #define BFD_HOST_64BIT_LONG @BFD_HOST_64BIT_LONG@
  58.  
  59. #if BFD_ARCH_SIZE >= 64
  60. #define BFD64
  61. #endif
  62.  
  63. #ifndef INLINE
  64. #if __GNUC__ >= 2
  65. #define INLINE __inline__
  66. #else
  67. #define INLINE
  68. #endif
  69. #endif
  70.  
  71. /* forward declaration */
  72. typedef struct _bfd bfd;
  73.  
  74. /* To squelch erroneous compiler warnings ("illegal pointer
  75.    combination") from the SVR3 compiler, we would like to typedef
  76.    boolean to int (it doesn't like functions which return boolean.
  77.    Making sure they are never implicitly declared to return int
  78.    doesn't seem to help).  But this file is not configured based on
  79.    the host.  */
  80. /* General rules: functions which are boolean return true on success
  81.    and false on failure (unless they're a predicate).   -- bfd.doc */
  82. /* I'm sure this is going to break something and someone is going to
  83.    force me to change it. */
  84. /* typedef enum boolean {false, true} boolean; */
  85. /* Yup, SVR4 has a "typedef enum boolean" in <sys/types.h>  -fnf */
  86. /* It gets worse if the host also defines a true/false enum... -sts */
  87. /* And even worse if your compiler has built-in boolean types... -law */
  88. #if defined (__GNUG__) && (__GNUC_MINOR__ > 5)
  89. #define TRUE_FALSE_ALREADY_DEFINED
  90. #endif
  91. #ifdef MPW
  92. /* Pre-emptive strike - get the file with the enum. */
  93. #include <Types.h>
  94. #define TRUE_FALSE_ALREADY_DEFINED
  95. #endif /* MPW */
  96. #ifndef TRUE_FALSE_ALREADY_DEFINED
  97. typedef enum bfd_boolean {false, true} boolean;
  98. #define BFD_TRUE_FALSE
  99. #else
  100. /* Use enum names that will appear nowhere else.  */
  101. typedef enum bfd_boolean {bfd_fffalse, bfd_tttrue} boolean;
  102. #endif
  103.  
  104. /* A pointer to a position in a file.  */
  105. /* FIXME:  This should be using off_t from <sys/types.h>.
  106.    For now, try to avoid breaking stuff by not including <sys/types.h> here.
  107.    This will break on systems with 64-bit file offsets (e.g. 4.4BSD).
  108.    Probably the best long-term answer is to avoid using file_ptr AND off_t 
  109.    in this header file, and to handle this in the BFD implementation
  110.    rather than in its interface.  */
  111. /* typedef off_t    file_ptr; */
  112. typedef long int file_ptr;
  113.  
  114. /* Support for different sizes of target format ints and addresses.
  115.    If the type `long' is at least 64 bits, BFD_HOST_64BIT_LONG will be
  116.    set to 1 above.  Otherwise, if gcc is being used, this code will
  117.    use gcc's "long long" type.  Otherwise, the compilation will fail
  118.    if 64-bit targets are requested.  */
  119.  
  120. #ifdef BFD64
  121.  
  122. #ifndef BFD_HOST_64_BIT
  123. #if BFD_HOST_64BIT_LONG
  124. #define BFD_HOST_64_BIT long
  125. #else
  126. #ifdef __GNUC__
  127. #define BFD_HOST_64_BIT long long
  128. #else /* ! defined (__GNUC__) */
  129.  #error No 64 bit integer type available
  130. #endif /* ! defined (__GNUC__) */
  131. #endif /* ! BFD_HOST_64BIT_LONG */
  132. #endif /* ! defined (BFD_HOST_64_BIT) */
  133.  
  134. typedef unsigned BFD_HOST_64_BIT bfd_vma;
  135. typedef BFD_HOST_64_BIT bfd_signed_vma;
  136. typedef unsigned BFD_HOST_64_BIT bfd_size_type;
  137. typedef unsigned BFD_HOST_64_BIT symvalue;
  138.  
  139. #ifndef fprintf_vma
  140. #if BFD_HOST_64BIT_LONG
  141. #define sprintf_vma(s,x) sprintf (s, "%016lx", x)
  142. #define fprintf_vma(f,x) fprintf (f, "%016lx", x)
  143. #else
  144. #define _bfd_int64_low(x) ((unsigned long) (((x) & 0xffffffff)))
  145. #define _bfd_int64_high(x) ((unsigned long) (((x) >> 32) & 0xffffffff))
  146. #define fprintf_vma(s,x) \
  147.   fprintf ((s), "%08lx%08lx", _bfd_int64_high (x), _bfd_int64_low (x))
  148. #define sprintf_vma(s,x) \
  149.   sprintf ((s), "%08lx%08lx", _bfd_int64_high (x), _bfd_int64_low (x))
  150. #endif
  151. #endif
  152.  
  153. #else /* not BFD64  */
  154.  
  155. /* Represent a target address.  Also used as a generic unsigned type
  156.    which is guaranteed to be big enough to hold any arithmetic types
  157.    we need to deal with.  */
  158. typedef unsigned long bfd_vma;
  159.  
  160. /* A generic signed type which is guaranteed to be big enough to hold any
  161.    arithmetic types we need to deal with.  Can be assumed to be compatible
  162.    with bfd_vma in the same way that signed and unsigned ints are compatible
  163.    (as parameters, in assignment, etc).  */
  164. typedef long bfd_signed_vma;
  165.  
  166. typedef unsigned long symvalue;
  167. typedef unsigned long bfd_size_type;
  168.  
  169. /* Print a bfd_vma x on stream s.  */
  170. #define fprintf_vma(s,x) fprintf(s, "%08lx", x)
  171. #define sprintf_vma(s,x) sprintf(s, "%08lx", x)
  172. #endif /* not BFD64  */
  173. #define printf_vma(x) fprintf_vma(stdout,x)
  174.  
  175. typedef unsigned int flagword;    /* 32 bits of flags */
  176. typedef unsigned char bfd_byte;
  177.  
  178. /** File formats */
  179.  
  180. typedef enum bfd_format {
  181.           bfd_unknown = 0,    /* file format is unknown */
  182.           bfd_object,    /* linker/assember/compiler output */
  183.           bfd_archive,    /* object archive file */
  184.           bfd_core,        /* core dump */
  185.           bfd_type_end}    /* marks the end; don't use it! */
  186.          bfd_format;
  187.  
  188. /* Values that may appear in the flags field of a BFD.  These also
  189.    appear in the object_flags field of the bfd_target structure, where
  190.    they indicate the set of flags used by that backend (not all flags
  191.    are meaningful for all object file formats) (FIXME: at the moment,
  192.    the object_flags values have mostly just been copied from backend
  193.    to another, and are not necessarily correct).  */
  194.  
  195. /* No flags.  */
  196. #define NO_FLAGS        0x00
  197.  
  198. /* BFD contains relocation entries.  */
  199. #define HAS_RELOC       0x01
  200.  
  201. /* BFD is directly executable.  */
  202. #define EXEC_P          0x02
  203.  
  204. /* BFD has line number information (basically used for F_LNNO in a
  205.    COFF header).  */
  206. #define HAS_LINENO      0x04
  207.  
  208. /* BFD has debugging information.  */
  209. #define HAS_DEBUG       0x08
  210.  
  211. /* BFD has symbols.  */
  212. #define HAS_SYMS        0x10
  213.  
  214. /* BFD has local symbols (basically used for F_LSYMS in a COFF
  215.    header).  */
  216. #define HAS_LOCALS      0x20
  217.  
  218. /* BFD is a dynamic object.  */
  219. #define DYNAMIC         0x40
  220.  
  221. /* Text section is write protected (if D_PAGED is not set, this is
  222.    like an a.out NMAGIC file) (the linker sets this by default, but
  223.    clears it for -r or -N).  */
  224. #define WP_TEXT         0x80
  225.  
  226. /* BFD is dynamically paged (this is like an a.out ZMAGIC file) (the
  227.    linker sets this by default, but clears it for -r or -n or -N).  */
  228. #define D_PAGED         0x100
  229.  
  230. /* BFD is relaxable (this means that bfd_relax_section may be able to
  231.    do something) (sometimes bfd_relax_section can do something even if
  232.    this is not set).  */
  233. #define BFD_IS_RELAXABLE 0x200
  234.  
  235. /* This may be set before writing out a BFD to request using a
  236.    traditional format.  For example, this is used to request that when
  237.    writing out an a.out object the symbols not be hashed to eliminate
  238.    duplicates.  */
  239. #define BFD_TRADITIONAL_FORMAT 0x400
  240.  
  241. /* This flag indicates that the BFD contents are actually cached in
  242.    memory.  If this is set, iostream points to a bfd_in_memory struct.  */
  243. #define BFD_IN_MEMORY 0x800
  244.  
  245. /* symbols and relocation */
  246.  
  247. /* A count of carsyms (canonical archive symbols).  */
  248. typedef unsigned long symindex;
  249.  
  250. /* How to perform a relocation.  */
  251. typedef const struct reloc_howto_struct reloc_howto_type;
  252.  
  253. #define BFD_NO_MORE_SYMBOLS ((symindex) ~0)
  254.  
  255. /* General purpose part of a symbol X;
  256.    target specific parts are in libcoff.h, libaout.h, etc.  */
  257.  
  258. #define bfd_get_section(x) ((x)->section)
  259. #define bfd_get_output_section(x) ((x)->section->output_section)
  260. #define bfd_set_section(x,y) ((x)->section) = (y)
  261. #define bfd_asymbol_base(x) ((x)->section->vma)
  262. #define bfd_asymbol_value(x) (bfd_asymbol_base(x) + (x)->value)
  263. #define bfd_asymbol_name(x) ((x)->name)
  264. /*Perhaps future: #define bfd_asymbol_bfd(x) ((x)->section->owner)*/
  265. #define bfd_asymbol_bfd(x) ((x)->the_bfd)
  266. #define bfd_asymbol_flavour(x) (bfd_asymbol_bfd(x)->xvec->flavour)
  267.  
  268. /* A canonical archive symbol.  */
  269. /* This is a type pun with struct ranlib on purpose! */
  270. typedef struct carsym {
  271.   char *name;
  272.   file_ptr file_offset;        /* look here to find the file */
  273. } carsym;            /* to make these you call a carsymogen */
  274.  
  275.   
  276. /* Used in generating armaps (archive tables of contents).
  277.    Perhaps just a forward definition would do? */
  278. struct orl {            /* output ranlib */
  279.   char **name;            /* symbol name */ 
  280.   file_ptr pos;            /* bfd* or file position */
  281.   int namidx;            /* index into string table */
  282. };
  283.  
  284.  
  285. /* Linenumber stuff */
  286. typedef struct lineno_cache_entry {
  287.   unsigned int line_number;    /* Linenumber from start of function*/  
  288.   union {
  289.     struct symbol_cache_entry *sym; /* Function name */
  290.     unsigned long offset;    /* Offset into section */
  291.   } u;
  292. } alent;
  293.  
  294. /* object and core file sections */
  295.  
  296. #define    align_power(addr, align)    \
  297.     ( ((addr) + ((1<<(align))-1)) & (-1 << (align)))
  298.  
  299. typedef struct sec *sec_ptr;
  300.  
  301. #define bfd_get_section_name(bfd, ptr) ((ptr)->name + 0)
  302. #define bfd_get_section_vma(bfd, ptr) ((ptr)->vma + 0)
  303. #define bfd_get_section_alignment(bfd, ptr) ((ptr)->alignment_power + 0)
  304. #define bfd_section_name(bfd, ptr) ((ptr)->name)
  305. #define bfd_section_size(bfd, ptr) (bfd_get_section_size_before_reloc(ptr))
  306. #define bfd_section_vma(bfd, ptr) ((ptr)->vma)
  307. #define bfd_section_alignment(bfd, ptr) ((ptr)->alignment_power)
  308. #define bfd_get_section_flags(bfd, ptr) ((ptr)->flags + 0)
  309. #define bfd_get_section_userdata(bfd, ptr) ((ptr)->userdata)
  310.  
  311. #define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0)
  312.  
  313. #define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma= (val)), ((ptr)->user_set_vma = (boolean)true), true)
  314. #define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),true)
  315. #define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),true)
  316.  
  317. typedef struct stat stat_type; 
  318.  
  319. typedef enum bfd_print_symbol
  320.   bfd_print_symbol_name,
  321.   bfd_print_symbol_more,
  322.   bfd_print_symbol_all
  323. } bfd_print_symbol_type;
  324.     
  325. /* Information about a symbol that nm needs.  */
  326.  
  327. typedef struct _symbol_info
  328. {
  329.   symvalue value;
  330.   char type;
  331.   CONST char *name;            /* Symbol name.  */
  332.   unsigned char stab_type;     /* Stab type.  */
  333.   char stab_other;             /* Stab other. */
  334.   short stab_desc;             /* Stab desc.  */
  335.   CONST char *stab_name;       /* String for stab type.  */
  336. } symbol_info;
  337.  
  338. /* Get the name of a stabs type code.  */
  339.  
  340. extern const char *bfd_get_stab_name PARAMS ((int));
  341.  
  342. /* Hash table routines.  There is no way to free up a hash table.  */
  343.  
  344. /* An element in the hash table.  Most uses will actually use a larger
  345.    structure, and an instance of this will be the first field.  */
  346.  
  347. struct bfd_hash_entry
  348. {
  349.   /* Next entry for this hash code.  */
  350.   struct bfd_hash_entry *next;
  351.   /* String being hashed.  */
  352.   const char *string;
  353.   /* Hash code.  This is the full hash code, not the index into the
  354.      table.  */
  355.   unsigned long hash;
  356. };
  357.  
  358. /* A hash table.  */
  359.  
  360. struct bfd_hash_table
  361. {
  362.   /* The hash array.  */
  363.   struct bfd_hash_entry **table;
  364.   /* The number of slots in the hash table.  */
  365.   unsigned int size;
  366.   /* A function used to create new elements in the hash table.  The
  367.      first entry is itself a pointer to an element.  When this
  368.      function is first invoked, this pointer will be NULL.  However,
  369.      having the pointer permits a hierarchy of method functions to be
  370.      built each of which calls the function in the superclass.  Thus
  371.      each function should be written to allocate a new block of memory
  372.      only if the argument is NULL.  */
  373.   struct bfd_hash_entry *(*newfunc) PARAMS ((struct bfd_hash_entry *,
  374.                          struct bfd_hash_table *,
  375.                          const char *));
  376.   /* An obstack for this hash table.  */
  377.   struct obstack memory;
  378. };
  379.  
  380. /* Initialize a hash table.  */
  381. extern boolean bfd_hash_table_init
  382.   PARAMS ((struct bfd_hash_table *,
  383.        struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
  384.                        struct bfd_hash_table *,
  385.                        const char *)));
  386.  
  387. /* Initialize a hash table specifying a size.  */
  388. extern boolean bfd_hash_table_init_n
  389.   PARAMS ((struct bfd_hash_table *,
  390.        struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
  391.                        struct bfd_hash_table *,
  392.                        const char *),
  393.        unsigned int size));
  394.  
  395. /* Free up a hash table.  */
  396. extern void bfd_hash_table_free PARAMS ((struct bfd_hash_table *));
  397.  
  398. /* Look up a string in a hash table.  If CREATE is true, a new entry
  399.    will be created for this string if one does not already exist.  The
  400.    COPY argument must be true if this routine should copy the string
  401.    into newly allocated memory when adding an entry.  */
  402. extern struct bfd_hash_entry *bfd_hash_lookup
  403.   PARAMS ((struct bfd_hash_table *, const char *, boolean create,
  404.        boolean copy));
  405.  
  406. /* Replace an entry in a hash table.  */
  407. extern void bfd_hash_replace
  408.   PARAMS ((struct bfd_hash_table *, struct bfd_hash_entry *old,
  409.        struct bfd_hash_entry *nw));
  410.  
  411. /* Base method for creating a hash table entry.  */
  412. extern struct bfd_hash_entry *bfd_hash_newfunc
  413.   PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *,
  414.        const char *));
  415.  
  416. /* Grab some space for a hash table entry.  */
  417. extern PTR bfd_hash_allocate PARAMS ((struct bfd_hash_table *,
  418.                       unsigned int));
  419.  
  420. /* Traverse a hash table in a random order, calling a function on each
  421.    element.  If the function returns false, the traversal stops.  The
  422.    INFO argument is passed to the function.  */
  423. extern void bfd_hash_traverse PARAMS ((struct bfd_hash_table *,
  424.                        boolean (*) (struct bfd_hash_entry *,
  425.                             PTR),
  426.                        PTR info));
  427.  
  428. /* Semi-portable string concatenation in cpp.
  429.    The CAT4 hack is to avoid a problem with some strict ANSI C preprocessors.
  430.    The problem is, "32_" is not a valid preprocessing token, and we don't
  431.    want extra underscores (e.g., "nlm_32_").  The XCAT2 macro will cause the
  432.    inner CAT macros to be evaluated first, producing still-valid pp-tokens.
  433.    Then the final concatenation can be done.  (Sigh.)  */
  434. #ifndef CAT
  435. #ifdef SABER
  436. #define CAT(a,b)    a##b
  437. #define CAT3(a,b,c)    a##b##c
  438. #define CAT4(a,b,c,d)    a##b##c##d
  439. #else
  440. #if defined(__STDC__) || defined(ALMOST_STDC)
  441. #define CAT(a,b) a##b
  442. #define CAT3(a,b,c) a##b##c
  443. #define XCAT2(a,b)    CAT(a,b)
  444. #define CAT4(a,b,c,d)    XCAT2(CAT(a,b),CAT(c,d))
  445. #else
  446. #define CAT(a,b) a/**/b
  447. #define CAT3(a,b,c) a/**/b/**/c
  448. #define CAT4(a,b,c,d)    a/**/b/**/c/**/d
  449. #endif
  450. #endif
  451. #endif
  452.  
  453. #define COFF_SWAP_TABLE (PTR) &bfd_coff_std_swap_table
  454.  
  455. /* User program access to BFD facilities */
  456.  
  457. /* Direct I/O routines, for programs which know more about the object
  458.    file than BFD does.  Use higher level routines if possible.  */
  459.  
  460. extern bfd_size_type bfd_read
  461.   PARAMS ((PTR, bfd_size_type size, bfd_size_type nitems, bfd *abfd));
  462. extern bfd_size_type bfd_write
  463.   PARAMS ((const PTR, bfd_size_type size, bfd_size_type nitems, bfd *abfd));
  464. extern int bfd_seek PARAMS ((bfd *abfd, file_ptr fp, int direction));
  465. extern long bfd_tell PARAMS ((bfd *abfd));
  466. extern int bfd_flush PARAMS ((bfd *abfd));
  467. extern int bfd_stat PARAMS ((bfd *abfd, struct stat *));
  468.  
  469.  
  470. /* Cast from const char * to char * so that caller can assign to
  471.    a char * without a warning.  */
  472. #define bfd_get_filename(abfd) ((char *) (abfd)->filename)
  473. #define bfd_get_cacheable(abfd) ((abfd)->cacheable)
  474. #define bfd_get_format(abfd) ((abfd)->format)
  475. #define bfd_get_target(abfd) ((abfd)->xvec->name)
  476. #define bfd_get_flavour(abfd) ((abfd)->xvec->flavour)
  477. #define bfd_big_endian(abfd) ((abfd)->xvec->byteorder == BFD_ENDIAN_BIG)
  478. #define bfd_little_endian(abfd) ((abfd)->xvec->byteorder == BFD_ENDIAN_LITTLE)
  479. #define bfd_header_big_endian(abfd) \
  480.   ((abfd)->xvec->header_byteorder == BFD_ENDIAN_BIG)
  481. #define bfd_header_little_endian(abfd) \
  482.   ((abfd)->xvec->header_byteorder == BFD_ENDIAN_LITTLE)
  483. #define bfd_get_file_flags(abfd) ((abfd)->flags)
  484. #define bfd_applicable_file_flags(abfd) ((abfd)->xvec->object_flags)
  485. #define bfd_applicable_section_flags(abfd) ((abfd)->xvec->section_flags)
  486. #define bfd_my_archive(abfd) ((abfd)->my_archive)
  487. #define bfd_has_map(abfd) ((abfd)->has_armap)
  488.  
  489. #define bfd_valid_reloc_types(abfd) ((abfd)->xvec->valid_reloc_types)
  490. #define bfd_usrdata(abfd) ((abfd)->usrdata)
  491.  
  492. #define bfd_get_start_address(abfd) ((abfd)->start_address)
  493. #define bfd_get_symcount(abfd) ((abfd)->symcount)
  494. #define bfd_get_outsymbols(abfd) ((abfd)->outsymbols)
  495. #define bfd_count_sections(abfd) ((abfd)->section_count)
  496.  
  497. #define bfd_get_symbol_leading_char(abfd) ((abfd)->xvec->symbol_leading_char)
  498.  
  499. #define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = (boolean)(bool)), true)
  500.  
  501. extern boolean bfd_record_phdr
  502.   PARAMS ((bfd *, unsigned long, boolean, flagword, boolean, bfd_vma,
  503.        boolean, boolean, unsigned int, struct sec **));
  504.  
  505. /* Byte swapping routines.  */
  506.  
  507. bfd_vma        bfd_getb64       PARAMS ((const unsigned char *));
  508. bfd_vma     bfd_getl64       PARAMS ((const unsigned char *));
  509. bfd_signed_vma    bfd_getb_signed_64 PARAMS ((const unsigned char *));
  510. bfd_signed_vma    bfd_getl_signed_64 PARAMS ((const unsigned char *));
  511. bfd_vma        bfd_getb32       PARAMS ((const unsigned char *));
  512. bfd_vma        bfd_getl32       PARAMS ((const unsigned char *));
  513. bfd_signed_vma    bfd_getb_signed_32 PARAMS ((const unsigned char *));
  514. bfd_signed_vma    bfd_getl_signed_32 PARAMS ((const unsigned char *));
  515. bfd_vma        bfd_getb16       PARAMS ((const unsigned char *));
  516. bfd_vma        bfd_getl16       PARAMS ((const unsigned char *));
  517. bfd_signed_vma    bfd_getb_signed_16 PARAMS ((const unsigned char *));
  518. bfd_signed_vma    bfd_getl_signed_16 PARAMS ((const unsigned char *));
  519. void        bfd_putb64       PARAMS ((bfd_vma, unsigned char *));
  520. void        bfd_putl64       PARAMS ((bfd_vma, unsigned char *));
  521. void        bfd_putb32       PARAMS ((bfd_vma, unsigned char *));
  522. void        bfd_putl32       PARAMS ((bfd_vma, unsigned char *));
  523. void        bfd_putb16       PARAMS ((bfd_vma, unsigned char *));
  524. void        bfd_putl16       PARAMS ((bfd_vma, unsigned char *));
  525.  
  526. /* Externally visible ECOFF routines.  */
  527.  
  528. #if defined(__STDC__) || defined(ALMOST_STDC)
  529. struct ecoff_debug_info;
  530. struct ecoff_debug_swap;
  531. struct ecoff_extr;
  532. struct symbol_cache_entry;
  533. struct bfd_link_info;
  534. struct bfd_link_hash_entry;
  535. #endif
  536. extern bfd_vma bfd_ecoff_get_gp_value PARAMS ((bfd * abfd));
  537. extern boolean bfd_ecoff_set_gp_value PARAMS ((bfd *abfd, bfd_vma gp_value));
  538. extern boolean bfd_ecoff_set_regmasks
  539.   PARAMS ((bfd *abfd, unsigned long gprmask, unsigned long fprmask,
  540.        unsigned long *cprmask));
  541. extern PTR bfd_ecoff_debug_init
  542.   PARAMS ((bfd *output_bfd, struct ecoff_debug_info *output_debug,
  543.        const struct ecoff_debug_swap *output_swap,
  544.        struct bfd_link_info *));
  545. extern void bfd_ecoff_debug_free
  546.   PARAMS ((PTR handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
  547.        const struct ecoff_debug_swap *output_swap,
  548.        struct bfd_link_info *));
  549. extern boolean bfd_ecoff_debug_accumulate
  550.   PARAMS ((PTR handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
  551.        const struct ecoff_debug_swap *output_swap,
  552.        bfd *input_bfd, struct ecoff_debug_info *input_debug,
  553.        const struct ecoff_debug_swap *input_swap,
  554.        struct bfd_link_info *));
  555. extern boolean bfd_ecoff_debug_accumulate_other
  556.   PARAMS ((PTR handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
  557.        const struct ecoff_debug_swap *output_swap, bfd *input_bfd,
  558.        struct bfd_link_info *));
  559. extern boolean bfd_ecoff_debug_externals
  560.   PARAMS ((bfd *abfd, struct ecoff_debug_info *debug,
  561.        const struct ecoff_debug_swap *swap,
  562.        boolean relocateable,
  563.        boolean (*get_extr) (struct symbol_cache_entry *,
  564.                 struct ecoff_extr *),
  565.        void (*set_index) (struct symbol_cache_entry *,
  566.                   bfd_size_type)));
  567. extern boolean bfd_ecoff_debug_one_external
  568.   PARAMS ((bfd *abfd, struct ecoff_debug_info *debug,
  569.        const struct ecoff_debug_swap *swap,
  570.        const char *name, struct ecoff_extr *esym));
  571. extern bfd_size_type bfd_ecoff_debug_size
  572.   PARAMS ((bfd *abfd, struct ecoff_debug_info *debug,
  573.        const struct ecoff_debug_swap *swap));
  574. extern boolean bfd_ecoff_write_debug
  575.   PARAMS ((bfd *abfd, struct ecoff_debug_info *debug,
  576.        const struct ecoff_debug_swap *swap, file_ptr where));
  577. extern boolean bfd_ecoff_write_accumulated_debug
  578.   PARAMS ((PTR handle, bfd *abfd, struct ecoff_debug_info *debug,
  579.        const struct ecoff_debug_swap *swap,
  580.        struct bfd_link_info *info, file_ptr where));
  581. extern boolean bfd_mips_ecoff_create_embedded_relocs
  582.   PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *,
  583.        char **));
  584.  
  585. /* Externally visible ELF routines.  */
  586.  
  587. struct bfd_link_needed_list
  588. {
  589.   struct bfd_link_needed_list *next;
  590.   bfd *by;
  591.   const char *name;
  592. };
  593.  
  594. extern boolean bfd_elf32_record_link_assignment
  595.   PARAMS ((bfd *, struct bfd_link_info *, const char *, boolean));
  596. extern boolean bfd_elf64_record_link_assignment
  597.   PARAMS ((bfd *, struct bfd_link_info *, const char *, boolean));
  598. extern struct bfd_link_needed_list *bfd_elf_get_needed_list
  599.   PARAMS ((bfd *, struct bfd_link_info *));
  600. extern boolean bfd_elf32_size_dynamic_sections
  601.   PARAMS ((bfd *, const char *, const char *, boolean,
  602.        struct bfd_link_info *, struct sec **));
  603. extern boolean bfd_elf64_size_dynamic_sections
  604.   PARAMS ((bfd *, const char *, const char *, boolean,
  605.        struct bfd_link_info *, struct sec **));
  606. extern void bfd_elf_set_dt_needed_name PARAMS ((bfd *, const char *));
  607. extern const char *bfd_elf_get_dt_soname PARAMS ((bfd *));
  608.  
  609. /* SunOS shared library support routines for the linker.  */
  610.  
  611. extern struct bfd_link_needed_list *bfd_sunos_get_needed_list
  612.   PARAMS ((bfd *, struct bfd_link_info *));
  613. extern boolean bfd_sunos_record_link_assignment
  614.   PARAMS ((bfd *, struct bfd_link_info *, const char *));
  615. extern boolean bfd_sunos_size_dynamic_sections
  616.   PARAMS ((bfd *, struct bfd_link_info *, struct sec **, struct sec **,
  617.        struct sec **));
  618.  
  619. /* Linux shared library support routines for the linker.  */
  620.  
  621. extern boolean bfd_i386linux_size_dynamic_sections
  622.   PARAMS ((bfd *, struct bfd_link_info *));
  623. extern boolean bfd_m68klinux_size_dynamic_sections
  624.   PARAMS ((bfd *, struct bfd_link_info *));
  625.  
  626. /* mmap hacks */
  627.  
  628. struct _bfd_window_internal;
  629. typedef struct _bfd_window_internal bfd_window_internal;
  630.  
  631. typedef struct _bfd_window {
  632.   /* What the user asked for.  */
  633.   PTR data;
  634.   bfd_size_type size;
  635.   /* The actual window used by BFD.  Small user-requested read-only
  636.      regions sharing a page may share a single window into the object
  637.      file.  Read-write versions shouldn't until I've fixed things to
  638.      keep track of which portions have been claimed by the
  639.      application; don't want to give the same region back when the
  640.      application wants two writable copies!  */
  641.   struct _bfd_window_internal *i;
  642. } bfd_window;
  643.  
  644. extern void bfd_init_window PARAMS ((bfd_window *));
  645. extern void bfd_free_window PARAMS ((bfd_window *));
  646. extern boolean bfd_get_file_window
  647.   PARAMS ((bfd *, file_ptr, bfd_size_type, bfd_window *, boolean));
  648.  
  649. /* XCOFF support routines for the linker.  */
  650.  
  651. extern boolean bfd_xcoff_link_record_set
  652.   PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *,
  653.        bfd_size_type));
  654. extern boolean bfd_xcoff_import_symbol
  655.   PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *,
  656.        bfd_vma, const char *, const char *, const char *));
  657. extern boolean bfd_xcoff_export_symbol
  658.   PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *,
  659.        boolean));
  660. extern boolean bfd_xcoff_link_count_reloc
  661.   PARAMS ((bfd *, struct bfd_link_info *, const char *));
  662. extern boolean bfd_xcoff_record_link_assignment
  663.   PARAMS ((bfd *, struct bfd_link_info *, const char *));
  664. extern boolean bfd_xcoff_size_dynamic_sections
  665.   PARAMS ((bfd *, struct bfd_link_info *, const char *, const char *,
  666.        unsigned long, unsigned long, unsigned long, boolean,
  667.        int, boolean, boolean, struct sec **));
  668.  
  669. /* Externally visible COFF routines.  */
  670.  
  671. #if defined(__STDC__) || defined(ALMOST_STDC)
  672. struct internal_syment;
  673. union internal_auxent;
  674. #endif
  675.  
  676. extern boolean bfd_coff_get_syment
  677.   PARAMS ((bfd *, struct symbol_cache_entry *, struct internal_syment *));
  678. extern boolean bfd_coff_get_auxent
  679.   PARAMS ((bfd *, struct symbol_cache_entry *, int, union internal_auxent *));
  680.  
  681. /* And more from the source.  */
  682. void 
  683. bfd_init PARAMS ((void));
  684.  
  685. bfd *
  686. bfd_openr PARAMS ((CONST char *filename, CONST char *target));
  687.  
  688. bfd *
  689. bfd_fdopenr PARAMS ((CONST char *filename, CONST char *target, int fd));
  690.  
  691. bfd *
  692. bfd_openstreamr PARAMS (());
  693.  
  694. bfd *
  695. bfd_openw PARAMS ((CONST char *filename, CONST char *target));
  696.  
  697. boolean 
  698. bfd_close PARAMS ((bfd *abfd));
  699.  
  700. boolean 
  701. bfd_close_all_done PARAMS ((bfd *));
  702.  
  703. bfd_size_type 
  704. bfd_alloc_size PARAMS ((bfd *abfd));
  705.  
  706. bfd *
  707. bfd_create PARAMS ((CONST char *filename, bfd *templ));
  708.  
  709.  
  710.  /* Byte swapping macros for user section data.  */
  711.  
  712. #define bfd_put_8(abfd, val, ptr) \
  713.                 (*((unsigned char *)(ptr)) = (unsigned char)(val))
  714. #define bfd_put_signed_8 \
  715.         bfd_put_8
  716. #define bfd_get_8(abfd, ptr) \
  717.                 (*(unsigned char *)(ptr))
  718. #define bfd_get_signed_8(abfd, ptr) \
  719.         ((*(unsigned char *)(ptr) ^ 0x80) - 0x80)
  720.  
  721. #define bfd_put_16(abfd, val, ptr) \
  722.                 BFD_SEND(abfd, bfd_putx16, ((val),(ptr)))
  723. #define bfd_put_signed_16 \
  724.          bfd_put_16
  725. #define bfd_get_16(abfd, ptr) \
  726.                 BFD_SEND(abfd, bfd_getx16, (ptr))
  727. #define bfd_get_signed_16(abfd, ptr) \
  728.               BFD_SEND (abfd, bfd_getx_signed_16, (ptr))
  729.  
  730. #define bfd_put_32(abfd, val, ptr) \
  731.                 BFD_SEND(abfd, bfd_putx32, ((val),(ptr)))
  732. #define bfd_put_signed_32 \
  733.          bfd_put_32
  734. #define bfd_get_32(abfd, ptr) \
  735.                 BFD_SEND(abfd, bfd_getx32, (ptr))
  736. #define bfd_get_signed_32(abfd, ptr) \
  737.          BFD_SEND(abfd, bfd_getx_signed_32, (ptr))
  738.  
  739. #define bfd_put_64(abfd, val, ptr) \
  740.                 BFD_SEND(abfd, bfd_putx64, ((val), (ptr)))
  741. #define bfd_put_signed_64 \
  742.          bfd_put_64
  743. #define bfd_get_64(abfd, ptr) \
  744.                 BFD_SEND(abfd, bfd_getx64, (ptr))
  745. #define bfd_get_signed_64(abfd, ptr) \
  746.          BFD_SEND(abfd, bfd_getx_signed_64, (ptr))
  747.  
  748.  
  749.  /* Byte swapping macros for file header data.  */
  750.  
  751. #define bfd_h_put_8(abfd, val, ptr) \
  752.         bfd_put_8 (abfd, val, ptr)
  753. #define bfd_h_put_signed_8(abfd, val, ptr) \
  754.         bfd_put_8 (abfd, val, ptr)
  755. #define bfd_h_get_8(abfd, ptr) \
  756.         bfd_get_8 (abfd, ptr)
  757. #define bfd_h_get_signed_8(abfd, ptr) \
  758.         bfd_get_signed_8 (abfd, ptr)
  759.  
  760. #define bfd_h_put_16(abfd, val, ptr) \
  761.                 BFD_SEND(abfd, bfd_h_putx16,(val,ptr))
  762. #define bfd_h_put_signed_16 \
  763.          bfd_h_put_16
  764. #define bfd_h_get_16(abfd, ptr) \
  765.                 BFD_SEND(abfd, bfd_h_getx16,(ptr))
  766. #define bfd_h_get_signed_16(abfd, ptr) \
  767.          BFD_SEND(abfd, bfd_h_getx_signed_16, (ptr))
  768.  
  769. #define bfd_h_put_32(abfd, val, ptr) \
  770.                 BFD_SEND(abfd, bfd_h_putx32,(val,ptr))
  771. #define bfd_h_put_signed_32 \
  772.          bfd_h_put_32
  773. #define bfd_h_get_32(abfd, ptr) \
  774.                 BFD_SEND(abfd, bfd_h_getx32,(ptr))
  775. #define bfd_h_get_signed_32(abfd, ptr) \
  776.          BFD_SEND(abfd, bfd_h_getx_signed_32, (ptr))
  777.  
  778. #define bfd_h_put_64(abfd, val, ptr) \
  779.                 BFD_SEND(abfd, bfd_h_putx64,(val, ptr))
  780. #define bfd_h_put_signed_64 \
  781.          bfd_h_put_64
  782. #define bfd_h_get_64(abfd, ptr) \
  783.                 BFD_SEND(abfd, bfd_h_getx64,(ptr))
  784. #define bfd_h_get_signed_64(abfd, ptr) \
  785.          BFD_SEND(abfd, bfd_h_getx_signed_64, (ptr))
  786.  
  787. typedef struct sec
  788. {
  789.          /* The name of the section; the name isn't a copy, the pointer is
  790.         the same as that passed to bfd_make_section. */
  791.  
  792.     CONST char *name;
  793.  
  794.          /* Which section is it; 0..nth.      */
  795.  
  796.    int index;
  797.  
  798.          /* The next section in the list belonging to the BFD, or NULL. */
  799.  
  800.     struct sec *next;
  801.  
  802.          /* The field flags contains attributes of the section. Some
  803.            flags are read in from the object file, and some are
  804.            synthesized from other information.  */
  805.  
  806.     flagword flags;
  807.  
  808. #define SEC_NO_FLAGS   0x000
  809.  
  810.          /* Tells the OS to allocate space for this section when loading.
  811.            This is clear for a section containing debug information
  812.            only. */
  813. #define SEC_ALLOC      0x001
  814.  
  815.          /* Tells the OS to load the section from the file when loading.
  816.            This is clear for a .bss section. */
  817. #define SEC_LOAD       0x002
  818.  
  819.          /* The section contains data still to be relocated, so there is
  820.            some relocation information too. */
  821. #define SEC_RELOC      0x004
  822.  
  823. #if 0    /* Obsolete ? */
  824. #define SEC_BALIGN     0x008
  825. #endif
  826.  
  827.          /* A signal to the OS that the section contains read only
  828.           data. */
  829. #define SEC_READONLY   0x010
  830.  
  831.          /* The section contains code only. */
  832. #define SEC_CODE       0x020
  833.  
  834.          /* The section contains data only. */
  835. #define SEC_DATA       0x040
  836.  
  837.          /* The section will reside in ROM. */
  838. #define SEC_ROM        0x080
  839.  
  840.          /* The section contains constructor information. This section
  841.            type is used by the linker to create lists of constructors and
  842.            destructors used by <<g++>>. When a back end sees a symbol
  843.            which should be used in a constructor list, it creates a new
  844.            section for the type of name (e.g., <<__CTOR_LIST__>>), attaches
  845.            the symbol to it, and builds a relocation. To build the lists
  846.            of constructors, all the linker has to do is catenate all the
  847.            sections called <<__CTOR_LIST__>> and relocate the data
  848.            contained within - exactly the operations it would peform on
  849.            standard data. */
  850. #define SEC_CONSTRUCTOR 0x100
  851.  
  852.          /* The section is a constuctor, and should be placed at the
  853.           end of the text, data, or bss section(?). */
  854. #define SEC_CONSTRUCTOR_TEXT 0x1100
  855. #define SEC_CONSTRUCTOR_DATA 0x2100
  856. #define SEC_CONSTRUCTOR_BSS  0x3100
  857.  
  858.          /* The section has contents - a data section could be
  859.            <<SEC_ALLOC>> | <<SEC_HAS_CONTENTS>>; a debug section could be
  860.            <<SEC_HAS_CONTENTS>> */
  861. #define SEC_HAS_CONTENTS 0x200
  862.  
  863.          /* An instruction to the linker to not output the section
  864.            even if it has information which would normally be written. */
  865. #define SEC_NEVER_LOAD 0x400
  866.  
  867.          /* The section is a COFF shared library section.  This flag is
  868.            only for the linker.  If this type of section appears in
  869.            the input file, the linker must copy it to the output file
  870.            without changing the vma or size.  FIXME: Although this
  871.            was originally intended to be general, it really is COFF
  872.            specific (and the flag was renamed to indicate this).  It
  873.            might be cleaner to have some more general mechanism to
  874.            allow the back end to control what the linker does with
  875.            sections. */
  876. #define SEC_COFF_SHARED_LIBRARY 0x800
  877.  
  878.          /* The section contains common symbols (symbols may be defined
  879.            multiple times, the value of a symbol is the amount of
  880.            space it requires, and the largest symbol value is the one
  881.            used).  Most targets have exactly one of these (which we
  882.         translate to bfd_com_section_ptr), but ECOFF has two. */
  883. #define SEC_IS_COMMON 0x8000
  884.  
  885.          /* The section contains only debugging information.  For
  886.            example, this is set for ELF .debug and .stab sections.
  887.            strip tests this flag to see if a section can be
  888.            discarded. */
  889. #define SEC_DEBUGGING 0x10000
  890.  
  891.          /* The contents of this section are held in memory pointed to
  892.            by the contents field.  This is checked by
  893.            bfd_get_section_contents, and the data is retrieved from
  894.            memory if appropriate.  */
  895. #define SEC_IN_MEMORY 0x20000
  896.  
  897.          /* The contents of this section are to be excluded by the
  898.         linker for executable and shared objects unless those
  899.         objects are to be further relocated.  */
  900. #define SEC_EXCLUDE 0x40000
  901.  
  902.      /* The contents of this section are to be sorted by the
  903.        based on the address specified in the associated symbol
  904.        table.  */
  905. #define SEC_SORT_ENTRIES 0x80000
  906.  
  907.      /* When linking, duplicate sections of the same name should be
  908.        discarded, rather than being combined into a single section as
  909.        is usually done.  This is similar to how common symbols are
  910.        handled.  See SEC_LINK_DUPLICATES below.  */
  911. #define SEC_LINK_ONCE 0x100000
  912.  
  913.      /* If SEC_LINK_ONCE is set, this bitfield describes how the linker
  914.        should handle duplicate sections.  */
  915. #define SEC_LINK_DUPLICATES 0x600000
  916.  
  917.      /* This value for SEC_LINK_DUPLICATES means that duplicate
  918.        sections with the same name should simply be discarded. */
  919. #define SEC_LINK_DUPLICATES_DISCARD 0x0
  920.  
  921.      /* This value for SEC_LINK_DUPLICATES means that the linker
  922.        should warn if there are any duplicate sections, although
  923.        it should still only link one copy.  */
  924. #define SEC_LINK_DUPLICATES_ONE_ONLY 0x200000
  925.  
  926.      /* This value for SEC_LINK_DUPLICATES means that the linker
  927.        should warn if any duplicate sections are a different size.  */
  928. #define SEC_LINK_DUPLICATES_SAME_SIZE 0x400000
  929.  
  930.      /* This value for SEC_LINK_DUPLICATES means that the linker
  931.        should warn if any duplicate sections contain different
  932.        contents.  */
  933. #define SEC_LINK_DUPLICATES_SAME_CONTENTS 0x600000
  934.  
  935.      /*  End of section flags.  */
  936.  
  937.      /* Some internal packed boolean fields.  */
  938.  
  939.      /* See the vma field.  */
  940.     unsigned int user_set_vma : 1;
  941.  
  942.      /* Whether relocations have been processed.  */
  943.     unsigned int reloc_done : 1;
  944.  
  945.      /* A mark flag used by some of the linker backends.  */
  946.     unsigned int linker_mark : 1;
  947.  
  948.      /* End of internal packed boolean fields.  */
  949.  
  950.         /*  The virtual memory address of the section - where it will be
  951.            at run time.  The symbols are relocated against this.  The
  952.         user_set_vma flag is maintained by bfd; if it's not set, the
  953.         backend can assign addresses (for example, in <<a.out>>, where
  954.         the default address for <<.data>> is dependent on the specific
  955.         target and various flags).  */
  956.  
  957.    bfd_vma vma;
  958.  
  959.         /*  The load address of the section - where it would be in a
  960.            rom image; really only used for writing section header
  961.         information. */
  962.  
  963.    bfd_vma lma;
  964.  
  965.          /* The size of the section in bytes, as it will be output.
  966.            contains a value even if the section has no contents (e.g., the
  967.            size of <<.bss>>). This will be filled in after relocation */
  968.  
  969.    bfd_size_type _cooked_size;
  970.  
  971.          /* The original size on disk of the section, in bytes.  Normally this
  972.         value is the same as the size, but if some relaxing has
  973.         been done, then this value will be bigger.  */
  974.  
  975.    bfd_size_type _raw_size;
  976.  
  977.          /* If this section is going to be output, then this value is the
  978.            offset into the output section of the first byte in the input
  979.            section. E.g., if this was going to start at the 100th byte in
  980.            the output section, this value would be 100. */
  981.  
  982.    bfd_vma output_offset;
  983.  
  984.          /* The output section through which to map on output. */
  985.  
  986.    struct sec *output_section;
  987.  
  988.          /* The alignment requirement of the section, as an exponent of 2 -
  989.            e.g., 3 aligns to 2^3 (or 8). */
  990.  
  991.    unsigned int alignment_power;
  992.  
  993.          /* If an input section, a pointer to a vector of relocation
  994.            records for the data in this section. */
  995.  
  996.    struct reloc_cache_entry *relocation;
  997.  
  998.          /* If an output section, a pointer to a vector of pointers to
  999.            relocation records for the data in this section. */
  1000.  
  1001.    struct reloc_cache_entry **orelocation;
  1002.  
  1003.          /* The number of relocation records in one of the above  */
  1004.  
  1005.    unsigned reloc_count;
  1006.  
  1007.          /* Information below is back end specific - and not always used
  1008.            or updated.  */
  1009.  
  1010.          /* File position of section data    */
  1011.  
  1012.    file_ptr filepos;
  1013.  
  1014.          /* File position of relocation info */
  1015.  
  1016.    file_ptr rel_filepos;
  1017.  
  1018.          /* File position of line data       */
  1019.  
  1020.    file_ptr line_filepos;
  1021.  
  1022.          /* Pointer to data for applications */
  1023.  
  1024.    PTR userdata;
  1025.  
  1026.          /* If the SEC_IN_MEMORY flag is set, this points to the actual
  1027.            contents.  */
  1028.    unsigned char *contents;
  1029.  
  1030.          /* Attached line number information */
  1031.  
  1032.    alent *lineno;
  1033.  
  1034.          /* Number of line number records   */
  1035.  
  1036.    unsigned int lineno_count;
  1037.  
  1038.          /* When a section is being output, this value changes as more
  1039.            linenumbers are written out */
  1040.  
  1041.    file_ptr moving_line_filepos;
  1042.  
  1043.          /* What the section number is in the target world  */
  1044.  
  1045.    int target_index;
  1046.  
  1047.    PTR used_by_bfd;
  1048.  
  1049.          /* If this is a constructor section then here is a list of the
  1050.            relocations created to relocate items within it. */
  1051.  
  1052.    struct relent_chain *constructor_chain;
  1053.  
  1054.          /* The BFD which owns the section. */
  1055.  
  1056.    bfd *owner;
  1057.  
  1058.       /* A symbol which points at this section only */
  1059.    struct symbol_cache_entry *symbol;
  1060.    struct symbol_cache_entry **symbol_ptr_ptr;
  1061.  
  1062.    struct bfd_link_order *link_order_head;
  1063.    struct bfd_link_order *link_order_tail;
  1064. } asection ;
  1065.  
  1066.      /* These sections are global, and are managed by BFD.  The application
  1067.        and target back end are not permitted to change the values in
  1068.     these sections.  New code should use the section_ptr macros rather
  1069.        than referring directly to the const sections.  The const sections
  1070.        may eventually vanish.  */
  1071. #define BFD_ABS_SECTION_NAME "*ABS*"
  1072. #define BFD_UND_SECTION_NAME "*UND*"
  1073. #define BFD_COM_SECTION_NAME "*COM*"
  1074. #define BFD_IND_SECTION_NAME "*IND*"
  1075.  
  1076.      /* the absolute section */
  1077. extern const asection bfd_abs_section;
  1078. #define bfd_abs_section_ptr ((asection *) &bfd_abs_section)
  1079. #define bfd_is_abs_section(sec) ((sec) == bfd_abs_section_ptr)
  1080.      /* Pointer to the undefined section */
  1081. extern const asection bfd_und_section;
  1082. #define bfd_und_section_ptr ((asection *) &bfd_und_section)
  1083. #define bfd_is_und_section(sec) ((sec) == bfd_und_section_ptr)
  1084.      /* Pointer to the common section */
  1085. extern const asection bfd_com_section;
  1086. #define bfd_com_section_ptr ((asection *) &bfd_com_section)
  1087.      /* Pointer to the indirect section */
  1088. extern const asection bfd_ind_section;
  1089. #define bfd_ind_section_ptr ((asection *) &bfd_ind_section)
  1090. #define bfd_is_ind_section(sec) ((sec) == bfd_ind_section_ptr)
  1091.  
  1092. extern const struct symbol_cache_entry * const bfd_abs_symbol;
  1093. extern const struct symbol_cache_entry * const bfd_com_symbol;
  1094. extern const struct symbol_cache_entry * const bfd_und_symbol;
  1095. extern const struct symbol_cache_entry * const bfd_ind_symbol;
  1096. #define bfd_get_section_size_before_reloc(section) \
  1097.      (section->reloc_done ? (abort(),1): (section)->_raw_size)
  1098. #define bfd_get_section_size_after_reloc(section) \
  1099.      ((section->reloc_done) ? (section)->_cooked_size: (abort(),1))
  1100. asection *
  1101. bfd_get_section_by_name PARAMS ((bfd *abfd, CONST char *name));
  1102.  
  1103. asection *
  1104. bfd_make_section_old_way PARAMS ((bfd *abfd, CONST char *name));
  1105.  
  1106. asection *
  1107. bfd_make_section_anyway PARAMS ((bfd *abfd, CONST char *name));
  1108.  
  1109. asection *
  1110. bfd_make_section PARAMS ((bfd *, CONST char *name));
  1111.  
  1112. boolean 
  1113. bfd_set_section_flags PARAMS ((bfd *abfd, asection *sec, flagword flags));
  1114.  
  1115. void 
  1116. bfd_map_over_sections PARAMS ((bfd *abfd,
  1117.     void (*func)(bfd *abfd,
  1118.     asection *sect,
  1119.     PTR obj),
  1120.     PTR obj));
  1121.  
  1122. boolean 
  1123. bfd_set_section_size PARAMS ((bfd *abfd, asection *sec, bfd_size_type val));
  1124.  
  1125. boolean 
  1126. bfd_set_section_contents
  1127.  PARAMS ((bfd *abfd,
  1128.     asection *section,
  1129.     PTR data,
  1130.     file_ptr offset,
  1131.     bfd_size_type count));
  1132.  
  1133. boolean 
  1134. bfd_get_section_contents
  1135.  PARAMS ((bfd *abfd, asection *section, PTR location,
  1136.     file_ptr offset, bfd_size_type count));
  1137.  
  1138. boolean 
  1139. bfd_copy_private_section_data PARAMS ((bfd *ibfd, asection *isec, bfd *obfd, asection *osec));
  1140.  
  1141. #define bfd_copy_private_section_data(ibfd, isection, obfd, osection) \
  1142.      BFD_SEND (ibfd, _bfd_copy_private_section_data, \
  1143.         (ibfd, isection, obfd, osection))
  1144. enum bfd_architecture 
  1145. {
  1146.   bfd_arch_unknown,    /* File arch not known */
  1147.   bfd_arch_obscure,    /* Arch known, not one of these */
  1148.   bfd_arch_m68k,       /* Motorola 68xxx */
  1149.   bfd_arch_vax,        /* DEC Vax */   
  1150.   bfd_arch_i960,       /* Intel 960 */
  1151.      /* The order of the following is important.
  1152.        lower number indicates a machine type that 
  1153.        only accepts a subset of the instructions
  1154.        available to machines with higher numbers.
  1155.        The exception is the "ca", which is
  1156.        incompatible with all other machines except 
  1157.        "core". */
  1158.  
  1159. #define bfd_mach_i960_core      1
  1160. #define bfd_mach_i960_ka_sa     2
  1161. #define bfd_mach_i960_kb_sb     3
  1162. #define bfd_mach_i960_mc        4
  1163. #define bfd_mach_i960_xa        5
  1164. #define bfd_mach_i960_ca        6
  1165. #define bfd_mach_i960_jx     7
  1166. #define bfd_mach_i960_hx        8
  1167.  
  1168.   bfd_arch_a29k,       /* AMD 29000 */
  1169.   bfd_arch_sparc,      /* SPARC */
  1170. #define bfd_mach_sparc            1
  1171.  /* The difference between v8plus and v9 is that v9 is a true 64 bit env.  */
  1172. #define bfd_mach_sparc_sparclet    2
  1173. #define bfd_mach_sparc_sparclite    3
  1174. #define bfd_mach_sparc_v8plus        4
  1175. #define bfd_mach_sparc_v8plusa        5  /* with ultrasparc add'ns */
  1176. #define bfd_mach_sparc_v9        6
  1177. #define bfd_mach_sparc_v9a        7  /* with ultrasparc add'ns */
  1178.  /* Nonzero if MACH has the v9 instruction set.  */
  1179. #define bfd_mach_sparc_v9_p(mach) \
  1180.   ((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9a)
  1181.   bfd_arch_mips,       /* MIPS Rxxxx */
  1182.   bfd_arch_i386,       /* Intel 386 */
  1183.   bfd_arch_we32k,      /* AT&T WE32xxx */
  1184.   bfd_arch_tahoe,      /* CCI/Harris Tahoe */
  1185.   bfd_arch_i860,       /* Intel 860 */
  1186.   bfd_arch_romp,       /* IBM ROMP PC/RT */
  1187.   bfd_arch_alliant,    /* Alliant */
  1188.   bfd_arch_convex,     /* Convex */
  1189.   bfd_arch_m88k,       /* Motorola 88xxx */
  1190.   bfd_arch_pyramid,    /* Pyramid Technology */
  1191.   bfd_arch_h8300,      /* Hitachi H8/300 */
  1192. #define bfd_mach_h8300   1
  1193. #define bfd_mach_h8300h  2
  1194.   bfd_arch_powerpc,    /* PowerPC */
  1195.   bfd_arch_rs6000,     /* IBM RS/6000 */
  1196.   bfd_arch_hppa,       /* HP PA RISC */
  1197.   bfd_arch_z8k,        /* Zilog Z8000 */
  1198. #define bfd_mach_z8001        1
  1199. #define bfd_mach_z8002        2
  1200.   bfd_arch_h8500,      /* Hitachi H8/500 */
  1201.   bfd_arch_sh,         /* Hitachi SH */
  1202.   bfd_arch_alpha,      /* Dec Alpha */
  1203.   bfd_arch_arm,        /* Advanced Risc Machines ARM */
  1204.   bfd_arch_ns32k,      /* National Semiconductors ns32000 */
  1205.   bfd_arch_w65,        /* WDC 65816 */
  1206.   bfd_arch_last
  1207.   };
  1208.  
  1209. typedef struct bfd_arch_info 
  1210. {
  1211.   int bits_per_word;
  1212.   int bits_per_address;
  1213.   int bits_per_byte;
  1214.   enum bfd_architecture arch;
  1215.   unsigned long mach;
  1216.   const char *arch_name;
  1217.   const char *printable_name;
  1218.   unsigned int section_align_power;
  1219.   /* true if this is the default machine for the architecture */
  1220.   boolean the_default;    
  1221.   const struct bfd_arch_info * (*compatible)
  1222.     PARAMS ((const struct bfd_arch_info *a,
  1223.              const struct bfd_arch_info *b));
  1224.  
  1225.   boolean (*scan) PARAMS ((const struct bfd_arch_info *, const char *));
  1226.  
  1227.   const struct bfd_arch_info *next;
  1228. } bfd_arch_info_type;
  1229. const char *
  1230. bfd_printable_name PARAMS ((bfd *abfd));
  1231.  
  1232. const bfd_arch_info_type *
  1233. bfd_scan_arch PARAMS ((const char *string));
  1234.  
  1235. const bfd_arch_info_type *
  1236. bfd_arch_get_compatible PARAMS ((
  1237.     const bfd *abfd,
  1238.     const bfd *bbfd));
  1239.  
  1240. void 
  1241. bfd_set_arch_info PARAMS ((bfd *abfd, const bfd_arch_info_type *arg));
  1242.  
  1243. enum bfd_architecture 
  1244. bfd_get_arch PARAMS ((bfd *abfd));
  1245.  
  1246. unsigned long 
  1247. bfd_get_mach PARAMS ((bfd *abfd));
  1248.  
  1249. unsigned int 
  1250. bfd_arch_bits_per_byte PARAMS ((bfd *abfd));
  1251.  
  1252. unsigned int 
  1253. bfd_arch_bits_per_address PARAMS ((bfd *abfd));
  1254.  
  1255. const bfd_arch_info_type * 
  1256. bfd_get_arch_info PARAMS ((bfd *abfd));
  1257.  
  1258. const bfd_arch_info_type *
  1259. bfd_lookup_arch
  1260.  PARAMS ((enum bfd_architecture
  1261.     arch,
  1262.     unsigned long machine));
  1263.  
  1264. const char *
  1265. bfd_printable_arch_mach
  1266.  PARAMS ((enum bfd_architecture arch, unsigned long machine));
  1267.  
  1268. typedef enum bfd_reloc_status
  1269. {
  1270.         /* No errors detected */
  1271.   bfd_reloc_ok,
  1272.  
  1273.         /* The relocation was performed, but there was an overflow. */
  1274.   bfd_reloc_overflow,
  1275.  
  1276.         /* The address to relocate was not within the section supplied. */
  1277.   bfd_reloc_outofrange,
  1278.  
  1279.         /* Used by special functions */
  1280.   bfd_reloc_continue,
  1281.  
  1282.         /* Unsupported relocation size requested. */
  1283.   bfd_reloc_notsupported,
  1284.  
  1285.         /* Unused */
  1286.   bfd_reloc_other,
  1287.  
  1288.         /* The symbol to relocate against was undefined. */
  1289.   bfd_reloc_undefined,
  1290.  
  1291.         /* The relocation was performed, but may not be ok - presently
  1292.           generated only when linking i960 coff files with i960 b.out
  1293.           symbols.  If this type is returned, the error_message argument
  1294.           to bfd_perform_relocation will be set.  */
  1295.   bfd_reloc_dangerous
  1296.  }
  1297.  bfd_reloc_status_type;
  1298.  
  1299.  
  1300. typedef struct reloc_cache_entry
  1301. {
  1302.         /* A pointer into the canonical table of pointers  */
  1303.   struct symbol_cache_entry **sym_ptr_ptr;
  1304.  
  1305.         /* offset in section */
  1306.   bfd_size_type address;
  1307.  
  1308.         /* addend for relocation value */
  1309.   bfd_vma addend;
  1310.  
  1311.         /* Pointer to how to perform the required relocation */
  1312.   reloc_howto_type *howto;
  1313.  
  1314. } arelent;
  1315. enum complain_overflow
  1316. {
  1317.      /* Do not complain on overflow. */
  1318.   complain_overflow_dont,
  1319.  
  1320.      /* Complain if the bitfield overflows, whether it is considered
  1321.        as signed or unsigned. */
  1322.   complain_overflow_bitfield,
  1323.  
  1324.      /* Complain if the value overflows when considered as signed
  1325.        number. */
  1326.   complain_overflow_signed,
  1327.  
  1328.      /* Complain if the value overflows when considered as an
  1329.        unsigned number. */
  1330.   complain_overflow_unsigned
  1331. };
  1332.  
  1333. struct reloc_howto_struct
  1334. {
  1335.         /*  The type field has mainly a documetary use - the back end can
  1336.            do what it wants with it, though normally the back end's
  1337.            external idea of what a reloc number is stored
  1338.            in this field. For example, a PC relative word relocation
  1339.            in a coff environment has the type 023 - because that's
  1340.            what the outside world calls a R_PCRWORD reloc. */
  1341.   unsigned int type;
  1342.  
  1343.         /*  The value the final relocation is shifted right by. This drops
  1344.            unwanted data from the relocation.  */
  1345.   unsigned int rightshift;
  1346.  
  1347.      /*  The size of the item to be relocated.  This is *not* a
  1348.         power-of-two measure.  To get the number of bytes operated
  1349.         on by a type of relocation, use bfd_get_reloc_size.  */
  1350.   int size;
  1351.  
  1352.         /*  The number of bits in the item to be relocated.  This is used
  1353.         when doing overflow checking.  */
  1354.   unsigned int bitsize;
  1355.  
  1356.         /*  Notes that the relocation is relative to the location in the
  1357.            data section of the addend. The relocation function will
  1358.            subtract from the relocation value the address of the location
  1359.            being relocated. */
  1360.   boolean pc_relative;
  1361.  
  1362.      /*  The bit position of the reloc value in the destination.
  1363.         The relocated value is left shifted by this amount. */
  1364.   unsigned int bitpos;
  1365.  
  1366.      /* What type of overflow error should be checked for when
  1367.        relocating. */
  1368.   enum complain_overflow complain_on_overflow;
  1369.  
  1370.         /* If this field is non null, then the supplied function is
  1371.           called rather than the normal function. This allows really
  1372.           strange relocation methods to be accomodated (e.g., i960 callj
  1373.           instructions). */
  1374.   bfd_reloc_status_type (*special_function)
  1375.                     PARAMS ((bfd *abfd,
  1376.                          arelent *reloc_entry,
  1377.                                             struct symbol_cache_entry *symbol,
  1378.                                             PTR data,
  1379.                                             asection *input_section,
  1380.                                             bfd *output_bfd,
  1381.                                             char **error_message));
  1382.  
  1383.         /* The textual name of the relocation type. */
  1384.   char *name;
  1385.  
  1386.         /* When performing a partial link, some formats must modify the
  1387.           relocations rather than the data - this flag signals this.*/
  1388.   boolean partial_inplace;
  1389.  
  1390.         /* The src_mask selects which parts of the read in data
  1391.           are to be used in the relocation sum.  E.g., if this was an 8 bit
  1392.           bit of data which we read and relocated, this would be
  1393.           0x000000ff. When we have relocs which have an addend, such as
  1394.           sun4 extended relocs, the value in the offset part of a
  1395.           relocating field is garbage so we never use it. In this case
  1396.           the mask would be 0x00000000. */
  1397.   bfd_vma src_mask;
  1398.  
  1399.         /* The dst_mask selects which parts of the instruction are replaced
  1400.           into the instruction. In most cases src_mask == dst_mask,
  1401.           except in the above special case, where dst_mask would be
  1402.           0x000000ff, and src_mask would be 0x00000000.   */
  1403.   bfd_vma dst_mask;
  1404.  
  1405.         /* When some formats create PC relative instructions, they leave
  1406.           the value of the pc of the place being relocated in the offset
  1407.           slot of the instruction, so that a PC relative relocation can
  1408.           be made just by adding in an ordinary offset (e.g., sun3 a.out).
  1409.           Some formats leave the displacement part of an instruction
  1410.           empty (e.g., m88k bcs); this flag signals the fact.*/
  1411.   boolean pcrel_offset;
  1412.  
  1413. };
  1414. #define HOWTO(C, R,S,B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC) \
  1415.   {(unsigned)C,R,S,B, P, BI, O,SF,NAME,INPLACE,MASKSRC,MASKDST,PC}
  1416. #define NEWHOWTO( FUNCTION, NAME,SIZE,REL,IN) HOWTO(0,0,SIZE,0,REL,0,complain_overflow_dont,FUNCTION, NAME,false,0,0,IN)
  1417.  
  1418. #define HOWTO_PREPARE(relocation, symbol)      \
  1419.   {                                            \
  1420.   if (symbol != (asymbol *)NULL) {             \
  1421.     if (bfd_is_com_section (symbol->section)) { \
  1422.       relocation = 0;                          \
  1423.     }                                          \
  1424.     else {                                     \
  1425.       relocation = symbol->value;              \
  1426.     }                                          \
  1427.   }                                            \
  1428. }
  1429. int 
  1430. bfd_get_reloc_size  PARAMS ((reloc_howto_type *));
  1431.  
  1432. typedef struct relent_chain {
  1433.   arelent relent;
  1434.   struct   relent_chain *next;
  1435. } arelent_chain;
  1436. bfd_reloc_status_type
  1437.  
  1438. bfd_perform_relocation
  1439.  PARAMS ((bfd *abfd,
  1440.     arelent *reloc_entry,
  1441.     PTR data,
  1442.     asection *input_section,
  1443.     bfd *output_bfd,
  1444.     char **error_message));
  1445.  
  1446. bfd_reloc_status_type
  1447.  
  1448. bfd_install_relocation
  1449.  PARAMS ((bfd *abfd,
  1450.     arelent *reloc_entry,
  1451.     PTR data, bfd_vma data_start,
  1452.     asection *input_section,
  1453.     char **error_message));
  1454.  
  1455. enum bfd_reloc_code_real {
  1456.   _dummy_first_bfd_reloc_code_real,
  1457.  
  1458.  
  1459. /* Basic absolute relocations of N bits. */
  1460.   BFD_RELOC_64,
  1461.   BFD_RELOC_32,
  1462.   BFD_RELOC_26,
  1463.   BFD_RELOC_16,
  1464.   BFD_RELOC_14,
  1465.   BFD_RELOC_8,
  1466.  
  1467. /* PC-relative relocations.  Sometimes these are relative to the address
  1468. of the relocation itself; sometimes they are relative to the start of
  1469. the section containing the relocation.  It depends on the specific target.
  1470.  
  1471. The 24-bit relocation is used in some Intel 960 configurations. */
  1472.   BFD_RELOC_64_PCREL,
  1473.   BFD_RELOC_32_PCREL,
  1474.   BFD_RELOC_24_PCREL,
  1475.   BFD_RELOC_16_PCREL,
  1476.   BFD_RELOC_12_PCREL,
  1477.   BFD_RELOC_8_PCREL,
  1478.  
  1479. /* For ELF. */
  1480.   BFD_RELOC_32_GOT_PCREL,
  1481.   BFD_RELOC_16_GOT_PCREL,
  1482.   BFD_RELOC_8_GOT_PCREL,
  1483.   BFD_RELOC_32_GOTOFF,
  1484.   BFD_RELOC_16_GOTOFF,
  1485.   BFD_RELOC_LO16_GOTOFF,
  1486.   BFD_RELOC_HI16_GOTOFF,
  1487.   BFD_RELOC_HI16_S_GOTOFF,
  1488.   BFD_RELOC_8_GOTOFF,
  1489.   BFD_RELOC_32_PLT_PCREL,
  1490.   BFD_RELOC_24_PLT_PCREL,
  1491.   BFD_RELOC_16_PLT_PCREL,
  1492.   BFD_RELOC_8_PLT_PCREL,
  1493.   BFD_RELOC_32_PLTOFF,
  1494.   BFD_RELOC_16_PLTOFF,
  1495.   BFD_RELOC_LO16_PLTOFF,
  1496.   BFD_RELOC_HI16_PLTOFF,
  1497.   BFD_RELOC_HI16_S_PLTOFF,
  1498.   BFD_RELOC_8_PLTOFF,
  1499.  
  1500. /* Relocations used by 68K ELF. */
  1501.   BFD_RELOC_68K_GLOB_DAT,
  1502.   BFD_RELOC_68K_JMP_SLOT,
  1503.   BFD_RELOC_68K_RELATIVE,
  1504.  
  1505. /* Linkage-table relative. */
  1506.   BFD_RELOC_32_BASEREL,
  1507.   BFD_RELOC_16_BASEREL,
  1508.   BFD_RELOC_LO16_BASEREL,
  1509.   BFD_RELOC_HI16_BASEREL,
  1510.   BFD_RELOC_HI16_S_BASEREL,
  1511.   BFD_RELOC_8_BASEREL,
  1512.   BFD_RELOC_RVA,
  1513.  
  1514. /* Absolute 8-bit relocation, but used to form an address like 0xFFnn. */
  1515.   BFD_RELOC_8_FFnn,
  1516.  
  1517. /* These PC-relative relocations are stored as word displacements --
  1518. i.e., byte displacements shifted right two bits.  The 30-bit word
  1519. displacement (<<32_PCREL_S2>> -- 32 bits, shifted 2) is used on the
  1520. SPARC.  (SPARC tools generally refer to this as <<WDISP30>>.)  The
  1521. signed 16-bit displacement is used on the MIPS, and the 23-bit
  1522. displacement is used on the Alpha. */
  1523.   BFD_RELOC_32_PCREL_S2,
  1524.   BFD_RELOC_16_PCREL_S2,
  1525.   BFD_RELOC_23_PCREL_S2,
  1526.  
  1527. /* High 22 bits and low 10 bits of 32-bit value, placed into lower bits of
  1528. the target word.  These are used on the SPARC. */
  1529.   BFD_RELOC_HI22,
  1530.   BFD_RELOC_LO10,
  1531.  
  1532. /* For systems that allocate a Global Pointer register, these are
  1533. displacements off that register.  These relocation types are
  1534. handled specially, because the value the register will have is
  1535. decided relatively late. */
  1536.   BFD_RELOC_GPREL16,
  1537.   BFD_RELOC_GPREL32,
  1538.  
  1539. /* For openVMS/Alpha systems, these are displacements for switch
  1540. tables. */
  1541.   BFD_RELOC_SWREL32,
  1542.   BFD_RELOC_SWREL64,
  1543.  
  1544. /* Reloc types used for i960/b.out. */
  1545.   BFD_RELOC_I960_CALLJ,
  1546.  
  1547. /* SPARC ELF relocations.  There is probably some overlap with other
  1548. relocation types already defined. */
  1549.   BFD_RELOC_NONE,
  1550.   BFD_RELOC_SPARC_WDISP22,
  1551.   BFD_RELOC_SPARC22,
  1552.   BFD_RELOC_SPARC13,
  1553.   BFD_RELOC_SPARC_GOT10,
  1554.   BFD_RELOC_SPARC_GOT13,
  1555.   BFD_RELOC_SPARC_GOT22,
  1556.   BFD_RELOC_SPARC_PC10,
  1557.   BFD_RELOC_SPARC_PC22,
  1558.   BFD_RELOC_SPARC_WPLT30,
  1559.   BFD_RELOC_SPARC_COPY,
  1560.   BFD_RELOC_SPARC_GLOB_DAT,
  1561.   BFD_RELOC_SPARC_JMP_SLOT,
  1562.   BFD_RELOC_SPARC_RELATIVE,
  1563.   BFD_RELOC_SPARC_UA32,
  1564.  
  1565. /* I think these are specific to SPARC a.out (e.g., Sun 4). */
  1566.   BFD_RELOC_SPARC_BASE13,
  1567.   BFD_RELOC_SPARC_BASE22,
  1568.  
  1569. /* Some relocations we're using for SPARC V9 -- subject to change. */
  1570. #define BFD_RELOC_SPARC_64 BFD_RELOC_64
  1571.   BFD_RELOC_SPARC_10,
  1572.   BFD_RELOC_SPARC_11,
  1573.   BFD_RELOC_SPARC_OLO10,
  1574.   BFD_RELOC_SPARC_HH22,
  1575.   BFD_RELOC_SPARC_HM10,
  1576.   BFD_RELOC_SPARC_LM22,
  1577.   BFD_RELOC_SPARC_PC_HH22,
  1578.   BFD_RELOC_SPARC_PC_HM10,
  1579.   BFD_RELOC_SPARC_PC_LM22,
  1580.   BFD_RELOC_SPARC_WDISP16,
  1581.   BFD_RELOC_SPARC_WDISP19,
  1582.   BFD_RELOC_SPARC_GLOB_JMP,
  1583.   BFD_RELOC_SPARC_7,
  1584.   BFD_RELOC_SPARC_6,
  1585.   BFD_RELOC_SPARC_5,
  1586.  
  1587. /* Alpha ECOFF and ELF relocations.  Some of these treat the symbol or
  1588. "addend" in some special way.
  1589. For GPDISP_HI16 ("gpdisp") relocations, the symbol is ignored when
  1590. writing; when reading, it will be the absolute section symbol.  The
  1591. addend is the displacement in bytes of the "lda" instruction from
  1592. the "ldah" instruction (which is at the address of this reloc). */
  1593.   BFD_RELOC_ALPHA_GPDISP_HI16,
  1594.  
  1595. /* For GPDISP_LO16 ("ignore") relocations, the symbol is handled as
  1596. with GPDISP_HI16 relocs.  The addend is ignored when writing the
  1597. relocations out, and is filled in with the file's GP value on
  1598. reading, for convenience. */
  1599.   BFD_RELOC_ALPHA_GPDISP_LO16,
  1600.  
  1601. /* The ELF GPDISP relocation is exactly the same as the GPDISP_HI16
  1602. relocation except that there is no accompanying GPDISP_LO16
  1603. relocation. */
  1604.   BFD_RELOC_ALPHA_GPDISP,
  1605.  
  1606. /* The Alpha LITERAL/LITUSE relocs are produced by a symbol reference;
  1607. the assembler turns it into a LDQ instruction to load the address of
  1608. the symbol, and then fills in a register in the real instruction.
  1609.  
  1610. The LITERAL reloc, at the LDQ instruction, refers to the .lita
  1611. section symbol.  The addend is ignored when writing, but is filled
  1612. in with the file's GP value on reading, for convenience, as with the
  1613. GPDISP_LO16 reloc.
  1614.  
  1615. The LITUSE reloc, on the instruction using the loaded address, gives
  1616. information to the linker that it might be able to use to optimize
  1617. away some literal section references.  The symbol is ignored (read
  1618. as the absolute section symbol), and the "addend" indicates the type
  1619. of instruction using the register:
  1620. 1 - "memory" fmt insn
  1621. 2 - byte-manipulation (byte offset reg)
  1622. 3 - jsr (target of branch)
  1623.  
  1624. The GNU linker currently doesn't do any of this optimizing. */
  1625.   BFD_RELOC_ALPHA_LITERAL,
  1626.   BFD_RELOC_ALPHA_LITUSE,
  1627.  
  1628. /* The HINT relocation indicates a value that should be filled into the
  1629. "hint" field of a jmp/jsr/ret instruction, for possible branch-
  1630. prediction logic which may be provided on some processors. */
  1631.   BFD_RELOC_ALPHA_HINT,
  1632.  
  1633. /* The LINKAGE relocation outputs a special code in the object file,
  1634. the rest is handled by the linker. */
  1635.   BFD_RELOC_ALPHA_LINKAGE,
  1636.  
  1637. /* The BASEREG relocation calculates differences to basereg. */
  1638.   BFD_RELOC_ALPHA_BASEREG,
  1639.  
  1640. /* Bits 27..2 of the relocation address shifted right 2 bits;
  1641. simple reloc otherwise. */
  1642.   BFD_RELOC_MIPS_JMP,
  1643.  
  1644. /* High 16 bits of 32-bit value; simple reloc. */
  1645.   BFD_RELOC_HI16,
  1646.  
  1647. /* High 16 bits of 32-bit value but the low 16 bits will be sign
  1648. extended and added to form the final result.  If the low 16
  1649. bits form a negative number, we need to add one to the high value
  1650. to compensate for the borrow when the low bits are added. */
  1651.   BFD_RELOC_HI16_S,
  1652.  
  1653. /* Low 16 bits. */
  1654.   BFD_RELOC_LO16,
  1655.  
  1656. /* Like BFD_RELOC_HI16_S, but PC relative. */
  1657.   BFD_RELOC_PCREL_HI16_S,
  1658.  
  1659. /* Like BFD_RELOC_LO16, but PC relative. */
  1660.   BFD_RELOC_PCREL_LO16,
  1661.  
  1662. /* Relocation relative to the global pointer. */
  1663. #define BFD_RELOC_MIPS_GPREL BFD_RELOC_GPREL16
  1664.  
  1665. /* Relocation against a MIPS literal section. */
  1666.   BFD_RELOC_MIPS_LITERAL,
  1667.  
  1668. /* MIPS ELF relocations. */
  1669.   BFD_RELOC_MIPS_GOT16,
  1670.   BFD_RELOC_MIPS_CALL16,
  1671. #define BFD_RELOC_MIPS_GPREL32 BFD_RELOC_GPREL32
  1672.   BFD_RELOC_MIPS_GOT_HI16,
  1673.   BFD_RELOC_MIPS_GOT_LO16,
  1674.   BFD_RELOC_MIPS_CALL_HI16,
  1675.   BFD_RELOC_MIPS_CALL_LO16,
  1676.  
  1677. /* i386/elf relocations */
  1678.   BFD_RELOC_386_GOT32,
  1679.   BFD_RELOC_386_PLT32,
  1680.   BFD_RELOC_386_COPY,
  1681.   BFD_RELOC_386_GLOB_DAT,
  1682.   BFD_RELOC_386_JUMP_SLOT,
  1683.   BFD_RELOC_386_RELATIVE,
  1684.   BFD_RELOC_386_GOTOFF,
  1685.   BFD_RELOC_386_GOTPC,
  1686.  
  1687. /* ns32k relocations */
  1688.   BFD_RELOC_NS32K_IMM_8,
  1689.   BFD_RELOC_NS32K_IMM_16,
  1690.   BFD_RELOC_NS32K_IMM_32,
  1691.   BFD_RELOC_NS32K_IMM_8_PCREL,
  1692.   BFD_RELOC_NS32K_IMM_16_PCREL,
  1693.   BFD_RELOC_NS32K_IMM_32_PCREL,
  1694.   BFD_RELOC_NS32K_DISP_8,
  1695.   BFD_RELOC_NS32K_DISP_16,
  1696.   BFD_RELOC_NS32K_DISP_32,
  1697.   BFD_RELOC_NS32K_DISP_8_PCREL,
  1698.   BFD_RELOC_NS32K_DISP_16_PCREL,
  1699.   BFD_RELOC_NS32K_DISP_32_PCREL,
  1700.  
  1701. /* Power(rs6000) and PowerPC relocations. */
  1702.   BFD_RELOC_PPC_B26,
  1703.   BFD_RELOC_PPC_BA26,
  1704.   BFD_RELOC_PPC_TOC16,
  1705.   BFD_RELOC_PPC_B16,
  1706.   BFD_RELOC_PPC_B16_BRTAKEN,
  1707.   BFD_RELOC_PPC_B16_BRNTAKEN,
  1708.   BFD_RELOC_PPC_BA16,
  1709.   BFD_RELOC_PPC_BA16_BRTAKEN,
  1710.   BFD_RELOC_PPC_BA16_BRNTAKEN,
  1711.   BFD_RELOC_PPC_COPY,
  1712.   BFD_RELOC_PPC_GLOB_DAT,
  1713.   BFD_RELOC_PPC_JMP_SLOT,
  1714.   BFD_RELOC_PPC_RELATIVE,
  1715.   BFD_RELOC_PPC_LOCAL24PC,
  1716.   BFD_RELOC_PPC_EMB_NADDR32,
  1717.   BFD_RELOC_PPC_EMB_NADDR16,
  1718.   BFD_RELOC_PPC_EMB_NADDR16_LO,
  1719.   BFD_RELOC_PPC_EMB_NADDR16_HI,
  1720.   BFD_RELOC_PPC_EMB_NADDR16_HA,
  1721.   BFD_RELOC_PPC_EMB_SDAI16,
  1722.   BFD_RELOC_PPC_EMB_SDA2I16,
  1723.   BFD_RELOC_PPC_EMB_SDA2REL,
  1724.   BFD_RELOC_PPC_EMB_SDA21,
  1725.   BFD_RELOC_PPC_EMB_MRKREF,
  1726.   BFD_RELOC_PPC_EMB_RELSEC16,
  1727.   BFD_RELOC_PPC_EMB_RELST_LO,
  1728.   BFD_RELOC_PPC_EMB_RELST_HI,
  1729.   BFD_RELOC_PPC_EMB_RELST_HA,
  1730.   BFD_RELOC_PPC_EMB_BIT_FLD,
  1731.   BFD_RELOC_PPC_EMB_RELSDA,
  1732.  
  1733. /* The type of reloc used to build a contructor table - at the moment
  1734. probably a 32 bit wide absolute relocation, but the target can choose.
  1735. It generally does map to one of the other relocation types. */
  1736.   BFD_RELOC_CTOR,
  1737.  
  1738. /* ARM 26 bit pc-relative branch.  The lowest two bits must be zero and are
  1739. not stored in the instruction. */
  1740.   BFD_RELOC_ARM_PCREL_BRANCH,
  1741.  
  1742. /* These relocs are only used within the ARM assembler.  They are not
  1743. (at present) written to any object files. */
  1744.   BFD_RELOC_ARM_IMMEDIATE,
  1745.   BFD_RELOC_ARM_OFFSET_IMM,
  1746.   BFD_RELOC_ARM_SHIFT_IMM,
  1747.   BFD_RELOC_ARM_SWI,
  1748.   BFD_RELOC_ARM_MULTI,
  1749.   BFD_RELOC_ARM_CP_OFF_IMM,
  1750.   BFD_RELOC_ARM_ADR_IMM,
  1751.   BFD_RELOC_ARM_LDR_IMM,
  1752.   BFD_RELOC_ARM_LITERAL,
  1753.   BFD_RELOC_ARM_IN_POOL,
  1754.   BFD_RELOC_UNUSED };
  1755. typedef enum bfd_reloc_code_real bfd_reloc_code_real_type;
  1756. reloc_howto_type *
  1757.  
  1758. bfd_reloc_type_lookup  PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
  1759.  
  1760. const char *
  1761. bfd_get_reloc_code_name  PARAMS ((bfd_reloc_code_real_type code));
  1762.  
  1763.  
  1764. typedef struct symbol_cache_entry
  1765. {
  1766.      /* A pointer to the BFD which owns the symbol. This information
  1767.        is necessary so that a back end can work out what additional
  1768.           information (invisible to the application writer) is carried
  1769.        with the symbol.
  1770.  
  1771.        This field is *almost* redundant, since you can use section->owner
  1772.        instead, except that some symbols point to the global sections
  1773.        bfd_{abs,com,und}_section.  This could be fixed by making
  1774.        these globals be per-bfd (or per-target-flavor).  FIXME. */
  1775.  
  1776.   struct _bfd *the_bfd;  /* Use bfd_asymbol_bfd(sym) to access this field. */
  1777.  
  1778.      /* The text of the symbol. The name is left alone, and not copied; the
  1779.        application may not alter it. */
  1780.   CONST char *name;
  1781.  
  1782.      /* The value of the symbol.  This really should be a union of a
  1783.           numeric value with a pointer, since some flags indicate that
  1784.           a pointer to another symbol is stored here.  */
  1785.   symvalue value;
  1786.  
  1787.      /* Attributes of a symbol: */
  1788.  
  1789. #define BSF_NO_FLAGS    0x00
  1790.  
  1791.      /* The symbol has local scope; <<static>> in <<C>>. The value
  1792.         is the offset into the section of the data. */
  1793. #define BSF_LOCAL    0x01
  1794.  
  1795.      /* The symbol has global scope; initialized data in <<C>>. The
  1796.        value is the offset into the section of the data. */
  1797. #define BSF_GLOBAL    0x02
  1798.  
  1799.      /* The symbol has global scope and is exported. The value is
  1800.        the offset into the section of the data. */
  1801. #define BSF_EXPORT    BSF_GLOBAL  /* no real difference */
  1802.  
  1803.      /* A normal C symbol would be one of:
  1804.        <<BSF_LOCAL>>, <<BSF_FORT_COMM>>,  <<BSF_UNDEFINED>> or
  1805.        <<BSF_GLOBAL>> */
  1806.  
  1807.      /* The symbol is a debugging record. The value has an arbitary
  1808.        meaning. */
  1809. #define BSF_DEBUGGING    0x08
  1810.  
  1811.      /* The symbol denotes a function entry point.  Used in ELF,
  1812.        perhaps others someday.  */
  1813. #define BSF_FUNCTION    0x10
  1814.  
  1815.      /* Used by the linker. */
  1816. #define BSF_KEEP        0x20
  1817. #define BSF_KEEP_G      0x40
  1818.  
  1819.      /* A weak global symbol, overridable without warnings by
  1820.        a regular global symbol of the same name.  */
  1821. #define BSF_WEAK        0x80
  1822.  
  1823.         /* This symbol was created to point to a section, e.g. ELF's
  1824.        STT_SECTION symbols.  */
  1825. #define BSF_SECTION_SYM 0x100
  1826.  
  1827.      /* The symbol used to be a common symbol, but now it is
  1828.        allocated. */
  1829. #define BSF_OLD_COMMON  0x200
  1830.  
  1831.      /* The default value for common data. */
  1832. #define BFD_FORT_COMM_DEFAULT_VALUE 0
  1833.  
  1834.      /* In some files the type of a symbol sometimes alters its
  1835.        location in an output file - ie in coff a <<ISFCN>> symbol
  1836.        which is also <<C_EXT>> symbol appears where it was
  1837.        declared and not at the end of a section.  This bit is set
  1838.          by the target BFD part to convey this information. */
  1839.  
  1840. #define BSF_NOT_AT_END    0x400
  1841.  
  1842.      /* Signal that the symbol is the label of constructor section. */
  1843. #define BSF_CONSTRUCTOR   0x800
  1844.  
  1845.      /* Signal that the symbol is a warning symbol.  The name is a
  1846.        warning.  The name of the next symbol is the one to warn about;
  1847.        if a reference is made to a symbol with the same name as the next
  1848.        symbol, a warning is issued by the linker. */
  1849. #define BSF_WARNING       0x1000
  1850.  
  1851.      /* Signal that the symbol is indirect.  This symbol is an indirect
  1852.        pointer to the symbol with the same name as the next symbol. */
  1853. #define BSF_INDIRECT      0x2000
  1854.  
  1855.      /* BSF_FILE marks symbols that contain a file name.  This is used
  1856.        for ELF STT_FILE symbols.  */
  1857. #define BSF_FILE          0x4000
  1858.  
  1859.      /* Symbol is from dynamic linking information.  */
  1860. #define BSF_DYNAMIC       0x8000
  1861.  
  1862.         /* The symbol denotes a data object.  Used in ELF, and perhaps
  1863.           others someday.  */
  1864. #define BSF_OBJECT       0x10000
  1865.  
  1866.   flagword flags;
  1867.  
  1868.      /* A pointer to the section to which this symbol is
  1869.        relative.  This will always be non NULL, there are special
  1870.           sections for undefined and absolute symbols.  */
  1871.   struct sec *section;
  1872.  
  1873.      /* Back end special data.  */
  1874.   union
  1875.     {
  1876.       PTR p;
  1877.       bfd_vma i;
  1878.     } udata;
  1879.  
  1880. } asymbol;
  1881. #define bfd_get_symtab_upper_bound(abfd) \
  1882.      BFD_SEND (abfd, _bfd_get_symtab_upper_bound, (abfd))
  1883. boolean 
  1884. bfd_is_local_label PARAMS ((bfd *abfd, asymbol *sym));
  1885.  
  1886. #define bfd_is_local_label(abfd, sym) \
  1887.      BFD_SEND (abfd, _bfd_is_local_label,(abfd, sym))
  1888. #define bfd_canonicalize_symtab(abfd, location) \
  1889.      BFD_SEND (abfd, _bfd_canonicalize_symtab,\
  1890.                   (abfd, location))
  1891. boolean 
  1892. bfd_set_symtab  PARAMS ((bfd *abfd, asymbol **location, unsigned int count));
  1893.  
  1894. void 
  1895. bfd_print_symbol_vandf PARAMS ((PTR file, asymbol *symbol));
  1896.  
  1897. #define bfd_make_empty_symbol(abfd) \
  1898.      BFD_SEND (abfd, _bfd_make_empty_symbol, (abfd))
  1899. #define bfd_make_debug_symbol(abfd,ptr,size) \
  1900.         BFD_SEND (abfd, _bfd_make_debug_symbol, (abfd, ptr, size))
  1901. int 
  1902. bfd_decode_symclass PARAMS ((asymbol *symbol));
  1903.  
  1904. void 
  1905. bfd_symbol_info PARAMS ((asymbol *symbol, symbol_info *ret));
  1906.  
  1907. boolean 
  1908. bfd_copy_private_symbol_data PARAMS ((bfd *ibfd, asymbol *isym, bfd *obfd, asymbol *osym));
  1909.  
  1910. #define bfd_copy_private_symbol_data(ibfd, isymbol, obfd, osymbol) \
  1911.      BFD_SEND (ibfd, _bfd_copy_private_symbol_data, \
  1912.         (ibfd, isymbol, obfd, osymbol))
  1913. struct _bfd 
  1914. {
  1915.      /* The filename the application opened the BFD with.  */
  1916.     CONST char *filename;                
  1917.  
  1918.      /* A pointer to the target jump table.             */
  1919.     const struct bfd_target *xvec;
  1920.  
  1921.      /* To avoid dragging too many header files into every file that
  1922.        includes `<<bfd.h>>', IOSTREAM has been declared as a "char
  1923.        *", and MTIME as a "long".  Their correct types, to which they
  1924.        are cast when used, are "FILE *" and "time_t".    The iostream
  1925.        is the result of an fopen on the filename.  However, if the
  1926.        BFD_IN_MEMORY flag is set, then iostream is actually a pointer
  1927.        to a bfd_in_memory struct.  */
  1928.     PTR iostream;
  1929.  
  1930.      /* Is the file descriptor being cached?  That is, can it be closed as
  1931.        needed, and re-opened when accessed later?  */
  1932.  
  1933.     boolean cacheable;
  1934.  
  1935.      /* Marks whether there was a default target specified when the
  1936.        BFD was opened. This is used to select which matching algorithm
  1937.        to use to choose the back end. */
  1938.  
  1939.     boolean target_defaulted;
  1940.  
  1941.      /* The caching routines use these to maintain a
  1942.        least-recently-used list of BFDs */
  1943.  
  1944.     struct _bfd *lru_prev, *lru_next;
  1945.  
  1946.      /* When a file is closed by the caching routines, BFD retains
  1947.        state information on the file here: */
  1948.  
  1949.     file_ptr where;              
  1950.  
  1951.      /* and here: (``once'' means at least once) */
  1952.  
  1953.     boolean opened_once;
  1954.  
  1955.      /* Set if we have a locally maintained mtime value, rather than
  1956.        getting it from the file each time: */
  1957.  
  1958.     boolean mtime_set;
  1959.  
  1960.      /* File modified time, if mtime_set is true: */
  1961.  
  1962.     long mtime;          
  1963.  
  1964.      /* Reserved for an unimplemented file locking extension.*/
  1965.  
  1966.     int ifd;
  1967.  
  1968.      /* The format which belongs to the BFD. (object, core, etc.) */
  1969.  
  1970.     bfd_format format;
  1971.  
  1972.      /* The direction the BFD was opened with*/
  1973.  
  1974.     enum bfd_direction {no_direction = 0,
  1975.                         read_direction = 1,
  1976.                         write_direction = 2,
  1977.                         both_direction = 3} direction;
  1978.  
  1979.      /* Format_specific flags*/
  1980.  
  1981.     flagword flags;              
  1982.  
  1983.      /* Currently my_archive is tested before adding origin to
  1984.        anything. I believe that this can become always an add of
  1985.        origin, with origin set to 0 for non archive files.   */
  1986.  
  1987.     file_ptr origin;             
  1988.  
  1989.      /* Remember when output has begun, to stop strange things
  1990.        from happening. */
  1991.     boolean output_has_begun;
  1992.  
  1993.      /* Pointer to linked list of sections*/
  1994.     struct sec  *sections;
  1995.  
  1996.      /* The number of sections */
  1997.     unsigned int section_count;
  1998.  
  1999.      /* Stuff only useful for object files: 
  2000.        The start address. */
  2001.     bfd_vma start_address;
  2002.  
  2003.      /* Used for input and output*/
  2004.     unsigned int symcount;
  2005.  
  2006.      /* Symbol table for output BFD (with symcount entries) */
  2007.     struct symbol_cache_entry  **outsymbols;             
  2008.  
  2009.      /* Pointer to structure which contains architecture information*/
  2010.     const struct bfd_arch_info *arch_info;
  2011.  
  2012.      /* Stuff only useful for archives:*/
  2013.     PTR arelt_data;              
  2014.     struct _bfd *my_archive;      /* The containing archive BFD.  */
  2015.     struct _bfd *next;            /* The next BFD in the archive.  */
  2016.     struct _bfd *archive_head;    /* The first BFD in the archive.  */
  2017.     boolean has_armap;           
  2018.  
  2019.      /* A chain of BFD structures involved in a link.  */
  2020.     struct _bfd *link_next;
  2021.  
  2022.      /* A field used by _bfd_generic_link_add_archive_symbols.  This will
  2023.        be used only for archive elements.  */
  2024.     int archive_pass;
  2025.  
  2026.      /* Used by the back end to hold private data. */
  2027.  
  2028.     union 
  2029.       {
  2030.       struct aout_data_struct *aout_data;
  2031.       struct artdata *aout_ar_data;
  2032.       struct _oasys_data *oasys_obj_data;
  2033.       struct _oasys_ar_data *oasys_ar_data;
  2034.       struct coff_tdata *coff_obj_data;
  2035.       struct pe_tdata *pe_obj_data;
  2036.       struct xcoff_tdata *xcoff_obj_data;
  2037.       struct ecoff_tdata *ecoff_obj_data;
  2038.       struct ieee_data_struct *ieee_data;
  2039.       struct ieee_ar_data_struct *ieee_ar_data;
  2040.       struct srec_data_struct *srec_data;
  2041.       struct ihex_data_struct *ihex_data;
  2042.       struct tekhex_data_struct *tekhex_data;
  2043.       struct elf_obj_tdata *elf_obj_data;
  2044.       struct nlm_obj_tdata *nlm_obj_data;
  2045.       struct bout_data_struct *bout_data;
  2046.       struct sun_core_struct *sun_core_data;
  2047.       struct trad_core_struct *trad_core_data;
  2048.       struct som_data_struct *som_data;
  2049.       struct hpux_core_struct *hpux_core_data;
  2050.       struct hppabsd_core_struct *hppabsd_core_data;
  2051.       struct sgi_core_struct *sgi_core_data;
  2052.       struct lynx_core_struct *lynx_core_data;
  2053.       struct osf_core_struct *osf_core_data;
  2054.       struct cisco_core_struct *cisco_core_data;
  2055.       struct versados_data_struct *versados_data;
  2056.       struct netbsd_core_struct *netbsd_core_data;
  2057.       struct amiga_data_struct *amiga_data;
  2058.       PTR any;
  2059.       } tdata;
  2060.   
  2061.      /* Used by the application to hold private data*/
  2062.     PTR usrdata;
  2063.  
  2064.      /* Where all the allocated stuff under this BFD goes */
  2065.     struct obstack memory;
  2066. };
  2067.  
  2068. typedef enum bfd_error
  2069. {
  2070.   bfd_error_no_error = 0,
  2071.   bfd_error_system_call,
  2072.   bfd_error_invalid_target,
  2073.   bfd_error_wrong_format,
  2074.   bfd_error_invalid_operation,
  2075.   bfd_error_no_memory,
  2076.   bfd_error_no_symbols,
  2077.   bfd_error_no_armap,
  2078.   bfd_error_no_more_archived_files,
  2079.   bfd_error_malformed_archive,
  2080.   bfd_error_file_not_recognized,
  2081.   bfd_error_file_ambiguously_recognized,
  2082.   bfd_error_no_contents,
  2083.   bfd_error_nonrepresentable_section,
  2084.   bfd_error_no_debug_section,
  2085.   bfd_error_bad_value,
  2086.   bfd_error_file_truncated,
  2087.   bfd_error_file_too_big,
  2088.   bfd_error_invalid_error_code
  2089. } bfd_error_type;
  2090.  
  2091. bfd_error_type 
  2092. bfd_get_error  PARAMS ((void));
  2093.  
  2094. void 
  2095. bfd_set_error  PARAMS ((bfd_error_type error_tag));
  2096.  
  2097. CONST char *
  2098. bfd_errmsg  PARAMS ((bfd_error_type error_tag));
  2099.  
  2100. void 
  2101. bfd_perror  PARAMS ((CONST char *message));
  2102.  
  2103. typedef void (*bfd_error_handler_type) PARAMS ((const char *, ...));
  2104.  
  2105. bfd_error_handler_type 
  2106. bfd_set_error_handler  PARAMS ((bfd_error_handler_type));
  2107.  
  2108. void 
  2109. bfd_set_error_program_name  PARAMS ((const char *));
  2110.  
  2111. long 
  2112. bfd_get_reloc_upper_bound PARAMS ((bfd *abfd, asection *sect));
  2113.  
  2114. long 
  2115. bfd_canonicalize_reloc
  2116.  PARAMS ((bfd *abfd,
  2117.     asection *sec,
  2118.     arelent **loc,
  2119.     asymbol    **syms));
  2120.  
  2121. void 
  2122. bfd_set_reloc
  2123.  PARAMS ((bfd *abfd, asection *sec, arelent **rel, unsigned int count)
  2124.     
  2125.     );
  2126.  
  2127. boolean 
  2128. bfd_set_file_flags PARAMS ((bfd *abfd, flagword flags));
  2129.  
  2130. boolean 
  2131. bfd_set_start_address PARAMS ((bfd *abfd, bfd_vma vma));
  2132.  
  2133. long 
  2134. bfd_get_mtime PARAMS ((bfd *abfd));
  2135.  
  2136. long 
  2137. bfd_get_size PARAMS ((bfd *abfd));
  2138.  
  2139. int 
  2140. bfd_get_gp_size PARAMS ((bfd *abfd));
  2141.  
  2142. void 
  2143. bfd_set_gp_size PARAMS ((bfd *abfd, int i));
  2144.  
  2145. bfd_vma 
  2146. bfd_scan_vma PARAMS ((CONST char *string, CONST char **end, int base));
  2147.  
  2148. boolean 
  2149. bfd_copy_private_bfd_data PARAMS ((bfd *ibfd, bfd *obfd));
  2150.  
  2151. #define bfd_copy_private_bfd_data(ibfd, obfd) \
  2152.      BFD_SEND (ibfd, _bfd_copy_private_bfd_data, \
  2153.         (ibfd, obfd))
  2154. boolean 
  2155. bfd_merge_private_bfd_data PARAMS ((bfd *ibfd, bfd *obfd));
  2156.  
  2157. #define bfd_merge_private_bfd_data(ibfd, obfd) \
  2158.      BFD_SEND (ibfd, _bfd_merge_private_bfd_data, \
  2159.         (ibfd, obfd))
  2160. boolean 
  2161. bfd_set_private_flags PARAMS ((bfd *abfd, flagword flags));
  2162.  
  2163. #define bfd_set_private_flags(abfd, flags) \
  2164.      BFD_SEND (abfd, _bfd_set_private_flags, \
  2165.         (abfd, flags))
  2166. #define bfd_sizeof_headers(abfd, reloc) \
  2167.      BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, reloc))
  2168.  
  2169. #define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \
  2170.      BFD_SEND (abfd, _bfd_find_nearest_line,  (abfd, sec, syms, off, file, func, line))
  2171.  
  2172.         /* Do these three do anything useful at all, for any back end?  */
  2173. #define bfd_debug_info_start(abfd) \
  2174.         BFD_SEND (abfd, _bfd_debug_info_start, (abfd))
  2175.  
  2176. #define bfd_debug_info_end(abfd) \
  2177.         BFD_SEND (abfd, _bfd_debug_info_end, (abfd))
  2178.  
  2179. #define bfd_debug_info_accumulate(abfd, section) \
  2180.         BFD_SEND (abfd, _bfd_debug_info_accumulate, (abfd, section))
  2181.  
  2182.  
  2183. #define bfd_stat_arch_elt(abfd, stat) \
  2184.         BFD_SEND (abfd, _bfd_stat_arch_elt,(abfd, stat))
  2185.  
  2186. #define bfd_update_armap_timestamp(abfd) \
  2187.         BFD_SEND (abfd, _bfd_update_armap_timestamp, (abfd))
  2188.  
  2189. #define bfd_set_arch_mach(abfd, arch, mach)\
  2190.         BFD_SEND ( abfd, _bfd_set_arch_mach, (abfd, arch, mach))
  2191.  
  2192. #define bfd_relax_section(abfd, section, link_info, again) \
  2193.        BFD_SEND (abfd, _bfd_relax_section, (abfd, section, link_info, again))
  2194.  
  2195. #define bfd_link_hash_table_create(abfd) \
  2196.     BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd))
  2197.  
  2198. #define bfd_link_add_symbols(abfd, info) \
  2199.     BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info))
  2200.  
  2201. #define bfd_final_link(abfd, info) \
  2202.     BFD_SEND (abfd, _bfd_final_link, (abfd, info))
  2203.  
  2204. #define bfd_free_cached_info(abfd) \
  2205.        BFD_SEND (abfd, _bfd_free_cached_info, (abfd))
  2206.  
  2207. #define bfd_get_dynamic_symtab_upper_bound(abfd) \
  2208.     BFD_SEND (abfd, _bfd_get_dynamic_symtab_upper_bound, (abfd))
  2209.  
  2210. #define bfd_print_private_bfd_data(abfd, file)\
  2211.     BFD_SEND (abfd, _bfd_print_private_bfd_data, (abfd, file))
  2212.  
  2213. #define bfd_canonicalize_dynamic_symtab(abfd, asymbols) \
  2214.     BFD_SEND (abfd, _bfd_canonicalize_dynamic_symtab, (abfd, asymbols))
  2215.  
  2216. #define bfd_get_dynamic_reloc_upper_bound(abfd) \
  2217.     BFD_SEND (abfd, _bfd_get_dynamic_reloc_upper_bound, (abfd))
  2218.  
  2219. #define bfd_canonicalize_dynamic_reloc(abfd, arels, asyms) \
  2220.     BFD_SEND (abfd, _bfd_canonicalize_dynamic_reloc, (abfd, arels, asyms))
  2221.  
  2222. extern bfd_byte *bfd_get_relocated_section_contents
  2223.     PARAMS ((bfd *, struct bfd_link_info *,
  2224.           struct bfd_link_order *, bfd_byte *,
  2225.           boolean, asymbol **));
  2226.  
  2227. symindex 
  2228. bfd_get_next_mapent PARAMS ((bfd *abfd, symindex previous, carsym **sym));
  2229.  
  2230. boolean 
  2231. bfd_set_archive_head PARAMS ((bfd *output, bfd *new_head));
  2232.  
  2233. bfd *
  2234. bfd_openr_next_archived_file PARAMS ((bfd *archive, bfd *previous));
  2235.  
  2236. CONST char *
  2237. bfd_core_file_failing_command PARAMS ((bfd *abfd));
  2238.  
  2239. int 
  2240. bfd_core_file_failing_signal PARAMS ((bfd *abfd));
  2241.  
  2242. boolean 
  2243. core_file_matches_executable_p
  2244.  PARAMS ((bfd *core_bfd, bfd *exec_bfd));
  2245.  
  2246. #define BFD_SEND(bfd, message, arglist) \
  2247.                ((*((bfd)->xvec->message)) arglist)
  2248.  
  2249. #ifdef DEBUG_BFD_SEND
  2250. #undef BFD_SEND
  2251. #define BFD_SEND(bfd, message, arglist) \
  2252.   (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \
  2253.     ((*((bfd)->xvec->message)) arglist) : \
  2254.     (bfd_assert (__FILE__,__LINE__), NULL))
  2255. #endif
  2256. #define BFD_SEND_FMT(bfd, message, arglist) \
  2257.             (((bfd)->xvec->message[(int)((bfd)->format)]) arglist)
  2258.  
  2259. #ifdef DEBUG_BFD_SEND
  2260. #undef BFD_SEND_FMT
  2261. #define BFD_SEND_FMT(bfd, message, arglist) \
  2262.   (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \
  2263.    (((bfd)->xvec->message[(int)((bfd)->format)]) arglist) : \
  2264.    (bfd_assert (__FILE__,__LINE__), NULL))
  2265. #endif
  2266. enum bfd_flavour {
  2267.   bfd_target_unknown_flavour,
  2268.   bfd_target_amiga_flavour,
  2269.   bfd_target_aout_flavour,
  2270.   bfd_target_coff_flavour,
  2271.   bfd_target_ecoff_flavour,
  2272.   bfd_target_elf_flavour,
  2273.   bfd_target_ieee_flavour,
  2274.   bfd_target_nlm_flavour,
  2275.   bfd_target_oasys_flavour,
  2276.   bfd_target_tekhex_flavour,
  2277.   bfd_target_srec_flavour,
  2278.   bfd_target_ihex_flavour,
  2279.   bfd_target_som_flavour,
  2280.   bfd_target_os9k_flavour,
  2281.   bfd_target_versados_flavour,
  2282.   bfd_target_msdos_flavour,
  2283.   bfd_target_evax_flavour
  2284. };
  2285.  
  2286. enum bfd_endian { BFD_ENDIAN_BIG, BFD_ENDIAN_LITTLE, BFD_ENDIAN_UNKNOWN };
  2287.  
  2288.  /* Forward declaration.  */
  2289. typedef struct bfd_link_info _bfd_link_info;
  2290.  
  2291. typedef struct bfd_target
  2292. {
  2293.   char *name;
  2294.   enum bfd_flavour flavour;
  2295.   enum bfd_endian byteorder;
  2296.   enum bfd_endian header_byteorder;
  2297.   flagword object_flags;       
  2298.   flagword section_flags;
  2299.   char symbol_leading_char;
  2300.   char ar_pad_char;            
  2301.   unsigned short ar_max_namelen;
  2302.   bfd_vma      (*bfd_getx64) PARAMS ((const bfd_byte *));
  2303.   bfd_signed_vma (*bfd_getx_signed_64) PARAMS ((const bfd_byte *));
  2304.   void         (*bfd_putx64) PARAMS ((bfd_vma, bfd_byte *));
  2305.   bfd_vma      (*bfd_getx32) PARAMS ((const bfd_byte *));
  2306.   bfd_signed_vma (*bfd_getx_signed_32) PARAMS ((const bfd_byte *));
  2307.   void         (*bfd_putx32) PARAMS ((bfd_vma, bfd_byte *));
  2308.   bfd_vma      (*bfd_getx16) PARAMS ((const bfd_byte *));
  2309.   bfd_signed_vma (*bfd_getx_signed_16) PARAMS ((const bfd_byte *));
  2310.   void         (*bfd_putx16) PARAMS ((bfd_vma, bfd_byte *));
  2311.   bfd_vma      (*bfd_h_getx64) PARAMS ((const bfd_byte *));
  2312.   bfd_signed_vma (*bfd_h_getx_signed_64) PARAMS ((const bfd_byte *));
  2313.   void         (*bfd_h_putx64) PARAMS ((bfd_vma, bfd_byte *));
  2314.   bfd_vma      (*bfd_h_getx32) PARAMS ((const bfd_byte *));
  2315.   bfd_signed_vma (*bfd_h_getx_signed_32) PARAMS ((const bfd_byte *));
  2316.   void         (*bfd_h_putx32) PARAMS ((bfd_vma, bfd_byte *));
  2317.   bfd_vma      (*bfd_h_getx16) PARAMS ((const bfd_byte *));
  2318.   bfd_signed_vma (*bfd_h_getx_signed_16) PARAMS ((const bfd_byte *));
  2319.   void         (*bfd_h_putx16) PARAMS ((bfd_vma, bfd_byte *));
  2320.   const struct bfd_target *(*_bfd_check_format[bfd_type_end]) PARAMS ((bfd *));
  2321.   boolean             (*_bfd_set_format[bfd_type_end]) PARAMS ((bfd *));
  2322.   boolean             (*_bfd_write_contents[bfd_type_end]) PARAMS ((bfd *));
  2323.  
  2324.    /* Generic entry points.  */
  2325. #define BFD_JUMP_TABLE_GENERIC(NAME)\
  2326. CAT(NAME,_close_and_cleanup),\
  2327. CAT(NAME,_bfd_free_cached_info),\
  2328. CAT(NAME,_new_section_hook),\
  2329. CAT(NAME,_get_section_contents),\
  2330. CAT(NAME,_get_section_contents_in_window)
  2331.  
  2332.    /* Called when the BFD is being closed to do any necessary cleanup.  */
  2333.   boolean       (*_close_and_cleanup) PARAMS ((bfd *));
  2334.    /* Ask the BFD to free all cached information.  */
  2335.   boolean (*_bfd_free_cached_info) PARAMS ((bfd *));
  2336.    /* Called when a new section is created.  */
  2337.   boolean       (*_new_section_hook) PARAMS ((bfd *, sec_ptr));
  2338.    /* Read the contents of a section.  */
  2339.   boolean       (*_bfd_get_section_contents) PARAMS ((bfd *, sec_ptr, PTR, 
  2340.                                             file_ptr, bfd_size_type));
  2341.   boolean       (*_bfd_get_section_contents_in_window)
  2342.                           PARAMS ((bfd *, sec_ptr, bfd_window *,
  2343.                                    file_ptr, bfd_size_type));
  2344.  
  2345.    /* Entry points to copy private data.  */
  2346. #define BFD_JUMP_TABLE_COPY(NAME)\
  2347. CAT(NAME,_bfd_copy_private_bfd_data),\
  2348. CAT(NAME,_bfd_merge_private_bfd_data),\
  2349. CAT(NAME,_bfd_copy_private_section_data),\
  2350. CAT(NAME,_bfd_copy_private_symbol_data),\
  2351. CAT(NAME,_bfd_set_private_flags),\
  2352. CAT(NAME,_bfd_print_private_bfd_data)\
  2353.    /* Called to copy BFD general private data from one object file
  2354.      to another.  */
  2355.   boolean     (*_bfd_copy_private_bfd_data) PARAMS ((bfd *, bfd *));
  2356.    /* Called to merge BFD general private data from one object file
  2357.      to a common output file when linking.  */
  2358.   boolean     (*_bfd_merge_private_bfd_data) PARAMS ((bfd *, bfd *));
  2359.    /* Called to copy BFD private section data from one object file
  2360.      to another.  */
  2361.   boolean       (*_bfd_copy_private_section_data) PARAMS ((bfd *, sec_ptr,
  2362.                                                        bfd *, sec_ptr));
  2363.    /* Called to copy BFD private symbol data from one symbol 
  2364.      to another.  */
  2365.   boolean       (*_bfd_copy_private_symbol_data) PARAMS ((bfd *, asymbol *,
  2366.                                bfd *, asymbol *));
  2367.    /* Called to set private backend flags */
  2368.   boolean     (*_bfd_set_private_flags) PARAMS ((bfd *, flagword));
  2369.  
  2370.    /* Called to print private BFD data */
  2371.   boolean       (*_bfd_print_private_bfd_data) PARAMS ((bfd *, PTR));
  2372.  
  2373.    /* Core file entry points.  */
  2374. #define BFD_JUMP_TABLE_CORE(NAME)\
  2375. CAT(NAME,_core_file_failing_command),\
  2376. CAT(NAME,_core_file_failing_signal),\
  2377. CAT(NAME,_core_file_matches_executable_p)
  2378.   char *   (*_core_file_failing_command) PARAMS ((bfd *));
  2379.   int      (*_core_file_failing_signal) PARAMS ((bfd *));
  2380.   boolean  (*_core_file_matches_executable_p) PARAMS ((bfd *, bfd *));
  2381.  
  2382.    /* Archive entry points.  */
  2383. #define BFD_JUMP_TABLE_ARCHIVE(NAME)\
  2384. CAT(NAME,_slurp_armap),\
  2385. CAT(NAME,_slurp_extended_name_table),\
  2386. CAT(NAME,_construct_extended_name_table),\
  2387. CAT(NAME,_truncate_arname),\
  2388. CAT(NAME,_write_armap),\
  2389. CAT(NAME,_read_ar_hdr),\
  2390. CAT(NAME,_openr_next_archived_file),\
  2391. CAT(NAME,_get_elt_at_index),\
  2392. CAT(NAME,_generic_stat_arch_elt),\
  2393. CAT(NAME,_update_armap_timestamp)
  2394.   boolean  (*_bfd_slurp_armap) PARAMS ((bfd *));
  2395.   boolean  (*_bfd_slurp_extended_name_table) PARAMS ((bfd *));
  2396.   boolean  (*_bfd_construct_extended_name_table)
  2397.              PARAMS ((bfd *, char **, bfd_size_type *, const char **));
  2398.   void     (*_bfd_truncate_arname) PARAMS ((bfd *, CONST char *, char *));
  2399.   boolean  (*write_armap) PARAMS ((bfd *arch, 
  2400.                               unsigned int elength,
  2401.                               struct orl *map,
  2402.                               unsigned int orl_count, 
  2403.                               int stridx));
  2404.   PTR (*_bfd_read_ar_hdr_fn) PARAMS ((bfd *));
  2405.   bfd *    (*openr_next_archived_file) PARAMS ((bfd *arch, bfd *prev));
  2406. #define bfd_get_elt_at_index(b,i) BFD_SEND(b, _bfd_get_elt_at_index, (b,i))
  2407.   bfd *    (*_bfd_get_elt_at_index) PARAMS ((bfd *, symindex));
  2408.   int      (*_bfd_stat_arch_elt) PARAMS ((bfd *, struct stat *));
  2409.   boolean  (*_bfd_update_armap_timestamp) PARAMS ((bfd *));
  2410.  
  2411.    /* Entry points used for symbols.  */
  2412. #define BFD_JUMP_TABLE_SYMBOLS(NAME)\
  2413. CAT(NAME,_get_symtab_upper_bound),\
  2414. CAT(NAME,_get_symtab),\
  2415. CAT(NAME,_make_empty_symbol),\
  2416. CAT(NAME,_print_symbol),\
  2417. CAT(NAME,_get_symbol_info),\
  2418. CAT(NAME,_bfd_is_local_label),\
  2419. CAT(NAME,_get_lineno),\
  2420. CAT(NAME,_find_nearest_line),\
  2421. CAT(NAME,_bfd_make_debug_symbol),\
  2422. CAT(NAME,_read_minisymbols),\
  2423. CAT(NAME,_minisymbol_to_symbol)
  2424.   long  (*_bfd_get_symtab_upper_bound) PARAMS ((bfd *));
  2425.   long  (*_bfd_canonicalize_symtab) PARAMS ((bfd *,
  2426.                                              struct symbol_cache_entry **));
  2427.   struct symbol_cache_entry  *
  2428.                 (*_bfd_make_empty_symbol) PARAMS ((bfd *));
  2429.   void          (*_bfd_print_symbol) PARAMS ((bfd *, PTR,
  2430.                                       struct symbol_cache_entry *,
  2431.                                       bfd_print_symbol_type));
  2432. #define bfd_print_symbol(b,p,s,e) BFD_SEND(b, _bfd_print_symbol, (b,p,s,e))
  2433.   void          (*_bfd_get_symbol_info) PARAMS ((bfd *,
  2434.                                       struct symbol_cache_entry *,
  2435.                                       symbol_info *));
  2436. #define bfd_get_symbol_info(b,p,e) BFD_SEND(b, _bfd_get_symbol_info, (b,p,e))
  2437.   boolean     (*_bfd_is_local_label) PARAMS ((bfd *, asymbol *));
  2438.  
  2439.   alent *    (*_get_lineno) PARAMS ((bfd *, struct symbol_cache_entry *));
  2440.   boolean    (*_bfd_find_nearest_line) PARAMS ((bfd *abfd,
  2441.                     struct sec *section, struct symbol_cache_entry **symbols,
  2442.                     bfd_vma offset, CONST char **file, CONST char **func,
  2443.                     unsigned int *line));
  2444.   /* Back-door to allow format-aware applications to create debug symbols
  2445.     while using BFD for everything else.  Currently used by the assembler
  2446.     when creating COFF files.  */
  2447.   asymbol *  (*_bfd_make_debug_symbol) PARAMS ((
  2448.        bfd *abfd,
  2449.        void *ptr,
  2450.        unsigned long size));
  2451. #define bfd_read_minisymbols(b, d, m, s) \
  2452.   BFD_SEND (b, _read_minisymbols, (b, d, m, s))
  2453.   long  (*_read_minisymbols) PARAMS ((bfd *, boolean, PTR *,
  2454.                                       unsigned int *));
  2455. #define bfd_minisymbol_to_symbol(b, d, m, f) \
  2456.   BFD_SEND (b, _minisymbol_to_symbol, (b, d, m, f))
  2457.   asymbol *(*_minisymbol_to_symbol) PARAMS ((bfd *, boolean, const PTR,
  2458.                                              asymbol *));
  2459.  
  2460.    /* Routines for relocs.  */
  2461. #define BFD_JUMP_TABLE_RELOCS(NAME)\
  2462. CAT(NAME,_get_reloc_upper_bound),\
  2463. CAT(NAME,_canonicalize_reloc),\
  2464. CAT(NAME,_bfd_reloc_type_lookup)
  2465.   long  (*_get_reloc_upper_bound) PARAMS ((bfd *, sec_ptr));
  2466.   long  (*_bfd_canonicalize_reloc) PARAMS ((bfd *, sec_ptr, arelent **,
  2467.                                             struct symbol_cache_entry **));
  2468.    /* See documentation on reloc types.  */
  2469.   reloc_howto_type *
  2470.        (*reloc_type_lookup) PARAMS ((bfd *abfd,
  2471.                                      bfd_reloc_code_real_type code));
  2472.  
  2473.    /* Routines used when writing an object file.  */
  2474. #define BFD_JUMP_TABLE_WRITE(NAME)\
  2475. CAT(NAME,_set_arch_mach),\
  2476. CAT(NAME,_set_section_contents)
  2477.   boolean    (*_bfd_set_arch_mach) PARAMS ((bfd *, enum bfd_architecture,
  2478.                     unsigned long));
  2479.   boolean       (*_bfd_set_section_contents) PARAMS ((bfd *, sec_ptr, PTR,
  2480.                                             file_ptr, bfd_size_type));
  2481.  
  2482.    /* Routines used by the linker.  */
  2483. #define BFD_JUMP_TABLE_LINK(NAME)\
  2484. CAT(NAME,_sizeof_headers),\
  2485. CAT(NAME,_bfd_get_relocated_section_contents),\
  2486. CAT(NAME,_bfd_relax_section),\
  2487. CAT(NAME,_bfd_link_hash_table_create),\
  2488. CAT(NAME,_bfd_link_add_symbols),\
  2489. CAT(NAME,_bfd_final_link),\
  2490. CAT(NAME,_bfd_link_split_section)
  2491.   int        (*_bfd_sizeof_headers) PARAMS ((bfd *, boolean));
  2492.   bfd_byte * (*_bfd_get_relocated_section_contents) PARAMS ((bfd *,
  2493.                     struct bfd_link_info *, struct bfd_link_order *,
  2494.                     bfd_byte *data, boolean relocateable,
  2495.                     struct symbol_cache_entry **));
  2496.  
  2497.   boolean    (*_bfd_relax_section) PARAMS ((bfd *, struct sec *,
  2498.                     struct bfd_link_info *, boolean *again));
  2499.  
  2500.    /* Create a hash table for the linker.  Different backends store
  2501.      different information in this table.  */
  2502.   struct bfd_link_hash_table *(*_bfd_link_hash_table_create) PARAMS ((bfd *));
  2503.  
  2504.    /* Add symbols from this object file into the hash table.  */
  2505.   boolean (*_bfd_link_add_symbols) PARAMS ((bfd *, struct bfd_link_info *));
  2506.  
  2507.    /* Do a link based on the link_order structures attached to each
  2508.      section of the BFD.  */
  2509.   boolean (*_bfd_final_link) PARAMS ((bfd *, struct bfd_link_info *));
  2510.  
  2511.    /* Should this section be split up into smaller pieces during linking.  */
  2512.   boolean (*_bfd_link_split_section) PARAMS ((bfd *, struct sec *));
  2513.  
  2514.   /* Routines to handle dynamic symbols and relocs.  */
  2515. #define BFD_JUMP_TABLE_DYNAMIC(NAME)\
  2516. CAT(NAME,_get_dynamic_symtab_upper_bound),\
  2517. CAT(NAME,_canonicalize_dynamic_symtab),\
  2518. CAT(NAME,_get_dynamic_reloc_upper_bound),\
  2519. CAT(NAME,_canonicalize_dynamic_reloc)
  2520.    /* Get the amount of memory required to hold the dynamic symbols. */
  2521.   long  (*_bfd_get_dynamic_symtab_upper_bound) PARAMS ((bfd *));
  2522.    /* Read in the dynamic symbols.  */
  2523.   long  (*_bfd_canonicalize_dynamic_symtab)
  2524.     PARAMS ((bfd *, struct symbol_cache_entry **));
  2525.    /* Get the amount of memory required to hold the dynamic relocs.  */
  2526.   long  (*_bfd_get_dynamic_reloc_upper_bound) PARAMS ((bfd *));
  2527.    /* Read in the dynamic relocs.  */
  2528.   long  (*_bfd_canonicalize_dynamic_reloc)
  2529.     PARAMS ((bfd *, arelent **, struct symbol_cache_entry **));
  2530.  
  2531.  PTR backend_data;
  2532. } bfd_target;
  2533. const bfd_target *
  2534. bfd_find_target PARAMS ((CONST char *target_name, bfd *abfd));
  2535.  
  2536. const char **
  2537. bfd_target_list PARAMS ((void));
  2538.  
  2539. boolean 
  2540. bfd_check_format PARAMS ((bfd *abfd, bfd_format format));
  2541.  
  2542. boolean 
  2543. bfd_check_format_matches PARAMS ((bfd *abfd, bfd_format format, char ***matching));
  2544.  
  2545. boolean 
  2546. bfd_set_format PARAMS ((bfd *abfd, bfd_format format));
  2547.  
  2548. CONST char *
  2549. bfd_format_string PARAMS ((bfd_format format));
  2550.  
  2551. #ifdef __cplusplus
  2552. }
  2553. #endif
  2554. #endif
  2555.