00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef ECOFF_H
00026 #define ECOFF_H
00027
00028
00029
00030
00031 #define MIPS_MAGIC_1 0x0180
00032 #define MIPS_MAGIC_LITTLE 0x0162
00033 #define MIPS_MAGIC_BIG 0x0160
00034
00035
00036
00037 #define MIPS_MAGIC_LITTLE2 0x0166
00038 #define MIPS_MAGIC_BIG2 0x0163
00039
00040
00041
00042 #define MIPS_MAGIC_LITTLE3 0x142
00043 #define MIPS_MAGIC_BIG3 0x140
00044
00045
00046 #define ALPHA_MAGIC 0x183
00047 #define ALPHA_MAGIC_BSD 0x185
00048
00049
00050 #define ECOFF_AOUT_OMAGIC 0407
00051 #define ECOFF_AOUT_ZMAGIC 0413
00052
00053
00054 #define _TEXT ".text"
00055 #define _DATA ".data"
00056 #define _BSS ".bss"
00057 #define _RDATA ".rdata"
00058 #define _SDATA ".sdata"
00059 #define _SBSS ".sbss"
00060 #define _LITA ".lita"
00061 #define _LIT4 ".lit4"
00062 #define _LIT8 ".lit8"
00063 #define _LIB ".lib"
00064 #define _INIT ".init"
00065 #define _FINI ".fini"
00066 #define _PDATA ".pdata"
00067 #define _XDATA ".xdata"
00068 #define _GOT ".got"
00069 #define _HASH ".hash"
00070 #define _DYNSYM ".dynsym"
00071 #define _DYNSTR ".dynstr"
00072 #define _RELDYN ".rel.dyn"
00073 #define _CONFLIC ".conflic"
00074 #define _COMMENT ".comment"
00075 #define _LIBLIST ".liblist"
00076 #define _DYNAMIC ".dynamic"
00077 #define _RCONST ".rconst"
00078
00079
00080 #define STYP_RDATA 0x100
00081 #define STYP_SDATA 0x200
00082 #define STYP_SBSS 0x400
00083 #define STYP_GOT 0x1000
00084 #define STYP_DYNAMIC 0x2000
00085 #define STYP_DYNSYM 0x4000
00086 #define STYP_RELDYN 0x8000
00087 #define STYP_DYNSTR 0x10000
00088 #define STYP_HASH 0x20000
00089 #define STYP_LIBLIST 0x40000
00090 #define STYP_CONFLIC 0x100000
00091 #define STYP_ECOFF_FINI 0x1000000
00092 #define STYP_EXTENDESC 0x2000000
00093 #define STYP_LITA 0x4000000
00094 #define STYP_LIT8 0x8000000
00095 #define STYP_LIT4 0x10000000
00096 #define STYP_ECOFF_LIB 0x40000000
00097 #define STYP_ECOFF_INIT 0x80000000
00098 #define STYP_OTHER_LOAD (STYP_ECOFF_INIT | STYP_ECOFF_FINI)
00099
00100
00101 #define STYP_COMMENT 0x2100000
00102 #define STYP_RCONST 0x2200000
00103 #define STYP_XDATA 0x2400000
00104 #define STYP_PDATA 0x2800000
00105
00106
00107
00108
00109
00110 #define SCOMMON ".scommon"
00111
00112
00113
00114
00115 #define RELOC_SECTION_NONE 0
00116 #define RELOC_SECTION_TEXT 1
00117 #define RELOC_SECTION_RDATA 2
00118 #define RELOC_SECTION_DATA 3
00119 #define RELOC_SECTION_SDATA 4
00120 #define RELOC_SECTION_SBSS 5
00121 #define RELOC_SECTION_BSS 6
00122 #define RELOC_SECTION_INIT 7
00123 #define RELOC_SECTION_LIT8 8
00124 #define RELOC_SECTION_LIT4 9
00125 #define RELOC_SECTION_XDATA 10
00126 #define RELOC_SECTION_PDATA 11
00127 #define RELOC_SECTION_FINI 12
00128 #define RELOC_SECTION_LITA 13
00129 #define RELOC_SECTION_ABS 14
00130 #define RELOC_SECTION_RCONST 15
00131
00132 #define NUM_RELOC_SECTIONS 16
00133
00134
00135
00136
00137
00138
00139
00140
00141 #define CODE_MASK 0x8F300
00142 #define ECOFF_IS_STAB(sym) (((sym)->index & 0xFFF00) == CODE_MASK)
00143 #define ECOFF_MARK_STAB(code) ((code)+CODE_MASK)
00144 #define ECOFF_UNMARK_STAB(code) ((code)-CODE_MASK)
00145 #define STABS_SYMBOL "@stabs"
00146
00147
00148
00149
00150
00151
00152 #define N_BTMASK (017)
00153 #define N_TMASK (060)
00154 #define N_BTSHFT (4)
00155 #define N_TSHIFT (2)
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168 struct tir_ext {
00169 unsigned char t_bits1[1];
00170 unsigned char t_tq45[1];
00171 unsigned char t_tq01[1];
00172 unsigned char t_tq23[1];
00173 };
00174
00175 #define TIR_BITS1_FBITFIELD_BIG ((unsigned int) 0x80)
00176 #define TIR_BITS1_FBITFIELD_LITTLE ((unsigned int) 0x01)
00177
00178 #define TIR_BITS1_CONTINUED_BIG ((unsigned int) 0x40)
00179 #define TIR_BITS1_CONTINUED_LITTLE ((unsigned int) 0x02)
00180
00181 #define TIR_BITS1_BT_BIG ((unsigned int) 0x3F)
00182 #define TIR_BITS1_BT_SH_BIG 0
00183 #define TIR_BITS1_BT_LITTLE ((unsigned int) 0xFC)
00184 #define TIR_BITS1_BT_SH_LITTLE 2
00185
00186 #define TIR_BITS_TQ4_BIG ((unsigned int) 0xF0)
00187 #define TIR_BITS_TQ4_SH_BIG 4
00188 #define TIR_BITS_TQ5_BIG ((unsigned int) 0x0F)
00189 #define TIR_BITS_TQ5_SH_BIG 0
00190 #define TIR_BITS_TQ4_LITTLE ((unsigned int) 0x0F)
00191 #define TIR_BITS_TQ4_SH_LITTLE 0
00192 #define TIR_BITS_TQ5_LITTLE ((unsigned int) 0xF0)
00193 #define TIR_BITS_TQ5_SH_LITTLE 4
00194
00195 #define TIR_BITS_TQ0_BIG ((unsigned int) 0xF0)
00196 #define TIR_BITS_TQ0_SH_BIG 4
00197 #define TIR_BITS_TQ1_BIG ((unsigned int) 0x0F)
00198 #define TIR_BITS_TQ1_SH_BIG 0
00199 #define TIR_BITS_TQ0_LITTLE ((unsigned int) 0x0F)
00200 #define TIR_BITS_TQ0_SH_LITTLE 0
00201 #define TIR_BITS_TQ1_LITTLE ((unsigned int) 0xF0)
00202 #define TIR_BITS_TQ1_SH_LITTLE 4
00203
00204 #define TIR_BITS_TQ2_BIG ((unsigned int) 0xF0)
00205 #define TIR_BITS_TQ2_SH_BIG 4
00206 #define TIR_BITS_TQ3_BIG ((unsigned int) 0x0F)
00207 #define TIR_BITS_TQ3_SH_BIG 0
00208 #define TIR_BITS_TQ2_LITTLE ((unsigned int) 0x0F)
00209 #define TIR_BITS_TQ2_SH_LITTLE 0
00210 #define TIR_BITS_TQ3_LITTLE ((unsigned int) 0xF0)
00211 #define TIR_BITS_TQ3_SH_LITTLE 4
00212
00213
00214
00215 struct rndx_ext {
00216 unsigned char r_bits[4];
00217 };
00218
00219 #define RNDX_BITS0_RFD_SH_LEFT_BIG 4
00220 #define RNDX_BITS1_RFD_BIG ((unsigned int) 0xF0)
00221 #define RNDX_BITS1_RFD_SH_BIG 4
00222
00223 #define RNDX_BITS0_RFD_SH_LEFT_LITTLE 0
00224 #define RNDX_BITS1_RFD_LITTLE ((unsigned int) 0x0F)
00225 #define RNDX_BITS1_RFD_SH_LEFT_LITTLE 8
00226
00227 #define RNDX_BITS1_INDEX_BIG ((unsigned int) 0x0F)
00228 #define RNDX_BITS1_INDEX_SH_LEFT_BIG 16
00229 #define RNDX_BITS2_INDEX_SH_LEFT_BIG 8
00230 #define RNDX_BITS3_INDEX_SH_LEFT_BIG 0
00231
00232 #define RNDX_BITS1_INDEX_LITTLE ((unsigned int) 0xF0)
00233 #define RNDX_BITS1_INDEX_SH_LITTLE 4
00234 #define RNDX_BITS2_INDEX_SH_LEFT_LITTLE 4
00235 #define RNDX_BITS3_INDEX_SH_LEFT_LITTLE 12
00236
00237
00238
00239 union aux_ext {
00240 struct tir_ext a_ti;
00241 struct rndx_ext a_rndx;
00242 unsigned char a_dnLow[4];
00243 unsigned char a_dnHigh[4];
00244 unsigned char a_isym[4];
00245 unsigned char a_iss[4];
00246 unsigned char a_width[4];
00247 unsigned char a_count[4];
00248 };
00249
00250 #define AUX_GET_ANY(bigend, ax, field) \
00251 ((bigend) ? bfd_getb32 ((ax)->field) : bfd_getl32 ((ax)->field))
00252
00253 #define AUX_GET_DNLOW(bigend, ax) AUX_GET_ANY ((bigend), (ax), a_dnLow)
00254 #define AUX_GET_DNHIGH(bigend, ax) AUX_GET_ANY ((bigend), (ax), a_dnHigh)
00255 #define AUX_GET_ISYM(bigend, ax) AUX_GET_ANY ((bigend), (ax), a_isym)
00256 #define AUX_GET_ISS(bigend, ax) AUX_GET_ANY ((bigend), (ax), a_iss)
00257 #define AUX_GET_WIDTH(bigend, ax) AUX_GET_ANY ((bigend), (ax), a_width)
00258 #define AUX_GET_COUNT(bigend, ax) AUX_GET_ANY ((bigend), (ax), a_count)
00259
00260 #define AUX_PUT_ANY(bigend, val, ax, field) \
00261 ((bigend) \
00262 ? (bfd_putb32 ((bfd_vma) (val), (ax)->field), 0) \
00263 : (bfd_putl32 ((bfd_vma) (val), (ax)->field), 0))
00264
00265 #define AUX_PUT_DNLOW(bigend, val, ax) \
00266 AUX_PUT_ANY ((bigend), (val), (ax), a_dnLow)
00267 #define AUX_PUT_DNHIGH(bigend, val, ax) \
00268 AUX_PUT_ANY ((bigend), (val), (ax), a_dnHigh)
00269 #define AUX_PUT_ISYM(bigend, val, ax) \
00270 AUX_PUT_ANY ((bigend), (val), (ax), a_isym)
00271 #define AUX_PUT_ISS(bigend, val, ax) \
00272 AUX_PUT_ANY ((bigend), (val), (ax), a_iss)
00273 #define AUX_PUT_WIDTH(bigend, val, ax) \
00274 AUX_PUT_ANY ((bigend), (val), (ax), a_width)
00275 #define AUX_PUT_COUNT(bigend, val, ax) \
00276 AUX_PUT_ANY ((bigend), (val), (ax), a_count)
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288 struct ecoff_debug_info
00289 {
00290
00291 HDRR symbolic_header;
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302 unsigned char *line;
00303 void *external_dnr;
00304 void *external_pdr;
00305 void *external_sym;
00306 void *external_opt;
00307 union aux_ext *external_aux;
00308 char *ss;
00309 char *ssext;
00310 void *external_fdr;
00311 void *external_rfd;
00312 void *external_ext;
00313
00314
00315
00316 char *ssext_end;
00317 void *external_ext_end;
00318
00319
00320
00321
00322 RFDT *ifdmap;
00323
00324
00325
00326
00327
00328 FDR *fdr;
00329 };
00330
00331
00332
00333 struct ecoff_fdrtab_entry
00334 {
00335
00336 bfd_vma base_addr;
00337 FDR *fdr;
00338 };
00339
00340 struct ecoff_find_line
00341 {
00342
00343 char *find_buffer;
00344
00345
00346 long fdrtab_len;
00347 struct ecoff_fdrtab_entry *fdrtab;
00348
00349
00350
00351 struct
00352 {
00353 asection *sect;
00354 bfd_vma start;
00355 bfd_vma stop;
00356 const char *filename;
00357 const char *functionname;
00358 unsigned int line_num;
00359 } cache;
00360 };
00361
00362
00363
00364
00365
00366
00367
00368
00369 struct ecoff_debug_swap
00370 {
00371
00372 int sym_magic;
00373
00374 bfd_size_type debug_align;
00375
00376 bfd_size_type external_hdr_size;
00377 bfd_size_type external_dnr_size;
00378 bfd_size_type external_pdr_size;
00379 bfd_size_type external_sym_size;
00380 bfd_size_type external_opt_size;
00381 bfd_size_type external_fdr_size;
00382 bfd_size_type external_rfd_size;
00383 bfd_size_type external_ext_size;
00384
00385 void (*swap_hdr_in) (bfd *, void *, HDRR *);
00386 void (*swap_dnr_in) (bfd *, void *, DNR *);
00387 void (*swap_pdr_in) (bfd *, void *, PDR *);
00388 void (*swap_sym_in) (bfd *, void *, SYMR *);
00389 void (*swap_opt_in) (bfd *, void *, OPTR *);
00390 void (*swap_fdr_in) (bfd *, void *, FDR *);
00391 void (*swap_rfd_in) (bfd *, void *, RFDT *);
00392 void (*swap_ext_in) (bfd *, void *, EXTR *);
00393 void (*swap_tir_in) (int, const struct tir_ext *, TIR *);
00394 void (*swap_rndx_in) (int, const struct rndx_ext *, RNDXR *);
00395
00396 void (*swap_hdr_out) (bfd *, const HDRR *, void *);
00397 void (*swap_dnr_out) (bfd *, const DNR *, void *);
00398 void (*swap_pdr_out) (bfd *, const PDR *, void *);
00399 void (*swap_sym_out) (bfd *, const SYMR *, void *);
00400 void (*swap_opt_out) (bfd *, const OPTR *, void *);
00401 void (*swap_fdr_out) (bfd *, const FDR *, void *);
00402 void (*swap_rfd_out) (bfd *, const RFDT *, void *);
00403 void (*swap_ext_out) (bfd *, const EXTR *, void *);
00404 void (*swap_tir_out) (int, const TIR *, struct tir_ext *);
00405 void (*swap_rndx_out) (int, const RNDXR *, struct rndx_ext *);
00406
00407
00408
00409 bfd_boolean (*read_debug_info) (bfd *, asection *, struct ecoff_debug_info *);
00410 };
00411
00412 #endif