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