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