00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "bfd.h"
00022 #include <stdio.h>
00023
00024 #ifndef __xSYM_H__
00025 #define __xSYM_H__
00026
00027 #define BFD_SYM_VERSION_STR_3_1 "\013Version 3.1"
00028 #define BFD_SYM_VERSION_STR_3_2 "\013Version 3.2"
00029 #define BFD_SYM_VERSION_STR_3_3 "\013Version 3.3"
00030 #define BFD_SYM_VERSION_STR_3_4 "\013Version 3.4"
00031 #define BFD_SYM_VERSION_STR_3_5 "\013Version 3.5"
00032 #define BFD_SYM_END_OF_LIST_3_2 0xffff
00033 #define BFD_SYM_END_OF_LIST_3_4 0xffffffff
00034 #define BFD_SYM_END_OF_LIST BFD_SYM_END_OF_LIST_3_4
00035 #define BFD_SYM_FILE_NAME_INDEX_3_2 0xfffe
00036 #define BFD_SYM_FILE_NAME_INDEX_3_4 0xfffffffe
00037 #define BFD_SYM_FILE_NAME_INDEX BFD_SYM_FILE_NAME_INDEX_3_4
00038 #define BFD_SYM_SOURCE_FILE_CHANGE_3_2 0xfffe
00039 #define BFD_SYM_SOURCE_FILE_CHANGE_3_4 0xfffffffe
00040 #define BFD_SYM_SOURCE_FILE_CHANGE BFD_SYM_SOURCE_FILE_CHANGE_3_4
00041 #define BFD_SYM_MAXIMUM_LEGAL_INDEX_3_2 0xfffd
00042 #define BFD_SYM_MAXIMUM_LEGAL_INDEX_3_4 0xfffffffd
00043 #define BFD_SYM_MAXIMUM_LEGAL_INDEX BFD_SYM_MAXIMUM_LEGAL_INDEX_3_4
00044
00045 enum bfd_sym_storage_class
00046 {
00047 BFD_SYM_STORAGE_CLASS_REGISTER = 0,
00048 BFD_SYM_STORAGE_CLASS_GLOBAL = 1,
00049 BFD_SYM_STORAGE_CLASS_FRAME_RELATIVE = 2,
00050 BFD_SYM_STORAGE_CLASS_STACK_RELATIVE = 3,
00051 BFD_SYM_STORAGE_CLASS_ABSOLUTE = 4,
00052 BFD_SYM_STORAGE_CLASS_CONSTANT = 5,
00053 BFD_SYM_STORAGE_CLASS_BIGCONSTANT = 6,
00054 BFD_SYM_STORAGE_CLASS_RESOURCE = 99
00055 };
00056 typedef enum bfd_sym_storage_class bfd_sym_storage_class;
00057
00058 enum bfd_sym_storage_kind
00059 {
00060 BFD_SYM_STORAGE_KIND_LOCAL = 0,
00061 BFD_SYM_STORAGE_KIND_VALUE = 1,
00062 BFD_SYM_STORAGE_KIND_REFERENCE = 2,
00063 BFD_SYM_STORAGE_KIND_WITH = 3
00064 };
00065 typedef enum bfd_sym_storage_kind bfd_sym_storage_kind;
00066
00067 enum bfd_sym_version
00068 {
00069 BFD_SYM_VERSION_3_1,
00070 BFD_SYM_VERSION_3_2,
00071 BFD_SYM_VERSION_3_3,
00072 BFD_SYM_VERSION_3_4,
00073 BFD_SYM_VERSION_3_5
00074 };
00075 typedef enum bfd_sym_version bfd_sym_version;
00076
00077 enum bfd_sym_module_kind
00078 {
00079 BFD_SYM_MODULE_KIND_NONE = 0,
00080 BFD_SYM_MODULE_KIND_PROGRAM = 1,
00081 BFD_SYM_MODULE_KIND_UNIT = 2,
00082 BFD_SYM_MODULE_KIND_PROCEDURE = 3,
00083 BFD_SYM_MODULE_KIND_FUNCTION = 4,
00084 BFD_SYM_MODULE_KIND_DATA = 5,
00085 BFD_SYM_MODULE_KIND_BLOCK = 6
00086 };
00087 typedef enum bfd_sym_module_kind bfd_sym_module_kind;
00088
00089 enum bfd_sym_symbol_scope
00090 {
00091 BFD_SYM_SYMBOL_SCOPE_LOCAL = 0,
00092 BFD_SYM_SYMBOL_SCOPE_GLOBAL = 1
00093 };
00094 typedef enum bfd_sym_symbol_scope bfd_sym_symbol_scope;
00095
00096 struct bfd_sym_file_reference
00097 {
00098 unsigned long fref_frte_index;
00099 unsigned long fref_offset;
00100 };
00101 typedef struct bfd_sym_file_reference bfd_sym_file_reference;
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119 struct bfd_sym_resources_table_entry
00120 {
00121 unsigned char rte_res_type[4];
00122 unsigned short rte_res_number;
00123 unsigned long rte_nte_index;
00124 unsigned long rte_mte_first;
00125 unsigned long rte_mte_last;
00126 unsigned long rte_res_size;
00127 };
00128 typedef struct bfd_sym_resources_table_entry bfd_sym_resources_table_entry;
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145 struct bfd_sym_modules_table_entry
00146 {
00147 unsigned long mte_rte_index;
00148 unsigned long mte_res_offset;
00149 unsigned long mte_size;
00150 char mte_kind;
00151 char mte_scope;
00152 unsigned long mte_parent;
00153 bfd_sym_file_reference mte_imp_fref;
00154 unsigned long mte_imp_end;
00155 unsigned long mte_nte_index;
00156 unsigned long mte_cmte_index;
00157 unsigned long mte_cvte_index;
00158 unsigned long mte_clte_index;
00159 unsigned long mte_ctte_index;
00160 unsigned long mte_csnte_idx_1;
00161 unsigned long mte_csnte_idx_2;
00162 };
00163 typedef struct bfd_sym_modules_table_entry bfd_sym_modules_table_entry;
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179 union bfd_sym_file_references_table_entry
00180 {
00181 struct
00182 {
00183
00184 unsigned long type;
00185 }
00186 generic;
00187
00188 struct
00189 {
00190
00191 unsigned long type;
00192 unsigned long nte_index;
00193 unsigned long mod_date;
00194 }
00195 filename;
00196
00197 struct
00198 {
00199
00200 unsigned long mte_index;
00201 unsigned long file_offset;
00202 }
00203 entry;
00204 };
00205 typedef union bfd_sym_file_references_table_entry bfd_sym_file_references_table_entry;
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215 union bfd_sym_contained_modules_table_entry
00216 {
00217 struct
00218 {
00219
00220 unsigned long type;
00221 }
00222 generic;
00223
00224 struct
00225 {
00226 unsigned long mte_index;
00227 unsigned long nte_index;
00228 }
00229 entry;
00230 };
00231 typedef union bfd_sym_contained_modules_table_entry bfd_sym_contained_modules_table_entry;
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262 #define BFD_SYM_CVTE_SCA 0
00263 #define BFD_SYM_CVTE_LA_MAX_SIZE 13
00264 #define BFD_SYM_CVTE_BIG_LA 127
00265
00266 union bfd_sym_contained_variables_table_entry
00267 {
00268 struct
00269 {
00270
00271 unsigned long type;
00272 }
00273 generic;
00274
00275 struct
00276 {
00277
00278 unsigned long type;
00279 bfd_sym_file_reference fref;
00280 }
00281 file;
00282
00283 struct
00284 {
00285
00286 unsigned long tte_index;
00287 unsigned long nte_index;
00288 unsigned long file_delta;
00289 unsigned char scope;
00290 unsigned char la_size;
00291
00292 union
00293 {
00294
00295 struct
00296 {
00297 unsigned char sca_kind;
00298 unsigned char sca_class;
00299 unsigned long sca_offset;
00300 }
00301 scstruct;
00302
00303
00304 struct {
00305 unsigned char la[BFD_SYM_CVTE_LA_MAX_SIZE];
00306 unsigned char la_kind;
00307 }
00308 lastruct;
00309
00310
00311 struct
00312 {
00313 unsigned long big_la;
00314 unsigned char big_la_kind;
00315 }
00316 biglastruct;
00317 }
00318 address;
00319 }
00320 entry;
00321 };
00322 typedef union bfd_sym_contained_variables_table_entry bfd_sym_contained_variables_table_entry;
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342 union bfd_sym_contained_statements_table_entry
00343 {
00344 struct
00345 {
00346
00347 unsigned long type;
00348 }
00349 generic;
00350
00351 struct
00352 {
00353
00354 unsigned long type;
00355 bfd_sym_file_reference fref;
00356 }
00357 file;
00358
00359 struct
00360 {
00361 unsigned long mte_index;
00362 unsigned long file_delta;
00363 unsigned long mte_offset;
00364 }
00365 entry;
00366 };
00367 typedef union bfd_sym_contained_statements_table_entry bfd_sym_contained_statements_table_entry;
00368
00369
00370
00371
00372
00373
00374 union bfd_sym_contained_labels_table_entry
00375 {
00376 struct
00377 {
00378
00379 unsigned long type;
00380 }
00381 generic;
00382
00383 struct
00384 {
00385
00386 unsigned long type;
00387 bfd_sym_file_reference fref;
00388 }
00389 file;
00390
00391 struct
00392 {
00393
00394 unsigned long mte_index;
00395 unsigned long mte_offset;
00396 unsigned long nte_index;
00397 unsigned long file_delta;
00398 unsigned short scope;
00399 }
00400 entry;
00401 };
00402 typedef union bfd_sym_contained_labels_table_entry bfd_sym_contained_labels_table_entry;
00403
00404
00405
00406
00407
00408
00409
00410 union bfd_sym_contained_types_table_entry
00411 {
00412 struct
00413 {
00414
00415 unsigned long type;
00416 }
00417 generic;
00418
00419 struct
00420 {
00421
00422 unsigned long type;
00423 bfd_sym_file_reference fref;
00424 }
00425 file;
00426
00427 struct
00428 {
00429
00430 unsigned long tte_index;
00431 unsigned long nte_index;
00432 unsigned long file_delta;
00433 }
00434 entry;
00435 };
00436 typedef union bfd_sym_contained_types_table_entry bfd_sym_contained_types_table_entry;
00437
00438
00439
00440 typedef unsigned long bfd_sym_type_table_entry;
00441
00442
00443
00444 struct bfd_sym_type_information_table_entry
00445 {
00446 unsigned long nte_index;
00447 unsigned long physical_size;
00448 unsigned long logical_size;
00449 unsigned long offset;
00450 };
00451 typedef struct bfd_sym_type_information_table_entry bfd_sym_type_information_table_entry;
00452
00453
00454
00455
00456
00457
00458
00459 union bfd_sym_file_references_index_table_entry
00460 {
00461 struct
00462 {
00463 unsigned long type;
00464 }
00465 generic;
00466
00467 struct
00468 {
00469 unsigned long frte_index;
00470 unsigned long nte_index;
00471 }
00472 entry;
00473 };
00474 typedef union bfd_sym_file_references_index_table_entry bfd_sym_file_references_index_table_entry;
00475
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485
00486
00487
00488 typedef short bfd_sym_constant_pool_entry;
00489
00490
00491
00492
00493
00494
00495
00496
00497
00498
00499
00500
00501
00502
00503
00504
00505 struct bfd_sym_table_info
00506 {
00507 unsigned long dti_first_page;
00508 unsigned long dti_page_count;
00509 unsigned long dti_object_count;
00510 };
00511 typedef struct bfd_sym_table_info bfd_sym_table_info;
00512
00513 struct bfd_sym_header_block
00514 {
00515 unsigned char dshb_id[32];
00516 unsigned short dshb_page_size;
00517 unsigned long dshb_hash_page;
00518 unsigned long dshb_root_mte;
00519 unsigned long dshb_mod_date;
00520 bfd_sym_table_info dshb_frte;
00521 bfd_sym_table_info dshb_rte;
00522 bfd_sym_table_info dshb_mte;
00523 bfd_sym_table_info dshb_cmte;
00524 bfd_sym_table_info dshb_cvte;
00525 bfd_sym_table_info dshb_csnte;
00526 bfd_sym_table_info dshb_clte;
00527 bfd_sym_table_info dshb_ctte;
00528 bfd_sym_table_info dshb_tte;
00529 bfd_sym_table_info dshb_nte;
00530 bfd_sym_table_info dshb_tinfo;
00531 bfd_sym_table_info dshb_fite;
00532 bfd_sym_table_info dshb_const;
00533
00534 unsigned char dshb_file_creator[4];
00535 unsigned char dshb_file_type[4];
00536 };
00537 typedef struct bfd_sym_header_block bfd_sym_header_block;
00538
00539 struct bfd_sym_data_struct
00540 {
00541 unsigned char *name_table;
00542 bfd_sym_header_block header;
00543 bfd_sym_version version;
00544 bfd *sbfd;
00545 };
00546 typedef struct bfd_sym_data_struct bfd_sym_data_struct;
00547
00548 extern bfd_boolean bfd_sym_mkobject
00549 PARAMS ((bfd *));
00550 extern void bfd_sym_print_symbol
00551 PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type));
00552 extern bfd_boolean bfd_sym_valid
00553 PARAMS ((bfd *));
00554 extern unsigned char * bfd_sym_read_name_table
00555 PARAMS ((bfd *, bfd_sym_header_block *));
00556 extern void bfd_sym_parse_file_reference_v32
00557 PARAMS ((unsigned char *, size_t, bfd_sym_file_reference *));
00558 extern void bfd_sym_parse_disk_table_v32
00559 PARAMS ((unsigned char *, size_t, bfd_sym_table_info *));
00560 extern void bfd_sym_parse_header_v32
00561 PARAMS ((unsigned char *, size_t, bfd_sym_header_block *));
00562 extern int bfd_sym_read_header_v32
00563 PARAMS ((bfd *, bfd_sym_header_block *));
00564 extern int bfd_sym_read_header_v34
00565 PARAMS ((bfd *, bfd_sym_header_block *));
00566 extern int bfd_sym_read_header
00567 PARAMS ((bfd *, bfd_sym_header_block *, bfd_sym_version));
00568 extern int bfd_sym_read_version
00569 PARAMS ((bfd *, bfd_sym_version *));
00570 extern void bfd_sym_display_table_summary
00571 PARAMS ((FILE *, bfd_sym_table_info *, const char *));
00572 extern void bfd_sym_display_header
00573 PARAMS ((FILE *, bfd_sym_header_block *));
00574 extern void bfd_sym_parse_resources_table_entry_v32
00575 PARAMS ((unsigned char *, size_t, bfd_sym_resources_table_entry *));
00576 extern void bfd_sym_parse_modules_table_entry_v33
00577 PARAMS ((unsigned char *, size_t, bfd_sym_modules_table_entry *));
00578 extern void bfd_sym_parse_file_references_table_entry_v32
00579 PARAMS ((unsigned char *, size_t, bfd_sym_file_references_table_entry *));
00580 extern void bfd_sym_parse_contained_modules_table_entry_v32
00581 PARAMS ((unsigned char *, size_t, bfd_sym_contained_modules_table_entry *));
00582 extern void bfd_sym_parse_contained_variables_table_entry_v32
00583 PARAMS ((unsigned char *, size_t, bfd_sym_contained_variables_table_entry *));
00584 extern void bfd_sym_parse_contained_statements_table_entry_v32
00585 PARAMS ((unsigned char *, size_t, bfd_sym_contained_statements_table_entry *));
00586 extern void bfd_sym_parse_contained_labels_table_entry_v32
00587 PARAMS ((unsigned char *, size_t, bfd_sym_contained_labels_table_entry *));
00588 extern void bfd_sym_parse_type_table_entry_v32
00589 PARAMS ((unsigned char *, size_t, bfd_sym_type_table_entry *));
00590 extern int bfd_sym_fetch_resources_table_entry
00591 PARAMS ((bfd *, bfd_sym_resources_table_entry *, unsigned long));
00592 extern int bfd_sym_fetch_modules_table_entry
00593 PARAMS ((bfd *, bfd_sym_modules_table_entry *, unsigned long));
00594 extern int bfd_sym_fetch_file_references_table_entry
00595 PARAMS ((bfd *, bfd_sym_file_references_table_entry *, unsigned long));
00596 extern int bfd_sym_fetch_contained_modules_table_entry
00597 PARAMS ((bfd *, bfd_sym_contained_modules_table_entry *, unsigned long));
00598 extern int bfd_sym_fetch_contained_variables_table_entry
00599 PARAMS ((bfd *, bfd_sym_contained_variables_table_entry *, unsigned long));
00600 extern int bfd_sym_fetch_contained_statements_table_entry
00601 PARAMS ((bfd *, bfd_sym_contained_statements_table_entry *, unsigned long));
00602 extern int bfd_sym_fetch_contained_labels_table_entry
00603 PARAMS ((bfd *, bfd_sym_contained_labels_table_entry *, unsigned long));
00604 extern int bfd_sym_fetch_contained_types_table_entry
00605 PARAMS ((bfd *, bfd_sym_contained_types_table_entry *, unsigned long));
00606 extern int bfd_sym_fetch_file_references_index_table_entry
00607 PARAMS ((bfd *, bfd_sym_file_references_index_table_entry *, unsigned long));
00608 extern int bfd_sym_fetch_constant_pool_entry
00609 PARAMS ((bfd *, bfd_sym_constant_pool_entry *, unsigned long));
00610 extern int bfd_sym_fetch_type_table_entry
00611 PARAMS ((bfd *, bfd_sym_type_table_entry *, unsigned long));
00612 extern int bfd_sym_fetch_type_information_table_entry
00613 PARAMS ((bfd *, bfd_sym_type_information_table_entry *, unsigned long));
00614 extern int bfd_sym_fetch_type_table_information
00615 PARAMS ((bfd *, bfd_sym_type_information_table_entry *, unsigned long));
00616 extern const unsigned char * bfd_sym_symbol_name
00617 PARAMS ((bfd *, unsigned long));
00618 extern const unsigned char * bfd_sym_module_name
00619 PARAMS ((bfd *, unsigned long));
00620 extern const char * bfd_sym_unparse_storage_kind
00621 PARAMS ((enum bfd_sym_storage_kind));
00622 extern const char * bfd_sym_unparse_storage_class
00623 PARAMS ((enum bfd_sym_storage_class));
00624 extern const char * bfd_sym_unparse_module_kind
00625 PARAMS ((enum bfd_sym_module_kind));
00626 extern const char * bfd_sym_unparse_symbol_scope
00627 PARAMS ((enum bfd_sym_symbol_scope));
00628 extern void bfd_sym_print_file_reference
00629 PARAMS ((bfd *, FILE *, bfd_sym_file_reference *));
00630 extern void bfd_sym_print_resources_table_entry
00631 PARAMS ((bfd *, FILE *, bfd_sym_resources_table_entry *));
00632 extern void bfd_sym_print_modules_table_entry
00633 PARAMS ((bfd *, FILE *, bfd_sym_modules_table_entry *));
00634 extern void bfd_sym_print_file_references_table_entry
00635 PARAMS ((bfd *, FILE *, bfd_sym_file_references_table_entry *));
00636 extern void bfd_sym_print_contained_modules_table_entry
00637 PARAMS ((bfd *, FILE *, bfd_sym_contained_modules_table_entry *));
00638 extern void bfd_sym_print_contained_variables_table_entry
00639 PARAMS ((bfd *, FILE *f, bfd_sym_contained_variables_table_entry *));
00640 extern void bfd_sym_print_contained_statements_table_entry
00641 PARAMS ((bfd *, FILE *, bfd_sym_contained_statements_table_entry *));
00642 extern void bfd_sym_print_contained_labels_table_entry
00643 PARAMS ((bfd *, FILE *, bfd_sym_contained_labels_table_entry *));
00644 extern void bfd_sym_print_contained_types_table_entry
00645 PARAMS ((bfd *, FILE *, bfd_sym_contained_types_table_entry *));
00646 extern const char * bfd_sym_type_operator_name
00647 PARAMS ((unsigned char));
00648 extern const char * bfd_sym_type_basic_name
00649 PARAMS ((unsigned char));
00650 extern int bfd_sym_fetch_long
00651 PARAMS ((unsigned char *, unsigned long, unsigned long, unsigned long *, long *));
00652 extern void bfd_sym_print_type_information
00653 PARAMS ((bfd *, FILE *, unsigned char *, unsigned long, unsigned long, unsigned long *));
00654 extern void bfd_sym_print_type_information_table_entry
00655 PARAMS ((bfd *, FILE *, bfd_sym_type_information_table_entry *));
00656 extern void bfd_sym_print_file_references_index_table_entry
00657 PARAMS ((bfd *, FILE *, bfd_sym_file_references_index_table_entry *));
00658 extern void bfd_sym_print_constant_pool_entry
00659 PARAMS ((bfd *, FILE *, bfd_sym_constant_pool_entry *));
00660 extern unsigned char * bfd_sym_display_name_table_entry
00661 PARAMS ((bfd *, FILE *, unsigned char *));
00662 extern void bfd_sym_display_name_table
00663 PARAMS ((bfd *, FILE *));
00664 extern void bfd_sym_display_resources_table
00665 PARAMS ((bfd *, FILE *));
00666 extern void bfd_sym_display_modules_table
00667 PARAMS ((bfd *, FILE *));
00668 extern void bfd_sym_display_file_references_table
00669 PARAMS ((bfd *, FILE *));
00670 extern void bfd_sym_display_contained_modules_table
00671 PARAMS ((bfd *, FILE *));
00672 extern void bfd_sym_display_contained_variables_table
00673 PARAMS ((bfd *, FILE *));
00674 extern void bfd_sym_display_contained_statements_table
00675 PARAMS ((bfd *, FILE *));
00676 extern void bfd_sym_display_contained_labels_table
00677 PARAMS ((bfd *, FILE *));
00678 extern void bfd_sym_display_contained_types_table
00679 PARAMS ((bfd *, FILE *));
00680 extern void bfd_sym_display_file_references_index_table
00681 PARAMS ((bfd *, FILE *));
00682 extern void bfd_sym_display_constant_pool
00683 PARAMS ((bfd *, FILE *));
00684 extern void bfd_sym_display_type_information_table
00685 PARAMS ((bfd *, FILE *));
00686 extern int bfd_sym_scan
00687 PARAMS ((bfd *, bfd_sym_version, bfd_sym_data_struct *));
00688 extern const bfd_target * bfd_sym_object_p
00689 PARAMS ((bfd *));
00690 extern asymbol * bfd_sym_make_empty_symbol
00691 PARAMS ((bfd *));
00692 extern void bfd_sym_get_symbol_info
00693 PARAMS ((bfd *, asymbol *, symbol_info *));
00694 extern long bfd_sym_get_symtab_upper_bound
00695 PARAMS ((bfd *));
00696 extern long bfd_sym_canonicalize_symtab
00697 PARAMS ((bfd *, asymbol **));
00698 extern int bfd_sym_sizeof_headers
00699 PARAMS ((bfd *, bfd_boolean));
00700
00701 #endif