#include "bfd.h"
#include <stdio.h>
#ifndef __xSYM_H__
#define __xSYM_H__
#define BFD_SYM_VERSION_STR_3_1 "\013Version 3.1"
#define BFD_SYM_VERSION_STR_3_2 "\013Version 3.2"
#define BFD_SYM_VERSION_STR_3_3 "\013Version 3.3"
#define BFD_SYM_VERSION_STR_3_3R0 "\017Version 3.3.3R0"
#define BFD_SYM_VERSION_STR_3_4 "\013Version 3.4"
#define BFD_SYM_VERSION_STR_3_5 "\013Version 3.5"
#define BFD_SYM_END_OF_LIST_3_2 0xffff
#define BFD_SYM_END_OF_LIST_3_3R0 0xffffffff
#define BFD_SYM_END_OF_LIST_3_4 0xffffffff
#define BFD_SYM_END_OF_LIST BFD_SYM_END_OF_LIST_3_4
#define BFD_SYM_FILE_NAME_INDEX_3_2 0xfffe
#define BFD_SYM_FILE_NAME_INDEX_3_3R0 0xfffffffe
#define BFD_SYM_FILE_NAME_INDEX_3_4 0xfffffffe
#define BFD_SYM_FILE_NAME_INDEX BFD_SYM_FILE_NAME_INDEX_3_4
#define BFD_SYM_SOURCE_FILE_CHANGE_3_2 0xfffe
#define BFD_SYM_SOURCE_FILE_CHANGE_3_3R0 0xfffffffe
#define BFD_SYM_SOURCE_FILE_CHANGE_3_4 0xfffffffe
#define BFD_SYM_SOURCE_FILE_CHANGE BFD_SYM_SOURCE_FILE_CHANGE_3_4
#define BFD_SYM_MAXIMUM_LEGAL_INDEX_3_2 0xfffd
#define BFD_SYM_MAXIMUM_LEGAL_INDEX_3_4 0xfffffffd
#define BFD_SYM_MAXIMUM_LEGAL_INDEX BFD_SYM_MAXIMUM_LEGAL_INDEX_3_4
enum bfd_sym_storage_class
{
BFD_SYM_STORAGE_CLASS_REGISTER = 0,
BFD_SYM_STORAGE_CLASS_GLOBAL = 1,
BFD_SYM_STORAGE_CLASS_FRAME_RELATIVE = 2,
BFD_SYM_STORAGE_CLASS_STACK_RELATIVE = 3,
BFD_SYM_STORAGE_CLASS_ABSOLUTE = 4,
BFD_SYM_STORAGE_CLASS_CONSTANT = 5,
BFD_SYM_STORAGE_CLASS_BIGCONSTANT = 6,
BFD_SYM_STORAGE_CLASS_RESOURCE = 99
};
typedef enum bfd_sym_storage_class bfd_sym_storage_class;
enum bfd_sym_storage_kind
{
BFD_SYM_STORAGE_KIND_LOCAL = 0,
BFD_SYM_STORAGE_KIND_VALUE = 1,
BFD_SYM_STORAGE_KIND_REFERENCE = 2,
BFD_SYM_STORAGE_KIND_WITH = 3
};
typedef enum bfd_sym_storage_kind bfd_sym_storage_kind;
enum bfd_sym_version
{
BFD_SYM_VERSION_3_1,
BFD_SYM_VERSION_3_2,
BFD_SYM_VERSION_3_3,
BFD_SYM_VERSION_3_3R0,
BFD_SYM_VERSION_3_4,
BFD_SYM_VERSION_3_5
};
typedef enum bfd_sym_version bfd_sym_version;
enum bfd_sym_module_kind
{
BFD_SYM_MODULE_KIND_NONE = 0,
BFD_SYM_MODULE_KIND_PROGRAM = 1,
BFD_SYM_MODULE_KIND_UNIT = 2,
BFD_SYM_MODULE_KIND_PROCEDURE = 3,
BFD_SYM_MODULE_KIND_FUNCTION = 4,
BFD_SYM_MODULE_KIND_DATA = 5,
BFD_SYM_MODULE_KIND_BLOCK = 6
};
typedef enum bfd_sym_module_kind bfd_sym_module_kind;
enum bfd_sym_symbol_scope
{
BFD_SYM_SYMBOL_SCOPE_LOCAL = 0,
BFD_SYM_SYMBOL_SCOPE_GLOBAL = 1
};
typedef enum bfd_sym_symbol_scope bfd_sym_symbol_scope;
struct bfd_sym_file_reference
{
unsigned long fref_frte_index;
unsigned long fref_offset;
};
typedef struct bfd_sym_file_reference bfd_sym_file_reference;
struct bfd_sym_resources_table_entry
{
unsigned char rte_res_type[4];
unsigned short rte_res_number;
unsigned long rte_nte_index;
unsigned long rte_mte_first;
unsigned long rte_mte_last;
unsigned long rte_res_size;
};
typedef struct bfd_sym_resources_table_entry bfd_sym_resources_table_entry;
struct bfd_sym_modules_table_entry
{
unsigned long mte_rte_index;
unsigned long mte_res_offset;
unsigned long mte_size;
char mte_kind;
char mte_scope;
unsigned long mte_parent;
bfd_sym_file_reference mte_imp_fref;
unsigned long mte_imp_end;
unsigned long mte_nte_index;
unsigned long mte_cmte_index;
unsigned long mte_cvte_index;
unsigned long mte_clte_index;
unsigned long mte_ctte_index;
unsigned long mte_csnte_idx_1;
unsigned long mte_csnte_idx_2;
};
typedef struct bfd_sym_modules_table_entry bfd_sym_modules_table_entry;
union bfd_sym_file_references_table_entry
{
struct
{
unsigned long type;
}
generic;
struct
{
unsigned long type;
unsigned long nte_index;
unsigned long mod_date;
}
filename;
struct
{
unsigned long mte_index;
unsigned long file_offset;
}
entry;
};
typedef union bfd_sym_file_references_table_entry bfd_sym_file_references_table_entry;
union bfd_sym_contained_modules_table_entry
{
struct
{
unsigned long type;
}
generic;
struct
{
unsigned long mte_index;
unsigned long nte_index;
}
entry;
};
typedef union bfd_sym_contained_modules_table_entry bfd_sym_contained_modules_table_entry;
#define BFD_SYM_CVTE_SCA 0
#define BFD_SYM_CVTE_LA_MAX_SIZE 13
#define BFD_SYM_CVTE_BIG_LA 127
union bfd_sym_contained_variables_table_entry
{
struct
{
unsigned long type;
}
generic;
struct
{
unsigned long type;
bfd_sym_file_reference fref;
}
file;
struct
{
unsigned long tte_index;
unsigned long nte_index;
unsigned long file_delta;
unsigned char scope;
unsigned char la_size;
union
{
struct
{
unsigned char sca_kind;
unsigned char sca_class;
unsigned long sca_offset;
}
scstruct;
struct {
unsigned char la[BFD_SYM_CVTE_LA_MAX_SIZE];
unsigned char la_kind;
}
lastruct;
struct
{
unsigned long big_la;
unsigned char big_la_kind;
}
biglastruct;
}
address;
}
entry;
};
typedef union bfd_sym_contained_variables_table_entry bfd_sym_contained_variables_table_entry;
union bfd_sym_contained_statements_table_entry
{
struct
{
unsigned long type;
}
generic;
struct
{
unsigned long type;
bfd_sym_file_reference fref;
}
file;
struct
{
unsigned long mte_index;
unsigned long file_delta;
unsigned long mte_offset;
}
entry;
};
typedef union bfd_sym_contained_statements_table_entry bfd_sym_contained_statements_table_entry;
union bfd_sym_contained_labels_table_entry
{
struct
{
unsigned long type;
}
generic;
struct
{
unsigned long type;
bfd_sym_file_reference fref;
}
file;
struct
{
unsigned long mte_index;
unsigned long mte_offset;
unsigned long nte_index;
unsigned long file_delta;
unsigned short scope;
}
entry;
};
typedef union bfd_sym_contained_labels_table_entry bfd_sym_contained_labels_table_entry;
union bfd_sym_contained_types_table_entry
{
struct
{
unsigned long type;
}
generic;
struct
{
unsigned long type;
bfd_sym_file_reference fref;
}
file;
struct
{
unsigned long tte_index;
unsigned long nte_index;
unsigned long file_delta;
}
entry;
};
typedef union bfd_sym_contained_types_table_entry bfd_sym_contained_types_table_entry;
typedef unsigned long bfd_sym_type_table_entry;
struct bfd_sym_type_information_table_entry
{
unsigned long nte_index;
unsigned long physical_size;
unsigned long logical_size;
unsigned long offset;
};
typedef struct bfd_sym_type_information_table_entry bfd_sym_type_information_table_entry;
union bfd_sym_file_references_index_table_entry
{
struct
{
unsigned long type;
}
generic;
struct
{
unsigned long frte_index;
unsigned long nte_index;
}
entry;
};
typedef union bfd_sym_file_references_index_table_entry bfd_sym_file_references_index_table_entry;
typedef short bfd_sym_constant_pool_entry;
struct bfd_sym_table_info
{
unsigned long dti_first_page;
unsigned long dti_page_count;
unsigned long dti_object_count;
};
typedef struct bfd_sym_table_info bfd_sym_table_info;
struct bfd_sym_header_block
{
unsigned char dshb_id[32];
unsigned short dshb_page_size;
unsigned long dshb_hash_page;
unsigned long dshb_root_mte;
unsigned long dshb_mod_date;
bfd_sym_table_info dshb_frte;
bfd_sym_table_info dshb_rte;
bfd_sym_table_info dshb_mte;
bfd_sym_table_info dshb_cmte;
bfd_sym_table_info dshb_cvte;
bfd_sym_table_info dshb_csnte;
bfd_sym_table_info dshb_clte;
bfd_sym_table_info dshb_ctte;
bfd_sym_table_info dshb_tte;
bfd_sym_table_info dshb_nte;
bfd_sym_table_info dshb_tinfo;
bfd_sym_table_info dshb_fite;
bfd_sym_table_info dshb_const;
unsigned char dshb_file_creator[4];
unsigned char dshb_file_type[4];
};
typedef struct bfd_sym_header_block bfd_sym_header_block;
struct bfd_sym_data_struct
{
unsigned char *name_table;
bfd_sym_header_block header;
bfd_sym_version version;
bfd *sbfd;
};
typedef struct bfd_sym_data_struct bfd_sym_data_struct;
extern bfd_boolean bfd_sym_mkobject
(bfd *);
extern void bfd_sym_print_symbol
(bfd *, PTR, asymbol *, bfd_print_symbol_type);
extern bfd_boolean bfd_sym_valid
(bfd *);
extern unsigned char * bfd_sym_read_name_table
(bfd *, bfd_sym_header_block *);
extern void bfd_sym_parse_file_reference_v32
(unsigned char *, size_t, bfd_sym_file_reference *);
extern void bfd_sym_parse_file_reference_v331
(unsigned char *, size_t, bfd_sym_file_reference *);
extern void bfd_sym_parse_disk_table_v32
(unsigned char *, size_t, bfd_sym_table_info *);
extern void bfd_sym_parse_header_v32
(unsigned char *, size_t, bfd_sym_header_block *);
extern int bfd_sym_read_header_v32
(bfd *, bfd_sym_header_block *);
extern int bfd_sym_read_header_v34
(bfd *, bfd_sym_header_block *);
extern int bfd_sym_read_header
(bfd *, bfd_sym_header_block *, bfd_sym_version);
extern int bfd_sym_read_version
(bfd *, bfd_sym_version *);
extern void bfd_sym_display_table_summary
(FILE *, bfd_sym_table_info *, const char *);
extern void bfd_sym_display_header
(FILE *, bfd_sym_header_block *);
extern void bfd_sym_parse_resources_table_entry_v32
(unsigned char *, size_t, bfd_sym_resources_table_entry *);
extern void bfd_sym_parse_modules_table_entry_v33
(unsigned char *, size_t, bfd_sym_modules_table_entry *);
extern void bfd_sym_parse_file_references_table_entry_v32
(unsigned char *, size_t, bfd_sym_file_references_table_entry *);
extern void bfd_sym_parse_contained_modules_table_entry_v32
(unsigned char *, size_t, bfd_sym_contained_modules_table_entry *);
extern void bfd_sym_parse_contained_variables_table_entry_v32
(unsigned char *, size_t, bfd_sym_contained_variables_table_entry *);
extern void bfd_sym_parse_contained_statements_table_entry_v32
(unsigned char *, size_t, bfd_sym_contained_statements_table_entry *);
extern void bfd_sym_parse_contained_labels_table_entry_v32
(unsigned char *, size_t, bfd_sym_contained_labels_table_entry *);
extern void bfd_sym_parse_type_table_entry_v32
(unsigned char *, size_t, bfd_sym_type_table_entry *);
extern int bfd_sym_fetch_resources_table_entry
(bfd *, bfd_sym_resources_table_entry *, unsigned long);
extern int bfd_sym_fetch_modules_table_entry
(bfd *, bfd_sym_modules_table_entry *, unsigned long);
extern int bfd_sym_fetch_file_references_table_entry
(bfd *, bfd_sym_file_references_table_entry *, unsigned long);
extern int bfd_sym_fetch_contained_modules_table_entry
(bfd *, bfd_sym_contained_modules_table_entry *, unsigned long);
extern int bfd_sym_fetch_contained_variables_table_entry
(bfd *, bfd_sym_contained_variables_table_entry *, unsigned long);
extern int bfd_sym_fetch_contained_statements_table_entry
(bfd *, bfd_sym_contained_statements_table_entry *, unsigned long);
extern int bfd_sym_fetch_contained_labels_table_entry
(bfd *, bfd_sym_contained_labels_table_entry *, unsigned long);
extern int bfd_sym_fetch_contained_types_table_entry
(bfd *, bfd_sym_contained_types_table_entry *, unsigned long);
extern int bfd_sym_fetch_file_references_index_table_entry
(bfd *, bfd_sym_file_references_index_table_entry *, unsigned long);
extern int bfd_sym_fetch_constant_pool_entry
(bfd *, bfd_sym_constant_pool_entry *, unsigned long);
extern int bfd_sym_fetch_type_table_entry
(bfd *, bfd_sym_type_table_entry *, unsigned long);
extern int bfd_sym_fetch_type_information_table_entry
(bfd *, bfd_sym_type_information_table_entry *, unsigned long);
extern int bfd_sym_fetch_type_table_information
(bfd *, bfd_sym_type_information_table_entry *, unsigned long);
extern const unsigned char * bfd_sym_symbol_name
(bfd *, unsigned long);
extern const unsigned char * bfd_sym_module_name
(bfd *, unsigned long);
extern const char * bfd_sym_unparse_storage_kind
(enum bfd_sym_storage_kind);
extern const char * bfd_sym_unparse_storage_class
(enum bfd_sym_storage_class);
extern const char * bfd_sym_unparse_module_kind
(enum bfd_sym_module_kind);
extern const char * bfd_sym_unparse_symbol_scope
(enum bfd_sym_symbol_scope);
extern void bfd_sym_print_file_reference
(bfd *, FILE *, bfd_sym_file_reference *);
extern void bfd_sym_print_resources_table_entry
(bfd *, FILE *, bfd_sym_resources_table_entry *);
extern void bfd_sym_print_modules_table_entry
(bfd *, FILE *, bfd_sym_modules_table_entry *);
extern void bfd_sym_print_file_references_table_entry
(bfd *, FILE *, bfd_sym_file_references_table_entry *);
extern void bfd_sym_print_contained_modules_table_entry
(bfd *, FILE *, bfd_sym_contained_modules_table_entry *);
extern void bfd_sym_print_contained_variables_table_entry
(bfd *, FILE *f, bfd_sym_contained_variables_table_entry *);
extern void bfd_sym_print_contained_statements_table_entry
(bfd *, FILE *, bfd_sym_contained_statements_table_entry *);
extern void bfd_sym_print_contained_labels_table_entry
(bfd *, FILE *, bfd_sym_contained_labels_table_entry *);
extern void bfd_sym_print_contained_types_table_entry
(bfd *, FILE *, bfd_sym_contained_types_table_entry *);
extern const char * bfd_sym_type_operator_name
(unsigned char);
extern const char * bfd_sym_type_basic_name
(unsigned char);
extern int bfd_sym_fetch_long
(unsigned char *, unsigned long, unsigned long, unsigned long *, long *);
extern void bfd_sym_print_type_information
(bfd *, FILE *, unsigned char *, unsigned long, unsigned long, unsigned long *);
extern void bfd_sym_print_type_information_table_entry
(bfd *, FILE *, bfd_sym_type_information_table_entry *);
extern void bfd_sym_print_file_references_index_table_entry
(bfd *, FILE *, bfd_sym_file_references_index_table_entry *);
extern void bfd_sym_print_constant_pool_entry
(bfd *, FILE *, bfd_sym_constant_pool_entry *);
extern unsigned char * bfd_sym_display_name_table_entry
(bfd *, FILE *, unsigned char *);
extern void bfd_sym_display_name_table
(bfd *, FILE *);
extern void bfd_sym_display_resources_table
(bfd *, FILE *);
extern void bfd_sym_display_modules_table
(bfd *, FILE *);
extern void bfd_sym_display_file_references_table
(bfd *, FILE *);
extern void bfd_sym_display_contained_modules_table
(bfd *, FILE *);
extern void bfd_sym_display_contained_variables_table
(bfd *, FILE *);
extern void bfd_sym_display_contained_statements_table
(bfd *, FILE *);
extern void bfd_sym_display_contained_labels_table
(bfd *, FILE *);
extern void bfd_sym_display_contained_types_table
(bfd *, FILE *);
extern void bfd_sym_display_file_references_index_table
(bfd *, FILE *);
extern void bfd_sym_display_constant_pool
(bfd *, FILE *);
extern void bfd_sym_display_type_information_table
(bfd *, FILE *);
extern int bfd_sym_scan
(bfd *, bfd_sym_version, bfd_sym_data_struct *);
extern const bfd_target * bfd_sym_object_p
(bfd *);
extern asymbol * bfd_sym_make_empty_symbol
(bfd *);
extern void bfd_sym_get_symbol_info
(bfd *, asymbol *, symbol_info *);
extern long bfd_sym_get_symtab_upper_bound
(bfd *);
extern long bfd_sym_canonicalize_symtab
(bfd *, asymbol **);
extern int bfd_sym_sizeof_headers
(bfd *, bfd_boolean);
extern void
bfd_sym_parse_file_reference_v33r0 (unsigned char *buf, size_t len, bfd_sym_file_reference *entry);
extern void
bfd_sym_parse_file_references_index_table_entry_v33r0
(unsigned char *buf, size_t len, bfd_sym_file_references_index_table_entry *entry);
extern void
bfd_sym_parse_modules_table_entry_v33r0 (unsigned char *buf, size_t len, bfd_sym_modules_table_entry *entry);
extern void
bfd_sym_parse_contained_statements_table_entry_v33r0 (unsigned char *buf, size_t len, bfd_sym_contained_statements_table_entry *entry);
extern void
bfd_sym_parse_contained_variables_table_entry_v33r0 (unsigned char *buf, size_t len, bfd_sym_contained_variables_table_entry *entry);
extern void
bfd_sym_parse_contained_modules_table_entry_v33r0 (unsigned char *buf, size_t len, bfd_sym_contained_modules_table_entry *entry);
extern void
bfd_sym_parse_file_references_table_entry_v33r0 (unsigned char *buf, size_t len, bfd_sym_file_references_table_entry *entry);
extern void
bfd_sym_parse_resources_table_entry_v33r0 (unsigned char *buf, size_t len, bfd_sym_resources_table_entry *entry);
#endif