xref: /netbsd/external/gpl3/gdb/dist/bfd/libpei.h (revision 1424dfb3)
1377e23a2Schristos /* Support for the generic parts of PE/PEI; common header information.
2*1424dfb3Schristos    Copyright (C) 1995-2020 Free Software Foundation, Inc.
3377e23a2Schristos    Written by Cygnus Solutions.
4377e23a2Schristos 
5377e23a2Schristos    This file is part of BFD, the Binary File Descriptor library.
6377e23a2Schristos 
7377e23a2Schristos    This program is free software; you can redistribute it and/or modify
8377e23a2Schristos    it under the terms of the GNU General Public License as published by
9377e23a2Schristos    the Free Software Foundation; either version 3 of the License, or
10377e23a2Schristos    (at your option) any later version.
11377e23a2Schristos 
12377e23a2Schristos    This program is distributed in the hope that it will be useful,
13377e23a2Schristos    but WITHOUT ANY WARRANTY; without even the implied warranty of
14377e23a2Schristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15377e23a2Schristos    GNU General Public License for more details.
16377e23a2Schristos 
17377e23a2Schristos    You should have received a copy of the GNU General Public License
18377e23a2Schristos    along with this program; if not, write to the Free Software
19377e23a2Schristos    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
20377e23a2Schristos    MA 02110-1301, USA.  */
21377e23a2Schristos 
22377e23a2Schristos 
23377e23a2Schristos /* Most of this hacked by  Steve Chamberlain,
24377e23a2Schristos 			sac@cygnus.com
25377e23a2Schristos 
26377e23a2Schristos    PE/PEI rearrangement (and code added): Donn Terry
27377e23a2Schristos 				       Softway Systems, Inc.  */
28377e23a2Schristos 
29377e23a2Schristos /* Hey look, some documentation [and in a place you expect to find it]!
30377e23a2Schristos 
31377e23a2Schristos    The main reference for the pei format is "Microsoft Portable Executable
32377e23a2Schristos    and Common Object File Format Specification 4.1".  Get it if you need to
33377e23a2Schristos    do some serious hacking on this code.
34377e23a2Schristos 
35377e23a2Schristos    Another reference:
36377e23a2Schristos    "Peering Inside the PE: A Tour of the Win32 Portable Executable
37377e23a2Schristos    File Format", MSJ 1994, Volume 9.
38377e23a2Schristos 
39377e23a2Schristos    The *sole* difference between the pe format and the pei format is that the
40377e23a2Schristos    latter has an MSDOS 2.0 .exe header on the front that prints the message
41377e23a2Schristos    "This app must be run under Windows." (or some such).
42377e23a2Schristos    (FIXME: Whether that statement is *really* true or not is unknown.
43377e23a2Schristos    Are there more subtle differences between pe and pei formats?
44377e23a2Schristos    For now assume there aren't.  If you find one, then for God sakes
45377e23a2Schristos    document it here!)
46377e23a2Schristos 
47377e23a2Schristos    The Microsoft docs use the word "image" instead of "executable" because
48377e23a2Schristos    the former can also refer to a DLL (shared library).  Confusion can arise
49377e23a2Schristos    because the `i' in `pei' also refers to "image".  The `pe' format can
50377e23a2Schristos    also create images (i.e. executables), it's just that to run on a win32
51377e23a2Schristos    system you need to use the pei format.
52377e23a2Schristos 
53377e23a2Schristos    FIXME: Please add more docs here so the next poor fool that has to hack
54377e23a2Schristos    on this code has a chance of getting something accomplished without
55377e23a2Schristos    wasting too much time.  */
56377e23a2Schristos 
57377e23a2Schristos #ifndef GET_FCN_LNNOPTR
58377e23a2Schristos #define GET_FCN_LNNOPTR(abfd, ext) \
59377e23a2Schristos   H_GET_32 (abfd, ext->x_sym.x_fcnary.x_fcn.x_lnnoptr)
60377e23a2Schristos #endif
61377e23a2Schristos 
62377e23a2Schristos #ifndef GET_FCN_ENDNDX
63377e23a2Schristos #define GET_FCN_ENDNDX(abfd, ext) \
64377e23a2Schristos   H_GET_32 (abfd, ext->x_sym.x_fcnary.x_fcn.x_endndx)
65377e23a2Schristos #endif
66377e23a2Schristos 
67377e23a2Schristos #ifndef PUT_FCN_LNNOPTR
68377e23a2Schristos #define PUT_FCN_LNNOPTR(abfd, in, ext) \
69377e23a2Schristos   H_PUT_32(abfd, in, ext->x_sym.x_fcnary.x_fcn.x_lnnoptr)
70377e23a2Schristos #endif
71377e23a2Schristos #ifndef PUT_FCN_ENDNDX
72377e23a2Schristos #define PUT_FCN_ENDNDX(abfd, in, ext) \
73377e23a2Schristos   H_PUT_32(abfd, in, ext->x_sym.x_fcnary.x_fcn.x_endndx)
74377e23a2Schristos #endif
75377e23a2Schristos #ifndef GET_LNSZ_LNNO
76377e23a2Schristos #define GET_LNSZ_LNNO(abfd, ext) \
77377e23a2Schristos   H_GET_16 (abfd, ext->x_sym.x_misc.x_lnsz.x_lnno)
78377e23a2Schristos #endif
79377e23a2Schristos #ifndef GET_LNSZ_SIZE
80377e23a2Schristos #define GET_LNSZ_SIZE(abfd, ext) \
81377e23a2Schristos   H_GET_16 (abfd, ext->x_sym.x_misc.x_lnsz.x_size)
82377e23a2Schristos #endif
83377e23a2Schristos #ifndef PUT_LNSZ_LNNO
84377e23a2Schristos #define PUT_LNSZ_LNNO(abfd, in, ext) \
85377e23a2Schristos   H_PUT_16(abfd, in, ext->x_sym.x_misc.x_lnsz.x_lnno)
86377e23a2Schristos #endif
87377e23a2Schristos #ifndef PUT_LNSZ_SIZE
88377e23a2Schristos #define PUT_LNSZ_SIZE(abfd, in, ext) \
89377e23a2Schristos   H_PUT_16(abfd, in, ext->x_sym.x_misc.x_lnsz.x_size)
90377e23a2Schristos #endif
91377e23a2Schristos #ifndef GET_SCN_SCNLEN
92377e23a2Schristos #define GET_SCN_SCNLEN(abfd, ext) \
93377e23a2Schristos   H_GET_32 (abfd, ext->x_scn.x_scnlen)
94377e23a2Schristos #endif
95377e23a2Schristos #ifndef GET_SCN_NRELOC
96377e23a2Schristos #define GET_SCN_NRELOC(abfd, ext) \
97377e23a2Schristos   H_GET_16 (abfd, ext->x_scn.x_nreloc)
98377e23a2Schristos #endif
99377e23a2Schristos #ifndef GET_SCN_NLINNO
100377e23a2Schristos #define GET_SCN_NLINNO(abfd, ext) \
101377e23a2Schristos   H_GET_16 (abfd, ext->x_scn.x_nlinno)
102377e23a2Schristos #endif
103377e23a2Schristos #ifndef PUT_SCN_SCNLEN
104377e23a2Schristos #define PUT_SCN_SCNLEN(abfd, in, ext) \
105377e23a2Schristos   H_PUT_32(abfd, in, ext->x_scn.x_scnlen)
106377e23a2Schristos #endif
107377e23a2Schristos #ifndef PUT_SCN_NRELOC
108377e23a2Schristos #define PUT_SCN_NRELOC(abfd, in, ext) \
109377e23a2Schristos   H_PUT_16(abfd, in, ext->x_scn.x_nreloc)
110377e23a2Schristos #endif
111377e23a2Schristos #ifndef PUT_SCN_NLINNO
112377e23a2Schristos #define PUT_SCN_NLINNO(abfd, in, ext) \
113377e23a2Schristos   H_PUT_16(abfd,in, ext->x_scn.x_nlinno)
114377e23a2Schristos #endif
115377e23a2Schristos #ifndef GET_LINENO_LNNO
116377e23a2Schristos #define GET_LINENO_LNNO(abfd, ext) \
117377e23a2Schristos   H_GET_16 (abfd, ext->l_lnno);
118377e23a2Schristos #endif
119377e23a2Schristos #ifndef PUT_LINENO_LNNO
120377e23a2Schristos #define PUT_LINENO_LNNO(abfd, val, ext) \
121377e23a2Schristos   H_PUT_16(abfd,val, ext->l_lnno);
122377e23a2Schristos #endif
123377e23a2Schristos 
124377e23a2Schristos /* The f_symptr field in the filehdr is sometimes 64 bits.  */
125377e23a2Schristos #ifndef GET_FILEHDR_SYMPTR
126377e23a2Schristos #define GET_FILEHDR_SYMPTR H_GET_32
127377e23a2Schristos #endif
128377e23a2Schristos #ifndef PUT_FILEHDR_SYMPTR
129377e23a2Schristos #define PUT_FILEHDR_SYMPTR H_PUT_32
130377e23a2Schristos #endif
131377e23a2Schristos 
132377e23a2Schristos /* Some fields in the aouthdr are sometimes 64 bits.  */
133377e23a2Schristos #ifndef GET_AOUTHDR_TSIZE
134377e23a2Schristos #define GET_AOUTHDR_TSIZE H_GET_32
135377e23a2Schristos #endif
136377e23a2Schristos #ifndef PUT_AOUTHDR_TSIZE
137377e23a2Schristos #define PUT_AOUTHDR_TSIZE H_PUT_32
138377e23a2Schristos #endif
139377e23a2Schristos #ifndef GET_AOUTHDR_DSIZE
140377e23a2Schristos #define GET_AOUTHDR_DSIZE H_GET_32
141377e23a2Schristos #endif
142377e23a2Schristos #ifndef PUT_AOUTHDR_DSIZE
143377e23a2Schristos #define PUT_AOUTHDR_DSIZE H_PUT_32
144377e23a2Schristos #endif
145377e23a2Schristos #ifndef GET_AOUTHDR_BSIZE
146377e23a2Schristos #define GET_AOUTHDR_BSIZE H_GET_32
147377e23a2Schristos #endif
148377e23a2Schristos #ifndef PUT_AOUTHDR_BSIZE
149377e23a2Schristos #define PUT_AOUTHDR_BSIZE H_PUT_32
150377e23a2Schristos #endif
151377e23a2Schristos #ifndef GET_AOUTHDR_ENTRY
152377e23a2Schristos #define GET_AOUTHDR_ENTRY H_GET_32
153377e23a2Schristos #endif
154377e23a2Schristos #ifndef PUT_AOUTHDR_ENTRY
155377e23a2Schristos #define PUT_AOUTHDR_ENTRY H_PUT_32
156377e23a2Schristos #endif
157377e23a2Schristos #ifndef GET_AOUTHDR_TEXT_START
158377e23a2Schristos #define GET_AOUTHDR_TEXT_START H_GET_32
159377e23a2Schristos #endif
160377e23a2Schristos #ifndef PUT_AOUTHDR_TEXT_START
161377e23a2Schristos #define PUT_AOUTHDR_TEXT_START H_PUT_32
162377e23a2Schristos #endif
163377e23a2Schristos #ifndef GET_AOUTHDR_DATA_START
164377e23a2Schristos #define GET_AOUTHDR_DATA_START H_GET_32
165377e23a2Schristos #endif
166377e23a2Schristos #ifndef PUT_AOUTHDR_DATA_START
167377e23a2Schristos #define PUT_AOUTHDR_DATA_START H_PUT_32
168377e23a2Schristos #endif
169377e23a2Schristos 
170377e23a2Schristos /* Some fields in the scnhdr are sometimes 64 bits.  */
171377e23a2Schristos #ifndef GET_SCNHDR_PADDR
172377e23a2Schristos #define GET_SCNHDR_PADDR H_GET_32
173377e23a2Schristos #endif
174377e23a2Schristos #ifndef PUT_SCNHDR_PADDR
175377e23a2Schristos #define PUT_SCNHDR_PADDR H_PUT_32
176377e23a2Schristos #endif
177377e23a2Schristos #ifndef GET_SCNHDR_VADDR
178377e23a2Schristos #define GET_SCNHDR_VADDR H_GET_32
179377e23a2Schristos #endif
180377e23a2Schristos #ifndef PUT_SCNHDR_VADDR
181377e23a2Schristos #define PUT_SCNHDR_VADDR H_PUT_32
182377e23a2Schristos #endif
183377e23a2Schristos #ifndef GET_SCNHDR_SIZE
184377e23a2Schristos #define GET_SCNHDR_SIZE H_GET_32
185377e23a2Schristos #endif
186377e23a2Schristos #ifndef PUT_SCNHDR_SIZE
187377e23a2Schristos #define PUT_SCNHDR_SIZE H_PUT_32
188377e23a2Schristos #endif
189377e23a2Schristos #ifndef GET_SCNHDR_SCNPTR
190377e23a2Schristos #define GET_SCNHDR_SCNPTR H_GET_32
191377e23a2Schristos #endif
192377e23a2Schristos #ifndef PUT_SCNHDR_SCNPTR
193377e23a2Schristos #define PUT_SCNHDR_SCNPTR H_PUT_32
194377e23a2Schristos #endif
195377e23a2Schristos #ifndef GET_SCNHDR_RELPTR
196377e23a2Schristos #define GET_SCNHDR_RELPTR H_GET_32
197377e23a2Schristos #endif
198377e23a2Schristos #ifndef PUT_SCNHDR_RELPTR
199377e23a2Schristos #define PUT_SCNHDR_RELPTR H_PUT_32
200377e23a2Schristos #endif
201377e23a2Schristos #ifndef GET_SCNHDR_LNNOPTR
202377e23a2Schristos #define GET_SCNHDR_LNNOPTR H_GET_32
203377e23a2Schristos #endif
204377e23a2Schristos #ifndef PUT_SCNHDR_LNNOPTR
205377e23a2Schristos #define PUT_SCNHDR_LNNOPTR H_PUT_32
206377e23a2Schristos #endif
207377e23a2Schristos 
208377e23a2Schristos #ifdef COFF_WITH_pex64
209377e23a2Schristos 
210377e23a2Schristos #define GET_OPTHDR_IMAGE_BASE		 H_GET_64
211377e23a2Schristos #define PUT_OPTHDR_IMAGE_BASE		 H_PUT_64
212377e23a2Schristos #define GET_OPTHDR_SIZE_OF_STACK_RESERVE H_GET_64
213377e23a2Schristos #define PUT_OPTHDR_SIZE_OF_STACK_RESERVE H_PUT_64
214377e23a2Schristos #define GET_OPTHDR_SIZE_OF_STACK_COMMIT	 H_GET_64
215377e23a2Schristos #define PUT_OPTHDR_SIZE_OF_STACK_COMMIT	 H_PUT_64
216377e23a2Schristos #define GET_OPTHDR_SIZE_OF_HEAP_RESERVE	 H_GET_64
217377e23a2Schristos #define PUT_OPTHDR_SIZE_OF_HEAP_RESERVE	 H_PUT_64
218377e23a2Schristos #define GET_OPTHDR_SIZE_OF_HEAP_COMMIT	 H_GET_64
219377e23a2Schristos #define PUT_OPTHDR_SIZE_OF_HEAP_COMMIT	 H_PUT_64
220377e23a2Schristos #define GET_PDATA_ENTRY			 bfd_get_32
221377e23a2Schristos 
222377e23a2Schristos #define _bfd_XX_bfd_copy_private_bfd_data_common	_bfd_pex64_bfd_copy_private_bfd_data_common
223377e23a2Schristos #define _bfd_XX_bfd_copy_private_section_data		_bfd_pex64_bfd_copy_private_section_data
224377e23a2Schristos #define _bfd_XX_get_symbol_info				_bfd_pex64_get_symbol_info
225377e23a2Schristos #define _bfd_XX_only_swap_filehdr_out			_bfd_pex64_only_swap_filehdr_out
226377e23a2Schristos #define _bfd_XX_print_private_bfd_data_common		_bfd_pex64_print_private_bfd_data_common
227377e23a2Schristos #define _bfd_XXi_final_link_postscript			_bfd_pex64i_final_link_postscript
228377e23a2Schristos #define _bfd_XXi_only_swap_filehdr_out			_bfd_pex64i_only_swap_filehdr_out
229377e23a2Schristos #define _bfd_XXi_swap_aouthdr_in			_bfd_pex64i_swap_aouthdr_in
230377e23a2Schristos #define _bfd_XXi_swap_aouthdr_out			_bfd_pex64i_swap_aouthdr_out
231377e23a2Schristos #define _bfd_XXi_swap_aux_in				_bfd_pex64i_swap_aux_in
232377e23a2Schristos #define _bfd_XXi_swap_aux_out				_bfd_pex64i_swap_aux_out
233377e23a2Schristos #define _bfd_XXi_swap_lineno_in				_bfd_pex64i_swap_lineno_in
234377e23a2Schristos #define _bfd_XXi_swap_lineno_out			_bfd_pex64i_swap_lineno_out
235377e23a2Schristos #define _bfd_XXi_swap_scnhdr_out			_bfd_pex64i_swap_scnhdr_out
236377e23a2Schristos #define _bfd_XXi_swap_sym_in				_bfd_pex64i_swap_sym_in
237377e23a2Schristos #define _bfd_XXi_swap_sym_out				_bfd_pex64i_swap_sym_out
2385e098073Schristos #define _bfd_XXi_swap_debugdir_in			_bfd_pex64i_swap_debugdir_in
2395e098073Schristos #define _bfd_XXi_swap_debugdir_out			_bfd_pex64i_swap_debugdir_out
2405e098073Schristos #define _bfd_XXi_write_codeview_record			_bfd_pex64i_write_codeview_record
241ed6a76a9Schristos #define _bfd_XXi_slurp_codeview_record			_bfd_pex64i_slurp_codeview_record
242377e23a2Schristos 
243377e23a2Schristos #elif defined COFF_WITH_pep
244377e23a2Schristos 
245377e23a2Schristos #define GET_OPTHDR_IMAGE_BASE H_GET_64
246377e23a2Schristos #define PUT_OPTHDR_IMAGE_BASE H_PUT_64
247377e23a2Schristos #define GET_OPTHDR_SIZE_OF_STACK_RESERVE H_GET_64
248377e23a2Schristos #define PUT_OPTHDR_SIZE_OF_STACK_RESERVE H_PUT_64
249377e23a2Schristos #define GET_OPTHDR_SIZE_OF_STACK_COMMIT H_GET_64
250377e23a2Schristos #define PUT_OPTHDR_SIZE_OF_STACK_COMMIT H_PUT_64
251377e23a2Schristos #define GET_OPTHDR_SIZE_OF_HEAP_RESERVE H_GET_64
252377e23a2Schristos #define PUT_OPTHDR_SIZE_OF_HEAP_RESERVE H_PUT_64
253377e23a2Schristos #define GET_OPTHDR_SIZE_OF_HEAP_COMMIT H_GET_64
254377e23a2Schristos #define PUT_OPTHDR_SIZE_OF_HEAP_COMMIT H_PUT_64
255377e23a2Schristos #define GET_PDATA_ENTRY bfd_get_64
256377e23a2Schristos 
257377e23a2Schristos #define _bfd_XX_bfd_copy_private_bfd_data_common	_bfd_pep_bfd_copy_private_bfd_data_common
258377e23a2Schristos #define _bfd_XX_bfd_copy_private_section_data		_bfd_pep_bfd_copy_private_section_data
259377e23a2Schristos #define _bfd_XX_get_symbol_info				_bfd_pep_get_symbol_info
260377e23a2Schristos #define _bfd_XX_only_swap_filehdr_out			_bfd_pep_only_swap_filehdr_out
261377e23a2Schristos #define _bfd_XX_print_private_bfd_data_common		_bfd_pep_print_private_bfd_data_common
262377e23a2Schristos #define _bfd_XXi_final_link_postscript			_bfd_pepi_final_link_postscript
263377e23a2Schristos #define _bfd_XXi_only_swap_filehdr_out			_bfd_pepi_only_swap_filehdr_out
264377e23a2Schristos #define _bfd_XXi_swap_aouthdr_in			_bfd_pepi_swap_aouthdr_in
265377e23a2Schristos #define _bfd_XXi_swap_aouthdr_out			_bfd_pepi_swap_aouthdr_out
266377e23a2Schristos #define _bfd_XXi_swap_aux_in				_bfd_pepi_swap_aux_in
267377e23a2Schristos #define _bfd_XXi_swap_aux_out				_bfd_pepi_swap_aux_out
268377e23a2Schristos #define _bfd_XXi_swap_lineno_in				_bfd_pepi_swap_lineno_in
269377e23a2Schristos #define _bfd_XXi_swap_lineno_out			_bfd_pepi_swap_lineno_out
270377e23a2Schristos #define _bfd_XXi_swap_scnhdr_out			_bfd_pepi_swap_scnhdr_out
271377e23a2Schristos #define _bfd_XXi_swap_sym_in				_bfd_pepi_swap_sym_in
272377e23a2Schristos #define _bfd_XXi_swap_sym_out				_bfd_pepi_swap_sym_out
2735e098073Schristos #define _bfd_XXi_swap_debugdir_in			_bfd_pepi_swap_debugdir_in
2745e098073Schristos #define _bfd_XXi_swap_debugdir_out			_bfd_pepi_swap_debugdir_out
2755e098073Schristos #define _bfd_XXi_write_codeview_record			_bfd_pepi_write_codeview_record
276ed6a76a9Schristos #define _bfd_XXi_slurp_codeview_record			_bfd_pepi_slurp_codeview_record
277377e23a2Schristos 
278377e23a2Schristos #else /* !COFF_WITH_pep */
279377e23a2Schristos 
280377e23a2Schristos #define GET_OPTHDR_IMAGE_BASE H_GET_32
281377e23a2Schristos #define PUT_OPTHDR_IMAGE_BASE H_PUT_32
282377e23a2Schristos #define GET_OPTHDR_SIZE_OF_STACK_RESERVE H_GET_32
283377e23a2Schristos #define PUT_OPTHDR_SIZE_OF_STACK_RESERVE H_PUT_32
284377e23a2Schristos #define GET_OPTHDR_SIZE_OF_STACK_COMMIT H_GET_32
285377e23a2Schristos #define PUT_OPTHDR_SIZE_OF_STACK_COMMIT H_PUT_32
286377e23a2Schristos #define GET_OPTHDR_SIZE_OF_HEAP_RESERVE H_GET_32
287377e23a2Schristos #define PUT_OPTHDR_SIZE_OF_HEAP_RESERVE H_PUT_32
288377e23a2Schristos #define GET_OPTHDR_SIZE_OF_HEAP_COMMIT H_GET_32
289377e23a2Schristos #define PUT_OPTHDR_SIZE_OF_HEAP_COMMIT H_PUT_32
290377e23a2Schristos #define GET_PDATA_ENTRY bfd_get_32
291377e23a2Schristos 
292377e23a2Schristos #define _bfd_XX_bfd_copy_private_bfd_data_common	_bfd_pe_bfd_copy_private_bfd_data_common
293377e23a2Schristos #define _bfd_XX_bfd_copy_private_section_data		_bfd_pe_bfd_copy_private_section_data
294377e23a2Schristos #define _bfd_XX_get_symbol_info				_bfd_pe_get_symbol_info
295377e23a2Schristos #define _bfd_XX_only_swap_filehdr_out			_bfd_pe_only_swap_filehdr_out
296377e23a2Schristos #define _bfd_XX_print_private_bfd_data_common		_bfd_pe_print_private_bfd_data_common
297377e23a2Schristos #define _bfd_XXi_final_link_postscript			_bfd_pei_final_link_postscript
298377e23a2Schristos #define _bfd_XXi_only_swap_filehdr_out			_bfd_pei_only_swap_filehdr_out
299377e23a2Schristos #define _bfd_XXi_swap_aouthdr_in			_bfd_pei_swap_aouthdr_in
300377e23a2Schristos #define _bfd_XXi_swap_aouthdr_out			_bfd_pei_swap_aouthdr_out
301377e23a2Schristos #define _bfd_XXi_swap_aux_in				_bfd_pei_swap_aux_in
302377e23a2Schristos #define _bfd_XXi_swap_aux_out				_bfd_pei_swap_aux_out
303377e23a2Schristos #define _bfd_XXi_swap_lineno_in				_bfd_pei_swap_lineno_in
304377e23a2Schristos #define _bfd_XXi_swap_lineno_out			_bfd_pei_swap_lineno_out
305377e23a2Schristos #define _bfd_XXi_swap_scnhdr_out			_bfd_pei_swap_scnhdr_out
306377e23a2Schristos #define _bfd_XXi_swap_sym_in				_bfd_pei_swap_sym_in
307377e23a2Schristos #define _bfd_XXi_swap_sym_out				_bfd_pei_swap_sym_out
3085e098073Schristos #define _bfd_XXi_swap_debugdir_in			_bfd_pei_swap_debugdir_in
3095e098073Schristos #define _bfd_XXi_swap_debugdir_out			_bfd_pei_swap_debugdir_out
3105e098073Schristos #define _bfd_XXi_write_codeview_record			_bfd_pei_write_codeview_record
311ed6a76a9Schristos #define _bfd_XXi_slurp_codeview_record			_bfd_pei_slurp_codeview_record
312377e23a2Schristos 
313377e23a2Schristos #endif /* !COFF_WITH_pep */
314377e23a2Schristos 
315377e23a2Schristos /* These functions are architecture dependent, and are in peicode.h:
316377e23a2Schristos    coff_swap_reloc_in
317377e23a2Schristos    int coff_swap_reloc_out
318377e23a2Schristos    coff_swap_filehdr_in
319377e23a2Schristos    coff_swap_scnhdr_in
320377e23a2Schristos    pe_mkobject
321377e23a2Schristos    pe_mkobject_hook  */
322377e23a2Schristos 
323377e23a2Schristos /* The functions described below are common across all PE/PEI
324377e23a2Schristos    implementations architecture types, and actually appear in
325377e23a2Schristos    peigen.c.  */
326377e23a2Schristos 
327377e23a2Schristos #define coff_swap_sym_in      _bfd_XXi_swap_sym_in
328377e23a2Schristos #define coff_swap_sym_out     _bfd_XXi_swap_sym_out
329377e23a2Schristos #define coff_swap_aux_in      _bfd_XXi_swap_aux_in
330377e23a2Schristos #define coff_swap_aux_out     _bfd_XXi_swap_aux_out
331377e23a2Schristos #define coff_swap_lineno_in   _bfd_XXi_swap_lineno_in
332377e23a2Schristos #define coff_swap_lineno_out  _bfd_XXi_swap_lineno_out
333377e23a2Schristos #define coff_swap_aouthdr_in  _bfd_XXi_swap_aouthdr_in
334377e23a2Schristos #define coff_swap_aouthdr_out _bfd_XXi_swap_aouthdr_out
335377e23a2Schristos #define coff_swap_scnhdr_out  _bfd_XXi_swap_scnhdr_out
336377e23a2Schristos 
337377e23a2Schristos #ifndef coff_final_link_postscript
338377e23a2Schristos #define coff_final_link_postscript _bfd_XXi_final_link_postscript
339377e23a2Schristos #endif
340377e23a2Schristos 
341377e23a2Schristos void	    _bfd_XXi_swap_sym_in (bfd *, void *, void *);
342377e23a2Schristos unsigned    _bfd_XXi_swap_sym_out (bfd *, void *, void *);
343377e23a2Schristos void	    _bfd_XXi_swap_aux_in (bfd *, void *, int, int, int, int, void *);
344377e23a2Schristos unsigned    _bfd_XXi_swap_aux_out (bfd *, void *, int, int, int, int, void *);
345377e23a2Schristos void	    _bfd_XXi_swap_lineno_in (bfd *, void *, void *);
346377e23a2Schristos unsigned    _bfd_XXi_swap_lineno_out (bfd *, void *, void *);
347377e23a2Schristos void	    _bfd_XXi_swap_aouthdr_in (bfd *, void *, void *);
348377e23a2Schristos unsigned    _bfd_XXi_swap_aouthdr_out (bfd *, void *, void *);
349377e23a2Schristos unsigned    _bfd_XXi_swap_scnhdr_out (bfd *, void *, void *);
350377e23a2Schristos bfd_boolean _bfd_XX_print_private_bfd_data_common (bfd *, void *);
351377e23a2Schristos bfd_boolean _bfd_XX_bfd_copy_private_bfd_data_common (bfd *, bfd *);
352377e23a2Schristos void	    _bfd_XX_get_symbol_info (bfd *, asymbol *, symbol_info *);
353377e23a2Schristos bfd_boolean _bfd_XXi_final_link_postscript (bfd *, struct coff_final_link_info *);
3545e098073Schristos void	    _bfd_XXi_swap_debugdir_in (bfd *, void *, void *);
3555e098073Schristos unsigned    _bfd_XXi_swap_debugdir_out (bfd *, void *, void *);
3565e098073Schristos unsigned    _bfd_XXi_write_codeview_record (bfd *, file_ptr, CODEVIEW_INFO *);
357ed6a76a9Schristos CODEVIEW_INFO * _bfd_XXi_slurp_codeview_record (bfd * abfd, file_ptr where, unsigned long length, CODEVIEW_INFO *cvinfo);
358377e23a2Schristos 
359377e23a2Schristos /* The following are needed only for ONE of pe or pei, but don't
360377e23a2Schristos    otherwise vary; peicode.h fixes up ifdefs but we provide the
361377e23a2Schristos    prototype.  */
362377e23a2Schristos 
363377e23a2Schristos unsigned    _bfd_XX_only_swap_filehdr_out  (bfd *, void *, void *);
364377e23a2Schristos unsigned    _bfd_XXi_only_swap_filehdr_out (bfd *, void *, void *);
365377e23a2Schristos bfd_boolean _bfd_XX_bfd_copy_private_section_data (bfd *, asection *, bfd *, asection *);
366377e23a2Schristos 
367377e23a2Schristos bfd_boolean _bfd_pe_print_ce_compressed_pdata (bfd *, void *);
368377e23a2Schristos bfd_boolean _bfd_pe64_print_ce_compressed_pdata (bfd *, void *);
369377e23a2Schristos bfd_boolean _bfd_pex64_print_ce_compressed_pdata (bfd *, void *);
370377e23a2Schristos bfd_boolean _bfd_pep_print_ce_compressed_pdata (bfd *, void *);
371377e23a2Schristos 
372