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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [bfd/] [libpei.h] - Blame information for rev 1771

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 104 markom
/* Support for the generic parts of PE/PEI; common header information.
2
   Copyright 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
3
   Written by Cygnus Solutions.
4
 
5
This file is part of BFD, the Binary File Descriptor library.
6
 
7
This program is free software; you can redistribute it and/or modify
8
it under the terms of the GNU General Public License as published by
9
the Free Software Foundation; either version 2 of the License, or
10
(at your option) any later version.
11
 
12
This program is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
GNU General Public License for more details.
16
 
17
You should have received a copy of the GNU General Public License
18
along with this program; if not, write to the Free Software
19
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
20
 
21
/*
22
Most of this hacked by  Steve Chamberlain,
23
                        sac@cygnus.com
24
 
25
PE/PEI rearrangement (and code added): Donn Terry
26
                                       Softway Systems, Inc.
27
*/
28
 
29
/* Hey look, some documentation [and in a place you expect to find it]!
30
 
31
   The main reference for the pei format is "Microsoft Portable Executable
32
   and Common Object File Format Specification 4.1".  Get it if you need to
33
   do some serious hacking on this code.
34
 
35
   Another reference:
36
   "Peering Inside the PE: A Tour of the Win32 Portable Executable
37
   File Format", MSJ 1994, Volume 9.
38
 
39
   The *sole* difference between the pe format and the pei format is that the
40
   latter has an MSDOS 2.0 .exe header on the front that prints the message
41
   "This app must be run under Windows." (or some such).
42
   (FIXME: Whether that statement is *really* true or not is unknown.
43
   Are there more subtle differences between pe and pei formats?
44
   For now assume there aren't.  If you find one, then for God sakes
45
   document it here!)
46
 
47
   The Microsoft docs use the word "image" instead of "executable" because
48
   the former can also refer to a DLL (shared library).  Confusion can arise
49
   because the `i' in `pei' also refers to "image".  The `pe' format can
50
   also create images (i.e. executables), it's just that to run on a win32
51
   system you need to use the pei format.
52
 
53
   FIXME: Please add more docs here so the next poor fool that has to hack
54
   on this code has a chance of getting something accomplished without
55
   wasting too much time.
56
*/
57
 
58
#ifndef GET_FCN_LNNOPTR
59
#define GET_FCN_LNNOPTR(abfd, ext) \
60
     bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_lnnoptr)
61
#endif
62
 
63
#ifndef GET_FCN_ENDNDX
64
#define GET_FCN_ENDNDX(abfd, ext)  \
65
        bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_endndx)
66
#endif
67
 
68
#ifndef PUT_FCN_LNNOPTR
69
#define PUT_FCN_LNNOPTR(abfd, in, ext)  bfd_h_put_32(abfd,  in, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_lnnoptr)
70
#endif
71
#ifndef PUT_FCN_ENDNDX
72
#define PUT_FCN_ENDNDX(abfd, in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_endndx)
73
#endif
74
#ifndef GET_LNSZ_LNNO
75
#define GET_LNSZ_LNNO(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *) ext->x_sym.x_misc.x_lnsz.x_lnno)
76
#endif
77
#ifndef GET_LNSZ_SIZE
78
#define GET_LNSZ_SIZE(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *) ext->x_sym.x_misc.x_lnsz.x_size)
79
#endif
80
#ifndef PUT_LNSZ_LNNO
81
#define PUT_LNSZ_LNNO(abfd, in, ext) bfd_h_put_16(abfd, in, (bfd_byte *)ext->x_sym.x_misc.x_lnsz.x_lnno)
82
#endif
83
#ifndef PUT_LNSZ_SIZE
84
#define PUT_LNSZ_SIZE(abfd, in, ext) bfd_h_put_16(abfd, in, (bfd_byte*) ext->x_sym.x_misc.x_lnsz.x_size)
85
#endif
86
#ifndef GET_SCN_SCNLEN
87
#define GET_SCN_SCNLEN(abfd,  ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_scn.x_scnlen)
88
#endif
89
#ifndef GET_SCN_NRELOC
90
#define GET_SCN_NRELOC(abfd,  ext) bfd_h_get_16(abfd, (bfd_byte *)ext->x_scn.x_nreloc)
91
#endif
92
#ifndef GET_SCN_NLINNO
93
#define GET_SCN_NLINNO(abfd, ext)  bfd_h_get_16(abfd, (bfd_byte *)ext->x_scn.x_nlinno)
94
#endif
95
#ifndef PUT_SCN_SCNLEN
96
#define PUT_SCN_SCNLEN(abfd,in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_scn.x_scnlen)
97
#endif
98
#ifndef PUT_SCN_NRELOC
99
#define PUT_SCN_NRELOC(abfd,in, ext) bfd_h_put_16(abfd, in, (bfd_byte *)ext->x_scn.x_nreloc)
100
#endif
101
#ifndef PUT_SCN_NLINNO
102
#define PUT_SCN_NLINNO(abfd,in, ext)  bfd_h_put_16(abfd,in, (bfd_byte  *) ext->x_scn.x_nlinno)
103
#endif
104
#ifndef GET_LINENO_LNNO
105
#define GET_LINENO_LNNO(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *) (ext->l_lnno));
106
#endif
107
#ifndef PUT_LINENO_LNNO
108
#define PUT_LINENO_LNNO(abfd,val, ext) bfd_h_put_16(abfd,val,  (bfd_byte *) (ext->l_lnno));
109
#endif
110
 
111
/* The f_symptr field in the filehdr is sometimes 64 bits.  */
112
#ifndef GET_FILEHDR_SYMPTR
113
#define GET_FILEHDR_SYMPTR bfd_h_get_32
114
#endif
115
#ifndef PUT_FILEHDR_SYMPTR
116
#define PUT_FILEHDR_SYMPTR bfd_h_put_32
117
#endif
118
 
119
/* Some fields in the aouthdr are sometimes 64 bits.  */
120
#ifndef GET_AOUTHDR_TSIZE
121
#define GET_AOUTHDR_TSIZE bfd_h_get_32
122
#endif
123
#ifndef PUT_AOUTHDR_TSIZE
124
#define PUT_AOUTHDR_TSIZE bfd_h_put_32
125
#endif
126
#ifndef GET_AOUTHDR_DSIZE
127
#define GET_AOUTHDR_DSIZE bfd_h_get_32
128
#endif
129
#ifndef PUT_AOUTHDR_DSIZE
130
#define PUT_AOUTHDR_DSIZE bfd_h_put_32
131
#endif
132
#ifndef GET_AOUTHDR_BSIZE
133
#define GET_AOUTHDR_BSIZE bfd_h_get_32
134
#endif
135
#ifndef PUT_AOUTHDR_BSIZE
136
#define PUT_AOUTHDR_BSIZE bfd_h_put_32
137
#endif
138
#ifndef GET_AOUTHDR_ENTRY
139
#define GET_AOUTHDR_ENTRY bfd_h_get_32
140
#endif
141
#ifndef PUT_AOUTHDR_ENTRY
142
#define PUT_AOUTHDR_ENTRY bfd_h_put_32
143
#endif
144
#ifndef GET_AOUTHDR_TEXT_START
145
#define GET_AOUTHDR_TEXT_START bfd_h_get_32
146
#endif
147
#ifndef PUT_AOUTHDR_TEXT_START
148
#define PUT_AOUTHDR_TEXT_START bfd_h_put_32
149
#endif
150
#ifndef GET_AOUTHDR_DATA_START
151
#define GET_AOUTHDR_DATA_START bfd_h_get_32
152
#endif
153
#ifndef PUT_AOUTHDR_DATA_START
154
#define PUT_AOUTHDR_DATA_START bfd_h_put_32
155
#endif
156
 
157
/* Some fields in the scnhdr are sometimes 64 bits.  */
158
#ifndef GET_SCNHDR_PADDR
159
#define GET_SCNHDR_PADDR bfd_h_get_32
160
#endif
161
#ifndef PUT_SCNHDR_PADDR
162
#define PUT_SCNHDR_PADDR bfd_h_put_32
163
#endif
164
#ifndef GET_SCNHDR_VADDR
165
#define GET_SCNHDR_VADDR bfd_h_get_32
166
#endif
167
#ifndef PUT_SCNHDR_VADDR
168
#define PUT_SCNHDR_VADDR bfd_h_put_32
169
#endif
170
#ifndef GET_SCNHDR_SIZE
171
#define GET_SCNHDR_SIZE bfd_h_get_32
172
#endif
173
#ifndef PUT_SCNHDR_SIZE
174
#define PUT_SCNHDR_SIZE bfd_h_put_32
175
#endif
176
#ifndef GET_SCNHDR_SCNPTR
177
#define GET_SCNHDR_SCNPTR bfd_h_get_32
178
#endif
179
#ifndef PUT_SCNHDR_SCNPTR
180
#define PUT_SCNHDR_SCNPTR bfd_h_put_32
181
#endif
182
#ifndef GET_SCNHDR_RELPTR
183
#define GET_SCNHDR_RELPTR bfd_h_get_32
184
#endif
185
#ifndef PUT_SCNHDR_RELPTR
186
#define PUT_SCNHDR_RELPTR bfd_h_put_32
187
#endif
188
#ifndef GET_SCNHDR_LNNOPTR
189
#define GET_SCNHDR_LNNOPTR bfd_h_get_32
190
#endif
191
#ifndef PUT_SCNHDR_LNNOPTR
192
#define PUT_SCNHDR_LNNOPTR bfd_h_put_32
193
#endif
194
 
195
/* These functions are architecture dependent, and are in peicode.h:
196
   coff_swap_reloc_in
197
   int coff_swap_reloc_out
198
   coff_swap_filehdr_in
199
   coff_swap_scnhdr_in
200
   pe_mkobject
201
   pe_mkobject_hook  */
202
 
203
/* The functions described below are common across all PE/PEI
204
   implementations architecture types, and actually appear in
205
   peigen.c.  */
206
 
207
void _bfd_pei_swap_sym_in PARAMS ((bfd*, PTR, PTR));
208
#define coff_swap_sym_in _bfd_pei_swap_sym_in
209
 
210
unsigned int _bfd_pei_swap_sym_out PARAMS ((bfd*, PTR, PTR));
211
#define coff_swap_sym_out _bfd_pei_swap_sym_out
212
 
213
void _bfd_pei_swap_aux_in PARAMS ((bfd *, PTR, int, int, int, int, PTR));
214
#define coff_swap_aux_in _bfd_pei_swap_aux_in
215
 
216
unsigned int _bfd_pei_swap_aux_out \
217
  PARAMS ((bfd *, PTR, int, int, int, int, PTR));
218
#define coff_swap_aux_out _bfd_pei_swap_aux_out
219
 
220
void _bfd_pei_swap_lineno_in PARAMS ((bfd*, PTR, PTR));
221
#define coff_swap_lineno_in _bfd_pei_swap_lineno_in
222
 
223
unsigned int _bfd_pei_swap_lineno_out PARAMS ((bfd*, PTR, PTR));
224
#define coff_swap_lineno_out _bfd_pei_swap_lineno_out
225
 
226
void _bfd_pei_swap_aouthdr_in PARAMS ((bfd*, PTR, PTR));
227
#define coff_swap_aouthdr_in _bfd_pei_swap_aouthdr_in
228
 
229
unsigned int _bfd_pei_swap_aouthdr_out PARAMS ((bfd *, PTR, PTR));
230
#define coff_swap_aouthdr_out _bfd_pei_swap_aouthdr_out
231
 
232
unsigned int _bfd_pei_swap_scnhdr_out PARAMS ((bfd *, PTR, PTR));
233
#define coff_swap_scnhdr_out _bfd_pei_swap_scnhdr_out
234
 
235
boolean _bfd_pe_print_private_bfd_data_common PARAMS ((bfd *, PTR));
236
 
237
boolean _bfd_pe_bfd_copy_private_bfd_data_common PARAMS ((bfd *, bfd *));
238
 
239
void _bfd_pe_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *));
240
 
241
boolean _bfd_pei_final_link_postscript
242
  PARAMS ((bfd *, struct coff_final_link_info *));
243
 
244
#ifndef coff_final_link_postscript
245
#define coff_final_link_postscript _bfd_pei_final_link_postscript
246
#endif
247
/* The following are needed only for ONE of pe or pei, but don't
248
   otherwise vary; peicode.h fixes up ifdefs but we provide the
249
   prototype.  */
250
 
251
unsigned int _bfd_pe_only_swap_filehdr_out PARAMS ((bfd*, PTR, PTR));
252
unsigned int _bfd_pei_only_swap_filehdr_out PARAMS ((bfd*, PTR, PTR));
253
boolean _bfd_pe_bfd_copy_private_section_data
254
  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.