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