1 |
14 |
khays |
/* xSYM symbol-file support for BFD.
|
2 |
|
|
Copyright 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007
|
3 |
|
|
Free Software Foundation, Inc.
|
4 |
|
|
|
5 |
|
|
This file is part of BFD, the Binary File Descriptor library.
|
6 |
|
|
|
7 |
|
|
This program is free software; you can redistribute it and/or modify
|
8 |
|
|
it under the terms of the GNU General Public License as published by
|
9 |
|
|
the Free Software Foundation; either version 3 of the License, or
|
10 |
|
|
(at your option) any later version.
|
11 |
|
|
|
12 |
|
|
This program is distributed in the hope that it will be useful,
|
13 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15 |
|
|
GNU General Public License for more details.
|
16 |
|
|
|
17 |
|
|
You should have received a copy of the GNU General Public License
|
18 |
|
|
along with this program; if not, write to the Free Software
|
19 |
|
|
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
20 |
|
|
MA 02110-1301, USA. */
|
21 |
|
|
|
22 |
|
|
#include "bfd.h"
|
23 |
|
|
#include <stdio.h>
|
24 |
|
|
|
25 |
|
|
#ifndef __xSYM_H__
|
26 |
|
|
#define __xSYM_H__
|
27 |
|
|
|
28 |
|
|
#define BFD_SYM_VERSION_STR_3_1 "\013Version 3.1"
|
29 |
|
|
#define BFD_SYM_VERSION_STR_3_2 "\013Version 3.2"
|
30 |
|
|
#define BFD_SYM_VERSION_STR_3_3 "\013Version 3.3"
|
31 |
|
|
#define BFD_SYM_VERSION_STR_3_4 "\013Version 3.4"
|
32 |
|
|
#define BFD_SYM_VERSION_STR_3_5 "\013Version 3.5"
|
33 |
|
|
#define BFD_SYM_END_OF_LIST_3_2 0xffff
|
34 |
|
|
#define BFD_SYM_END_OF_LIST_3_4 0xffffffff
|
35 |
|
|
#define BFD_SYM_END_OF_LIST BFD_SYM_END_OF_LIST_3_4
|
36 |
|
|
#define BFD_SYM_FILE_NAME_INDEX_3_2 0xfffe
|
37 |
|
|
#define BFD_SYM_FILE_NAME_INDEX_3_4 0xfffffffe
|
38 |
|
|
#define BFD_SYM_FILE_NAME_INDEX BFD_SYM_FILE_NAME_INDEX_3_4
|
39 |
|
|
#define BFD_SYM_SOURCE_FILE_CHANGE_3_2 0xfffe
|
40 |
|
|
#define BFD_SYM_SOURCE_FILE_CHANGE_3_4 0xfffffffe
|
41 |
|
|
#define BFD_SYM_SOURCE_FILE_CHANGE BFD_SYM_SOURCE_FILE_CHANGE_3_4
|
42 |
|
|
#define BFD_SYM_MAXIMUM_LEGAL_INDEX_3_2 0xfffd
|
43 |
|
|
#define BFD_SYM_MAXIMUM_LEGAL_INDEX_3_4 0xfffffffd
|
44 |
|
|
#define BFD_SYM_MAXIMUM_LEGAL_INDEX BFD_SYM_MAXIMUM_LEGAL_INDEX_3_4
|
45 |
|
|
|
46 |
|
|
enum bfd_sym_storage_class
|
47 |
|
|
{
|
48 |
|
|
BFD_SYM_STORAGE_CLASS_REGISTER = 0,
|
49 |
|
|
BFD_SYM_STORAGE_CLASS_GLOBAL = 1,
|
50 |
|
|
BFD_SYM_STORAGE_CLASS_FRAME_RELATIVE = 2,
|
51 |
|
|
BFD_SYM_STORAGE_CLASS_STACK_RELATIVE = 3,
|
52 |
|
|
BFD_SYM_STORAGE_CLASS_ABSOLUTE = 4,
|
53 |
|
|
BFD_SYM_STORAGE_CLASS_CONSTANT = 5,
|
54 |
|
|
BFD_SYM_STORAGE_CLASS_BIGCONSTANT = 6,
|
55 |
|
|
BFD_SYM_STORAGE_CLASS_RESOURCE = 99
|
56 |
|
|
};
|
57 |
|
|
typedef enum bfd_sym_storage_class bfd_sym_storage_class;
|
58 |
|
|
|
59 |
|
|
enum bfd_sym_storage_kind
|
60 |
|
|
{
|
61 |
|
|
BFD_SYM_STORAGE_KIND_LOCAL = 0,
|
62 |
|
|
BFD_SYM_STORAGE_KIND_VALUE = 1,
|
63 |
|
|
BFD_SYM_STORAGE_KIND_REFERENCE = 2,
|
64 |
|
|
BFD_SYM_STORAGE_KIND_WITH = 3
|
65 |
|
|
};
|
66 |
|
|
typedef enum bfd_sym_storage_kind bfd_sym_storage_kind;
|
67 |
|
|
|
68 |
|
|
enum bfd_sym_version
|
69 |
|
|
{
|
70 |
|
|
BFD_SYM_VERSION_3_1,
|
71 |
|
|
BFD_SYM_VERSION_3_2,
|
72 |
|
|
BFD_SYM_VERSION_3_3,
|
73 |
|
|
BFD_SYM_VERSION_3_4,
|
74 |
|
|
BFD_SYM_VERSION_3_5
|
75 |
|
|
};
|
76 |
|
|
typedef enum bfd_sym_version bfd_sym_version;
|
77 |
|
|
|
78 |
|
|
enum bfd_sym_module_kind
|
79 |
|
|
{
|
80 |
|
|
BFD_SYM_MODULE_KIND_NONE = 0,
|
81 |
|
|
BFD_SYM_MODULE_KIND_PROGRAM = 1,
|
82 |
|
|
BFD_SYM_MODULE_KIND_UNIT = 2,
|
83 |
|
|
BFD_SYM_MODULE_KIND_PROCEDURE = 3,
|
84 |
|
|
BFD_SYM_MODULE_KIND_FUNCTION = 4,
|
85 |
|
|
BFD_SYM_MODULE_KIND_DATA = 5,
|
86 |
|
|
BFD_SYM_MODULE_KIND_BLOCK = 6
|
87 |
|
|
};
|
88 |
|
|
typedef enum bfd_sym_module_kind bfd_sym_module_kind;
|
89 |
|
|
|
90 |
|
|
enum bfd_sym_symbol_scope
|
91 |
|
|
{
|
92 |
|
|
BFD_SYM_SYMBOL_SCOPE_LOCAL = 0, /* Object is seen only inside current scope. */
|
93 |
|
|
BFD_SYM_SYMBOL_SCOPE_GLOBAL = 1 /* Object has global scope. */
|
94 |
|
|
};
|
95 |
|
|
typedef enum bfd_sym_symbol_scope bfd_sym_symbol_scope;
|
96 |
|
|
|
97 |
|
|
struct bfd_sym_file_reference
|
98 |
|
|
{
|
99 |
|
|
unsigned long fref_frte_index; /* File reference table index. */
|
100 |
|
|
unsigned long fref_offset; /* Absolute offset into source file. */
|
101 |
|
|
};
|
102 |
|
|
typedef struct bfd_sym_file_reference bfd_sym_file_reference;
|
103 |
|
|
|
104 |
|
|
/* NAME TABLE (NTE). */
|
105 |
|
|
|
106 |
|
|
/* RESOURCES TABLE (RTE)
|
107 |
|
|
|
108 |
|
|
All code and data is *defined* to reside in a resource. Even A5
|
109 |
|
|
relative data is defined to reside in a dummy resource of ResType
|
110 |
|
|
'gbld'. Code always resides in a resource. Because a code/data
|
111 |
|
|
is built of many modules, when walking through a resource we must
|
112 |
|
|
point back to the modules in the order they were defined. This is
|
113 |
|
|
done by requiring the entries in the Modules Entry table to be
|
114 |
|
|
ordered by resource/resource-number and by the location in that
|
115 |
|
|
resource. Hence, the resource table entry points to the first
|
116 |
|
|
module making up that resource. All modules table entries following
|
117 |
|
|
that first one with the same restype/resnum are contiguous and offset
|
118 |
|
|
from that first entry. */
|
119 |
|
|
|
120 |
|
|
struct bfd_sym_resources_table_entry
|
121 |
|
|
{
|
122 |
|
|
unsigned char rte_res_type[4]; /* Resource Type. */
|
123 |
|
|
unsigned short rte_res_number; /* Resource Number. */
|
124 |
|
|
unsigned long rte_nte_index; /* Name of the resource. */
|
125 |
|
|
unsigned long rte_mte_first; /* Index of first module in the resource. */
|
126 |
|
|
unsigned long rte_mte_last; /* Index of the last module in the resource. */
|
127 |
|
|
unsigned long rte_res_size; /* Size of the resource. */
|
128 |
|
|
};
|
129 |
|
|
typedef struct bfd_sym_resources_table_entry bfd_sym_resources_table_entry;
|
130 |
|
|
|
131 |
|
|
/* MODULES TABLE (MTE)
|
132 |
|
|
|
133 |
|
|
Modules table entries are ordered by their appearance in a resource.
|
134 |
|
|
(Note that having a single module copied into two resources is not
|
135 |
|
|
possible). Modules map back to their resource via an index into the
|
136 |
|
|
resource table and an offset into the resource. Modules also point
|
137 |
|
|
to their source files, both the definition module and implementation
|
138 |
|
|
module. Because modules can be textually nested within other
|
139 |
|
|
modules, a link to the parent (containing) module is required. This
|
140 |
|
|
module can textually contain other modules. A link to the contiguous
|
141 |
|
|
list of child (contained) modules is required. Variables, statements,
|
142 |
|
|
and types defined in the module are pointed to by indexing the head of
|
143 |
|
|
the contiguous lists of contained variables, contained statements,
|
144 |
|
|
and contained types. */
|
145 |
|
|
|
146 |
|
|
struct bfd_sym_modules_table_entry
|
147 |
|
|
{
|
148 |
|
|
unsigned long mte_rte_index; /* Which resource it is in. */
|
149 |
|
|
unsigned long mte_res_offset; /* Offset into the resource. */
|
150 |
|
|
unsigned long mte_size; /* Size of module. */
|
151 |
|
|
char mte_kind; /* What kind of module this is. */
|
152 |
|
|
char mte_scope; /* How visible is it? */
|
153 |
|
|
unsigned long mte_parent; /* Containing module. */
|
154 |
|
|
bfd_sym_file_reference mte_imp_fref; /* Implementation source. */
|
155 |
|
|
unsigned long mte_imp_end; /* End of implementation source. */
|
156 |
|
|
unsigned long mte_nte_index; /* The name of the module. */
|
157 |
|
|
unsigned long mte_cmte_index; /* Modules contained in this. */
|
158 |
|
|
unsigned long mte_cvte_index; /* Variables contained in this. */
|
159 |
|
|
unsigned long mte_clte_index; /* Local labels defined here. */
|
160 |
|
|
unsigned long mte_ctte_index; /* Types contained in this. */
|
161 |
|
|
unsigned long mte_csnte_idx_1; /* CSNTE index of mte_snbr_first. */
|
162 |
|
|
unsigned long mte_csnte_idx_2; /* CSNTE index of mte_snbr_last. */
|
163 |
|
|
};
|
164 |
|
|
typedef struct bfd_sym_modules_table_entry bfd_sym_modules_table_entry;
|
165 |
|
|
|
166 |
|
|
/* FILE REFERENCES TABLE (FRTE)
|
167 |
|
|
|
168 |
|
|
The FILE REFERENCES TABLE maps from source file to module & offset.
|
169 |
|
|
The table is ordered by increasing file offset. Each new offset
|
170 |
|
|
references a module.
|
171 |
|
|
|
172 |
|
|
FRT = FILE_SOURCE_START
|
173 |
|
|
FILE_SOURCE_INCREMENT*
|
174 |
|
|
END_OF_LIST.
|
175 |
|
|
|
176 |
|
|
*** THIS MECHANISM IS VERY SLOW FOR FILE+STATEMENT_NUMBER TO
|
177 |
|
|
*** MODULE/CODE ADDRESS OPERATIONS. ANOTHER MECHANISM IS
|
178 |
|
|
*** REQUIRED!! */
|
179 |
|
|
|
180 |
|
|
union bfd_sym_file_references_table_entry
|
181 |
|
|
{
|
182 |
|
|
struct
|
183 |
|
|
{
|
184 |
|
|
/* END_OF_LIST, FILE_NAME_INDEX, or module table entry. */
|
185 |
|
|
unsigned long type;
|
186 |
|
|
}
|
187 |
|
|
generic;
|
188 |
|
|
|
189 |
|
|
struct
|
190 |
|
|
{
|
191 |
|
|
/* FILE_NAME_INDEX. */
|
192 |
|
|
unsigned long type;
|
193 |
|
|
unsigned long nte_index;
|
194 |
|
|
unsigned long mod_date;
|
195 |
|
|
}
|
196 |
|
|
filename;
|
197 |
|
|
|
198 |
|
|
struct
|
199 |
|
|
{
|
200 |
|
|
/* < FILE_NAME_INDEX. */
|
201 |
|
|
unsigned long mte_index;
|
202 |
|
|
unsigned long file_offset;
|
203 |
|
|
}
|
204 |
|
|
entry;
|
205 |
|
|
};
|
206 |
|
|
typedef union bfd_sym_file_references_table_entry bfd_sym_file_references_table_entry;
|
207 |
|
|
|
208 |
|
|
/* CONTAINED MODULES TABLE (CMTE)
|
209 |
|
|
|
210 |
|
|
Contained Modules are lists of indices into the modules table. The
|
211 |
|
|
lists are terminated by an END_OF_LIST index. All entries are of the
|
212 |
|
|
same size, hence mapping an index into a CMTE list is simple.
|
213 |
|
|
|
214 |
|
|
CMT = MTE_INDEX* END_OF_LIST. */
|
215 |
|
|
|
216 |
|
|
union bfd_sym_contained_modules_table_entry
|
217 |
|
|
{
|
218 |
|
|
struct
|
219 |
|
|
{
|
220 |
|
|
/* END_OF_LIST, index. */
|
221 |
|
|
unsigned long type;
|
222 |
|
|
}
|
223 |
|
|
generic;
|
224 |
|
|
|
225 |
|
|
struct
|
226 |
|
|
{
|
227 |
|
|
unsigned long mte_index; /* Index into the Modules Table. */
|
228 |
|
|
unsigned long nte_index; /* The name of the module. */
|
229 |
|
|
}
|
230 |
|
|
entry;
|
231 |
|
|
};
|
232 |
|
|
typedef union bfd_sym_contained_modules_table_entry bfd_sym_contained_modules_table_entry;
|
233 |
|
|
|
234 |
|
|
/* CONTAINED VARIABLES TABLE (CVTE)
|
235 |
|
|
|
236 |
|
|
Contained Variables map into the module table, file table, name table, and type
|
237 |
|
|
table. Contained Variables are a contiguous list of source file change record,
|
238 |
|
|
giving the name of and offset into the source file corresponding to all variables
|
239 |
|
|
following. Variable definition records contain an index into the name table (giving
|
240 |
|
|
the text of the variable as it appears in the source code), an index into the type
|
241 |
|
|
table giving the type of the variable, an increment added to the source file
|
242 |
|
|
offset giving the start of the implementation of the variable, and a storage
|
243 |
|
|
class address, giving information on variable's runtime address.
|
244 |
|
|
|
245 |
|
|
CVT = SOURCE_FILE_CHANGE SYMBOL_INFO* END_OF_LIST.
|
246 |
|
|
SYMBOL_INFO = SYMBOL_DEFINITION | SOURCE_FILE_CHANGE .
|
247 |
|
|
|
248 |
|
|
All entries are of the same size, making the fetching of data simple. The
|
249 |
|
|
variable entries in the list are in ALPHABETICAL ORDER to simplify the display of
|
250 |
|
|
available variables for several of the debugger's windows. */
|
251 |
|
|
|
252 |
|
|
/* 'la_size' determines the variant used below:
|
253 |
|
|
|
254 |
|
|
== BFD_SYM_CVTE_SCA
|
255 |
|
|
Traditional STORAGE_CLASS_ADDRESS;
|
256 |
|
|
|
257 |
|
|
<= BFD_SYM_CVTE_LA_MAX_SIZE
|
258 |
|
|
That many logical address bytes ("in-situ");
|
259 |
|
|
|
260 |
|
|
== BFD_SYM_CVTE_BIG_LA
|
261 |
|
|
Logical address bytes in constant pool, at offset 'big_la'. */
|
262 |
|
|
|
263 |
|
|
#define BFD_SYM_CVTE_SCA 0 /* Indicate SCA variant of CVTE. */
|
264 |
|
|
#define BFD_SYM_CVTE_LA_MAX_SIZE 13 /* Max# of logical address bytes in a CVTE. */
|
265 |
|
|
#define BFD_SYM_CVTE_BIG_LA 127 /* Indicates LA redirection to constant pool. */
|
266 |
|
|
|
267 |
|
|
union bfd_sym_contained_variables_table_entry
|
268 |
|
|
{
|
269 |
|
|
struct
|
270 |
|
|
{
|
271 |
|
|
/* END_OF_LIST, SOURCE_FILE_CHANGE, or type table entry. */
|
272 |
|
|
unsigned long type;
|
273 |
|
|
}
|
274 |
|
|
generic;
|
275 |
|
|
|
276 |
|
|
struct
|
277 |
|
|
{
|
278 |
|
|
/* SOURCE_FILE_CHANGE. */
|
279 |
|
|
unsigned long type;
|
280 |
|
|
bfd_sym_file_reference fref;
|
281 |
|
|
}
|
282 |
|
|
file;
|
283 |
|
|
|
284 |
|
|
struct
|
285 |
|
|
{
|
286 |
|
|
/* < SOURCE_FILE_CHANGE. */
|
287 |
|
|
unsigned long tte_index;
|
288 |
|
|
unsigned long nte_index;
|
289 |
|
|
unsigned long file_delta; /* Increment from previous source. */
|
290 |
|
|
unsigned char scope;
|
291 |
|
|
unsigned char la_size; /* #bytes of LAs below. */
|
292 |
|
|
|
293 |
|
|
union
|
294 |
|
|
{
|
295 |
|
|
/* la_size == BFD_SYM_CVTE_SCA. */
|
296 |
|
|
struct
|
297 |
|
|
{
|
298 |
|
|
unsigned char sca_kind; /* Distinguish local from value/var formal. */
|
299 |
|
|
unsigned char sca_class; /* The storage class itself. */
|
300 |
|
|
unsigned long sca_offset;
|
301 |
|
|
}
|
302 |
|
|
scstruct;
|
303 |
|
|
|
304 |
|
|
/* la_size <= BFD_SYM_CVTE_LA_MAX_SIZE. */
|
305 |
|
|
struct {
|
306 |
|
|
unsigned char la[BFD_SYM_CVTE_LA_MAX_SIZE]; /* Logical address bytes. */
|
307 |
|
|
unsigned char la_kind; /* Eqv. cvte_location.sca_kind. */
|
308 |
|
|
}
|
309 |
|
|
lastruct;
|
310 |
|
|
|
311 |
|
|
/* la_size == BFD_SYM_CVTE_BIG_LA 127. */
|
312 |
|
|
struct
|
313 |
|
|
{
|
314 |
|
|
unsigned long big_la; /* Logical address bytes in constant pool. */
|
315 |
|
|
unsigned char big_la_kind; /* Eqv. cvte_location.sca_kind. */
|
316 |
|
|
}
|
317 |
|
|
biglastruct;
|
318 |
|
|
}
|
319 |
|
|
address;
|
320 |
|
|
}
|
321 |
|
|
entry;
|
322 |
|
|
};
|
323 |
|
|
typedef union bfd_sym_contained_variables_table_entry bfd_sym_contained_variables_table_entry;
|
324 |
|
|
|
325 |
|
|
/* CONTAINED STATEMENTS TABLE (CSNTE)
|
326 |
|
|
|
327 |
|
|
Contained Statements table. This table is similar to the Contained
|
328 |
|
|
Variables table except that instead of VARIABLE_DEFINITION entries, this
|
329 |
|
|
module contains STATEMENT_NUMBER_DEFINITION entries. A statement number
|
330 |
|
|
definition points back to the containing module (via an index into
|
331 |
|
|
the module entry table) and contains the file and resource deltas
|
332 |
|
|
to add to the previous values to get to this statement.
|
333 |
|
|
All entries are of the same size, making the fetching of data simple. The
|
334 |
|
|
entries in the table are in order of increasing statement number within the
|
335 |
|
|
source file.
|
336 |
|
|
|
337 |
|
|
The Contained Statements table is indexed from two places. An MTE contains
|
338 |
|
|
an index to the first statement number within the module. An FRTE contains
|
339 |
|
|
an index to the first statement in the table (Possibly. This is slow.) Or
|
340 |
|
|
a table of fast statement number to CSNTE entry mappings indexes into the
|
341 |
|
|
table. Choice not yet made. */
|
342 |
|
|
|
343 |
|
|
union bfd_sym_contained_statements_table_entry
|
344 |
|
|
{
|
345 |
|
|
struct
|
346 |
|
|
{
|
347 |
|
|
/* END_OF_LIST, SOURCE_FILE_CHANGE, or statement table entry. */
|
348 |
|
|
unsigned long type;
|
349 |
|
|
}
|
350 |
|
|
generic;
|
351 |
|
|
|
352 |
|
|
struct
|
353 |
|
|
{
|
354 |
|
|
/* SOURCE_FILE_CHANGE. */
|
355 |
|
|
unsigned long type;
|
356 |
|
|
bfd_sym_file_reference fref; /* File name table. */
|
357 |
|
|
}
|
358 |
|
|
file;
|
359 |
|
|
|
360 |
|
|
struct
|
361 |
|
|
{
|
362 |
|
|
unsigned long mte_index; /* Which module contains it. */
|
363 |
|
|
unsigned long file_delta; /* Where it is defined. */
|
364 |
|
|
unsigned long mte_offset; /* Where it is in the module. */
|
365 |
|
|
}
|
366 |
|
|
entry;
|
367 |
|
|
};
|
368 |
|
|
typedef union bfd_sym_contained_statements_table_entry bfd_sym_contained_statements_table_entry;
|
369 |
|
|
|
370 |
|
|
/* CONTAINED LABELS TABLE (CLTE)
|
371 |
|
|
|
372 |
|
|
Contained Labels table names those labels local to the module. It is similar
|
373 |
|
|
to the Contained Statements table. */
|
374 |
|
|
|
375 |
|
|
union bfd_sym_contained_labels_table_entry
|
376 |
|
|
{
|
377 |
|
|
struct
|
378 |
|
|
{
|
379 |
|
|
/* END_OF_LIST, SOURCE_FILE_CHANGE, index. */
|
380 |
|
|
unsigned long type;
|
381 |
|
|
}
|
382 |
|
|
generic;
|
383 |
|
|
|
384 |
|
|
struct
|
385 |
|
|
{
|
386 |
|
|
/* SOURCE_FILE_CHANGE. */
|
387 |
|
|
unsigned long type;
|
388 |
|
|
bfd_sym_file_reference fref;
|
389 |
|
|
}
|
390 |
|
|
file;
|
391 |
|
|
|
392 |
|
|
struct
|
393 |
|
|
{
|
394 |
|
|
/* < SOURCE_FILE_CHANGE. */
|
395 |
|
|
unsigned long mte_index; /* Which module contains us. */
|
396 |
|
|
unsigned long mte_offset; /* Where it is in the module. */
|
397 |
|
|
unsigned long nte_index; /* The name of the label. */
|
398 |
|
|
unsigned long file_delta; /* Where it is defined. */
|
399 |
|
|
unsigned short scope; /* How visible the label is. */
|
400 |
|
|
}
|
401 |
|
|
entry;
|
402 |
|
|
};
|
403 |
|
|
typedef union bfd_sym_contained_labels_table_entry bfd_sym_contained_labels_table_entry;
|
404 |
|
|
|
405 |
|
|
/* CONTAINED TYPES TABLE (CTTE)
|
406 |
|
|
|
407 |
|
|
Contained Types define the named types that are in the module. It is used to
|
408 |
|
|
map name indices into type indices. The type entries in the table are in
|
409 |
|
|
alphabetical order by type name. */
|
410 |
|
|
|
411 |
|
|
union bfd_sym_contained_types_table_entry
|
412 |
|
|
{
|
413 |
|
|
struct
|
414 |
|
|
{
|
415 |
|
|
/* END_OF_LIST, SOURCE_FILE_CHANGE, or type table entry. */
|
416 |
|
|
unsigned long type;
|
417 |
|
|
}
|
418 |
|
|
generic;
|
419 |
|
|
|
420 |
|
|
struct
|
421 |
|
|
{
|
422 |
|
|
/* SOURCE_FILE_CHANGE. */
|
423 |
|
|
unsigned long type;
|
424 |
|
|
bfd_sym_file_reference fref;
|
425 |
|
|
}
|
426 |
|
|
file;
|
427 |
|
|
|
428 |
|
|
struct
|
429 |
|
|
{
|
430 |
|
|
/* < SOURCE_FILE_CHANGE. */
|
431 |
|
|
unsigned long tte_index;
|
432 |
|
|
unsigned long nte_index;
|
433 |
|
|
unsigned long file_delta; /* From last file definition. */
|
434 |
|
|
}
|
435 |
|
|
entry;
|
436 |
|
|
};
|
437 |
|
|
typedef union bfd_sym_contained_types_table_entry bfd_sym_contained_types_table_entry;
|
438 |
|
|
|
439 |
|
|
/* TYPE TABLE (TTE). */
|
440 |
|
|
|
441 |
|
|
typedef unsigned long bfd_sym_type_table_entry;
|
442 |
|
|
|
443 |
|
|
/* TYPE INFORMATION TABLE (TINFO). */
|
444 |
|
|
|
445 |
|
|
struct bfd_sym_type_information_table_entry
|
446 |
|
|
{
|
447 |
|
|
unsigned long nte_index;
|
448 |
|
|
unsigned long physical_size;
|
449 |
|
|
unsigned long logical_size;
|
450 |
|
|
unsigned long offset;
|
451 |
|
|
};
|
452 |
|
|
typedef struct bfd_sym_type_information_table_entry bfd_sym_type_information_table_entry;
|
453 |
|
|
|
454 |
|
|
/* FILE REFERENCES INDEX TABLE (FITE)
|
455 |
|
|
|
456 |
|
|
The FRTE INDEX TABLE indexes into the FILE REFERENCE TABLE above. The FRTE
|
457 |
|
|
at that index is the FILE_SOURCE_START for a series of files. The FRTEs are
|
458 |
|
|
indexed from 1. The list is terminated with an END_OF_LIST. */
|
459 |
|
|
|
460 |
|
|
union bfd_sym_file_references_index_table_entry
|
461 |
|
|
{
|
462 |
|
|
struct
|
463 |
|
|
{
|
464 |
|
|
unsigned long type;
|
465 |
|
|
}
|
466 |
|
|
generic;
|
467 |
|
|
|
468 |
|
|
struct
|
469 |
|
|
{
|
470 |
|
|
unsigned long frte_index; /* Index into the FRTE table. */
|
471 |
|
|
unsigned long nte_index; /* Name table index, gives filename. */
|
472 |
|
|
}
|
473 |
|
|
entry;
|
474 |
|
|
};
|
475 |
|
|
typedef union bfd_sym_file_references_index_table_entry bfd_sym_file_references_index_table_entry;
|
476 |
|
|
|
477 |
|
|
/* CONSTANT POOL (CONST)
|
478 |
|
|
|
479 |
|
|
The CONSTANT_POOL consists of entries that start on word boundaries. The entries
|
480 |
|
|
are referenced by byte index into the constant pool, not by record number.
|
481 |
|
|
|
482 |
|
|
Each entry takes the form:
|
483 |
|
|
|
484 |
|
|
<16-bit size>
|
485 |
|
|
<that many bytes of stuff>
|
486 |
|
|
|
487 |
|
|
Entries do not cross page boundaries. */
|
488 |
|
|
|
489 |
|
|
typedef short bfd_sym_constant_pool_entry;
|
490 |
|
|
|
491 |
|
|
/* The DISK_SYMBOL_HEADER_BLOCK is the first record in a .SYM file,
|
492 |
|
|
defining the physical characteristics of the symbolic information.
|
493 |
|
|
The remainder of the * .SYM file is stored in fixed block
|
494 |
|
|
allocations. For the purposes of paging, the * file is considered
|
495 |
|
|
to be an array of dshb_page_size blocks, with block 0 (and *
|
496 |
|
|
possibly more) devoted to the DISK_SYMBOL_HEADER_BLOCK.
|
497 |
|
|
|
498 |
|
|
The dti_object_count field means that the allowed indices for that
|
499 |
|
|
type of object are 0 .. dti_object_count. An index of 0, although
|
500 |
|
|
allowed, is never done. However, an 0th entry is created in the
|
501 |
|
|
table. That entry is filled with all zeroes. The reason for this
|
502 |
|
|
is to avoid off-by-one programming errors that would otherwise
|
503 |
|
|
occur: an index of k *MEANS* k, not k-1 when going to the disk
|
504 |
|
|
table. */
|
505 |
|
|
|
506 |
|
|
struct bfd_sym_table_info
|
507 |
|
|
{
|
508 |
|
|
unsigned long dti_first_page; /* First page for this table. */
|
509 |
|
|
unsigned long dti_page_count; /* Number of pages for the table. */
|
510 |
|
|
unsigned long dti_object_count; /* Number of objects in the table. */
|
511 |
|
|
};
|
512 |
|
|
typedef struct bfd_sym_table_info bfd_sym_table_info;
|
513 |
|
|
|
514 |
|
|
struct bfd_sym_header_block
|
515 |
|
|
{
|
516 |
|
|
unsigned char dshb_id[32]; /* Version information. */
|
517 |
|
|
unsigned short dshb_page_size; /* Size of the pages/blocks. */
|
518 |
|
|
unsigned long dshb_hash_page; /* Disk page for the hash table. */
|
519 |
|
|
unsigned long dshb_root_mte; /* MTE index of the program root. */
|
520 |
|
|
unsigned long dshb_mod_date; /* modification date of executable. */
|
521 |
|
|
bfd_sym_table_info dshb_frte; /* Per TABLE information. */
|
522 |
|
|
bfd_sym_table_info dshb_rte;
|
523 |
|
|
bfd_sym_table_info dshb_mte;
|
524 |
|
|
bfd_sym_table_info dshb_cmte;
|
525 |
|
|
bfd_sym_table_info dshb_cvte;
|
526 |
|
|
bfd_sym_table_info dshb_csnte;
|
527 |
|
|
bfd_sym_table_info dshb_clte;
|
528 |
|
|
bfd_sym_table_info dshb_ctte;
|
529 |
|
|
bfd_sym_table_info dshb_tte;
|
530 |
|
|
bfd_sym_table_info dshb_nte;
|
531 |
|
|
bfd_sym_table_info dshb_tinfo;
|
532 |
|
|
bfd_sym_table_info dshb_fite; /* File information. */
|
533 |
|
|
bfd_sym_table_info dshb_const; /* Constant pool. */
|
534 |
|
|
|
535 |
|
|
unsigned char dshb_file_creator[4]; /* Executable's creator. */
|
536 |
|
|
unsigned char dshb_file_type[4]; /* Executable's file type. */
|
537 |
|
|
};
|
538 |
|
|
typedef struct bfd_sym_header_block bfd_sym_header_block;
|
539 |
|
|
|
540 |
|
|
struct bfd_sym_data_struct
|
541 |
|
|
{
|
542 |
|
|
unsigned char *name_table;
|
543 |
|
|
bfd_sym_header_block header;
|
544 |
|
|
bfd_sym_version version;
|
545 |
|
|
bfd *sbfd;
|
546 |
|
|
};
|
547 |
|
|
typedef struct bfd_sym_data_struct bfd_sym_data_struct;
|
548 |
|
|
|
549 |
|
|
extern bfd_boolean bfd_sym_mkobject
|
550 |
|
|
(bfd *);
|
551 |
|
|
extern void bfd_sym_print_symbol
|
552 |
|
|
(bfd *, PTR, asymbol *, bfd_print_symbol_type);
|
553 |
|
|
extern bfd_boolean bfd_sym_valid
|
554 |
|
|
(bfd *);
|
555 |
|
|
extern unsigned char * bfd_sym_read_name_table
|
556 |
|
|
(bfd *, bfd_sym_header_block *);
|
557 |
|
|
extern void bfd_sym_parse_file_reference_v32
|
558 |
|
|
(unsigned char *, size_t, bfd_sym_file_reference *);
|
559 |
|
|
extern void bfd_sym_parse_disk_table_v32
|
560 |
|
|
(unsigned char *, size_t, bfd_sym_table_info *);
|
561 |
|
|
extern void bfd_sym_parse_header_v32
|
562 |
|
|
(unsigned char *, size_t, bfd_sym_header_block *);
|
563 |
|
|
extern int bfd_sym_read_header_v32
|
564 |
|
|
(bfd *, bfd_sym_header_block *);
|
565 |
|
|
extern int bfd_sym_read_header_v34
|
566 |
|
|
(bfd *, bfd_sym_header_block *);
|
567 |
|
|
extern int bfd_sym_read_header
|
568 |
|
|
(bfd *, bfd_sym_header_block *, bfd_sym_version);
|
569 |
|
|
extern int bfd_sym_read_version
|
570 |
|
|
(bfd *, bfd_sym_version *);
|
571 |
|
|
extern void bfd_sym_display_table_summary
|
572 |
|
|
(FILE *, bfd_sym_table_info *, const char *);
|
573 |
|
|
extern void bfd_sym_display_header
|
574 |
|
|
(FILE *, bfd_sym_header_block *);
|
575 |
|
|
extern void bfd_sym_parse_resources_table_entry_v32
|
576 |
|
|
(unsigned char *, size_t, bfd_sym_resources_table_entry *);
|
577 |
|
|
extern void bfd_sym_parse_modules_table_entry_v33
|
578 |
|
|
(unsigned char *, size_t, bfd_sym_modules_table_entry *);
|
579 |
|
|
extern void bfd_sym_parse_file_references_table_entry_v32
|
580 |
|
|
(unsigned char *, size_t, bfd_sym_file_references_table_entry *);
|
581 |
|
|
extern void bfd_sym_parse_contained_modules_table_entry_v32
|
582 |
|
|
(unsigned char *, size_t, bfd_sym_contained_modules_table_entry *);
|
583 |
|
|
extern void bfd_sym_parse_contained_variables_table_entry_v32
|
584 |
|
|
(unsigned char *, size_t, bfd_sym_contained_variables_table_entry *);
|
585 |
|
|
extern void bfd_sym_parse_contained_statements_table_entry_v32
|
586 |
|
|
(unsigned char *, size_t, bfd_sym_contained_statements_table_entry *);
|
587 |
|
|
extern void bfd_sym_parse_contained_labels_table_entry_v32
|
588 |
|
|
(unsigned char *, size_t, bfd_sym_contained_labels_table_entry *);
|
589 |
|
|
extern void bfd_sym_parse_type_table_entry_v32
|
590 |
|
|
(unsigned char *, size_t, bfd_sym_type_table_entry *);
|
591 |
|
|
extern int bfd_sym_fetch_resources_table_entry
|
592 |
|
|
(bfd *, bfd_sym_resources_table_entry *, unsigned long);
|
593 |
|
|
extern int bfd_sym_fetch_modules_table_entry
|
594 |
|
|
(bfd *, bfd_sym_modules_table_entry *, unsigned long);
|
595 |
|
|
extern int bfd_sym_fetch_file_references_table_entry
|
596 |
|
|
(bfd *, bfd_sym_file_references_table_entry *, unsigned long);
|
597 |
|
|
extern int bfd_sym_fetch_contained_modules_table_entry
|
598 |
|
|
(bfd *, bfd_sym_contained_modules_table_entry *, unsigned long);
|
599 |
|
|
extern int bfd_sym_fetch_contained_variables_table_entry
|
600 |
|
|
(bfd *, bfd_sym_contained_variables_table_entry *, unsigned long);
|
601 |
|
|
extern int bfd_sym_fetch_contained_statements_table_entry
|
602 |
|
|
(bfd *, bfd_sym_contained_statements_table_entry *, unsigned long);
|
603 |
|
|
extern int bfd_sym_fetch_contained_labels_table_entry
|
604 |
|
|
(bfd *, bfd_sym_contained_labels_table_entry *, unsigned long);
|
605 |
|
|
extern int bfd_sym_fetch_contained_types_table_entry
|
606 |
|
|
(bfd *, bfd_sym_contained_types_table_entry *, unsigned long);
|
607 |
|
|
extern int bfd_sym_fetch_file_references_index_table_entry
|
608 |
|
|
(bfd *, bfd_sym_file_references_index_table_entry *, unsigned long);
|
609 |
|
|
extern int bfd_sym_fetch_constant_pool_entry
|
610 |
|
|
(bfd *, bfd_sym_constant_pool_entry *, unsigned long);
|
611 |
|
|
extern int bfd_sym_fetch_type_table_entry
|
612 |
|
|
(bfd *, bfd_sym_type_table_entry *, unsigned long);
|
613 |
|
|
extern int bfd_sym_fetch_type_information_table_entry
|
614 |
|
|
(bfd *, bfd_sym_type_information_table_entry *, unsigned long);
|
615 |
|
|
extern int bfd_sym_fetch_type_table_information
|
616 |
|
|
(bfd *, bfd_sym_type_information_table_entry *, unsigned long);
|
617 |
|
|
extern const unsigned char * bfd_sym_symbol_name
|
618 |
|
|
(bfd *, unsigned long);
|
619 |
|
|
extern const unsigned char * bfd_sym_module_name
|
620 |
|
|
(bfd *, unsigned long);
|
621 |
|
|
extern const char * bfd_sym_unparse_storage_kind
|
622 |
|
|
(enum bfd_sym_storage_kind);
|
623 |
|
|
extern const char * bfd_sym_unparse_storage_class
|
624 |
|
|
(enum bfd_sym_storage_class);
|
625 |
|
|
extern const char * bfd_sym_unparse_module_kind
|
626 |
|
|
(enum bfd_sym_module_kind);
|
627 |
|
|
extern const char * bfd_sym_unparse_symbol_scope
|
628 |
|
|
(enum bfd_sym_symbol_scope);
|
629 |
|
|
extern void bfd_sym_print_file_reference
|
630 |
|
|
(bfd *, FILE *, bfd_sym_file_reference *);
|
631 |
|
|
extern void bfd_sym_print_resources_table_entry
|
632 |
|
|
(bfd *, FILE *, bfd_sym_resources_table_entry *);
|
633 |
|
|
extern void bfd_sym_print_modules_table_entry
|
634 |
|
|
(bfd *, FILE *, bfd_sym_modules_table_entry *);
|
635 |
|
|
extern void bfd_sym_print_file_references_table_entry
|
636 |
|
|
(bfd *, FILE *, bfd_sym_file_references_table_entry *);
|
637 |
|
|
extern void bfd_sym_print_contained_modules_table_entry
|
638 |
|
|
(bfd *, FILE *, bfd_sym_contained_modules_table_entry *);
|
639 |
|
|
extern void bfd_sym_print_contained_variables_table_entry
|
640 |
|
|
(bfd *, FILE *f, bfd_sym_contained_variables_table_entry *);
|
641 |
|
|
extern void bfd_sym_print_contained_statements_table_entry
|
642 |
|
|
(bfd *, FILE *, bfd_sym_contained_statements_table_entry *);
|
643 |
|
|
extern void bfd_sym_print_contained_labels_table_entry
|
644 |
|
|
(bfd *, FILE *, bfd_sym_contained_labels_table_entry *);
|
645 |
|
|
extern void bfd_sym_print_contained_types_table_entry
|
646 |
|
|
(bfd *, FILE *, bfd_sym_contained_types_table_entry *);
|
647 |
|
|
extern const char * bfd_sym_type_operator_name
|
648 |
|
|
(unsigned char);
|
649 |
|
|
extern const char * bfd_sym_type_basic_name
|
650 |
|
|
(unsigned char);
|
651 |
|
|
extern int bfd_sym_fetch_long
|
652 |
|
|
(unsigned char *, unsigned long, unsigned long, unsigned long *, long *);
|
653 |
|
|
extern void bfd_sym_print_type_information
|
654 |
|
|
(bfd *, FILE *, unsigned char *, unsigned long, unsigned long, unsigned long *);
|
655 |
|
|
extern void bfd_sym_print_type_information_table_entry
|
656 |
|
|
(bfd *, FILE *, bfd_sym_type_information_table_entry *);
|
657 |
|
|
extern void bfd_sym_print_file_references_index_table_entry
|
658 |
|
|
(bfd *, FILE *, bfd_sym_file_references_index_table_entry *);
|
659 |
|
|
extern void bfd_sym_print_constant_pool_entry
|
660 |
|
|
(bfd *, FILE *, bfd_sym_constant_pool_entry *);
|
661 |
|
|
extern unsigned char * bfd_sym_display_name_table_entry
|
662 |
|
|
(bfd *, FILE *, unsigned char *);
|
663 |
|
|
extern void bfd_sym_display_name_table
|
664 |
|
|
(bfd *, FILE *);
|
665 |
|
|
extern void bfd_sym_display_resources_table
|
666 |
|
|
(bfd *, FILE *);
|
667 |
|
|
extern void bfd_sym_display_modules_table
|
668 |
|
|
(bfd *, FILE *);
|
669 |
|
|
extern void bfd_sym_display_file_references_table
|
670 |
|
|
(bfd *, FILE *);
|
671 |
|
|
extern void bfd_sym_display_contained_modules_table
|
672 |
|
|
(bfd *, FILE *);
|
673 |
|
|
extern void bfd_sym_display_contained_variables_table
|
674 |
|
|
(bfd *, FILE *);
|
675 |
|
|
extern void bfd_sym_display_contained_statements_table
|
676 |
|
|
(bfd *, FILE *);
|
677 |
|
|
extern void bfd_sym_display_contained_labels_table
|
678 |
|
|
(bfd *, FILE *);
|
679 |
|
|
extern void bfd_sym_display_contained_types_table
|
680 |
|
|
(bfd *, FILE *);
|
681 |
|
|
extern void bfd_sym_display_file_references_index_table
|
682 |
|
|
(bfd *, FILE *);
|
683 |
|
|
extern void bfd_sym_display_constant_pool
|
684 |
|
|
(bfd *, FILE *);
|
685 |
|
|
extern void bfd_sym_display_type_information_table
|
686 |
|
|
(bfd *, FILE *);
|
687 |
|
|
extern int bfd_sym_scan
|
688 |
|
|
(bfd *, bfd_sym_version, bfd_sym_data_struct *);
|
689 |
|
|
extern const bfd_target * bfd_sym_object_p
|
690 |
|
|
(bfd *);
|
691 |
|
|
extern void bfd_sym_get_symbol_info
|
692 |
|
|
(bfd *, asymbol *, symbol_info *);
|
693 |
|
|
extern long bfd_sym_get_symtab_upper_bound
|
694 |
|
|
(bfd *);
|
695 |
|
|
extern long bfd_sym_canonicalize_symtab
|
696 |
|
|
(bfd *, asymbol **);
|
697 |
|
|
extern int bfd_sym_sizeof_headers
|
698 |
|
|
(bfd *, struct bfd_link_info *);
|
699 |
|
|
|
700 |
|
|
#endif /* __xSYM_H__ */
|