1*a9fa9459Szrj /* Generic ECOFF support.
2*a9fa9459Szrj    This does not include symbol information, found in sym.h and
3*a9fa9459Szrj    symconst.h.
4*a9fa9459Szrj 
5*a9fa9459Szrj    Copyright (C) 2001-2016 Free Software Foundation, Inc.
6*a9fa9459Szrj 
7*a9fa9459Szrj    This program is free software; you can redistribute it and/or modify
8*a9fa9459Szrj    it under the terms of the GNU General Public License as published by
9*a9fa9459Szrj    the Free Software Foundation; either version 3 of the License, or
10*a9fa9459Szrj    (at your option) any later version.
11*a9fa9459Szrj 
12*a9fa9459Szrj    This program is distributed in the hope that it will be useful,
13*a9fa9459Szrj    but WITHOUT ANY WARRANTY; without even the implied warranty of
14*a9fa9459Szrj    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15*a9fa9459Szrj    GNU General Public License for more details.
16*a9fa9459Szrj 
17*a9fa9459Szrj    You should have received a copy of the GNU General Public License
18*a9fa9459Szrj    along with this program; if not, write to the Free Software
19*a9fa9459Szrj    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
20*a9fa9459Szrj    MA 02110-1301, USA.  */
21*a9fa9459Szrj 
22*a9fa9459Szrj #ifndef ECOFF_H
23*a9fa9459Szrj #define ECOFF_H
24*a9fa9459Szrj 
25*a9fa9459Szrj /* Mips magic numbers used in filehdr.  MIPS_MAGIC_LITTLE is used on
26*a9fa9459Szrj    little endian machines.  MIPS_MAGIC_BIG is used on big endian
27*a9fa9459Szrj    machines.  Where is MIPS_MAGIC_1 from?  */
28*a9fa9459Szrj #define MIPS_MAGIC_1 0x0180
29*a9fa9459Szrj #define MIPS_MAGIC_LITTLE 0x0162
30*a9fa9459Szrj #define MIPS_MAGIC_BIG 0x0160
31*a9fa9459Szrj 
32*a9fa9459Szrj /* These are the magic numbers used for MIPS code compiled at ISA
33*a9fa9459Szrj    level 2.  */
34*a9fa9459Szrj #define MIPS_MAGIC_LITTLE2 0x0166
35*a9fa9459Szrj #define MIPS_MAGIC_BIG2 0x0163
36*a9fa9459Szrj 
37*a9fa9459Szrj /* These are the magic numbers used for MIPS code compiled at ISA
38*a9fa9459Szrj    level 3.  */
39*a9fa9459Szrj #define MIPS_MAGIC_LITTLE3 0x142
40*a9fa9459Szrj #define MIPS_MAGIC_BIG3 0x140
41*a9fa9459Szrj 
42*a9fa9459Szrj /* Alpha magic numbers used in filehdr.  */
43*a9fa9459Szrj #define ALPHA_MAGIC 0x183
44*a9fa9459Szrj #define ALPHA_MAGIC_BSD 0x185
45*a9fa9459Szrj /* A compressed version of an ALPHA_MAGIC file created by DEC's tools.  */
46*a9fa9459Szrj #define ALPHA_MAGIC_COMPRESSED 0x188
47*a9fa9459Szrj 
48*a9fa9459Szrj /* Magic numbers used in a.out header.  */
49*a9fa9459Szrj #define ECOFF_AOUT_OMAGIC 0407	/* not demand paged (ld -N).  */
50*a9fa9459Szrj #define ECOFF_AOUT_ZMAGIC 0413	/* demand load format, eg normal ld output */
51*a9fa9459Szrj 
52*a9fa9459Szrj /* Names of special sections.  */
53*a9fa9459Szrj #define _TEXT   ".text"
54*a9fa9459Szrj #define _DATA   ".data"
55*a9fa9459Szrj #define _BSS    ".bss"
56*a9fa9459Szrj #define _RDATA	".rdata"
57*a9fa9459Szrj #define _SDATA	".sdata"
58*a9fa9459Szrj #define _SBSS	".sbss"
59*a9fa9459Szrj #define _LITA	".lita"
60*a9fa9459Szrj #define _LIT4	".lit4"
61*a9fa9459Szrj #define _LIT8	".lit8"
62*a9fa9459Szrj #define _LIB	".lib"
63*a9fa9459Szrj #define _INIT	".init"
64*a9fa9459Szrj #define _FINI	".fini"
65*a9fa9459Szrj #define _PDATA	".pdata"
66*a9fa9459Szrj #define _XDATA	".xdata"
67*a9fa9459Szrj #define _GOT	".got"
68*a9fa9459Szrj #define _HASH	".hash"
69*a9fa9459Szrj #define _DYNSYM	".dynsym"
70*a9fa9459Szrj #define _DYNSTR	".dynstr"
71*a9fa9459Szrj #define _RELDYN	".rel.dyn"
72*a9fa9459Szrj #define _CONFLIC ".conflic"
73*a9fa9459Szrj #define _COMMENT ".comment"
74*a9fa9459Szrj #define _LIBLIST ".liblist"
75*a9fa9459Szrj #define _DYNAMIC ".dynamic"
76*a9fa9459Szrj #define _RCONST	".rconst"
77*a9fa9459Szrj 
78*a9fa9459Szrj /* ECOFF uses some additional section flags.  */
79*a9fa9459Szrj #define STYP_RDATA	     0x100
80*a9fa9459Szrj #define STYP_SDATA	     0x200
81*a9fa9459Szrj #define STYP_SBSS	     0x400
82*a9fa9459Szrj #define STYP_GOT	    0x1000
83*a9fa9459Szrj #define STYP_DYNAMIC	    0x2000
84*a9fa9459Szrj #define STYP_DYNSYM	    0x4000
85*a9fa9459Szrj #define STYP_RELDYN	    0x8000
86*a9fa9459Szrj #define STYP_DYNSTR	   0x10000
87*a9fa9459Szrj #define STYP_HASH	   0x20000
88*a9fa9459Szrj #define STYP_LIBLIST	   0x40000
89*a9fa9459Szrj #define STYP_CONFLIC	  0x100000
90*a9fa9459Szrj #define STYP_ECOFF_FINI	 0x1000000
91*a9fa9459Szrj #define STYP_EXTENDESC	 0x2000000 /* 0x02FFF000 bits => scn type, rest clr */
92*a9fa9459Szrj #define STYP_LITA	 0x4000000
93*a9fa9459Szrj #define STYP_LIT8	 0x8000000
94*a9fa9459Szrj #define STYP_LIT4	0x10000000
95*a9fa9459Szrj #define STYP_ECOFF_LIB	0x40000000
96*a9fa9459Szrj #define STYP_ECOFF_INIT 0x80000000
97*a9fa9459Szrj #define STYP_OTHER_LOAD (STYP_ECOFF_INIT | STYP_ECOFF_FINI)
98*a9fa9459Szrj 
99*a9fa9459Szrj /* extended section types */
100*a9fa9459Szrj #define STYP_COMMENT	 0x2100000
101*a9fa9459Szrj #define STYP_RCONST	 0x2200000
102*a9fa9459Szrj #define STYP_XDATA	 0x2400000
103*a9fa9459Szrj #define STYP_PDATA	 0x2800000
104*a9fa9459Szrj 
105*a9fa9459Szrj /* The linker needs a section to hold small common variables while
106*a9fa9459Szrj    linking.  There is no convenient way to create it when the linker
107*a9fa9459Szrj    needs it, so we always create one for each BFD.  We then avoid
108*a9fa9459Szrj    writing it out.  */
109*a9fa9459Szrj #define SCOMMON ".scommon"
110*a9fa9459Szrj 
111*a9fa9459Szrj /* If the extern bit in a reloc is 1, then r_symndx is an index into
112*a9fa9459Szrj    the external symbol table.  If the extern bit is 0, then r_symndx
113*a9fa9459Szrj    indicates a section, and is one of the following values.  */
114*a9fa9459Szrj #define RELOC_SECTION_NONE	0
115*a9fa9459Szrj #define RELOC_SECTION_TEXT	1
116*a9fa9459Szrj #define RELOC_SECTION_RDATA	2
117*a9fa9459Szrj #define RELOC_SECTION_DATA	3
118*a9fa9459Szrj #define RELOC_SECTION_SDATA	4
119*a9fa9459Szrj #define RELOC_SECTION_SBSS	5
120*a9fa9459Szrj #define RELOC_SECTION_BSS	6
121*a9fa9459Szrj #define RELOC_SECTION_INIT	7
122*a9fa9459Szrj #define RELOC_SECTION_LIT8	8
123*a9fa9459Szrj #define RELOC_SECTION_LIT4	9
124*a9fa9459Szrj #define RELOC_SECTION_XDATA    10
125*a9fa9459Szrj #define RELOC_SECTION_PDATA    11
126*a9fa9459Szrj #define RELOC_SECTION_FINI     12
127*a9fa9459Szrj #define RELOC_SECTION_LITA     13
128*a9fa9459Szrj #define RELOC_SECTION_ABS      14
129*a9fa9459Szrj #define RELOC_SECTION_RCONST   15
130*a9fa9459Szrj 
131*a9fa9459Szrj #define NUM_RELOC_SECTIONS     16
132*a9fa9459Szrj 
133*a9fa9459Szrj /********************** STABS **********************/
134*a9fa9459Szrj 
135*a9fa9459Szrj /* gcc uses mips-tfile to output type information in special stabs
136*a9fa9459Szrj    entries.  These must match the corresponding definition in
137*a9fa9459Szrj    gcc/config/mips.h.  At some point, these should probably go into a
138*a9fa9459Szrj    shared include file, but currently gcc and gdb do not share any
139*a9fa9459Szrj    directories. */
140*a9fa9459Szrj #define CODE_MASK 0x8F300
141*a9fa9459Szrj #define ECOFF_IS_STAB(sym) (((sym)->index & 0xFFF00) == CODE_MASK)
142*a9fa9459Szrj #define ECOFF_MARK_STAB(code) ((code)+CODE_MASK)
143*a9fa9459Szrj #define ECOFF_UNMARK_STAB(code) ((code)-CODE_MASK)
144*a9fa9459Szrj #define STABS_SYMBOL "@stabs"
145*a9fa9459Szrj 
146*a9fa9459Szrj /********************** COFF **********************/
147*a9fa9459Szrj 
148*a9fa9459Szrj /* gcc also uses mips-tfile to output COFF debugging information.
149*a9fa9459Szrj    These are the values it uses when outputting the .type directive.
150*a9fa9459Szrj    These should also be in a shared include file.  */
151*a9fa9459Szrj #define N_BTMASK	(017)
152*a9fa9459Szrj #define N_TMASK		(060)
153*a9fa9459Szrj #define N_BTSHFT	(4)
154*a9fa9459Szrj #define N_TSHIFT	(2)
155*a9fa9459Szrj 
156*a9fa9459Szrj /********************** AUX **********************/
157*a9fa9459Szrj 
158*a9fa9459Szrj /* The auxiliary type information is the same on all known ECOFF
159*a9fa9459Szrj    targets.  I can't see any reason that it would ever change, so I am
160*a9fa9459Szrj    going to gamble and define the external structures here, in the
161*a9fa9459Szrj    target independent ECOFF header file.  The internal forms are
162*a9fa9459Szrj    defined in coff/sym.h, which was originally donated by MIPS
163*a9fa9459Szrj    Computer Systems.  */
164*a9fa9459Szrj 
165*a9fa9459Szrj /* Type information external record */
166*a9fa9459Szrj 
167*a9fa9459Szrj struct tir_ext {
168*a9fa9459Szrj 	unsigned char	t_bits1[1];
169*a9fa9459Szrj 	unsigned char	t_tq45[1];
170*a9fa9459Szrj 	unsigned char	t_tq01[1];
171*a9fa9459Szrj 	unsigned char	t_tq23[1];
172*a9fa9459Szrj };
173*a9fa9459Szrj 
174*a9fa9459Szrj #define	TIR_BITS1_FBITFIELD_BIG		((unsigned int) 0x80)
175*a9fa9459Szrj #define	TIR_BITS1_FBITFIELD_LITTLE	((unsigned int) 0x01)
176*a9fa9459Szrj 
177*a9fa9459Szrj #define	TIR_BITS1_CONTINUED_BIG		((unsigned int) 0x40)
178*a9fa9459Szrj #define	TIR_BITS1_CONTINUED_LITTLE	((unsigned int) 0x02)
179*a9fa9459Szrj 
180*a9fa9459Szrj #define	TIR_BITS1_BT_BIG		((unsigned int) 0x3F)
181*a9fa9459Szrj #define	TIR_BITS1_BT_SH_BIG		0
182*a9fa9459Szrj #define	TIR_BITS1_BT_LITTLE		((unsigned int) 0xFC)
183*a9fa9459Szrj #define	TIR_BITS1_BT_SH_LITTLE		2
184*a9fa9459Szrj 
185*a9fa9459Szrj #define	TIR_BITS_TQ4_BIG		((unsigned int) 0xF0)
186*a9fa9459Szrj #define	TIR_BITS_TQ4_SH_BIG		4
187*a9fa9459Szrj #define	TIR_BITS_TQ5_BIG		((unsigned int) 0x0F)
188*a9fa9459Szrj #define	TIR_BITS_TQ5_SH_BIG		0
189*a9fa9459Szrj #define	TIR_BITS_TQ4_LITTLE		((unsigned int) 0x0F)
190*a9fa9459Szrj #define	TIR_BITS_TQ4_SH_LITTLE		0
191*a9fa9459Szrj #define	TIR_BITS_TQ5_LITTLE		((unsigned int) 0xF0)
192*a9fa9459Szrj #define	TIR_BITS_TQ5_SH_LITTLE		4
193*a9fa9459Szrj 
194*a9fa9459Szrj #define	TIR_BITS_TQ0_BIG		((unsigned int) 0xF0)
195*a9fa9459Szrj #define	TIR_BITS_TQ0_SH_BIG		4
196*a9fa9459Szrj #define	TIR_BITS_TQ1_BIG		((unsigned int) 0x0F)
197*a9fa9459Szrj #define	TIR_BITS_TQ1_SH_BIG		0
198*a9fa9459Szrj #define	TIR_BITS_TQ0_LITTLE		((unsigned int) 0x0F)
199*a9fa9459Szrj #define	TIR_BITS_TQ0_SH_LITTLE		0
200*a9fa9459Szrj #define	TIR_BITS_TQ1_LITTLE		((unsigned int) 0xF0)
201*a9fa9459Szrj #define	TIR_BITS_TQ1_SH_LITTLE		4
202*a9fa9459Szrj 
203*a9fa9459Szrj #define	TIR_BITS_TQ2_BIG		((unsigned int) 0xF0)
204*a9fa9459Szrj #define	TIR_BITS_TQ2_SH_BIG		4
205*a9fa9459Szrj #define	TIR_BITS_TQ3_BIG		((unsigned int) 0x0F)
206*a9fa9459Szrj #define	TIR_BITS_TQ3_SH_BIG		0
207*a9fa9459Szrj #define	TIR_BITS_TQ2_LITTLE		((unsigned int) 0x0F)
208*a9fa9459Szrj #define	TIR_BITS_TQ2_SH_LITTLE		0
209*a9fa9459Szrj #define	TIR_BITS_TQ3_LITTLE		((unsigned int) 0xF0)
210*a9fa9459Szrj #define	TIR_BITS_TQ3_SH_LITTLE		4
211*a9fa9459Szrj 
212*a9fa9459Szrj /* Relative symbol external record */
213*a9fa9459Szrj 
214*a9fa9459Szrj struct rndx_ext {
215*a9fa9459Szrj 	unsigned char	r_bits[4];
216*a9fa9459Szrj };
217*a9fa9459Szrj 
218*a9fa9459Szrj #define	RNDX_BITS0_RFD_SH_LEFT_BIG	4
219*a9fa9459Szrj #define	RNDX_BITS1_RFD_BIG		((unsigned int) 0xF0)
220*a9fa9459Szrj #define	RNDX_BITS1_RFD_SH_BIG		4
221*a9fa9459Szrj 
222*a9fa9459Szrj #define	RNDX_BITS0_RFD_SH_LEFT_LITTLE	0
223*a9fa9459Szrj #define	RNDX_BITS1_RFD_LITTLE		((unsigned int) 0x0F)
224*a9fa9459Szrj #define	RNDX_BITS1_RFD_SH_LEFT_LITTLE	8
225*a9fa9459Szrj 
226*a9fa9459Szrj #define	RNDX_BITS1_INDEX_BIG		((unsigned int) 0x0F)
227*a9fa9459Szrj #define	RNDX_BITS1_INDEX_SH_LEFT_BIG	16
228*a9fa9459Szrj #define	RNDX_BITS2_INDEX_SH_LEFT_BIG	8
229*a9fa9459Szrj #define	RNDX_BITS3_INDEX_SH_LEFT_BIG	0
230*a9fa9459Szrj 
231*a9fa9459Szrj #define	RNDX_BITS1_INDEX_LITTLE		((unsigned int) 0xF0)
232*a9fa9459Szrj #define	RNDX_BITS1_INDEX_SH_LITTLE	4
233*a9fa9459Szrj #define	RNDX_BITS2_INDEX_SH_LEFT_LITTLE	4
234*a9fa9459Szrj #define	RNDX_BITS3_INDEX_SH_LEFT_LITTLE	12
235*a9fa9459Szrj 
236*a9fa9459Szrj /* Auxiliary symbol information external record */
237*a9fa9459Szrj 
238*a9fa9459Szrj union aux_ext {
239*a9fa9459Szrj 	struct tir_ext	a_ti;
240*a9fa9459Szrj 	struct rndx_ext	a_rndx;
241*a9fa9459Szrj 	unsigned char	a_dnLow[4];
242*a9fa9459Szrj 	unsigned char	a_dnHigh[4];
243*a9fa9459Szrj 	unsigned char	a_isym[4];
244*a9fa9459Szrj 	unsigned char	a_iss[4];
245*a9fa9459Szrj 	unsigned char	a_width[4];
246*a9fa9459Szrj 	unsigned char	a_count[4];
247*a9fa9459Szrj };
248*a9fa9459Szrj 
249*a9fa9459Szrj #define AUX_GET_ANY(bigend, ax, field) \
250*a9fa9459Szrj   ((bigend) ? bfd_getb32 ((ax)->field) : bfd_getl32 ((ax)->field))
251*a9fa9459Szrj 
252*a9fa9459Szrj #define	AUX_GET_DNLOW(bigend, ax)	AUX_GET_ANY ((bigend), (ax), a_dnLow)
253*a9fa9459Szrj #define	AUX_GET_DNHIGH(bigend, ax)	AUX_GET_ANY ((bigend), (ax), a_dnHigh)
254*a9fa9459Szrj #define	AUX_GET_ISYM(bigend, ax)	AUX_GET_ANY ((bigend), (ax), a_isym)
255*a9fa9459Szrj #define AUX_GET_ISS(bigend, ax)		AUX_GET_ANY ((bigend), (ax), a_iss)
256*a9fa9459Szrj #define AUX_GET_WIDTH(bigend, ax)	AUX_GET_ANY ((bigend), (ax), a_width)
257*a9fa9459Szrj #define AUX_GET_COUNT(bigend, ax)	AUX_GET_ANY ((bigend), (ax), a_count)
258*a9fa9459Szrj 
259*a9fa9459Szrj #define AUX_PUT_ANY(bigend, val, ax, field) \
260*a9fa9459Szrj   ((bigend) \
261*a9fa9459Szrj    ? (bfd_putb32 ((bfd_vma) (val), (ax)->field), 0) \
262*a9fa9459Szrj    : (bfd_putl32 ((bfd_vma) (val), (ax)->field), 0))
263*a9fa9459Szrj 
264*a9fa9459Szrj #define AUX_PUT_DNLOW(bigend, val, ax) \
265*a9fa9459Szrj   AUX_PUT_ANY ((bigend), (val), (ax), a_dnLow)
266*a9fa9459Szrj #define AUX_PUT_DNHIGH(bigend, val, ax) \
267*a9fa9459Szrj   AUX_PUT_ANY ((bigend), (val), (ax), a_dnHigh)
268*a9fa9459Szrj #define AUX_PUT_ISYM(bigend, val, ax) \
269*a9fa9459Szrj   AUX_PUT_ANY ((bigend), (val), (ax), a_isym)
270*a9fa9459Szrj #define AUX_PUT_ISS(bigend, val, ax) \
271*a9fa9459Szrj   AUX_PUT_ANY ((bigend), (val), (ax), a_iss)
272*a9fa9459Szrj #define AUX_PUT_WIDTH(bigend, val, ax) \
273*a9fa9459Szrj   AUX_PUT_ANY ((bigend), (val), (ax), a_width)
274*a9fa9459Szrj #define AUX_PUT_COUNT(bigend, val, ax) \
275*a9fa9459Szrj   AUX_PUT_ANY ((bigend), (val), (ax), a_count)
276*a9fa9459Szrj 
277*a9fa9459Szrj /********************** SYMBOLS **********************/
278*a9fa9459Szrj 
279*a9fa9459Szrj /* For efficiency, gdb deals directly with the unswapped symbolic
280*a9fa9459Szrj    information (that way it only takes the time to swap information
281*a9fa9459Szrj    that it really needs to read).  gdb originally retrieved the
282*a9fa9459Szrj    information directly from the BFD backend information, but that
283*a9fa9459Szrj    strategy, besides being sort of ugly, does not work for MIPS ELF,
284*a9fa9459Szrj    which also uses ECOFF debugging information.  This structure holds
285*a9fa9459Szrj    pointers to the (mostly) unswapped symbolic information.  */
286*a9fa9459Szrj 
287*a9fa9459Szrj struct ecoff_debug_info
288*a9fa9459Szrj {
289*a9fa9459Szrj   /* The swapped ECOFF symbolic header.  */
290*a9fa9459Szrj   HDRR symbolic_header;
291*a9fa9459Szrj 
292*a9fa9459Szrj   /* Pointers to the unswapped symbolic information.  Note that the
293*a9fa9459Szrj      pointers to external structures point to different sorts of
294*a9fa9459Szrj      information on different ECOFF targets.  The ecoff_debug_swap
295*a9fa9459Szrj      structure provides the sizes of the structures and the functions
296*a9fa9459Szrj      needed to swap the information in and out.  These pointers are
297*a9fa9459Szrj      all pointers to arrays, not single structures.  They will be NULL
298*a9fa9459Szrj      if there are no instances of the relevant structure.  These
299*a9fa9459Szrj      fields are also used by the assembler to output ECOFF debugging
300*a9fa9459Szrj      information.  */
301*a9fa9459Szrj   unsigned char *line;
302*a9fa9459Szrj   void *external_dnr;	/* struct dnr_ext */
303*a9fa9459Szrj   void *external_pdr;	/* struct pdr_ext */
304*a9fa9459Szrj   void *external_sym;	/* struct sym_ext */
305*a9fa9459Szrj   void *external_opt;	/* struct opt_ext */
306*a9fa9459Szrj   union aux_ext *external_aux;
307*a9fa9459Szrj   char *ss;
308*a9fa9459Szrj   char *ssext;
309*a9fa9459Szrj   void *external_fdr;	/* struct fdr_ext */
310*a9fa9459Szrj   void *external_rfd;	/* struct rfd_ext */
311*a9fa9459Szrj   void *external_ext;	/* struct ext_ext */
312*a9fa9459Szrj 
313*a9fa9459Szrj   /* These fields are used when linking.  They may disappear at some
314*a9fa9459Szrj      point.  */
315*a9fa9459Szrj   char *ssext_end;
316*a9fa9459Szrj   void *external_ext_end;
317*a9fa9459Szrj 
318*a9fa9459Szrj   /* When linking, this field holds a mapping from the input FDR
319*a9fa9459Szrj      numbers to the output numbers, and is used when writing out the
320*a9fa9459Szrj      external symbols.  It is NULL if no mapping is required.  */
321*a9fa9459Szrj   RFDT *ifdmap;
322*a9fa9459Szrj 
323*a9fa9459Szrj   /* The swapped FDR information.  Currently this is never NULL, but
324*a9fa9459Szrj      code using this structure should probably double-check in case
325*a9fa9459Szrj      this changes in the future.  This is a pointer to an array, not a
326*a9fa9459Szrj      single structure.  */
327*a9fa9459Szrj   FDR *fdr;
328*a9fa9459Szrj };
329*a9fa9459Szrj 
330*a9fa9459Szrj /* These structures are used by the ECOFF find_nearest_line function.  */
331*a9fa9459Szrj 
332*a9fa9459Szrj struct ecoff_fdrtab_entry
333*a9fa9459Szrj {
334*a9fa9459Szrj   /* Base address in .text of this FDR.  */
335*a9fa9459Szrj   bfd_vma base_addr;
336*a9fa9459Szrj   FDR *fdr;
337*a9fa9459Szrj };
338*a9fa9459Szrj 
339*a9fa9459Szrj struct ecoff_find_line
340*a9fa9459Szrj {
341*a9fa9459Szrj   /* Allocated memory to hold function and file names.  */
342*a9fa9459Szrj   char *find_buffer;
343*a9fa9459Szrj 
344*a9fa9459Szrj   /* FDR table, sorted by address: */
345*a9fa9459Szrj   long fdrtab_len;
346*a9fa9459Szrj   struct ecoff_fdrtab_entry *fdrtab;
347*a9fa9459Szrj 
348*a9fa9459Szrj   /* Cache entry for most recently found line information.  The sect
349*a9fa9459Szrj      field is NULL if this cache does not contain valid information.  */
350*a9fa9459Szrj   struct
351*a9fa9459Szrj     {
352*a9fa9459Szrj       asection *sect;
353*a9fa9459Szrj       bfd_vma start;
354*a9fa9459Szrj       bfd_vma stop;
355*a9fa9459Szrj       const char *filename;
356*a9fa9459Szrj       const char *functionname;
357*a9fa9459Szrj       unsigned int line_num;
358*a9fa9459Szrj     } cache;
359*a9fa9459Szrj };
360*a9fa9459Szrj 
361*a9fa9459Szrj /********************** SWAPPING **********************/
362*a9fa9459Szrj 
363*a9fa9459Szrj /* The generic ECOFF code needs to be able to swap debugging
364*a9fa9459Szrj    information in and out in the specific format used by a particular
365*a9fa9459Szrj    ECOFF implementation.  This structure provides the information
366*a9fa9459Szrj    needed to do this.  */
367*a9fa9459Szrj 
368*a9fa9459Szrj struct ecoff_debug_swap
369*a9fa9459Szrj {
370*a9fa9459Szrj   /* Symbol table magic number.  */
371*a9fa9459Szrj   int sym_magic;
372*a9fa9459Szrj   /* Alignment of debugging information.  E.g., 4.  */
373*a9fa9459Szrj   bfd_size_type debug_align;
374*a9fa9459Szrj   /* Sizes of external symbolic information.  */
375*a9fa9459Szrj   bfd_size_type external_hdr_size;
376*a9fa9459Szrj   bfd_size_type external_dnr_size;
377*a9fa9459Szrj   bfd_size_type external_pdr_size;
378*a9fa9459Szrj   bfd_size_type external_sym_size;
379*a9fa9459Szrj   bfd_size_type external_opt_size;
380*a9fa9459Szrj   bfd_size_type external_fdr_size;
381*a9fa9459Szrj   bfd_size_type external_rfd_size;
382*a9fa9459Szrj   bfd_size_type external_ext_size;
383*a9fa9459Szrj   /* Functions to swap in external symbolic data.  */
384*a9fa9459Szrj   void (*swap_hdr_in) (bfd *, void *, HDRR *);
385*a9fa9459Szrj   void (*swap_dnr_in) (bfd *, void *, DNR *);
386*a9fa9459Szrj   void (*swap_pdr_in) (bfd *, void *, PDR *);
387*a9fa9459Szrj   void (*swap_sym_in) (bfd *, void *, SYMR *);
388*a9fa9459Szrj   void (*swap_opt_in) (bfd *, void *, OPTR *);
389*a9fa9459Szrj   void (*swap_fdr_in) (bfd *, void *, FDR *);
390*a9fa9459Szrj   void (*swap_rfd_in) (bfd *, void *, RFDT *);
391*a9fa9459Szrj   void (*swap_ext_in) (bfd *, void *, EXTR *);
392*a9fa9459Szrj   void (*swap_tir_in) (int, const struct tir_ext *, TIR *);
393*a9fa9459Szrj   void (*swap_rndx_in) (int, const struct rndx_ext *, RNDXR *);
394*a9fa9459Szrj   /* Functions to swap out external symbolic data.  */
395*a9fa9459Szrj   void (*swap_hdr_out) (bfd *, const HDRR *, void *);
396*a9fa9459Szrj   void (*swap_dnr_out) (bfd *, const DNR *, void *);
397*a9fa9459Szrj   void (*swap_pdr_out) (bfd *, const PDR *, void *);
398*a9fa9459Szrj   void (*swap_sym_out) (bfd *, const SYMR *, void *);
399*a9fa9459Szrj   void (*swap_opt_out) (bfd *, const OPTR *, void *);
400*a9fa9459Szrj   void (*swap_fdr_out) (bfd *, const FDR *, void *);
401*a9fa9459Szrj   void (*swap_rfd_out) (bfd *, const RFDT *, void *);
402*a9fa9459Szrj   void (*swap_ext_out) (bfd *, const EXTR *, void *);
403*a9fa9459Szrj   void (*swap_tir_out) (int, const TIR *, struct tir_ext *);
404*a9fa9459Szrj   void (*swap_rndx_out) (int, const RNDXR *, struct rndx_ext *);
405*a9fa9459Szrj   /* Function to read symbol data and set up pointers in
406*a9fa9459Szrj      ecoff_debug_info structure.  The section argument is used for
407*a9fa9459Szrj      ELF, not straight ECOFF.  */
408*a9fa9459Szrj   bfd_boolean (*read_debug_info) (bfd *, asection *, struct ecoff_debug_info *);
409*a9fa9459Szrj };
410*a9fa9459Szrj 
411*a9fa9459Szrj #endif /* ! defined (ECOFF_H) */
412