xref: /openbsd-src/gnu/usr.bin/binutils-2.17/bfd/libpei.h (revision 3d8817e467ea46cf4772788d6804dd293abfb01a)
1*3d8817e4Smiod /* Support for the generic parts of PE/PEI; common header information.
2*3d8817e4Smiod    Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005
3*3d8817e4Smiod    Free Software Foundation, Inc.
4*3d8817e4Smiod    Written by Cygnus Solutions.
5*3d8817e4Smiod 
6*3d8817e4Smiod    This file is part of BFD, the Binary File Descriptor library.
7*3d8817e4Smiod 
8*3d8817e4Smiod    This program is free software; you can redistribute it and/or modify
9*3d8817e4Smiod    it under the terms of the GNU General Public License as published by
10*3d8817e4Smiod    the Free Software Foundation; either version 2 of the License, or
11*3d8817e4Smiod    (at your option) any later version.
12*3d8817e4Smiod 
13*3d8817e4Smiod    This program is distributed in the hope that it will be useful,
14*3d8817e4Smiod    but WITHOUT ANY WARRANTY; without even the implied warranty of
15*3d8817e4Smiod    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16*3d8817e4Smiod    GNU General Public License for more details.
17*3d8817e4Smiod 
18*3d8817e4Smiod    You should have received a copy of the GNU General Public License
19*3d8817e4Smiod    along with this program; if not, write to the Free Software
20*3d8817e4Smiod    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
21*3d8817e4Smiod 
22*3d8817e4Smiod /* Most of this hacked by  Steve Chamberlain,
23*3d8817e4Smiod 			sac@cygnus.com
24*3d8817e4Smiod 
25*3d8817e4Smiod    PE/PEI rearrangement (and code added): Donn Terry
26*3d8817e4Smiod 				       Softway Systems, Inc.  */
27*3d8817e4Smiod 
28*3d8817e4Smiod /* Hey look, some documentation [and in a place you expect to find it]!
29*3d8817e4Smiod 
30*3d8817e4Smiod    The main reference for the pei format is "Microsoft Portable Executable
31*3d8817e4Smiod    and Common Object File Format Specification 4.1".  Get it if you need to
32*3d8817e4Smiod    do some serious hacking on this code.
33*3d8817e4Smiod 
34*3d8817e4Smiod    Another reference:
35*3d8817e4Smiod    "Peering Inside the PE: A Tour of the Win32 Portable Executable
36*3d8817e4Smiod    File Format", MSJ 1994, Volume 9.
37*3d8817e4Smiod 
38*3d8817e4Smiod    The *sole* difference between the pe format and the pei format is that the
39*3d8817e4Smiod    latter has an MSDOS 2.0 .exe header on the front that prints the message
40*3d8817e4Smiod    "This app must be run under Windows." (or some such).
41*3d8817e4Smiod    (FIXME: Whether that statement is *really* true or not is unknown.
42*3d8817e4Smiod    Are there more subtle differences between pe and pei formats?
43*3d8817e4Smiod    For now assume there aren't.  If you find one, then for God sakes
44*3d8817e4Smiod    document it here!)
45*3d8817e4Smiod 
46*3d8817e4Smiod    The Microsoft docs use the word "image" instead of "executable" because
47*3d8817e4Smiod    the former can also refer to a DLL (shared library).  Confusion can arise
48*3d8817e4Smiod    because the `i' in `pei' also refers to "image".  The `pe' format can
49*3d8817e4Smiod    also create images (i.e. executables), it's just that to run on a win32
50*3d8817e4Smiod    system you need to use the pei format.
51*3d8817e4Smiod 
52*3d8817e4Smiod    FIXME: Please add more docs here so the next poor fool that has to hack
53*3d8817e4Smiod    on this code has a chance of getting something accomplished without
54*3d8817e4Smiod    wasting too much time.  */
55*3d8817e4Smiod 
56*3d8817e4Smiod #ifndef GET_FCN_LNNOPTR
57*3d8817e4Smiod #define GET_FCN_LNNOPTR(abfd, ext) \
58*3d8817e4Smiod   H_GET_32 (abfd, ext->x_sym.x_fcnary.x_fcn.x_lnnoptr)
59*3d8817e4Smiod #endif
60*3d8817e4Smiod 
61*3d8817e4Smiod #ifndef GET_FCN_ENDNDX
62*3d8817e4Smiod #define GET_FCN_ENDNDX(abfd, ext) \
63*3d8817e4Smiod   H_GET_32 (abfd, ext->x_sym.x_fcnary.x_fcn.x_endndx)
64*3d8817e4Smiod #endif
65*3d8817e4Smiod 
66*3d8817e4Smiod #ifndef PUT_FCN_LNNOPTR
67*3d8817e4Smiod #define PUT_FCN_LNNOPTR(abfd, in, ext) \
68*3d8817e4Smiod   H_PUT_32(abfd, in, ext->x_sym.x_fcnary.x_fcn.x_lnnoptr)
69*3d8817e4Smiod #endif
70*3d8817e4Smiod #ifndef PUT_FCN_ENDNDX
71*3d8817e4Smiod #define PUT_FCN_ENDNDX(abfd, in, ext) \
72*3d8817e4Smiod   H_PUT_32(abfd, in, ext->x_sym.x_fcnary.x_fcn.x_endndx)
73*3d8817e4Smiod #endif
74*3d8817e4Smiod #ifndef GET_LNSZ_LNNO
75*3d8817e4Smiod #define GET_LNSZ_LNNO(abfd, ext) \
76*3d8817e4Smiod   H_GET_16 (abfd, ext->x_sym.x_misc.x_lnsz.x_lnno)
77*3d8817e4Smiod #endif
78*3d8817e4Smiod #ifndef GET_LNSZ_SIZE
79*3d8817e4Smiod #define GET_LNSZ_SIZE(abfd, ext) \
80*3d8817e4Smiod   H_GET_16 (abfd, ext->x_sym.x_misc.x_lnsz.x_size)
81*3d8817e4Smiod #endif
82*3d8817e4Smiod #ifndef PUT_LNSZ_LNNO
83*3d8817e4Smiod #define PUT_LNSZ_LNNO(abfd, in, ext) \
84*3d8817e4Smiod   H_PUT_16(abfd, in, ext->x_sym.x_misc.x_lnsz.x_lnno)
85*3d8817e4Smiod #endif
86*3d8817e4Smiod #ifndef PUT_LNSZ_SIZE
87*3d8817e4Smiod #define PUT_LNSZ_SIZE(abfd, in, ext) \
88*3d8817e4Smiod   H_PUT_16(abfd, in, ext->x_sym.x_misc.x_lnsz.x_size)
89*3d8817e4Smiod #endif
90*3d8817e4Smiod #ifndef GET_SCN_SCNLEN
91*3d8817e4Smiod #define GET_SCN_SCNLEN(abfd, ext) \
92*3d8817e4Smiod   H_GET_32 (abfd, ext->x_scn.x_scnlen)
93*3d8817e4Smiod #endif
94*3d8817e4Smiod #ifndef GET_SCN_NRELOC
95*3d8817e4Smiod #define GET_SCN_NRELOC(abfd, ext) \
96*3d8817e4Smiod   H_GET_16 (abfd, ext->x_scn.x_nreloc)
97*3d8817e4Smiod #endif
98*3d8817e4Smiod #ifndef GET_SCN_NLINNO
99*3d8817e4Smiod #define GET_SCN_NLINNO(abfd, ext) \
100*3d8817e4Smiod   H_GET_16 (abfd, ext->x_scn.x_nlinno)
101*3d8817e4Smiod #endif
102*3d8817e4Smiod #ifndef PUT_SCN_SCNLEN
103*3d8817e4Smiod #define PUT_SCN_SCNLEN(abfd, in, ext) \
104*3d8817e4Smiod   H_PUT_32(abfd, in, ext->x_scn.x_scnlen)
105*3d8817e4Smiod #endif
106*3d8817e4Smiod #ifndef PUT_SCN_NRELOC
107*3d8817e4Smiod #define PUT_SCN_NRELOC(abfd, in, ext) \
108*3d8817e4Smiod   H_PUT_16(abfd, in, ext->x_scn.x_nreloc)
109*3d8817e4Smiod #endif
110*3d8817e4Smiod #ifndef PUT_SCN_NLINNO
111*3d8817e4Smiod #define PUT_SCN_NLINNO(abfd, in, ext) \
112*3d8817e4Smiod   H_PUT_16(abfd,in, ext->x_scn.x_nlinno)
113*3d8817e4Smiod #endif
114*3d8817e4Smiod #ifndef GET_LINENO_LNNO
115*3d8817e4Smiod #define GET_LINENO_LNNO(abfd, ext) \
116*3d8817e4Smiod   H_GET_16 (abfd, ext->l_lnno);
117*3d8817e4Smiod #endif
118*3d8817e4Smiod #ifndef PUT_LINENO_LNNO
119*3d8817e4Smiod #define PUT_LINENO_LNNO(abfd, val, ext) \
120*3d8817e4Smiod   H_PUT_16(abfd,val, ext->l_lnno);
121*3d8817e4Smiod #endif
122*3d8817e4Smiod 
123*3d8817e4Smiod /* The f_symptr field in the filehdr is sometimes 64 bits.  */
124*3d8817e4Smiod #ifndef GET_FILEHDR_SYMPTR
125*3d8817e4Smiod #define GET_FILEHDR_SYMPTR H_GET_32
126*3d8817e4Smiod #endif
127*3d8817e4Smiod #ifndef PUT_FILEHDR_SYMPTR
128*3d8817e4Smiod #define PUT_FILEHDR_SYMPTR H_PUT_32
129*3d8817e4Smiod #endif
130*3d8817e4Smiod 
131*3d8817e4Smiod /* Some fields in the aouthdr are sometimes 64 bits.  */
132*3d8817e4Smiod #ifndef GET_AOUTHDR_TSIZE
133*3d8817e4Smiod #define GET_AOUTHDR_TSIZE H_GET_32
134*3d8817e4Smiod #endif
135*3d8817e4Smiod #ifndef PUT_AOUTHDR_TSIZE
136*3d8817e4Smiod #define PUT_AOUTHDR_TSIZE H_PUT_32
137*3d8817e4Smiod #endif
138*3d8817e4Smiod #ifndef GET_AOUTHDR_DSIZE
139*3d8817e4Smiod #define GET_AOUTHDR_DSIZE H_GET_32
140*3d8817e4Smiod #endif
141*3d8817e4Smiod #ifndef PUT_AOUTHDR_DSIZE
142*3d8817e4Smiod #define PUT_AOUTHDR_DSIZE H_PUT_32
143*3d8817e4Smiod #endif
144*3d8817e4Smiod #ifndef GET_AOUTHDR_BSIZE
145*3d8817e4Smiod #define GET_AOUTHDR_BSIZE H_GET_32
146*3d8817e4Smiod #endif
147*3d8817e4Smiod #ifndef PUT_AOUTHDR_BSIZE
148*3d8817e4Smiod #define PUT_AOUTHDR_BSIZE H_PUT_32
149*3d8817e4Smiod #endif
150*3d8817e4Smiod #ifndef GET_AOUTHDR_ENTRY
151*3d8817e4Smiod #define GET_AOUTHDR_ENTRY H_GET_32
152*3d8817e4Smiod #endif
153*3d8817e4Smiod #ifndef PUT_AOUTHDR_ENTRY
154*3d8817e4Smiod #define PUT_AOUTHDR_ENTRY H_PUT_32
155*3d8817e4Smiod #endif
156*3d8817e4Smiod #ifndef GET_AOUTHDR_TEXT_START
157*3d8817e4Smiod #define GET_AOUTHDR_TEXT_START H_GET_32
158*3d8817e4Smiod #endif
159*3d8817e4Smiod #ifndef PUT_AOUTHDR_TEXT_START
160*3d8817e4Smiod #define PUT_AOUTHDR_TEXT_START H_PUT_32
161*3d8817e4Smiod #endif
162*3d8817e4Smiod #ifndef GET_AOUTHDR_DATA_START
163*3d8817e4Smiod #define GET_AOUTHDR_DATA_START H_GET_32
164*3d8817e4Smiod #endif
165*3d8817e4Smiod #ifndef PUT_AOUTHDR_DATA_START
166*3d8817e4Smiod #define PUT_AOUTHDR_DATA_START H_PUT_32
167*3d8817e4Smiod #endif
168*3d8817e4Smiod 
169*3d8817e4Smiod /* Some fields in the scnhdr are sometimes 64 bits.  */
170*3d8817e4Smiod #ifndef GET_SCNHDR_PADDR
171*3d8817e4Smiod #define GET_SCNHDR_PADDR H_GET_32
172*3d8817e4Smiod #endif
173*3d8817e4Smiod #ifndef PUT_SCNHDR_PADDR
174*3d8817e4Smiod #define PUT_SCNHDR_PADDR H_PUT_32
175*3d8817e4Smiod #endif
176*3d8817e4Smiod #ifndef GET_SCNHDR_VADDR
177*3d8817e4Smiod #define GET_SCNHDR_VADDR H_GET_32
178*3d8817e4Smiod #endif
179*3d8817e4Smiod #ifndef PUT_SCNHDR_VADDR
180*3d8817e4Smiod #define PUT_SCNHDR_VADDR H_PUT_32
181*3d8817e4Smiod #endif
182*3d8817e4Smiod #ifndef GET_SCNHDR_SIZE
183*3d8817e4Smiod #define GET_SCNHDR_SIZE H_GET_32
184*3d8817e4Smiod #endif
185*3d8817e4Smiod #ifndef PUT_SCNHDR_SIZE
186*3d8817e4Smiod #define PUT_SCNHDR_SIZE H_PUT_32
187*3d8817e4Smiod #endif
188*3d8817e4Smiod #ifndef GET_SCNHDR_SCNPTR
189*3d8817e4Smiod #define GET_SCNHDR_SCNPTR H_GET_32
190*3d8817e4Smiod #endif
191*3d8817e4Smiod #ifndef PUT_SCNHDR_SCNPTR
192*3d8817e4Smiod #define PUT_SCNHDR_SCNPTR H_PUT_32
193*3d8817e4Smiod #endif
194*3d8817e4Smiod #ifndef GET_SCNHDR_RELPTR
195*3d8817e4Smiod #define GET_SCNHDR_RELPTR H_GET_32
196*3d8817e4Smiod #endif
197*3d8817e4Smiod #ifndef PUT_SCNHDR_RELPTR
198*3d8817e4Smiod #define PUT_SCNHDR_RELPTR H_PUT_32
199*3d8817e4Smiod #endif
200*3d8817e4Smiod #ifndef GET_SCNHDR_LNNOPTR
201*3d8817e4Smiod #define GET_SCNHDR_LNNOPTR H_GET_32
202*3d8817e4Smiod #endif
203*3d8817e4Smiod #ifndef PUT_SCNHDR_LNNOPTR
204*3d8817e4Smiod #define PUT_SCNHDR_LNNOPTR H_PUT_32
205*3d8817e4Smiod #endif
206*3d8817e4Smiod 
207*3d8817e4Smiod #ifdef COFF_WITH_pep
208*3d8817e4Smiod 
209*3d8817e4Smiod #define GET_OPTHDR_IMAGE_BASE H_GET_64
210*3d8817e4Smiod #define PUT_OPTHDR_IMAGE_BASE H_PUT_64
211*3d8817e4Smiod #define GET_OPTHDR_SIZE_OF_STACK_RESERVE H_GET_64
212*3d8817e4Smiod #define PUT_OPTHDR_SIZE_OF_STACK_RESERVE H_PUT_64
213*3d8817e4Smiod #define GET_OPTHDR_SIZE_OF_STACK_COMMIT H_GET_64
214*3d8817e4Smiod #define PUT_OPTHDR_SIZE_OF_STACK_COMMIT H_PUT_64
215*3d8817e4Smiod #define GET_OPTHDR_SIZE_OF_HEAP_RESERVE H_GET_64
216*3d8817e4Smiod #define PUT_OPTHDR_SIZE_OF_HEAP_RESERVE H_PUT_64
217*3d8817e4Smiod #define GET_OPTHDR_SIZE_OF_HEAP_COMMIT H_GET_64
218*3d8817e4Smiod #define PUT_OPTHDR_SIZE_OF_HEAP_COMMIT H_PUT_64
219*3d8817e4Smiod #define GET_PDATA_ENTRY bfd_get_64
220*3d8817e4Smiod 
221*3d8817e4Smiod #define _bfd_XX_bfd_copy_private_bfd_data_common	_bfd_pep_bfd_copy_private_bfd_data_common
222*3d8817e4Smiod #define _bfd_XX_bfd_copy_private_section_data		_bfd_pep_bfd_copy_private_section_data
223*3d8817e4Smiod #define _bfd_XX_get_symbol_info				_bfd_pep_get_symbol_info
224*3d8817e4Smiod #define _bfd_XX_only_swap_filehdr_out			_bfd_pep_only_swap_filehdr_out
225*3d8817e4Smiod #define _bfd_XX_print_private_bfd_data_common		_bfd_pep_print_private_bfd_data_common
226*3d8817e4Smiod #define _bfd_XXi_final_link_postscript			_bfd_pepi_final_link_postscript
227*3d8817e4Smiod #define _bfd_XXi_final_link_postscript			_bfd_pepi_final_link_postscript
228*3d8817e4Smiod #define _bfd_XXi_only_swap_filehdr_out			_bfd_pepi_only_swap_filehdr_out
229*3d8817e4Smiod #define _bfd_XXi_swap_aouthdr_in			_bfd_pepi_swap_aouthdr_in
230*3d8817e4Smiod #define _bfd_XXi_swap_aouthdr_out			_bfd_pepi_swap_aouthdr_out
231*3d8817e4Smiod #define _bfd_XXi_swap_aux_in				_bfd_pepi_swap_aux_in
232*3d8817e4Smiod #define _bfd_XXi_swap_aux_out				_bfd_pepi_swap_aux_out
233*3d8817e4Smiod #define _bfd_XXi_swap_lineno_in				_bfd_pepi_swap_lineno_in
234*3d8817e4Smiod #define _bfd_XXi_swap_lineno_out			_bfd_pepi_swap_lineno_out
235*3d8817e4Smiod #define _bfd_XXi_swap_scnhdr_out			_bfd_pepi_swap_scnhdr_out
236*3d8817e4Smiod #define _bfd_XXi_swap_sym_in				_bfd_pepi_swap_sym_in
237*3d8817e4Smiod #define _bfd_XXi_swap_sym_out				_bfd_pepi_swap_sym_out
238*3d8817e4Smiod 
239*3d8817e4Smiod #else /* !COFF_WITH_pep */
240*3d8817e4Smiod 
241*3d8817e4Smiod #define GET_OPTHDR_IMAGE_BASE H_GET_32
242*3d8817e4Smiod #define PUT_OPTHDR_IMAGE_BASE H_PUT_32
243*3d8817e4Smiod #define GET_OPTHDR_SIZE_OF_STACK_RESERVE H_GET_32
244*3d8817e4Smiod #define PUT_OPTHDR_SIZE_OF_STACK_RESERVE H_PUT_32
245*3d8817e4Smiod #define GET_OPTHDR_SIZE_OF_STACK_COMMIT H_GET_32
246*3d8817e4Smiod #define PUT_OPTHDR_SIZE_OF_STACK_COMMIT H_PUT_32
247*3d8817e4Smiod #define GET_OPTHDR_SIZE_OF_HEAP_RESERVE H_GET_32
248*3d8817e4Smiod #define PUT_OPTHDR_SIZE_OF_HEAP_RESERVE H_PUT_32
249*3d8817e4Smiod #define GET_OPTHDR_SIZE_OF_HEAP_COMMIT H_GET_32
250*3d8817e4Smiod #define PUT_OPTHDR_SIZE_OF_HEAP_COMMIT H_PUT_32
251*3d8817e4Smiod #define GET_PDATA_ENTRY bfd_get_32
252*3d8817e4Smiod 
253*3d8817e4Smiod #define _bfd_XX_bfd_copy_private_bfd_data_common	_bfd_pe_bfd_copy_private_bfd_data_common
254*3d8817e4Smiod #define _bfd_XX_bfd_copy_private_section_data		_bfd_pe_bfd_copy_private_section_data
255*3d8817e4Smiod #define _bfd_XX_get_symbol_info				_bfd_pe_get_symbol_info
256*3d8817e4Smiod #define _bfd_XX_only_swap_filehdr_out			_bfd_pe_only_swap_filehdr_out
257*3d8817e4Smiod #define _bfd_XX_print_private_bfd_data_common		_bfd_pe_print_private_bfd_data_common
258*3d8817e4Smiod #define _bfd_XXi_final_link_postscript			_bfd_pei_final_link_postscript
259*3d8817e4Smiod #define _bfd_XXi_final_link_postscript			_bfd_pei_final_link_postscript
260*3d8817e4Smiod #define _bfd_XXi_only_swap_filehdr_out			_bfd_pei_only_swap_filehdr_out
261*3d8817e4Smiod #define _bfd_XXi_swap_aouthdr_in			_bfd_pei_swap_aouthdr_in
262*3d8817e4Smiod #define _bfd_XXi_swap_aouthdr_out			_bfd_pei_swap_aouthdr_out
263*3d8817e4Smiod #define _bfd_XXi_swap_aux_in				_bfd_pei_swap_aux_in
264*3d8817e4Smiod #define _bfd_XXi_swap_aux_out				_bfd_pei_swap_aux_out
265*3d8817e4Smiod #define _bfd_XXi_swap_lineno_in				_bfd_pei_swap_lineno_in
266*3d8817e4Smiod #define _bfd_XXi_swap_lineno_out			_bfd_pei_swap_lineno_out
267*3d8817e4Smiod #define _bfd_XXi_swap_scnhdr_out			_bfd_pei_swap_scnhdr_out
268*3d8817e4Smiod #define _bfd_XXi_swap_sym_in				_bfd_pei_swap_sym_in
269*3d8817e4Smiod #define _bfd_XXi_swap_sym_out				_bfd_pei_swap_sym_out
270*3d8817e4Smiod 
271*3d8817e4Smiod #endif /* !COFF_WITH_pep */
272*3d8817e4Smiod 
273*3d8817e4Smiod /* Macro: Returns true if the bfd is a PE executable as opposed to a PE object file.  */
274*3d8817e4Smiod #define bfd_pe_executable_p(abfd) \
275*3d8817e4Smiod   (strncmp ((abfd)->xvec->name, "pei-", 4) == 0		\
276*3d8817e4Smiod    || strncmp ((abfd)->xvec->name, "efi-app-", 8) == 0)
277*3d8817e4Smiod 
278*3d8817e4Smiod /* These functions are architecture dependent, and are in peicode.h:
279*3d8817e4Smiod    coff_swap_reloc_in
280*3d8817e4Smiod    int coff_swap_reloc_out
281*3d8817e4Smiod    coff_swap_filehdr_in
282*3d8817e4Smiod    coff_swap_scnhdr_in
283*3d8817e4Smiod    pe_mkobject
284*3d8817e4Smiod    pe_mkobject_hook  */
285*3d8817e4Smiod 
286*3d8817e4Smiod /* The functions described below are common across all PE/PEI
287*3d8817e4Smiod    implementations architecture types, and actually appear in
288*3d8817e4Smiod    peigen.c.  */
289*3d8817e4Smiod 
290*3d8817e4Smiod #define coff_swap_sym_in      _bfd_XXi_swap_sym_in
291*3d8817e4Smiod #define coff_swap_sym_out     _bfd_XXi_swap_sym_out
292*3d8817e4Smiod #define coff_swap_aux_in      _bfd_XXi_swap_aux_in
293*3d8817e4Smiod #define coff_swap_aux_out     _bfd_XXi_swap_aux_out
294*3d8817e4Smiod #define coff_swap_lineno_in   _bfd_XXi_swap_lineno_in
295*3d8817e4Smiod #define coff_swap_lineno_out  _bfd_XXi_swap_lineno_out
296*3d8817e4Smiod #define coff_swap_aouthdr_in  _bfd_XXi_swap_aouthdr_in
297*3d8817e4Smiod #define coff_swap_aouthdr_out _bfd_XXi_swap_aouthdr_out
298*3d8817e4Smiod #define coff_swap_scnhdr_out  _bfd_XXi_swap_scnhdr_out
299*3d8817e4Smiod 
300*3d8817e4Smiod #ifndef coff_final_link_postscript
301*3d8817e4Smiod #define coff_final_link_postscript _bfd_XXi_final_link_postscript
302*3d8817e4Smiod #endif
303*3d8817e4Smiod 
304*3d8817e4Smiod void        _bfd_XXi_swap_sym_in (bfd *, void *, void *);
305*3d8817e4Smiod unsigned    _bfd_XXi_swap_sym_out (bfd *, void *, void *);
306*3d8817e4Smiod void        _bfd_XXi_swap_aux_in (bfd *, void *, int, int, int, int, void *);
307*3d8817e4Smiod unsigned    _bfd_XXi_swap_aux_out (bfd *, void *, int, int, int, int, void *);
308*3d8817e4Smiod void        _bfd_XXi_swap_lineno_in (bfd *, void *, void *);
309*3d8817e4Smiod unsigned    _bfd_XXi_swap_lineno_out (bfd *, void *, void *);
310*3d8817e4Smiod void        _bfd_XXi_swap_aouthdr_in (bfd *, void *, void *);
311*3d8817e4Smiod unsigned    _bfd_XXi_swap_aouthdr_out (bfd *, void *, void *);
312*3d8817e4Smiod unsigned    _bfd_XXi_swap_scnhdr_out (bfd *, void *, void *);
313*3d8817e4Smiod bfd_boolean _bfd_XX_print_private_bfd_data_common (bfd *, void *);
314*3d8817e4Smiod bfd_boolean _bfd_XX_bfd_copy_private_bfd_data_common (bfd *, bfd *);
315*3d8817e4Smiod void        _bfd_XX_get_symbol_info (bfd *, asymbol *, symbol_info *);
316*3d8817e4Smiod bfd_boolean _bfd_XXi_final_link_postscript (bfd *, struct coff_final_link_info *);
317*3d8817e4Smiod 
318*3d8817e4Smiod /* The following are needed only for ONE of pe or pei, but don't
319*3d8817e4Smiod    otherwise vary; peicode.h fixes up ifdefs but we provide the
320*3d8817e4Smiod    prototype.  */
321*3d8817e4Smiod 
322*3d8817e4Smiod unsigned    _bfd_XX_only_swap_filehdr_out  (bfd *, void *, void *);
323*3d8817e4Smiod unsigned    _bfd_XXi_only_swap_filehdr_out (bfd *, void *, void *);
324*3d8817e4Smiod bfd_boolean _bfd_XX_bfd_copy_private_section_data (bfd *, asection *, bfd *, asection *);
325*3d8817e4Smiod 
326