Subversion Repositories Kolibri OS

Rev

Rev 5197 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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