2007-07-05 Markus Deuling <deuling@de.ibm.com>
[deliverable/binutils-gdb.git] / binutils / coffgrok.h
CommitLineData
f462a9ea 1/* coffgrok.h
aef6203b 2 Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
8c2bc687
NC
3
4This file is part of GNU Binutils.
5
6This program is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2 of the License, or
9(at your option) any later version.
10
11This program is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with this program; if not, write to the Free Software
b43b5d5f 18Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
8c2bc687 19
252b5132
RH
20#define T_NULL 0
21#define T_VOID 1 /* function argument (only used by compiler) */
22#define T_CHAR 2 /* character */
23#define T_SHORT 3 /* short integer */
24#define T_INT 4 /* integer */
25#define T_LONG 5 /* long integer */
26#define T_FLOAT 6 /* floating point */
27#define T_DOUBLE 7 /* double word */
28#define T_STRUCT 8 /* structure */
29#define T_UNION 9 /* union */
30#define T_ENUM 10 /* enumeration */
31#define T_MOE 11 /* member of enumeration*/
32#define T_UCHAR 12 /* unsigned character */
33#define T_USHORT 13 /* unsigned short */
34#define T_UINT 14 /* unsigned integer */
35#define T_ULONG 15 /* unsigned long */
36#define T_LNGDBL 16 /* long double */
37
38
39 struct coff_reloc
40 {
41 int offset;
42 struct coff_symbol *symbol;
43 int addend;
44 };
45
f462a9ea 46 struct coff_section
252b5132
RH
47 {
48 char *name;
49 int code;
50 int data;
51 int address;
52 int number; /* 0..n, .text = 0 */
53 int nrelocs;
54 int size;
55 struct coff_reloc *relocs;
198beae2 56 struct bfd_section *bfd_section;
252b5132
RH
57 };
58
59struct coff_ofile
60{
61 int nsources;
62 struct coff_sfile *source_head;
63 struct coff_sfile *source_tail;
64 int nsections;
65 struct coff_section *sections;
66 struct coff_symbol *symbol_list_head;
67 struct coff_symbol *symbol_list_tail;
68};
69
70struct coff_isection {
71 int low;
72 int high;
73 int init;
74 struct coff_section *parent;
75};
76
77struct coff_sfile
78{
79 char *name;
80 struct coff_scope *scope;
81 struct coff_sfile *next;
82
83 /* Vector which maps where in each output section
84 the input file has it's data */
f462a9ea 85 struct coff_isection *section;
252b5132
RH
86
87};
88
89
90 struct coff_type
91{
92 int size;
93 enum
94 {
95 coff_pointer_type, coff_function_type, coff_array_type, coff_structdef_type, coff_basic_type,
96 coff_structref_type, coff_enumref_type, coff_enumdef_type, coff_secdef_type
97 } type;
98 union
99 {
f462a9ea 100 struct
252b5132
RH
101 {
102 int address;
103 int size;
104 } asecdef;
105
106 struct
107 {
108 int isstruct;
109 struct coff_scope *elements;
110 int idx;
111 }
112 astructdef;
113 struct
114 {
115 struct coff_symbol *ref;
116 } astructref;
117
118 struct
119 {
120 struct coff_scope *elements;
121 int idx;
122 } aenumdef;
123 struct
124 {
125 struct coff_symbol *ref;
126 } aenumref;
127
128 struct
129 {
130 struct coff_type *points_to;
131 } pointer;
132 struct
133 {
134 int dim;
135 struct coff_type *array_of;
136 } array;
137
138 struct
139 {
140 struct coff_type *function_returns;
141 struct coff_scope *parameters;
142 struct coff_scope *code;
143 struct coff_line *lines;
144 } function;
145 int basic; /* One of T_VOID.. T_UINT */
146 } u;
147};
148
149
f462a9ea 150 struct coff_line
252b5132
RH
151 {
152 int nlines;
153 int *lines;
154 int *addresses;
155 };
156
157
158 struct coff_scope
159 {
160 struct coff_section *sec; /* What section */
161 int offset; /* where */
162 int size; /* How big */
163 struct coff_scope *parent; /* one up */
164
165 struct coff_scope *next; /*next along */
166
167 int nvars;
168
169 struct coff_symbol *vars_head; /* symbols */
170 struct coff_symbol *vars_tail;
171
172 struct coff_scope *list_head; /* children */
173 struct coff_scope *list_tail;
174
175 };
176
177
178 struct coff_visible
179 {
180 enum coff_vis_type
181 {
182 coff_vis_ext_def,
183 coff_vis_ext_ref,
184 coff_vis_int_def,
185 coff_vis_common,
186 coff_vis_auto,
187 coff_vis_register,
188 coff_vis_tag,
189 coff_vis_member_of_struct,
190 coff_vis_member_of_enum,
f462a9ea 191 coff_vis_autoparam,
252b5132
RH
192 coff_vis_regparam,
193 } type;
194 };
195
196 struct coff_where
197 {
198 enum
199 {
200 coff_where_stack, coff_where_memory, coff_where_register, coff_where_unknown,
201 coff_where_strtag, coff_where_member_of_struct,
202 coff_where_member_of_enum, coff_where_entag, coff_where_typedef
203
204 } where;
205 int offset;
206 int bitoffset;
207 int bitsize;
208 struct coff_section *section;
209 };
210
211 struct coff_symbol
212 {
213 char *name;
214 int tag;
215 struct coff_type *type;
216 struct coff_where *where;
217 struct coff_visible *visible;
218 struct coff_symbol *next;
219 struct coff_symbol *next_in_ofile_list; /* For the ofile list */
220 int number;
221 int er_number;
222 struct coff_sfile *sfile;
223 };
224
c32144ff 225struct coff_ofile *coff_grok PARAMS ((bfd *));
This page took 0.41156 seconds and 4 git commands to generate.