OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.3/] [bfd/] [libpei.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.