Commit | Line | Data |
---|---|---|
e52e2acd SC |
1 | #define T_NULL 0 |
2 | #define T_VOID 1 /* function argument (only used by compiler) */ | |
3 | #define T_CHAR 2 /* character */ | |
4 | #define T_SHORT 3 /* short integer */ | |
5 | #define T_INT 4 /* integer */ | |
6 | #define T_LONG 5 /* long integer */ | |
7 | #define T_FLOAT 6 /* floating point */ | |
8 | #define T_DOUBLE 7 /* double word */ | |
9 | #define T_STRUCT 8 /* structure */ | |
10 | #define T_UNION 9 /* union */ | |
11 | #define T_ENUM 10 /* enumeration */ | |
12 | #define T_MOE 11 /* member of enumeration*/ | |
13 | #define T_UCHAR 12 /* unsigned character */ | |
14 | #define T_USHORT 13 /* unsigned short */ | |
15 | #define T_UINT 14 /* unsigned integer */ | |
16 | #define T_ULONG 15 /* unsigned long */ | |
17 | #define T_LNGDBL 16 /* long double */ | |
18 | ||
19 | ||
20 | struct coff_reloc | |
21 | { | |
22 | int offset; | |
23 | struct coff_symbol *symbol; | |
24 | int addend; | |
25 | }; | |
26 | ||
27 | struct coff_section | |
28 | { | |
29 | char *name; | |
30 | int code; | |
31 | int data; | |
32 | int address; | |
33 | int number; /* 0..n, .text = 0 */ | |
34 | int nrelocs; | |
35 | int size; | |
36 | struct coff_reloc *relocs; | |
37 | struct sec *bfd_section; | |
38 | }; | |
39 | ||
40 | struct coff_ofile | |
41 | { | |
42 | int nsources; | |
43 | struct coff_sfile *source_head; | |
44 | struct coff_sfile *source_tail; | |
45 | int nsections; | |
46 | struct coff_section *sections; | |
47 | struct coff_symbol *symbol_list_head; | |
48 | struct coff_symbol *symbol_list_tail; | |
49 | }; | |
50 | ||
51 | ||
52 | struct coff_sfile | |
53 | { | |
54 | char *name; | |
55 | struct coff_scope *scope; | |
56 | struct coff_sfile *next; | |
57 | ||
58 | ||
59 | }; | |
60 | ||
61 | ||
62 | struct coff_type | |
63 | { | |
64 | int size; | |
65 | enum | |
66 | { | |
67 | coff_pointer_type, coff_function_type, coff_array_type, coff_structdef_type, coff_basic_type, | |
68 | coff_structref_type, coff_enumref_type, coff_enumdef_type | |
69 | } type; | |
70 | union | |
71 | { | |
72 | struct | |
73 | { | |
74 | int isstruct; | |
75 | struct coff_scope *elements; | |
76 | int idx; | |
77 | } | |
78 | astructdef; | |
79 | struct | |
80 | { | |
81 | struct coff_symbol *ref; | |
82 | } astructref; | |
83 | ||
84 | struct | |
85 | { | |
86 | struct coff_scope *elements; | |
87 | int idx; | |
88 | } aenumdef; | |
89 | struct | |
90 | { | |
91 | struct coff_symbol *ref; | |
92 | } aenumref; | |
93 | ||
94 | struct | |
95 | { | |
96 | struct coff_type *points_to; | |
97 | } pointer; | |
98 | struct | |
99 | { | |
100 | int dim; | |
101 | struct coff_type *array_of; | |
102 | } array; | |
103 | ||
104 | struct | |
105 | { | |
106 | struct coff_type *function_returns; | |
107 | struct coff_scope *parameters; | |
108 | struct coff_scope *code; | |
109 | struct coff_line *lines; | |
110 | } function; | |
111 | int basic; /* One of T_VOID.. T_UINT */ | |
112 | } u; | |
113 | }; | |
114 | ||
115 | ||
116 | struct coff_line | |
117 | { | |
118 | int nlines; | |
119 | int *lines; | |
120 | int *addresses; | |
121 | }; | |
122 | ||
123 | ||
124 | struct coff_scope | |
125 | { | |
126 | struct coff_scope *parent; /* one up */ | |
127 | ||
128 | struct coff_scope *next; /*next along */ | |
129 | ||
130 | int nvars; | |
131 | struct coff_symbol *vars_head; /* symbols */ | |
132 | struct coff_symbol *vars_tail; | |
133 | ||
134 | struct coff_scope *list_head; /* children */ | |
135 | struct coff_scope *list_tail; | |
136 | ||
137 | }; | |
138 | ||
139 | ||
140 | struct coff_visible | |
141 | { | |
142 | enum coff_vis_type | |
143 | { | |
144 | coff_vis_ext_def, | |
145 | coff_vis_ext_ref, | |
146 | coff_vis_int_def, | |
147 | coff_vis_common, | |
148 | coff_vis_auto, | |
149 | coff_vis_register, | |
150 | coff_vis_tag, | |
151 | coff_vis_member_of_struct, | |
152 | coff_vis_member_of_enum, | |
153 | } type; | |
154 | }; | |
155 | ||
156 | struct coff_where | |
157 | { | |
158 | enum | |
159 | { | |
160 | coff_where_stack, coff_where_memory, coff_where_register, coff_where_unknown, | |
161 | coff_where_strtag, coff_where_member_of_struct, | |
162 | coff_where_member_of_enum, coff_where_entag, coff_where_typedef | |
163 | ||
164 | } where; | |
165 | int offset; | |
166 | int bitoffset; | |
167 | int bitsize; | |
168 | struct coff_section *section; | |
169 | }; | |
170 | ||
171 | struct coff_symbol | |
172 | { | |
173 | char *name; | |
174 | int tag; | |
175 | struct coff_type *type; | |
176 | struct coff_where *where; | |
177 | struct coff_visible *visible; | |
178 | struct coff_symbol *next; | |
179 | struct coff_symbol *next_in_ofile_list; /* For the ofile list */ | |
180 | int number; | |
181 | }; | |
182 | ||
183 | struct coff_ofile *coff_grok(); |