Commit | Line | Data |
---|---|---|
3af9a47b | 1 | /* xSYM symbol-file support for BFD. |
cd123cb7 | 2 | Copyright 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007 |
3af9a47b NC |
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 | |
cd123cb7 | 9 | the Free Software Foundation; either version 3 of the License, or |
3af9a47b NC |
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 | |
e84d6fca | 18 | along with this program; if not, write to the Free Software |
cd123cb7 NC |
19 | Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, |
20 | MA 02110-1301, USA. */ | |
3af9a47b NC |
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) | |
e84d6fca | 107 | |
3af9a47b NC |
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) | |
e84d6fca | 132 | |
3af9a47b NC |
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 | |
7dee875e | 137 | to their source files, both the definition module and implementation |
3af9a47b NC |
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. */ | |
e84d6fca | 163 | }; |
3af9a47b NC |
164 | typedef struct bfd_sym_modules_table_entry bfd_sym_modules_table_entry; |
165 | ||
166 | /* FILE REFERENCES TABLE (FRTE) | |
e84d6fca | 167 | |
3af9a47b NC |
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. | |
e84d6fca | 171 | |
3af9a47b NC |
172 | FRT = FILE_SOURCE_START |
173 | FILE_SOURCE_INCREMENT* | |
174 | END_OF_LIST. | |
e84d6fca | 175 | |
3af9a47b NC |
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; | |
e84d6fca | 197 | |
3af9a47b NC |
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. | |
e84d6fca | 213 | |
3af9a47b NC |
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; | |
e84d6fca | 224 | |
3af9a47b NC |
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) | |
e84d6fca | 235 | |
3af9a47b NC |
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. | |
e84d6fca | 244 | |
3af9a47b NC |
245 | CVT = SOURCE_FILE_CHANGE SYMBOL_INFO* END_OF_LIST. |
246 | SYMBOL_INFO = SYMBOL_DEFINITION | SOURCE_FILE_CHANGE . | |
e84d6fca | 247 | |
3af9a47b NC |
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: | |
e84d6fca | 253 | |
3af9a47b NC |
254 | == BFD_SYM_CVTE_SCA |
255 | Traditional STORAGE_CLASS_ADDRESS; | |
e84d6fca | 256 | |
3af9a47b NC |
257 | <= BFD_SYM_CVTE_LA_MAX_SIZE |
258 | That many logical address bytes ("in-situ"); | |
e84d6fca | 259 | |
3af9a47b NC |
260 | == BFD_SYM_CVTE_BIG_LA |
261 | Logical address bytes in constant pool, at offset 'big_la'. */ | |
e84d6fca | 262 | |
3af9a47b NC |
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) | |
e84d6fca | 326 | |
3af9a47b NC |
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. | |
e84d6fca | 336 | |
3af9a47b NC |
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) | |
e84d6fca | 371 | |
3af9a47b NC |
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) | |
e84d6fca | 406 | |
3af9a47b NC |
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. */ | |
e84d6fca | 431 | unsigned long tte_index; |
3af9a47b NC |
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) | |
e84d6fca | 455 | |
3af9a47b NC |
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; | |
e84d6fca | 467 | |
3af9a47b NC |
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) | |
e84d6fca | 478 | |
3af9a47b NC |
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. | |
e84d6fca | 481 | |
3af9a47b | 482 | Each entry takes the form: |
e84d6fca | 483 | |
3af9a47b NC |
484 | <16-bit size> |
485 | <that many bytes of stuff> | |
e84d6fca | 486 | |
3af9a47b NC |
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. | |
e84d6fca | 497 | |
3af9a47b NC |
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 | ||
e84d6fca | 514 | struct bfd_sym_header_block |
3af9a47b NC |
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 | ||
b34976b6 | 549 | extern bfd_boolean bfd_sym_mkobject |
116c20d2 | 550 | (bfd *); |
b34976b6 | 551 | extern void bfd_sym_print_symbol |
116c20d2 | 552 | (bfd *, PTR, asymbol *, bfd_print_symbol_type); |
b34976b6 | 553 | extern bfd_boolean bfd_sym_valid |
116c20d2 | 554 | (bfd *); |
b34976b6 | 555 | extern unsigned char * bfd_sym_read_name_table |
116c20d2 | 556 | (bfd *, bfd_sym_header_block *); |
b34976b6 | 557 | extern void bfd_sym_parse_file_reference_v32 |
116c20d2 | 558 | (unsigned char *, size_t, bfd_sym_file_reference *); |
b34976b6 | 559 | extern void bfd_sym_parse_disk_table_v32 |
116c20d2 | 560 | (unsigned char *, size_t, bfd_sym_table_info *); |
b34976b6 | 561 | extern void bfd_sym_parse_header_v32 |
116c20d2 | 562 | (unsigned char *, size_t, bfd_sym_header_block *); |
b34976b6 | 563 | extern int bfd_sym_read_header_v32 |
116c20d2 | 564 | (bfd *, bfd_sym_header_block *); |
b34976b6 | 565 | extern int bfd_sym_read_header_v34 |
116c20d2 | 566 | (bfd *, bfd_sym_header_block *); |
b34976b6 | 567 | extern int bfd_sym_read_header |
116c20d2 | 568 | (bfd *, bfd_sym_header_block *, bfd_sym_version); |
b34976b6 | 569 | extern int bfd_sym_read_version |
116c20d2 | 570 | (bfd *, bfd_sym_version *); |
b34976b6 | 571 | extern void bfd_sym_display_table_summary |
116c20d2 | 572 | (FILE *, bfd_sym_table_info *, const char *); |
b34976b6 | 573 | extern void bfd_sym_display_header |
116c20d2 | 574 | (FILE *, bfd_sym_header_block *); |
b34976b6 | 575 | extern void bfd_sym_parse_resources_table_entry_v32 |
116c20d2 | 576 | (unsigned char *, size_t, bfd_sym_resources_table_entry *); |
b34976b6 | 577 | extern void bfd_sym_parse_modules_table_entry_v33 |
116c20d2 | 578 | (unsigned char *, size_t, bfd_sym_modules_table_entry *); |
b34976b6 | 579 | extern void bfd_sym_parse_file_references_table_entry_v32 |
116c20d2 | 580 | (unsigned char *, size_t, bfd_sym_file_references_table_entry *); |
b34976b6 | 581 | extern void bfd_sym_parse_contained_modules_table_entry_v32 |
116c20d2 | 582 | (unsigned char *, size_t, bfd_sym_contained_modules_table_entry *); |
b34976b6 | 583 | extern void bfd_sym_parse_contained_variables_table_entry_v32 |
116c20d2 | 584 | (unsigned char *, size_t, bfd_sym_contained_variables_table_entry *); |
b34976b6 | 585 | extern void bfd_sym_parse_contained_statements_table_entry_v32 |
116c20d2 | 586 | (unsigned char *, size_t, bfd_sym_contained_statements_table_entry *); |
b34976b6 | 587 | extern void bfd_sym_parse_contained_labels_table_entry_v32 |
116c20d2 | 588 | (unsigned char *, size_t, bfd_sym_contained_labels_table_entry *); |
b34976b6 | 589 | extern void bfd_sym_parse_type_table_entry_v32 |
116c20d2 | 590 | (unsigned char *, size_t, bfd_sym_type_table_entry *); |
b34976b6 | 591 | extern int bfd_sym_fetch_resources_table_entry |
116c20d2 | 592 | (bfd *, bfd_sym_resources_table_entry *, unsigned long); |
b34976b6 | 593 | extern int bfd_sym_fetch_modules_table_entry |
116c20d2 | 594 | (bfd *, bfd_sym_modules_table_entry *, unsigned long); |
b34976b6 | 595 | extern int bfd_sym_fetch_file_references_table_entry |
116c20d2 | 596 | (bfd *, bfd_sym_file_references_table_entry *, unsigned long); |
b34976b6 | 597 | extern int bfd_sym_fetch_contained_modules_table_entry |
116c20d2 | 598 | (bfd *, bfd_sym_contained_modules_table_entry *, unsigned long); |
b34976b6 | 599 | extern int bfd_sym_fetch_contained_variables_table_entry |
116c20d2 | 600 | (bfd *, bfd_sym_contained_variables_table_entry *, unsigned long); |
b34976b6 | 601 | extern int bfd_sym_fetch_contained_statements_table_entry |
116c20d2 | 602 | (bfd *, bfd_sym_contained_statements_table_entry *, unsigned long); |
b34976b6 | 603 | extern int bfd_sym_fetch_contained_labels_table_entry |
116c20d2 | 604 | (bfd *, bfd_sym_contained_labels_table_entry *, unsigned long); |
b34976b6 | 605 | extern int bfd_sym_fetch_contained_types_table_entry |
116c20d2 | 606 | (bfd *, bfd_sym_contained_types_table_entry *, unsigned long); |
b34976b6 | 607 | extern int bfd_sym_fetch_file_references_index_table_entry |
116c20d2 | 608 | (bfd *, bfd_sym_file_references_index_table_entry *, unsigned long); |
b34976b6 | 609 | extern int bfd_sym_fetch_constant_pool_entry |
116c20d2 | 610 | (bfd *, bfd_sym_constant_pool_entry *, unsigned long); |
b34976b6 | 611 | extern int bfd_sym_fetch_type_table_entry |
116c20d2 | 612 | (bfd *, bfd_sym_type_table_entry *, unsigned long); |
b34976b6 | 613 | extern int bfd_sym_fetch_type_information_table_entry |
116c20d2 | 614 | (bfd *, bfd_sym_type_information_table_entry *, unsigned long); |
b34976b6 | 615 | extern int bfd_sym_fetch_type_table_information |
116c20d2 | 616 | (bfd *, bfd_sym_type_information_table_entry *, unsigned long); |
3af9a47b | 617 | extern const unsigned char * bfd_sym_symbol_name |
116c20d2 | 618 | (bfd *, unsigned long); |
3af9a47b | 619 | extern const unsigned char * bfd_sym_module_name |
116c20d2 | 620 | (bfd *, unsigned long); |
b34976b6 | 621 | extern const char * bfd_sym_unparse_storage_kind |
116c20d2 | 622 | (enum bfd_sym_storage_kind); |
b34976b6 | 623 | extern const char * bfd_sym_unparse_storage_class |
116c20d2 | 624 | (enum bfd_sym_storage_class); |
b34976b6 | 625 | extern const char * bfd_sym_unparse_module_kind |
116c20d2 | 626 | (enum bfd_sym_module_kind); |
b34976b6 | 627 | extern const char * bfd_sym_unparse_symbol_scope |
116c20d2 | 628 | (enum bfd_sym_symbol_scope); |
b34976b6 | 629 | extern void bfd_sym_print_file_reference |
116c20d2 | 630 | (bfd *, FILE *, bfd_sym_file_reference *); |
b34976b6 | 631 | extern void bfd_sym_print_resources_table_entry |
116c20d2 | 632 | (bfd *, FILE *, bfd_sym_resources_table_entry *); |
b34976b6 | 633 | extern void bfd_sym_print_modules_table_entry |
116c20d2 | 634 | (bfd *, FILE *, bfd_sym_modules_table_entry *); |
b34976b6 | 635 | extern void bfd_sym_print_file_references_table_entry |
116c20d2 | 636 | (bfd *, FILE *, bfd_sym_file_references_table_entry *); |
b34976b6 | 637 | extern void bfd_sym_print_contained_modules_table_entry |
116c20d2 | 638 | (bfd *, FILE *, bfd_sym_contained_modules_table_entry *); |
b34976b6 | 639 | extern void bfd_sym_print_contained_variables_table_entry |
116c20d2 | 640 | (bfd *, FILE *f, bfd_sym_contained_variables_table_entry *); |
b34976b6 | 641 | extern void bfd_sym_print_contained_statements_table_entry |
116c20d2 | 642 | (bfd *, FILE *, bfd_sym_contained_statements_table_entry *); |
b34976b6 | 643 | extern void bfd_sym_print_contained_labels_table_entry |
116c20d2 | 644 | (bfd *, FILE *, bfd_sym_contained_labels_table_entry *); |
b34976b6 | 645 | extern void bfd_sym_print_contained_types_table_entry |
116c20d2 | 646 | (bfd *, FILE *, bfd_sym_contained_types_table_entry *); |
b34976b6 | 647 | extern const char * bfd_sym_type_operator_name |
116c20d2 | 648 | (unsigned char); |
b34976b6 | 649 | extern const char * bfd_sym_type_basic_name |
116c20d2 | 650 | (unsigned char); |
b34976b6 | 651 | extern int bfd_sym_fetch_long |
116c20d2 | 652 | (unsigned char *, unsigned long, unsigned long, unsigned long *, long *); |
b34976b6 | 653 | extern void bfd_sym_print_type_information |
116c20d2 | 654 | (bfd *, FILE *, unsigned char *, unsigned long, unsigned long, unsigned long *); |
b34976b6 | 655 | extern void bfd_sym_print_type_information_table_entry |
116c20d2 | 656 | (bfd *, FILE *, bfd_sym_type_information_table_entry *); |
b34976b6 | 657 | extern void bfd_sym_print_file_references_index_table_entry |
116c20d2 | 658 | (bfd *, FILE *, bfd_sym_file_references_index_table_entry *); |
b34976b6 | 659 | extern void bfd_sym_print_constant_pool_entry |
116c20d2 | 660 | (bfd *, FILE *, bfd_sym_constant_pool_entry *); |
b34976b6 | 661 | extern unsigned char * bfd_sym_display_name_table_entry |
116c20d2 | 662 | (bfd *, FILE *, unsigned char *); |
b34976b6 | 663 | extern void bfd_sym_display_name_table |
116c20d2 | 664 | (bfd *, FILE *); |
b34976b6 | 665 | extern void bfd_sym_display_resources_table |
116c20d2 | 666 | (bfd *, FILE *); |
b34976b6 | 667 | extern void bfd_sym_display_modules_table |
116c20d2 | 668 | (bfd *, FILE *); |
b34976b6 | 669 | extern void bfd_sym_display_file_references_table |
116c20d2 | 670 | (bfd *, FILE *); |
b34976b6 | 671 | extern void bfd_sym_display_contained_modules_table |
116c20d2 | 672 | (bfd *, FILE *); |
b34976b6 | 673 | extern void bfd_sym_display_contained_variables_table |
116c20d2 | 674 | (bfd *, FILE *); |
b34976b6 | 675 | extern void bfd_sym_display_contained_statements_table |
116c20d2 | 676 | (bfd *, FILE *); |
b34976b6 | 677 | extern void bfd_sym_display_contained_labels_table |
116c20d2 | 678 | (bfd *, FILE *); |
b34976b6 | 679 | extern void bfd_sym_display_contained_types_table |
116c20d2 | 680 | (bfd *, FILE *); |
b34976b6 | 681 | extern void bfd_sym_display_file_references_index_table |
116c20d2 | 682 | (bfd *, FILE *); |
b34976b6 | 683 | extern void bfd_sym_display_constant_pool |
116c20d2 | 684 | (bfd *, FILE *); |
b34976b6 | 685 | extern void bfd_sym_display_type_information_table |
116c20d2 | 686 | (bfd *, FILE *); |
b34976b6 | 687 | extern int bfd_sym_scan |
116c20d2 | 688 | (bfd *, bfd_sym_version, bfd_sym_data_struct *); |
b34976b6 | 689 | extern const bfd_target * bfd_sym_object_p |
116c20d2 | 690 | (bfd *); |
b34976b6 | 691 | extern void bfd_sym_get_symbol_info |
116c20d2 | 692 | (bfd *, asymbol *, symbol_info *); |
b34976b6 | 693 | extern long bfd_sym_get_symtab_upper_bound |
116c20d2 | 694 | (bfd *); |
6cee3f79 | 695 | extern long bfd_sym_canonicalize_symtab |
116c20d2 | 696 | (bfd *, asymbol **); |
b34976b6 | 697 | extern int bfd_sym_sizeof_headers |
a6b96beb | 698 | (bfd *, struct bfd_link_info *); |
3af9a47b NC |
699 | |
700 | #endif /* __xSYM_H__ */ |