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