184865Sobrien/* Support for the generic parts of PE/PEI; common header information.
2218822Sdim   Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006
384865Sobrien   Free Software Foundation, Inc.
484865Sobrien   Written by Cygnus Solutions.
584865Sobrien
6130561Sobrien   This file is part of BFD, the Binary File Descriptor library.
784865Sobrien
8130561Sobrien   This program is free software; you can redistribute it and/or modify
9130561Sobrien   it under the terms of the GNU General Public License as published by
10130561Sobrien   the Free Software Foundation; either version 2 of the License, or
11130561Sobrien   (at your option) any later version.
1284865Sobrien
13130561Sobrien   This program is distributed in the hope that it will be useful,
14130561Sobrien   but WITHOUT ANY WARRANTY; without even the implied warranty of
15130561Sobrien   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16130561Sobrien   GNU General Public License for more details.
17130561Sobrien
18130561Sobrien   You should have received a copy of the GNU General Public License
19130561Sobrien   along with this program; if not, write to the Free Software
20218822Sdim   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
2184865Sobrien
22130561Sobrien/* Most of this hacked by  Steve Chamberlain,
2384865Sobrien			sac@cygnus.com
2484865Sobrien
25130561Sobrien   PE/PEI rearrangement (and code added): Donn Terry
26130561Sobrien				       Softway Systems, Inc.  */
2784865Sobrien
2884865Sobrien/* Hey look, some documentation [and in a place you expect to find it]!
2984865Sobrien
3084865Sobrien   The main reference for the pei format is "Microsoft Portable Executable
3184865Sobrien   and Common Object File Format Specification 4.1".  Get it if you need to
3284865Sobrien   do some serious hacking on this code.
3384865Sobrien
3484865Sobrien   Another reference:
3584865Sobrien   "Peering Inside the PE: A Tour of the Win32 Portable Executable
3684865Sobrien   File Format", MSJ 1994, Volume 9.
3784865Sobrien
3884865Sobrien   The *sole* difference between the pe format and the pei format is that the
3984865Sobrien   latter has an MSDOS 2.0 .exe header on the front that prints the message
4084865Sobrien   "This app must be run under Windows." (or some such).
4184865Sobrien   (FIXME: Whether that statement is *really* true or not is unknown.
4284865Sobrien   Are there more subtle differences between pe and pei formats?
4384865Sobrien   For now assume there aren't.  If you find one, then for God sakes
4484865Sobrien   document it here!)
4584865Sobrien
4684865Sobrien   The Microsoft docs use the word "image" instead of "executable" because
4784865Sobrien   the former can also refer to a DLL (shared library).  Confusion can arise
4884865Sobrien   because the `i' in `pei' also refers to "image".  The `pe' format can
4984865Sobrien   also create images (i.e. executables), it's just that to run on a win32
5084865Sobrien   system you need to use the pei format.
5184865Sobrien
5284865Sobrien   FIXME: Please add more docs here so the next poor fool that has to hack
5384865Sobrien   on this code has a chance of getting something accomplished without
54130561Sobrien   wasting too much time.  */
5584865Sobrien
5684865Sobrien#ifndef GET_FCN_LNNOPTR
5784865Sobrien#define GET_FCN_LNNOPTR(abfd, ext) \
5894536Sobrien  H_GET_32 (abfd, ext->x_sym.x_fcnary.x_fcn.x_lnnoptr)
5984865Sobrien#endif
6084865Sobrien
6184865Sobrien#ifndef GET_FCN_ENDNDX
6294536Sobrien#define GET_FCN_ENDNDX(abfd, ext) \
6394536Sobrien  H_GET_32 (abfd, ext->x_sym.x_fcnary.x_fcn.x_endndx)
6484865Sobrien#endif
6584865Sobrien
6684865Sobrien#ifndef PUT_FCN_LNNOPTR
6794536Sobrien#define PUT_FCN_LNNOPTR(abfd, in, ext) \
6894536Sobrien  H_PUT_32(abfd, in, ext->x_sym.x_fcnary.x_fcn.x_lnnoptr)
6984865Sobrien#endif
7084865Sobrien#ifndef PUT_FCN_ENDNDX
7194536Sobrien#define PUT_FCN_ENDNDX(abfd, in, ext) \
7294536Sobrien  H_PUT_32(abfd, in, ext->x_sym.x_fcnary.x_fcn.x_endndx)
7384865Sobrien#endif
7484865Sobrien#ifndef GET_LNSZ_LNNO
7594536Sobrien#define GET_LNSZ_LNNO(abfd, ext) \
7694536Sobrien  H_GET_16 (abfd, ext->x_sym.x_misc.x_lnsz.x_lnno)
7784865Sobrien#endif
7884865Sobrien#ifndef GET_LNSZ_SIZE
7994536Sobrien#define GET_LNSZ_SIZE(abfd, ext) \
8094536Sobrien  H_GET_16 (abfd, ext->x_sym.x_misc.x_lnsz.x_size)
8184865Sobrien#endif
8284865Sobrien#ifndef PUT_LNSZ_LNNO
8394536Sobrien#define PUT_LNSZ_LNNO(abfd, in, ext) \
8494536Sobrien  H_PUT_16(abfd, in, ext->x_sym.x_misc.x_lnsz.x_lnno)
8584865Sobrien#endif
8684865Sobrien#ifndef PUT_LNSZ_SIZE
8794536Sobrien#define PUT_LNSZ_SIZE(abfd, in, ext) \
8894536Sobrien  H_PUT_16(abfd, in, ext->x_sym.x_misc.x_lnsz.x_size)
8984865Sobrien#endif
9084865Sobrien#ifndef GET_SCN_SCNLEN
9194536Sobrien#define GET_SCN_SCNLEN(abfd, ext) \
9294536Sobrien  H_GET_32 (abfd, ext->x_scn.x_scnlen)
9384865Sobrien#endif
9484865Sobrien#ifndef GET_SCN_NRELOC
9594536Sobrien#define GET_SCN_NRELOC(abfd, ext) \
9694536Sobrien  H_GET_16 (abfd, ext->x_scn.x_nreloc)
9784865Sobrien#endif
9884865Sobrien#ifndef GET_SCN_NLINNO
9994536Sobrien#define GET_SCN_NLINNO(abfd, ext) \
10094536Sobrien  H_GET_16 (abfd, ext->x_scn.x_nlinno)
10184865Sobrien#endif
10284865Sobrien#ifndef PUT_SCN_SCNLEN
10394536Sobrien#define PUT_SCN_SCNLEN(abfd, in, ext) \
10494536Sobrien  H_PUT_32(abfd, in, ext->x_scn.x_scnlen)
10584865Sobrien#endif
10684865Sobrien#ifndef PUT_SCN_NRELOC
10794536Sobrien#define PUT_SCN_NRELOC(abfd, in, ext) \
10894536Sobrien  H_PUT_16(abfd, in, ext->x_scn.x_nreloc)
10984865Sobrien#endif
11084865Sobrien#ifndef PUT_SCN_NLINNO
11194536Sobrien#define PUT_SCN_NLINNO(abfd, in, ext) \
11294536Sobrien  H_PUT_16(abfd,in, ext->x_scn.x_nlinno)
11384865Sobrien#endif
11484865Sobrien#ifndef GET_LINENO_LNNO
11594536Sobrien#define GET_LINENO_LNNO(abfd, ext) \
11694536Sobrien  H_GET_16 (abfd, ext->l_lnno);
11784865Sobrien#endif
11884865Sobrien#ifndef PUT_LINENO_LNNO
11994536Sobrien#define PUT_LINENO_LNNO(abfd, val, ext) \
12094536Sobrien  H_PUT_16(abfd,val, ext->l_lnno);
12184865Sobrien#endif
12284865Sobrien
12384865Sobrien/* The f_symptr field in the filehdr is sometimes 64 bits.  */
12484865Sobrien#ifndef GET_FILEHDR_SYMPTR
12594536Sobrien#define GET_FILEHDR_SYMPTR H_GET_32
12684865Sobrien#endif
12784865Sobrien#ifndef PUT_FILEHDR_SYMPTR
12894536Sobrien#define PUT_FILEHDR_SYMPTR H_PUT_32
12984865Sobrien#endif
13084865Sobrien
13184865Sobrien/* Some fields in the aouthdr are sometimes 64 bits.  */
13284865Sobrien#ifndef GET_AOUTHDR_TSIZE
13394536Sobrien#define GET_AOUTHDR_TSIZE H_GET_32
13484865Sobrien#endif
13584865Sobrien#ifndef PUT_AOUTHDR_TSIZE
13694536Sobrien#define PUT_AOUTHDR_TSIZE H_PUT_32
13784865Sobrien#endif
13884865Sobrien#ifndef GET_AOUTHDR_DSIZE
13994536Sobrien#define GET_AOUTHDR_DSIZE H_GET_32
14084865Sobrien#endif
14184865Sobrien#ifndef PUT_AOUTHDR_DSIZE
14294536Sobrien#define PUT_AOUTHDR_DSIZE H_PUT_32
14384865Sobrien#endif
14484865Sobrien#ifndef GET_AOUTHDR_BSIZE
14594536Sobrien#define GET_AOUTHDR_BSIZE H_GET_32
14684865Sobrien#endif
14784865Sobrien#ifndef PUT_AOUTHDR_BSIZE
14894536Sobrien#define PUT_AOUTHDR_BSIZE H_PUT_32
14984865Sobrien#endif
15084865Sobrien#ifndef GET_AOUTHDR_ENTRY
15194536Sobrien#define GET_AOUTHDR_ENTRY H_GET_32
15284865Sobrien#endif
15384865Sobrien#ifndef PUT_AOUTHDR_ENTRY
15494536Sobrien#define PUT_AOUTHDR_ENTRY H_PUT_32
15584865Sobrien#endif
15684865Sobrien#ifndef GET_AOUTHDR_TEXT_START
15794536Sobrien#define GET_AOUTHDR_TEXT_START H_GET_32
15884865Sobrien#endif
15984865Sobrien#ifndef PUT_AOUTHDR_TEXT_START
16094536Sobrien#define PUT_AOUTHDR_TEXT_START H_PUT_32
16184865Sobrien#endif
16284865Sobrien#ifndef GET_AOUTHDR_DATA_START
16394536Sobrien#define GET_AOUTHDR_DATA_START H_GET_32
16484865Sobrien#endif
16584865Sobrien#ifndef PUT_AOUTHDR_DATA_START
16694536Sobrien#define PUT_AOUTHDR_DATA_START H_PUT_32
16784865Sobrien#endif
16884865Sobrien
16984865Sobrien/* Some fields in the scnhdr are sometimes 64 bits.  */
17084865Sobrien#ifndef GET_SCNHDR_PADDR
17194536Sobrien#define GET_SCNHDR_PADDR H_GET_32
17284865Sobrien#endif
17384865Sobrien#ifndef PUT_SCNHDR_PADDR
17494536Sobrien#define PUT_SCNHDR_PADDR H_PUT_32
17584865Sobrien#endif
17684865Sobrien#ifndef GET_SCNHDR_VADDR
17794536Sobrien#define GET_SCNHDR_VADDR H_GET_32
17884865Sobrien#endif
17984865Sobrien#ifndef PUT_SCNHDR_VADDR
18094536Sobrien#define PUT_SCNHDR_VADDR H_PUT_32
18184865Sobrien#endif
18284865Sobrien#ifndef GET_SCNHDR_SIZE
18394536Sobrien#define GET_SCNHDR_SIZE H_GET_32
18484865Sobrien#endif
18584865Sobrien#ifndef PUT_SCNHDR_SIZE
18694536Sobrien#define PUT_SCNHDR_SIZE H_PUT_32
18784865Sobrien#endif
18884865Sobrien#ifndef GET_SCNHDR_SCNPTR
18994536Sobrien#define GET_SCNHDR_SCNPTR H_GET_32
19084865Sobrien#endif
19184865Sobrien#ifndef PUT_SCNHDR_SCNPTR
19294536Sobrien#define PUT_SCNHDR_SCNPTR H_PUT_32
19384865Sobrien#endif
19484865Sobrien#ifndef GET_SCNHDR_RELPTR
19594536Sobrien#define GET_SCNHDR_RELPTR H_GET_32
19684865Sobrien#endif
19784865Sobrien#ifndef PUT_SCNHDR_RELPTR
19894536Sobrien#define PUT_SCNHDR_RELPTR H_PUT_32
19984865Sobrien#endif
20084865Sobrien#ifndef GET_SCNHDR_LNNOPTR
20194536Sobrien#define GET_SCNHDR_LNNOPTR H_GET_32
20284865Sobrien#endif
20384865Sobrien#ifndef PUT_SCNHDR_LNNOPTR
20494536Sobrien#define PUT_SCNHDR_LNNOPTR H_PUT_32
20584865Sobrien#endif
20684865Sobrien
207218822Sdim#ifdef COFF_WITH_pex64
20884865Sobrien
209218822Sdim#define GET_OPTHDR_IMAGE_BASE            H_GET_64
210218822Sdim#define PUT_OPTHDR_IMAGE_BASE            H_PUT_64
211218822Sdim#define GET_OPTHDR_SIZE_OF_STACK_RESERVE H_GET_64
212218822Sdim#define PUT_OPTHDR_SIZE_OF_STACK_RESERVE H_PUT_64
213218822Sdim#define GET_OPTHDR_SIZE_OF_STACK_COMMIT  H_GET_64
214218822Sdim#define PUT_OPTHDR_SIZE_OF_STACK_COMMIT  H_PUT_64
215218822Sdim#define GET_OPTHDR_SIZE_OF_HEAP_RESERVE  H_GET_64
216218822Sdim#define PUT_OPTHDR_SIZE_OF_HEAP_RESERVE  H_PUT_64
217218822Sdim#define GET_OPTHDR_SIZE_OF_HEAP_COMMIT   H_GET_64
218218822Sdim#define PUT_OPTHDR_SIZE_OF_HEAP_COMMIT   H_PUT_64
219218822Sdim#define GET_PDATA_ENTRY                  bfd_get_32
220218822Sdim
221218822Sdim#define _bfd_XX_bfd_copy_private_bfd_data_common	_bfd_pex64_bfd_copy_private_bfd_data_common
222218822Sdim#define _bfd_XX_bfd_copy_private_section_data		_bfd_pex64_bfd_copy_private_section_data
223218822Sdim#define _bfd_XX_get_symbol_info				_bfd_pex64_get_symbol_info
224218822Sdim#define _bfd_XX_only_swap_filehdr_out			_bfd_pex64_only_swap_filehdr_out
225218822Sdim#define _bfd_XX_print_private_bfd_data_common		_bfd_pex64_print_private_bfd_data_common
226218822Sdim#define _bfd_XXi_final_link_postscript			_bfd_pex64i_final_link_postscript
227218822Sdim#define _bfd_XXi_only_swap_filehdr_out			_bfd_pex64i_only_swap_filehdr_out
228218822Sdim#define _bfd_XXi_swap_aouthdr_in			_bfd_pex64i_swap_aouthdr_in
229218822Sdim#define _bfd_XXi_swap_aouthdr_out			_bfd_pex64i_swap_aouthdr_out
230218822Sdim#define _bfd_XXi_swap_aux_in				_bfd_pex64i_swap_aux_in
231218822Sdim#define _bfd_XXi_swap_aux_out				_bfd_pex64i_swap_aux_out
232218822Sdim#define _bfd_XXi_swap_lineno_in				_bfd_pex64i_swap_lineno_in
233218822Sdim#define _bfd_XXi_swap_lineno_out			_bfd_pex64i_swap_lineno_out
234218822Sdim#define _bfd_XXi_swap_scnhdr_out			_bfd_pex64i_swap_scnhdr_out
235218822Sdim#define _bfd_XXi_swap_sym_in				_bfd_pex64i_swap_sym_in
236218822Sdim#define _bfd_XXi_swap_sym_out				_bfd_pex64i_swap_sym_out
237218822Sdim
238218822Sdim#elif defined COFF_WITH_pep
239218822Sdim
24094536Sobrien#define GET_OPTHDR_IMAGE_BASE H_GET_64
24194536Sobrien#define PUT_OPTHDR_IMAGE_BASE H_PUT_64
24294536Sobrien#define GET_OPTHDR_SIZE_OF_STACK_RESERVE H_GET_64
24394536Sobrien#define PUT_OPTHDR_SIZE_OF_STACK_RESERVE H_PUT_64
24494536Sobrien#define GET_OPTHDR_SIZE_OF_STACK_COMMIT H_GET_64
24594536Sobrien#define PUT_OPTHDR_SIZE_OF_STACK_COMMIT H_PUT_64
24694536Sobrien#define GET_OPTHDR_SIZE_OF_HEAP_RESERVE H_GET_64
24794536Sobrien#define PUT_OPTHDR_SIZE_OF_HEAP_RESERVE H_PUT_64
24894536Sobrien#define GET_OPTHDR_SIZE_OF_HEAP_COMMIT H_GET_64
24994536Sobrien#define PUT_OPTHDR_SIZE_OF_HEAP_COMMIT H_PUT_64
25084865Sobrien#define GET_PDATA_ENTRY bfd_get_64
25184865Sobrien
25284865Sobrien#define _bfd_XX_bfd_copy_private_bfd_data_common	_bfd_pep_bfd_copy_private_bfd_data_common
25384865Sobrien#define _bfd_XX_bfd_copy_private_section_data		_bfd_pep_bfd_copy_private_section_data
25484865Sobrien#define _bfd_XX_get_symbol_info				_bfd_pep_get_symbol_info
25584865Sobrien#define _bfd_XX_only_swap_filehdr_out			_bfd_pep_only_swap_filehdr_out
25684865Sobrien#define _bfd_XX_print_private_bfd_data_common		_bfd_pep_print_private_bfd_data_common
25784865Sobrien#define _bfd_XXi_final_link_postscript			_bfd_pepi_final_link_postscript
25884865Sobrien#define _bfd_XXi_only_swap_filehdr_out			_bfd_pepi_only_swap_filehdr_out
25984865Sobrien#define _bfd_XXi_swap_aouthdr_in			_bfd_pepi_swap_aouthdr_in
26084865Sobrien#define _bfd_XXi_swap_aouthdr_out			_bfd_pepi_swap_aouthdr_out
26184865Sobrien#define _bfd_XXi_swap_aux_in				_bfd_pepi_swap_aux_in
26284865Sobrien#define _bfd_XXi_swap_aux_out				_bfd_pepi_swap_aux_out
26384865Sobrien#define _bfd_XXi_swap_lineno_in				_bfd_pepi_swap_lineno_in
26484865Sobrien#define _bfd_XXi_swap_lineno_out			_bfd_pepi_swap_lineno_out
26584865Sobrien#define _bfd_XXi_swap_scnhdr_out			_bfd_pepi_swap_scnhdr_out
26684865Sobrien#define _bfd_XXi_swap_sym_in				_bfd_pepi_swap_sym_in
26784865Sobrien#define _bfd_XXi_swap_sym_out				_bfd_pepi_swap_sym_out
26884865Sobrien
26984865Sobrien#else /* !COFF_WITH_pep */
27084865Sobrien
27194536Sobrien#define GET_OPTHDR_IMAGE_BASE H_GET_32
27294536Sobrien#define PUT_OPTHDR_IMAGE_BASE H_PUT_32
27394536Sobrien#define GET_OPTHDR_SIZE_OF_STACK_RESERVE H_GET_32
27494536Sobrien#define PUT_OPTHDR_SIZE_OF_STACK_RESERVE H_PUT_32
27594536Sobrien#define GET_OPTHDR_SIZE_OF_STACK_COMMIT H_GET_32
27694536Sobrien#define PUT_OPTHDR_SIZE_OF_STACK_COMMIT H_PUT_32
27794536Sobrien#define GET_OPTHDR_SIZE_OF_HEAP_RESERVE H_GET_32
27894536Sobrien#define PUT_OPTHDR_SIZE_OF_HEAP_RESERVE H_PUT_32
27994536Sobrien#define GET_OPTHDR_SIZE_OF_HEAP_COMMIT H_GET_32
28094536Sobrien#define PUT_OPTHDR_SIZE_OF_HEAP_COMMIT H_PUT_32
28184865Sobrien#define GET_PDATA_ENTRY bfd_get_32
28284865Sobrien
28384865Sobrien#define _bfd_XX_bfd_copy_private_bfd_data_common	_bfd_pe_bfd_copy_private_bfd_data_common
28484865Sobrien#define _bfd_XX_bfd_copy_private_section_data		_bfd_pe_bfd_copy_private_section_data
28584865Sobrien#define _bfd_XX_get_symbol_info				_bfd_pe_get_symbol_info
28684865Sobrien#define _bfd_XX_only_swap_filehdr_out			_bfd_pe_only_swap_filehdr_out
28784865Sobrien#define _bfd_XX_print_private_bfd_data_common		_bfd_pe_print_private_bfd_data_common
28884865Sobrien#define _bfd_XXi_final_link_postscript			_bfd_pei_final_link_postscript
28984865Sobrien#define _bfd_XXi_only_swap_filehdr_out			_bfd_pei_only_swap_filehdr_out
29084865Sobrien#define _bfd_XXi_swap_aouthdr_in			_bfd_pei_swap_aouthdr_in
29184865Sobrien#define _bfd_XXi_swap_aouthdr_out			_bfd_pei_swap_aouthdr_out
29284865Sobrien#define _bfd_XXi_swap_aux_in				_bfd_pei_swap_aux_in
29384865Sobrien#define _bfd_XXi_swap_aux_out				_bfd_pei_swap_aux_out
29484865Sobrien#define _bfd_XXi_swap_lineno_in				_bfd_pei_swap_lineno_in
29584865Sobrien#define _bfd_XXi_swap_lineno_out			_bfd_pei_swap_lineno_out
29684865Sobrien#define _bfd_XXi_swap_scnhdr_out			_bfd_pei_swap_scnhdr_out
29784865Sobrien#define _bfd_XXi_swap_sym_in				_bfd_pei_swap_sym_in
29884865Sobrien#define _bfd_XXi_swap_sym_out				_bfd_pei_swap_sym_out
29984865Sobrien
30084865Sobrien#endif /* !COFF_WITH_pep */
30184865Sobrien
302218822Sdim/* Returns true if the target is a PE executable target.  */
303218822Sdim#define bfd_target_pei_p(xvec)				\
304218822Sdim  (CONST_STRNEQ ((xvec)->name, "pei-"))
305218822Sdim
306218822Sdim/* Return the arch string of a PE executable target.  */
307218822Sdim#define bfd_target_pei_arch(xvec)				\
308218822Sdim  ((xvec)->name + sizeof ("pei-") - 1)
309218822Sdim
310218822Sdim/* Returns true if the target is an EFI target.  */
311218822Sdim#define bfd_target_efi_p(xvec)				\
312218822Sdim   (CONST_STRNEQ ((xvec)->name, "efi-app-"))
313218822Sdim
314218822Sdim/* Return the arch string of an EFI target.  */
315218822Sdim#define bfd_target_efi_arch(xvec)				\
316218822Sdim  ((xvec)->name + sizeof ("efi-app-") - 1)
317218822Sdim
318218822Sdim/* Macro: Returns true if the bfd is a PE executable as opposed to a
319218822Sdim   PE object file.  */
320218822Sdim#define bfd_pe_executable_p(abfd)			\
321218822Sdim  (bfd_target_pei_p ((abfd)->xvec)			\
322218822Sdim   || bfd_target_efi_p ((abfd)->xvec))
323218822Sdim
32484865Sobrien/* These functions are architecture dependent, and are in peicode.h:
32584865Sobrien   coff_swap_reloc_in
32684865Sobrien   int coff_swap_reloc_out
32784865Sobrien   coff_swap_filehdr_in
32884865Sobrien   coff_swap_scnhdr_in
32984865Sobrien   pe_mkobject
33084865Sobrien   pe_mkobject_hook  */
33184865Sobrien
33284865Sobrien/* The functions described below are common across all PE/PEI
33384865Sobrien   implementations architecture types, and actually appear in
33484865Sobrien   peigen.c.  */
33584865Sobrien
336218822Sdim#define coff_swap_sym_in      _bfd_XXi_swap_sym_in
337218822Sdim#define coff_swap_sym_out     _bfd_XXi_swap_sym_out
338218822Sdim#define coff_swap_aux_in      _bfd_XXi_swap_aux_in
339218822Sdim#define coff_swap_aux_out     _bfd_XXi_swap_aux_out
340218822Sdim#define coff_swap_lineno_in   _bfd_XXi_swap_lineno_in
341218822Sdim#define coff_swap_lineno_out  _bfd_XXi_swap_lineno_out
342218822Sdim#define coff_swap_aouthdr_in  _bfd_XXi_swap_aouthdr_in
34384865Sobrien#define coff_swap_aouthdr_out _bfd_XXi_swap_aouthdr_out
344218822Sdim#define coff_swap_scnhdr_out  _bfd_XXi_swap_scnhdr_out
34584865Sobrien
34684865Sobrien#ifndef coff_final_link_postscript
34784865Sobrien#define coff_final_link_postscript _bfd_XXi_final_link_postscript
34884865Sobrien#endif
349218822Sdim
350218822Sdimvoid        _bfd_XXi_swap_sym_in (bfd *, void *, void *);
351218822Sdimunsigned    _bfd_XXi_swap_sym_out (bfd *, void *, void *);
352218822Sdimvoid        _bfd_XXi_swap_aux_in (bfd *, void *, int, int, int, int, void *);
353218822Sdimunsigned    _bfd_XXi_swap_aux_out (bfd *, void *, int, int, int, int, void *);
354218822Sdimvoid        _bfd_XXi_swap_lineno_in (bfd *, void *, void *);
355218822Sdimunsigned    _bfd_XXi_swap_lineno_out (bfd *, void *, void *);
356218822Sdimvoid        _bfd_XXi_swap_aouthdr_in (bfd *, void *, void *);
357218822Sdimunsigned    _bfd_XXi_swap_aouthdr_out (bfd *, void *, void *);
358218822Sdimunsigned    _bfd_XXi_swap_scnhdr_out (bfd *, void *, void *);
359218822Sdimbfd_boolean _bfd_XX_print_private_bfd_data_common (bfd *, void *);
360218822Sdimbfd_boolean _bfd_XX_bfd_copy_private_bfd_data_common (bfd *, bfd *);
361218822Sdimvoid        _bfd_XX_get_symbol_info (bfd *, asymbol *, symbol_info *);
362218822Sdimbfd_boolean _bfd_XXi_final_link_postscript (bfd *, struct coff_final_link_info *);
363218822Sdim
36484865Sobrien/* The following are needed only for ONE of pe or pei, but don't
36584865Sobrien   otherwise vary; peicode.h fixes up ifdefs but we provide the
36684865Sobrien   prototype.  */
36784865Sobrien
368218822Sdimunsigned    _bfd_XX_only_swap_filehdr_out  (bfd *, void *, void *);
369218822Sdimunsigned    _bfd_XXi_only_swap_filehdr_out (bfd *, void *, void *);
370218822Sdimbfd_boolean _bfd_XX_bfd_copy_private_section_data (bfd *, asection *, bfd *, asection *);
371130561Sobrien
372