Back to index

cell-binutils  2.17cvs20070401
coffgrok.h
Go to the documentation of this file.
00001 /* coffgrok.h
00002    Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
00003 
00004 This file is part of GNU Binutils.
00005 
00006 This program is free software; you can redistribute it and/or modify
00007 it under the terms of the GNU General Public License as published by
00008 the Free Software Foundation; either version 2 of the License, or
00009 (at your option) any later version.
00010 
00011 This program is distributed in the hope that it will be useful,
00012 but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 GNU General Public License for more details.
00015 
00016 You should have received a copy of the GNU General Public License
00017 along with this program; if not, write to the Free Software
00018 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
00019 
00020 #define T_NULL              0
00021 #define T_VOID              1      /* function argument (only used by compiler) */
00022 #define T_CHAR              2      /* character         */
00023 #define T_SHORT             3      /* short integer     */
00024 #define T_INT        4      /* integer           */
00025 #define T_LONG              5      /* long integer             */
00026 #define T_FLOAT             6      /* floating point    */
00027 #define T_DOUBLE     7      /* double word              */
00028 #define T_STRUCT     8      /* structure         */
00029 #define T_UNION             9      /* union             */
00030 #define T_ENUM              10     /* enumeration              */
00031 #define T_MOE        11     /* member of enumeration*/
00032 #define T_UCHAR             12     /* unsigned character       */
00033 #define T_USHORT     13     /* unsigned short    */
00034 #define T_UINT              14     /* unsigned integer  */
00035 #define T_ULONG             15     /* unsigned long     */
00036 #define T_LNGDBL     16     /* long double              */
00037 
00038 
00039  struct coff_reloc
00040  {
00041    int offset;
00042    struct coff_symbol *symbol;
00043    int addend;
00044  };
00045 
00046  struct coff_section
00047  {
00048    char *name;
00049    int code;
00050    int data;
00051    int address;
00052    int number;  /* 0..n, .text = 0 */
00053    int nrelocs;
00054    int size;
00055    struct coff_reloc *relocs;
00056    struct bfd_section *bfd_section;
00057  };
00058 
00059 struct coff_ofile
00060 {
00061   int nsources;
00062   struct coff_sfile *source_head;
00063   struct coff_sfile *source_tail;
00064   int nsections;
00065   struct coff_section *sections;
00066   struct coff_symbol *symbol_list_head;
00067   struct coff_symbol *symbol_list_tail;
00068 };
00069 
00070 struct coff_isection {
00071   int low;
00072   int high;
00073   int init;
00074   struct coff_section *parent;
00075 };
00076 
00077 struct coff_sfile
00078 {
00079   char *name;
00080   struct coff_scope *scope;
00081   struct coff_sfile *next;
00082 
00083   /* Vector which maps where in each output section
00084      the input file has it's data */
00085   struct coff_isection *section;
00086 
00087 };
00088 
00089 
00090  struct coff_type
00091 {
00092   int size;
00093   enum
00094     {
00095       coff_pointer_type, coff_function_type, coff_array_type, coff_structdef_type, coff_basic_type,
00096       coff_structref_type, coff_enumref_type, coff_enumdef_type, coff_secdef_type
00097       } type;
00098   union
00099     {
00100       struct
00101        {
00102        int address;
00103        int size;
00104       } asecdef;
00105 
00106       struct
00107        {
00108          int isstruct;
00109          struct coff_scope *elements;
00110          int idx;
00111        }
00112       astructdef;
00113       struct
00114        {
00115          struct coff_symbol *ref;
00116        } astructref;
00117 
00118       struct
00119        {
00120          struct coff_scope *elements;
00121          int idx;
00122        } aenumdef;
00123       struct
00124        {
00125          struct coff_symbol *ref;
00126        } aenumref;
00127 
00128       struct
00129        {
00130          struct coff_type *points_to;
00131        } pointer;
00132       struct
00133        {
00134          int dim;
00135          struct coff_type *array_of;
00136        } array;
00137 
00138       struct
00139        {
00140          struct coff_type *function_returns;
00141          struct coff_scope *parameters;
00142          struct coff_scope *code;
00143          struct coff_line *lines;
00144        } function;
00145       int basic;            /* One of T_VOID.. T_UINT */
00146     }  u;
00147 };
00148 
00149 
00150  struct coff_line
00151  {
00152    int nlines;
00153    int *lines;
00154    int *addresses;
00155  };
00156 
00157 
00158  struct coff_scope
00159    {
00160      struct coff_section *sec; /* What section */
00161      int offset; /* where */
00162      int size; /* How big */
00163      struct coff_scope *parent;    /* one up */
00164 
00165      struct coff_scope *next;      /*next along */
00166 
00167      int nvars;
00168 
00169      struct coff_symbol *vars_head;       /* symbols */
00170      struct coff_symbol *vars_tail;
00171 
00172      struct coff_scope *list_head; /* children */
00173      struct coff_scope *list_tail;
00174 
00175    };
00176 
00177 
00178  struct coff_visible
00179    {
00180      enum coff_vis_type
00181        {
00182         coff_vis_ext_def,
00183         coff_vis_ext_ref,
00184         coff_vis_int_def,
00185         coff_vis_common,
00186         coff_vis_auto,
00187         coff_vis_register,
00188         coff_vis_tag,
00189         coff_vis_member_of_struct,
00190         coff_vis_member_of_enum,
00191         coff_vis_autoparam,
00192         coff_vis_regparam,
00193        } type;
00194    };
00195 
00196  struct coff_where
00197    {
00198      enum
00199        {
00200         coff_where_stack, coff_where_memory, coff_where_register, coff_where_unknown,
00201         coff_where_strtag, coff_where_member_of_struct,
00202         coff_where_member_of_enum, coff_where_entag, coff_where_typedef
00203 
00204        } where;
00205      int offset;
00206      int bitoffset;
00207      int bitsize;
00208      struct coff_section *section;
00209    };
00210 
00211  struct coff_symbol
00212    {
00213      char *name;
00214      int tag;
00215      struct coff_type *type;
00216      struct coff_where *where;
00217      struct coff_visible *visible;
00218      struct coff_symbol *next;
00219      struct coff_symbol *next_in_ofile_list; /* For the ofile list */
00220      int number;
00221      int er_number;
00222      struct coff_sfile *sfile;
00223   };
00224 
00225 struct coff_ofile *coff_grok PARAMS ((bfd *));