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 / libcoff.h < prev    next >
C/C++ Source or Header  |  1996-09-28  |  29KB  |  854 lines

  1. /* BFD COFF object file private structure.
  2.    Copyright (C) 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
  3.    Written by Cygnus Support.
  4.  
  5. ** NOTE: libcoff.h is a GENERATED file.  Don't change it; instead,
  6. ** change libcoff-in.h or coffcode.h.
  7.  
  8. This file is part of BFD, the Binary File Descriptor library.
  9.  
  10. This program is free software; you can redistribute it and/or modify
  11. it under the terms of the GNU General Public License as published by
  12. the Free Software Foundation; either version 2 of the License, or
  13. (at your option) any later version.
  14.  
  15. This program is distributed in the hope that it will be useful,
  16. but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18. GNU General Public License for more details.
  19.  
  20. You should have received a copy of the GNU General Public License
  21. along with this program; if not, write to the Free Software
  22. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
  23.  
  24. #include "bfdlink.h"
  25.  
  26. /* Object file tdata; access macros */
  27.  
  28. #define coff_data(bfd)        ((bfd)->tdata.coff_obj_data)
  29. #define exec_hdr(bfd)        (coff_data(bfd)->hdr)
  30. #define obj_pe(bfd)             (coff_data(bfd)->pe)
  31. #define obj_symbols(bfd)    (coff_data(bfd)->symbols)
  32. #define    obj_sym_filepos(bfd)    (coff_data(bfd)->sym_filepos)
  33.  
  34. #define obj_relocbase(bfd)    (coff_data(bfd)->relocbase)
  35. #define obj_raw_syments(bfd)    (coff_data(bfd)->raw_syments)
  36. #define obj_raw_syment_count(bfd)    (coff_data(bfd)->raw_syment_count)
  37. #define obj_convert(bfd)    (coff_data(bfd)->conversion_table)
  38. #define obj_conv_table_size(bfd) (coff_data(bfd)->conv_table_size)
  39.  
  40. #define obj_coff_external_syms(bfd) (coff_data (bfd)->external_syms)
  41. #define obj_coff_keep_syms(bfd)    (coff_data (bfd)->keep_syms)
  42. #define obj_coff_strings(bfd)    (coff_data (bfd)->strings)
  43. #define obj_coff_keep_strings(bfd) (coff_data (bfd)->keep_strings)
  44. #define obj_coff_sym_hashes(bfd) (coff_data (bfd)->sym_hashes)
  45.  
  46. #define obj_coff_local_toc_table(bfd) (coff_data(bfd)->local_toc_sym_map)
  47.  
  48. /* `Tdata' information kept for COFF files.  */
  49.  
  50. typedef struct coff_tdata
  51. {
  52.   struct   coff_symbol_struct *symbols;    /* symtab for input bfd */
  53.   unsigned int *conversion_table;
  54.   int conv_table_size;
  55.   file_ptr sym_filepos;
  56.  
  57.   struct coff_ptr_struct *raw_syments;
  58.   unsigned int raw_syment_count;
  59.  
  60.   /* These are only valid once writing has begun */
  61.   long int relocbase;
  62.  
  63.   /* These members communicate important constants about the symbol table
  64.      to GDB's symbol-reading code.  These `constants' unfortunately vary
  65.      from coff implementation to implementation...  */
  66.   unsigned local_n_btmask;
  67.   unsigned local_n_btshft;
  68.   unsigned local_n_tmask;
  69.   unsigned local_n_tshift;
  70.   unsigned local_symesz;
  71.   unsigned local_auxesz;
  72.   unsigned local_linesz;
  73.  
  74.   /* The unswapped external symbols.  May be NULL.  Read by
  75.      _bfd_coff_get_external_symbols.  */
  76.   PTR external_syms;
  77.   /* If this is true, the external_syms may not be freed.  */
  78.   boolean keep_syms;
  79.  
  80.   /* The string table.  May be NULL.  Read by
  81.      _bfd_coff_read_string_table.  */
  82.   char *strings;
  83.   /* If this is true, the strings may not be freed.  */
  84.   boolean keep_strings;
  85.  
  86.   /* is this a PE format coff file */
  87.   int pe;
  88.   /* Used by the COFF backend linker.  */
  89.   struct coff_link_hash_entry **sym_hashes;
  90.  
  91.   /* used by the pe linker for PowerPC */
  92.   int *local_toc_sym_map;
  93.  
  94.   struct bfd_link_info *link_info;
  95.  
  96.   /* Used by coff_find_nearest_line.  */
  97.   PTR line_info;
  98. } coff_data_type;
  99.  
  100. /* Tdata for pe image files. */
  101. typedef struct pe_tdata
  102. {
  103.   coff_data_type coff;
  104.   struct internal_extra_pe_aouthdr pe_opthdr;
  105.   int dll;
  106.   int has_reloc_section;
  107.   boolean (*in_reloc_p) PARAMS((bfd *, reloc_howto_type *));
  108.   flagword real_flags;
  109. } pe_data_type;
  110.  
  111. #define pe_data(bfd)        ((bfd)->tdata.pe_obj_data)
  112.  
  113. /* Tdata for XCOFF files.  */
  114.  
  115. struct xcoff_tdata
  116. {
  117.   /* Basic COFF information.  */
  118.   coff_data_type coff;
  119.  
  120.   /* True if a large a.out header should be generated.  */
  121.   boolean full_aouthdr;
  122.  
  123.   /* TOC value.  */
  124.   bfd_vma toc;
  125.  
  126.   /* Index of section holding TOC.  */
  127.   int sntoc;
  128.  
  129.   /* Index of section holding entry point.  */
  130.   int snentry;
  131.  
  132.   /* .text alignment from optional header.  */
  133.   int text_align_power;
  134.  
  135.   /* .data alignment from optional header.  */
  136.   int data_align_power;
  137.  
  138.   /* modtype from optional header.  */
  139.   short modtype;
  140.  
  141.   /* cputype from optional header.  */
  142.   short cputype;
  143.  
  144.   /* maxdata from optional header.  */
  145.   bfd_size_type maxdata;
  146.  
  147.   /* maxstack from optional header.  */
  148.   bfd_size_type maxstack;
  149.  
  150.   /* Used by the XCOFF backend linker.  */
  151.   asection **csects;
  152.   unsigned long *debug_indices;
  153.   unsigned int import_file_id;
  154. };
  155.  
  156. #define xcoff_data(abfd) ((abfd)->tdata.xcoff_obj_data)
  157.  
  158. /* We take the address of the first element of a asymbol to ensure that the
  159.  * macro is only ever applied to an asymbol.  */
  160. #define coffsymbol(asymbol) ((coff_symbol_type *)(&((asymbol)->the_bfd)))
  161.  
  162. /* The used_by_bfd field of a section may be set to a pointer to this
  163.    structure.  */
  164.  
  165. struct coff_section_tdata
  166. {
  167.   /* The relocs, swapped into COFF internal form.  This may be NULL.  */
  168.   struct internal_reloc *relocs;
  169.   /* If this is true, the relocs entry may not be freed.  */
  170.   boolean keep_relocs;
  171.   /* The section contents.  This may be NULL.  */
  172.   bfd_byte *contents;
  173.   /* If this is true, the contents entry may not be freed.  */
  174.   boolean keep_contents;
  175.   /* Information cached by coff_find_nearest_line.  */
  176.   bfd_vma offset;
  177.   unsigned int i;
  178.   const char *function;
  179.   int line_base;
  180.   /* A pointer used for .stab linking optimizations.  */
  181.   PTR stab_info;
  182.   /* Available for individual backends.  */
  183.   PTR tdata;
  184. };
  185.  
  186. /* An accessor macro for the coff_section_tdata structure.  */
  187. #define coff_section_data(abfd, sec) \
  188.   ((struct coff_section_tdata *) (sec)->used_by_bfd)
  189.  
  190. /* Tdata for sections in XCOFF files.  This is used by the linker.  */
  191.  
  192. struct xcoff_section_tdata
  193. {
  194.   /* Used for XCOFF csects created by the linker; points to the real
  195.      XCOFF section which contains this csect.  */
  196.   asection *enclosing;
  197.   /* The lineno_count field for the enclosing section, because we are
  198.      going to clobber it there.  */
  199.   unsigned int lineno_count;
  200.   /* The first and one past the last symbol indices for symbols used
  201.      by this csect.  */
  202.   unsigned long first_symndx;
  203.   unsigned long last_symndx;
  204. };
  205.  
  206. /* An accessor macro the xcoff_section_tdata structure.  */
  207. #define xcoff_section_data(abfd, sec) \
  208.   ((struct xcoff_section_tdata *) coff_section_data ((abfd), (sec))->tdata)
  209.  
  210. /* Tdata for sections in PEI image files.  */
  211.  
  212. struct pei_section_tdata
  213. {
  214.   /* The virtual size of the section.  */
  215.   bfd_size_type virt_size;
  216. };
  217.  
  218. /* An accessor macro for the pei_section_tdata structure.  */
  219. #define pei_section_data(abfd, sec) \
  220.   ((struct pei_section_tdata *) coff_section_data ((abfd), (sec))->tdata)
  221.  
  222. /* COFF linker hash table entries.  */
  223.  
  224. struct coff_link_hash_entry
  225. {
  226.   struct bfd_link_hash_entry root;
  227.  
  228.   /* Symbol index in output file.  Set to -1 initially.  Set to -2 if
  229.      there is a reloc against this symbol.  */
  230.   long indx;
  231.  
  232.   /* Symbol type.  */
  233.   unsigned short type;
  234.  
  235.   /* Symbol class.  */
  236.   unsigned char class;
  237.  
  238.   /* Number of auxiliary entries.  */
  239.   char numaux;
  240.  
  241.   /* BFD to take auxiliary entries from.  */
  242.   bfd *auxbfd;
  243.  
  244.   /* Pointer to array of auxiliary entries, if any.  */
  245.   union internal_auxent *aux;
  246. };
  247.  
  248. /* COFF linker hash table.  */
  249.  
  250. struct coff_link_hash_table
  251. {
  252.   struct bfd_link_hash_table root;
  253.   /* A pointer to information used to link stabs in sections.  */
  254.   PTR stab_info;
  255. };
  256.  
  257. /* Look up an entry in a COFF linker hash table.  */
  258.  
  259. #define coff_link_hash_lookup(table, string, create, copy, follow)    \
  260.   ((struct coff_link_hash_entry *)                    \
  261.    bfd_link_hash_lookup (&(table)->root, (string), (create),        \
  262.              (copy), (follow)))
  263.  
  264. /* Traverse a COFF linker hash table.  */
  265.  
  266. #define coff_link_hash_traverse(table, func, info)            \
  267.   (bfd_link_hash_traverse                        \
  268.    (&(table)->root,                            \
  269.     (boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func),    \
  270.     (info)))
  271.  
  272. /* Get the COFF linker hash table from a link_info structure.  */
  273.  
  274. #define coff_hash_table(p) ((struct coff_link_hash_table *) ((p)->hash))
  275.  
  276. /* Functions in coffgen.c.  */
  277. extern const bfd_target *coff_object_p PARAMS ((bfd *));
  278. extern struct sec *coff_section_from_bfd_index PARAMS ((bfd *, int));
  279. extern long coff_get_symtab_upper_bound PARAMS ((bfd *));
  280. extern long coff_get_symtab PARAMS ((bfd *, asymbol **));
  281. extern int coff_count_linenumbers PARAMS ((bfd *));
  282. extern struct coff_symbol_struct *coff_symbol_from PARAMS ((bfd *, asymbol *));
  283. extern boolean coff_renumber_symbols PARAMS ((bfd *, int *));
  284. extern void coff_mangle_symbols PARAMS ((bfd *));
  285. extern boolean coff_write_symbols PARAMS ((bfd *));
  286. extern boolean coff_write_linenumbers PARAMS ((bfd *));
  287. extern alent *coff_get_lineno PARAMS ((bfd *, asymbol *));
  288. extern asymbol *coff_section_symbol PARAMS ((bfd *, char *));
  289. extern boolean _bfd_coff_get_external_symbols PARAMS ((bfd *));
  290. extern const char *_bfd_coff_read_string_table PARAMS ((bfd *));
  291. extern boolean _bfd_coff_free_symbols PARAMS ((bfd *));
  292. extern struct coff_ptr_struct *coff_get_normalized_symtab PARAMS ((bfd *));
  293. extern long coff_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr));
  294. extern asymbol *coff_make_empty_symbol PARAMS ((bfd *));
  295. extern void coff_print_symbol PARAMS ((bfd *, PTR filep, asymbol *,
  296.                        bfd_print_symbol_type how));
  297. extern void coff_get_symbol_info PARAMS ((bfd *, asymbol *,
  298.                       symbol_info *ret));
  299. extern asymbol *coff_bfd_make_debug_symbol PARAMS ((bfd *, PTR,
  300.                             unsigned long));
  301. extern boolean coff_find_nearest_line PARAMS ((bfd *,
  302.                            asection *,
  303.                            asymbol **,
  304.                            bfd_vma offset,
  305.                            CONST char **filename_ptr,
  306.                            CONST char **functionname_ptr,
  307.                            unsigned int *line_ptr));
  308. extern int coff_sizeof_headers PARAMS ((bfd *, boolean reloc));
  309. extern boolean bfd_coff_reloc16_relax_section
  310.   PARAMS ((bfd *, asection *, struct bfd_link_info *, boolean *));
  311. extern bfd_byte *bfd_coff_reloc16_get_relocated_section_contents
  312.   PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *,
  313.        bfd_byte *, boolean relocateable, asymbol **));
  314. extern bfd_vma bfd_coff_reloc16_get_value PARAMS ((arelent *,
  315.                            struct bfd_link_info *,
  316.                            asection *));
  317. extern void bfd_perform_slip PARAMS ((bfd *abfd, unsigned int slip,
  318.                       asection *input_section,
  319.                       bfd_vma val));
  320.  
  321. /* Functions and types in cofflink.c.  */
  322.  
  323. #define STRING_SIZE_SIZE (4)
  324.  
  325. /* We use a hash table to merge identical enum, struct, and union
  326.    definitions in the linker.  */
  327.  
  328. /* Information we keep for a single element (an enum value, a
  329.    structure or union field) in the debug merge hash table.  */
  330.  
  331. struct coff_debug_merge_element
  332. {
  333.   /* Next element.  */
  334.   struct coff_debug_merge_element *next;
  335.  
  336.   /* Name.  */
  337.   const char *name;
  338.  
  339.   /* Type.  */
  340.   unsigned int type;
  341.  
  342.   /* Symbol index for complex type.  */
  343.   long tagndx;
  344. };
  345.  
  346. /* A linked list of debug merge entries for a given name.  */
  347.  
  348. struct coff_debug_merge_type
  349. {
  350.   /* Next type with the same name.  */
  351.   struct coff_debug_merge_type *next;
  352.  
  353.   /* Class of type.  */
  354.   int class;
  355.  
  356.   /* Symbol index where this type is defined.  */
  357.   long indx;
  358.  
  359.   /* List of elements.  */
  360.   struct coff_debug_merge_element *elements;
  361. };
  362.  
  363. /* Information we store in the debug merge hash table.  */
  364.  
  365. struct coff_debug_merge_hash_entry
  366. {
  367.   struct bfd_hash_entry root;
  368.  
  369.   /* A list of types with this name.  */
  370.   struct coff_debug_merge_type *types;
  371. };
  372.  
  373. /* The debug merge hash table.  */
  374.  
  375. struct coff_debug_merge_hash_table
  376. {
  377.   struct bfd_hash_table root;
  378. };
  379.  
  380. /* Initialize a COFF debug merge hash table.  */
  381.  
  382. #define coff_debug_merge_hash_table_init(table) \
  383.   (bfd_hash_table_init (&(table)->root, _bfd_coff_debug_merge_hash_newfunc))
  384.  
  385. /* Free a COFF debug merge hash table.  */
  386.  
  387. #define coff_debug_merge_hash_table_free(table) \
  388.   (bfd_hash_table_free (&(table)->root))
  389.  
  390. /* Look up an entry in a COFF debug merge hash table.  */
  391.  
  392. #define coff_debug_merge_hash_lookup(table, string, create, copy) \
  393.   ((struct coff_debug_merge_hash_entry *) \
  394.    bfd_hash_lookup (&(table)->root, (string), (create), (copy)))
  395.  
  396. /* Information we keep for each section in the output file when doing
  397.    a relocateable link.  */
  398.  
  399. struct coff_link_section_info
  400. {
  401.   /* The relocs to be output.  */
  402.   struct internal_reloc *relocs;
  403.   /* For each reloc against a global symbol whose index was not known
  404.      when the reloc was handled, the global hash table entry.  */
  405.   struct coff_link_hash_entry **rel_hashes;
  406. };
  407.  
  408. /* Information that we pass around while doing the final link step.  */
  409.  
  410. struct coff_final_link_info
  411. {
  412.   /* General link information.  */
  413.   struct bfd_link_info *info;
  414.   /* Output BFD.  */
  415.   bfd *output_bfd;
  416.   /* Used to indicate failure in traversal routine.  */
  417.   boolean failed;
  418.   /* Hash table for long symbol names.  */
  419.   struct bfd_strtab_hash *strtab;
  420.   /* When doing a relocateable link, an array of information kept for
  421.      each output section, indexed by the target_index field.  */
  422.   struct coff_link_section_info *section_info;
  423.   /* Symbol index of last C_FILE symbol (-1 if none).  */
  424.   long last_file_index;
  425.   /* Contents of last C_FILE symbol.  */
  426.   struct internal_syment last_file;
  427.   /* Symbol index of first aux entry of last .bf symbol with an empty
  428.      endndx field (-1 if none).  */
  429.   long last_bf_index;
  430.   /* Contents of last_bf_index aux entry.  */
  431.   union internal_auxent last_bf;
  432.   /* Hash table used to merge debug information.  */
  433.   struct coff_debug_merge_hash_table debug_merge;
  434.   /* Buffer large enough to hold swapped symbols of any input file.  */
  435.   struct internal_syment *internal_syms;
  436.   /* Buffer large enough to hold sections of symbols of any input file.  */
  437.   asection **sec_ptrs;
  438.   /* Buffer large enough to hold output indices of symbols of any
  439.      input file.  */
  440.   long *sym_indices;
  441.   /* Buffer large enough to hold output symbols for any input file.  */
  442.   bfd_byte *outsyms;
  443.   /* Buffer large enough to hold external line numbers for any input
  444.      section.  */
  445.   bfd_byte *linenos;
  446.   /* Buffer large enough to hold any input section.  */
  447.   bfd_byte *contents;
  448.   /* Buffer large enough to hold external relocs of any input section.  */
  449.   bfd_byte *external_relocs;
  450.   /* Buffer large enough to hold swapped relocs of any input section.  */
  451.   struct internal_reloc *internal_relocs;
  452. };
  453.  
  454. extern struct bfd_hash_entry *_bfd_coff_link_hash_newfunc
  455.   PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
  456. extern boolean _bfd_coff_link_hash_table_init
  457.   PARAMS ((struct coff_link_hash_table *, bfd *,
  458.        struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
  459.                        struct bfd_hash_table *,
  460.                        const char *)));
  461. extern struct bfd_link_hash_table *_bfd_coff_link_hash_table_create
  462.   PARAMS ((bfd *));
  463. extern const char *_bfd_coff_internal_syment_name
  464.   PARAMS ((bfd *, const struct internal_syment *, char *));
  465. extern boolean _bfd_coff_link_add_symbols
  466.   PARAMS ((bfd *, struct bfd_link_info *));
  467. extern boolean _bfd_coff_final_link
  468.   PARAMS ((bfd *, struct bfd_link_info *));
  469. extern struct internal_reloc *_bfd_coff_read_internal_relocs
  470.   PARAMS ((bfd *, asection *, boolean, bfd_byte *, boolean,
  471.        struct internal_reloc *));
  472. extern boolean _bfd_coff_generic_relocate_section
  473.   PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
  474.        struct internal_reloc *, struct internal_syment *, asection **));
  475.  
  476. extern struct bfd_hash_entry *_bfd_coff_debug_merge_hash_newfunc
  477.   PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
  478. extern boolean _bfd_coff_write_global_sym
  479.   PARAMS ((struct coff_link_hash_entry *, PTR));
  480. extern boolean _bfd_coff_link_input_bfd
  481.   PARAMS ((struct coff_final_link_info *, bfd *));
  482. extern boolean _bfd_coff_reloc_link_order
  483.   PARAMS ((bfd *, struct coff_final_link_info *, asection *,
  484.        struct bfd_link_order *));
  485.  
  486.  
  487. #define coff_get_section_contents_in_window \
  488.   _bfd_generic_get_section_contents_in_window
  489.  
  490. /* Functions in xcofflink.c.  */
  491.  
  492. extern long _bfd_xcoff_get_dynamic_symtab_upper_bound PARAMS ((bfd *));
  493. extern long _bfd_xcoff_canonicalize_dynamic_symtab
  494.   PARAMS ((bfd *, asymbol **));
  495. extern long _bfd_xcoff_get_dynamic_reloc_upper_bound PARAMS ((bfd *));
  496. extern long _bfd_xcoff_canonicalize_dynamic_reloc
  497.   PARAMS ((bfd *, arelent **, asymbol **));
  498. extern struct bfd_link_hash_table *_bfd_xcoff_bfd_link_hash_table_create
  499.   PARAMS ((bfd *));
  500. extern boolean _bfd_xcoff_bfd_link_add_symbols
  501.   PARAMS ((bfd *, struct bfd_link_info *));
  502. extern boolean _bfd_xcoff_bfd_final_link
  503.   PARAMS ((bfd *, struct bfd_link_info *));
  504. extern boolean _bfd_ppc_xcoff_relocate_section
  505.   PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
  506.        struct internal_reloc *, struct internal_syment *, asection **));
  507.  
  508. /* And more taken from the source .. */
  509.  
  510. typedef struct coff_ptr_struct
  511. {
  512.  
  513.         /* Remembers the offset from the first symbol in the file for
  514.           this symbol. Generated by coff_renumber_symbols. */
  515. unsigned int offset;
  516.  
  517.         /* Should the value of this symbol be renumbered.  Used for
  518.           XCOFF C_BSTAT symbols.  Set by coff_slurp_symbol_table.  */
  519. unsigned int fix_value : 1;
  520.  
  521.         /* Should the tag field of this symbol be renumbered.
  522.           Created by coff_pointerize_aux. */
  523. unsigned int fix_tag : 1;
  524.  
  525.         /* Should the endidx field of this symbol be renumbered.
  526.           Created by coff_pointerize_aux. */
  527. unsigned int fix_end : 1;
  528.  
  529.         /* Should the x_csect.x_scnlen field be renumbered.
  530.           Created by coff_pointerize_aux. */
  531. unsigned int fix_scnlen : 1;
  532.  
  533.         /* Fix up an XCOFF C_BINCL/C_EINCL symbol.  The value is the
  534.           index into the line number entries.  Set by
  535.           coff_slurp_symbol_table.  */
  536. unsigned int fix_line : 1;
  537.  
  538.         /* The container for the symbol structure as read and translated
  539.            from the file. */
  540.  
  541. union {
  542.    union internal_auxent auxent;
  543.    struct internal_syment syment;
  544.  } u;
  545. } combined_entry_type;
  546.  
  547.  
  548.  /* Each canonical asymbol really looks like this: */
  549.  
  550. typedef struct coff_symbol_struct
  551. {
  552.     /* The actual symbol which the rest of BFD works with */
  553. asymbol symbol;
  554.  
  555.     /* A pointer to the hidden information for this symbol */
  556. combined_entry_type *native;
  557.  
  558.     /* A pointer to the linenumber information for this symbol */
  559. struct lineno_cache_entry *lineno;
  560.  
  561.     /* Have the line numbers been relocated yet ? */
  562. boolean done_lineno;
  563. } coff_symbol_type;
  564. typedef struct
  565. {
  566.   void (*_bfd_coff_swap_aux_in) PARAMS ((
  567.        bfd            *abfd,
  568.        PTR             ext,
  569.        int             type,
  570.        int             class,
  571.        int             indaux,
  572.        int             numaux,
  573.        PTR             in));
  574.  
  575.   void (*_bfd_coff_swap_sym_in) PARAMS ((
  576.        bfd            *abfd ,
  577.        PTR             ext,
  578.        PTR             in));
  579.  
  580.   void (*_bfd_coff_swap_lineno_in) PARAMS ((
  581.        bfd            *abfd,
  582.        PTR            ext,
  583.        PTR             in));
  584.  
  585.  unsigned int (*_bfd_coff_swap_aux_out) PARAMS ((
  586.        bfd       *abfd,
  587.        PTR    in,
  588.        int        type,
  589.        int        class,
  590.        int     indaux,
  591.        int     numaux,
  592.        PTR        ext));
  593.  
  594.  unsigned int (*_bfd_coff_swap_sym_out) PARAMS ((
  595.       bfd      *abfd,
  596.       PTR    in,
  597.       PTR    ext));
  598.  
  599.  unsigned int (*_bfd_coff_swap_lineno_out) PARAMS ((
  600.           bfd       *abfd,
  601.           PTR    in,
  602.     PTR    ext));
  603.  
  604.  unsigned int (*_bfd_coff_swap_reloc_out) PARAMS ((
  605.           bfd     *abfd,
  606.          PTR    src,
  607.     PTR    dst));
  608.  
  609.  unsigned int (*_bfd_coff_swap_filehdr_out) PARAMS ((
  610.           bfd      *abfd,
  611.     PTR     in,
  612.     PTR     out));
  613.  
  614.  unsigned int (*_bfd_coff_swap_aouthdr_out) PARAMS ((
  615.           bfd     *abfd,
  616.     PTR     in,
  617.     PTR    out));
  618.  
  619.  unsigned int (*_bfd_coff_swap_scnhdr_out) PARAMS ((
  620.           bfd      *abfd,
  621.           PTR    in,
  622.     PTR    out));
  623.  
  624.  unsigned int _bfd_filhsz;
  625.  unsigned int _bfd_aoutsz;
  626.  unsigned int _bfd_scnhsz;
  627.  unsigned int _bfd_symesz;
  628.  unsigned int _bfd_auxesz;
  629.  unsigned int _bfd_relsz;
  630.  unsigned int _bfd_linesz;
  631.  boolean _bfd_coff_long_filenames;
  632.  boolean _bfd_coff_long_section_names;
  633.  void (*_bfd_coff_swap_filehdr_in) PARAMS ((
  634.        bfd     *abfd,
  635.        PTR     ext,
  636.        PTR     in));
  637.  void (*_bfd_coff_swap_aouthdr_in) PARAMS ((
  638.        bfd     *abfd,
  639.        PTR     ext,
  640.        PTR     in));
  641.  void (*_bfd_coff_swap_scnhdr_in) PARAMS ((
  642.        bfd     *abfd,
  643.        PTR     ext,
  644.        PTR     in));
  645.  void (*_bfd_coff_swap_reloc_in) PARAMS ((
  646.        bfd     *abfd,
  647.        PTR     ext,
  648.        PTR     in));
  649.  boolean (*_bfd_coff_bad_format_hook) PARAMS ((
  650.        bfd     *abfd,
  651.        PTR     internal_filehdr));
  652.  boolean (*_bfd_coff_set_arch_mach_hook) PARAMS ((
  653.        bfd     *abfd,
  654.        PTR     internal_filehdr));
  655.  PTR (*_bfd_coff_mkobject_hook) PARAMS ((
  656.        bfd     *abfd,
  657.        PTR     internal_filehdr,
  658.        PTR     internal_aouthdr));
  659.  flagword (*_bfd_styp_to_sec_flags_hook) PARAMS ((
  660.        bfd     *abfd,
  661.        PTR     internal_scnhdr,
  662.        const char *name));
  663.  void (*_bfd_set_alignment_hook) PARAMS ((
  664.        bfd     *abfd,
  665.        asection *sec,
  666.        PTR     internal_scnhdr));
  667.  boolean (*_bfd_coff_slurp_symbol_table) PARAMS ((
  668.        bfd     *abfd));
  669.  boolean (*_bfd_coff_symname_in_debug) PARAMS ((
  670.        bfd     *abfd,
  671.        struct internal_syment *sym));
  672.  boolean (*_bfd_coff_pointerize_aux_hook) PARAMS ((
  673.        bfd *abfd,
  674.        combined_entry_type *table_base,
  675.        combined_entry_type *symbol,
  676.        unsigned int indaux,
  677.        combined_entry_type *aux));
  678.  boolean (*_bfd_coff_print_aux) PARAMS ((
  679.        bfd *abfd,
  680.        FILE *file,
  681.        combined_entry_type *table_base,
  682.        combined_entry_type *symbol,
  683.        combined_entry_type *aux,
  684.        unsigned int indaux));
  685.  void (*_bfd_coff_reloc16_extra_cases) PARAMS ((
  686.        bfd     *abfd,
  687.        struct bfd_link_info *link_info,
  688.        struct bfd_link_order *link_order,
  689.        arelent *reloc,
  690.        bfd_byte *data,
  691.        unsigned int *src_ptr,
  692.        unsigned int *dst_ptr));
  693.  int (*_bfd_coff_reloc16_estimate) PARAMS ((
  694.        bfd *abfd,
  695.        asection *input_section,
  696.        arelent *r,
  697.        unsigned int shrink,
  698.        struct bfd_link_info *link_info));
  699.  boolean (*_bfd_coff_sym_is_global) PARAMS ((
  700.        bfd *abfd,
  701.        struct internal_syment *));
  702.  void (*_bfd_coff_compute_section_file_positions) PARAMS ((
  703.        bfd *abfd));
  704.  boolean (*_bfd_coff_start_final_link) PARAMS ((
  705.        bfd *output_bfd,
  706.        struct bfd_link_info *info));
  707.  boolean (*_bfd_coff_relocate_section) PARAMS ((
  708.        bfd *output_bfd,
  709.        struct bfd_link_info *info,
  710.        bfd *input_bfd,
  711.        asection *input_section,
  712.        bfd_byte *contents,
  713.        struct internal_reloc *relocs,
  714.        struct internal_syment *syms,
  715.        asection **sections));
  716.  reloc_howto_type *(*_bfd_coff_rtype_to_howto) PARAMS ((
  717.        bfd *abfd,
  718.        asection *sec,
  719.        struct internal_reloc *rel,
  720.        struct coff_link_hash_entry *h,
  721.        struct internal_syment *sym,
  722.        bfd_vma *addendp));
  723.  boolean (*_bfd_coff_adjust_symndx) PARAMS ((
  724.        bfd *obfd,
  725.        struct bfd_link_info *info,
  726.        bfd *ibfd,
  727.        asection *sec,
  728.        struct internal_reloc *reloc,
  729.        boolean *adjustedp));
  730.  boolean (*_bfd_coff_link_add_one_symbol) PARAMS ((
  731.        struct bfd_link_info *info,
  732.        bfd *abfd,
  733.        const char *name,
  734.        flagword flags, 
  735.        asection *section,
  736.        bfd_vma value,
  737.        const char *string,
  738.        boolean copy,
  739.        boolean collect, 
  740.        struct bfd_link_hash_entry **hashp));
  741.  
  742. } bfd_coff_backend_data;
  743.  
  744. #define coff_backend_info(abfd) ((bfd_coff_backend_data *) (abfd)->xvec->backend_data)
  745.  
  746. #define bfd_coff_swap_aux_in(a,e,t,c,ind,num,i) \
  747.         ((coff_backend_info (a)->_bfd_coff_swap_aux_in) (a,e,t,c,ind,num,i))
  748.  
  749. #define bfd_coff_swap_sym_in(a,e,i) \
  750.         ((coff_backend_info (a)->_bfd_coff_swap_sym_in) (a,e,i))
  751.  
  752. #define bfd_coff_swap_lineno_in(a,e,i) \
  753.         ((coff_backend_info ( a)->_bfd_coff_swap_lineno_in) (a,e,i))
  754.  
  755. #define bfd_coff_swap_reloc_out(abfd, i, o) \
  756.         ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_out) (abfd, i, o))
  757.  
  758. #define bfd_coff_swap_lineno_out(abfd, i, o) \
  759.         ((coff_backend_info (abfd)->_bfd_coff_swap_lineno_out) (abfd, i, o))
  760.  
  761. #define bfd_coff_swap_aux_out(a,i,t,c,ind,num,o) \
  762.         ((coff_backend_info (a)->_bfd_coff_swap_aux_out) (a,i,t,c,ind,num,o))
  763.  
  764. #define bfd_coff_swap_sym_out(abfd, i,o) \
  765.         ((coff_backend_info (abfd)->_bfd_coff_swap_sym_out) (abfd, i, o))
  766.  
  767. #define bfd_coff_swap_scnhdr_out(abfd, i,o) \
  768.         ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_out) (abfd, i, o))
  769.  
  770. #define bfd_coff_swap_filehdr_out(abfd, i,o) \
  771.         ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_out) (abfd, i, o))
  772.  
  773. #define bfd_coff_swap_aouthdr_out(abfd, i,o) \
  774.         ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_out) (abfd, i, o))
  775.  
  776. #define bfd_coff_filhsz(abfd) (coff_backend_info (abfd)->_bfd_filhsz)
  777. #define bfd_coff_aoutsz(abfd) (coff_backend_info (abfd)->_bfd_aoutsz)
  778. #define bfd_coff_scnhsz(abfd) (coff_backend_info (abfd)->_bfd_scnhsz)
  779. #define bfd_coff_symesz(abfd) (coff_backend_info (abfd)->_bfd_symesz)
  780. #define bfd_coff_auxesz(abfd) (coff_backend_info (abfd)->_bfd_auxesz)
  781. #define bfd_coff_relsz(abfd)  (coff_backend_info (abfd)->_bfd_relsz)
  782. #define bfd_coff_linesz(abfd) (coff_backend_info (abfd)->_bfd_linesz)
  783. #define bfd_coff_long_filenames(abfd) (coff_backend_info (abfd)->_bfd_coff_long_filenames)
  784. #define bfd_coff_long_section_names(abfd) \
  785.         (coff_backend_info (abfd)->_bfd_coff_long_section_names)
  786. #define bfd_coff_swap_filehdr_in(abfd, i,o) \
  787.         ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_in) (abfd, i, o))
  788.  
  789. #define bfd_coff_swap_aouthdr_in(abfd, i,o) \
  790.         ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_in) (abfd, i, o))
  791.  
  792. #define bfd_coff_swap_scnhdr_in(abfd, i,o) \
  793.         ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_in) (abfd, i, o))
  794.  
  795. #define bfd_coff_swap_reloc_in(abfd, i, o) \
  796.         ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_in) (abfd, i, o))
  797.  
  798. #define bfd_coff_bad_format_hook(abfd, filehdr) \
  799.         ((coff_backend_info (abfd)->_bfd_coff_bad_format_hook) (abfd, filehdr))
  800.  
  801. #define bfd_coff_set_arch_mach_hook(abfd, filehdr)\
  802.         ((coff_backend_info (abfd)->_bfd_coff_set_arch_mach_hook) (abfd, filehdr))
  803. #define bfd_coff_mkobject_hook(abfd, filehdr, aouthdr)\
  804.         ((coff_backend_info (abfd)->_bfd_coff_mkobject_hook) (abfd, filehdr, aouthdr))
  805.  
  806. #define bfd_coff_styp_to_sec_flags_hook(abfd, scnhdr, name)\
  807.         ((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook) (abfd, scnhdr, name))
  808.  
  809. #define bfd_coff_set_alignment_hook(abfd, sec, scnhdr)\
  810.         ((coff_backend_info (abfd)->_bfd_set_alignment_hook) (abfd, sec, scnhdr))
  811.  
  812. #define bfd_coff_slurp_symbol_table(abfd)\
  813.         ((coff_backend_info (abfd)->_bfd_coff_slurp_symbol_table) (abfd))
  814.  
  815. #define bfd_coff_symname_in_debug(abfd, sym)\
  816.         ((coff_backend_info (abfd)->_bfd_coff_symname_in_debug) (abfd, sym))
  817.  
  818. #define bfd_coff_print_aux(abfd, file, base, symbol, aux, indaux)\
  819.         ((coff_backend_info (abfd)->_bfd_coff_print_aux)\
  820.          (abfd, file, base, symbol, aux, indaux))
  821.  
  822. #define bfd_coff_reloc16_extra_cases(abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)\
  823.         ((coff_backend_info (abfd)->_bfd_coff_reloc16_extra_cases)\
  824.          (abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr))
  825.  
  826. #define bfd_coff_reloc16_estimate(abfd, section, reloc, shrink, link_info)\
  827.         ((coff_backend_info (abfd)->_bfd_coff_reloc16_estimate)\
  828.          (abfd, section, reloc, shrink, link_info))
  829.  
  830. #define bfd_coff_sym_is_global(abfd, sym)\
  831.         ((coff_backend_info (abfd)->_bfd_coff_sym_is_global)\
  832.          (abfd, sym))
  833.  
  834. #define bfd_coff_compute_section_file_positions(abfd)\
  835.         ((coff_backend_info (abfd)->_bfd_coff_compute_section_file_positions)\
  836.          (abfd))
  837.  
  838. #define bfd_coff_start_final_link(obfd, info)\
  839.         ((coff_backend_info (obfd)->_bfd_coff_start_final_link)\
  840.          (obfd, info))
  841. #define bfd_coff_relocate_section(obfd,info,ibfd,o,con,rel,isyms,secs)\
  842.         ((coff_backend_info (ibfd)->_bfd_coff_relocate_section)\
  843.          (obfd, info, ibfd, o, con, rel, isyms, secs))
  844. #define bfd_coff_rtype_to_howto(abfd, sec, rel, h, sym, addendp)\
  845.         ((coff_backend_info (abfd)->_bfd_coff_rtype_to_howto)\
  846.          (abfd, sec, rel, h, sym, addendp))
  847. #define bfd_coff_adjust_symndx(obfd, info, ibfd, sec, rel, adjustedp)\
  848.         ((coff_backend_info (abfd)->_bfd_coff_adjust_symndx)\
  849.          (obfd, info, ibfd, sec, rel, adjustedp))
  850. #define bfd_coff_link_add_one_symbol(info,abfd,name,flags,section,value,string,cp,coll,hashp)\
  851.         ((coff_backend_info (abfd)->_bfd_coff_link_add_one_symbol)\
  852.          (info, abfd, name, flags, section, value, string, cp, coll, hashp))
  853.  
  854.