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