Rev 5191 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5191 | Rev 6324 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | /* Internal format of COFF object file data structures, for GNU BFD. |
1 | /* Internal format of COFF object file data structures, for GNU BFD. |
2 | This file is part of BFD, the Binary File Descriptor library. |
2 | This file is part of BFD, the Binary File Descriptor library. |
Line 3... | Line -... | ||
3 | - | ||
4 | Copyright 1999, 2000, 2001, 2002, 2003, 2004. 2005, 2006, 2007, 2009, |
3 | |
Line 5... | Line 4... | ||
5 | 2010 Free Software Foundation, Inc. |
4 | Copyright (C) 1999-2015 Free Software Foundation, Inc. |
6 | 5 | ||
7 | This program is free software; you can redistribute it and/or modify |
6 | 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 |
7 | it under the terms of the GNU General Public License as published by |
Line 72... | Line 71... | ||
72 | created in BFD have no pre-set go32stub. */ |
71 | created in BFD have no pre-set go32stub. */ |
73 | char go32stub[GO32_STUBSIZE]; |
72 | char go32stub[GO32_STUBSIZE]; |
Line 74... | Line 73... | ||
74 | 73 | ||
75 | /* Standard coff internal info. */ |
74 | /* Standard coff internal info. */ |
76 | unsigned short f_magic; /* magic number */ |
75 | unsigned short f_magic; /* magic number */ |
77 | unsigned short f_nscns; /* number of sections */ |
76 | unsigned int f_nscns; /* number of sections */ |
78 | long f_timdat; /* time & date stamp */ |
77 | long f_timdat; /* time & date stamp */ |
79 | bfd_vma f_symptr; /* file pointer to symtab */ |
78 | bfd_vma f_symptr; /* file pointer to symtab */ |
80 | long f_nsyms; /* number of symtab entries */ |
79 | long f_nsyms; /* number of symtab entries */ |
81 | unsigned short f_opthdr; /* sizeof(optional hdr) */ |
80 | unsigned short f_opthdr; /* sizeof(optional hdr) */ |
Line 131... | Line 130... | ||
131 | #define PE_DELAY_IMPORT_DESCRIPTOR 13 |
130 | #define PE_DELAY_IMPORT_DESCRIPTOR 13 |
132 | #define PE_CLR_RUNTIME_HEADER 14 |
131 | #define PE_CLR_RUNTIME_HEADER 14 |
133 | /* DataDirectory[15] is currently reserved, so no define. */ |
132 | /* DataDirectory[15] is currently reserved, so no define. */ |
134 | #define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16 |
133 | #define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16 |
Line -... | Line 134... | ||
- | 134 | ||
- | 135 | /* Extra structure used in debug directory. */ |
|
- | 136 | struct internal_IMAGE_DEBUG_DIRECTORY |
|
- | 137 | { |
|
- | 138 | unsigned long Characteristics; |
|
- | 139 | unsigned long TimeDateStamp; |
|
- | 140 | unsigned short MajorVersion; |
|
- | 141 | unsigned short MinorVersion; |
|
- | 142 | unsigned long Type; |
|
- | 143 | unsigned long SizeOfData; |
|
- | 144 | unsigned long AddressOfRawData; |
|
- | 145 | unsigned long PointerToRawData; |
|
- | 146 | }; |
|
- | 147 | ||
- | 148 | #define PE_IMAGE_DEBUG_TYPE_UNKNOWN 0 |
|
- | 149 | #define PE_IMAGE_DEBUG_TYPE_COFF 1 |
|
- | 150 | #define PE_IMAGE_DEBUG_TYPE_CODEVIEW 2 |
|
- | 151 | #define PE_IMAGE_DEBUG_TYPE_FPO 3 |
|
- | 152 | #define PE_IMAGE_DEBUG_TYPE_MISC 4 |
|
- | 153 | #define PE_IMAGE_DEBUG_TYPE_EXCEPTION 5 |
|
- | 154 | #define PE_IMAGE_DEBUG_TYPE_FIXUP 6 |
|
- | 155 | #define PE_IMAGE_DEBUG_TYPE_OMAP_TO_SRC 7 |
|
- | 156 | #define PE_IMAGE_DEBUG_TYPE_OMAP_FROM_SRC 8 |
|
- | 157 | #define PE_IMAGE_DEBUG_TYPE_BORLAND 9 |
|
- | 158 | #define PE_IMAGE_DEBUG_TYPE_RESERVED10 10 |
|
- | 159 | #define PE_IMAGE_DEBUG_TYPE_CLSID 11 |
|
- | 160 | ||
- | 161 | /* Extra structure for a codeview debug record */ |
|
- | 162 | #define CV_INFO_SIGNATURE_LENGTH 16 |
|
- | 163 | ||
- | 164 | typedef struct _CODEVIEW_INFO |
|
- | 165 | { |
|
- | 166 | unsigned long CVSignature; |
|
- | 167 | char Signature[CV_INFO_SIGNATURE_LENGTH]; |
|
- | 168 | unsigned int SignatureLength; |
|
- | 169 | unsigned long Age; |
|
- | 170 | // char PdbFileName[]; |
|
- | 171 | } CODEVIEW_INFO; |
|
135 | 172 | ||
136 | /* Default image base for NT. */ |
173 | /* Default image base for NT. */ |
137 | #define NT_EXE_IMAGE_BASE 0x400000 |
174 | #define NT_EXE_IMAGE_BASE 0x400000 |
Line 138... | Line 175... | ||
138 | #define NT_DLL_IMAGE_BASE 0x10000000 |
175 | #define NT_DLL_IMAGE_BASE 0x10000000 |
Line 151... | Line 188... | ||
151 | struct internal_extra_pe_aouthdr |
188 | struct internal_extra_pe_aouthdr |
152 | { |
189 | { |
153 | /* FIXME: The following entries are in AOUTHDR. But they aren't |
190 | /* FIXME: The following entries are in AOUTHDR. But they aren't |
154 | available internally in bfd. We add them here so that objdump |
191 | available internally in bfd. We add them here so that objdump |
155 | can dump them. */ |
192 | can dump them. */ |
156 | /* The state of the image file */ |
193 | /* The state of the image file. */ |
157 | short Magic; |
194 | short Magic; |
158 | /* Linker major version number */ |
195 | /* Linker major version number. */ |
159 | char MajorLinkerVersion; |
196 | char MajorLinkerVersion; |
160 | /* Linker minor version number */ |
197 | /* Linker minor version number. */ |
161 | char MinorLinkerVersion; |
198 | char MinorLinkerVersion; |
162 | /* Total size of all code sections */ |
199 | /* Total size of all code sections. */ |
163 | long SizeOfCode; |
200 | long SizeOfCode; |
164 | /* Total size of all initialized data sections */ |
201 | /* Total size of all initialized data sections. */ |
165 | long SizeOfInitializedData; |
202 | long SizeOfInitializedData; |
166 | /* Total size of all uninitialized data sections */ |
203 | /* Total size of all uninitialized data sections. */ |
167 | long SizeOfUninitializedData; |
204 | long SizeOfUninitializedData; |
168 | /* Address of entry point relative to image base. */ |
205 | /* Address of entry point relative to image base. */ |
169 | bfd_vma AddressOfEntryPoint; |
206 | bfd_vma AddressOfEntryPoint; |
170 | /* Address of the first code section relative to image base. */ |
207 | /* Address of the first code section relative to image base. */ |
171 | bfd_vma BaseOfCode; |
208 | bfd_vma BaseOfCode; |
172 | /* Address of the first data section relative to image base. */ |
209 | /* Address of the first data section relative to image base. */ |
173 | bfd_vma BaseOfData; |
210 | bfd_vma BaseOfData; |
Line 174... | Line 211... | ||
174 | 211 | ||
175 | /* PE stuff */ |
212 | /* PE stuff */ |
176 | bfd_vma ImageBase; /* address of specific location in memory that |
213 | bfd_vma ImageBase; /* Address of specific location in memory that |
Line 177... | Line 214... | ||
177 | file is located, NT default 0x10000 */ |
214 | file is located, NT default 0x10000. */ |
178 | 215 | ||
179 | bfd_vma SectionAlignment; /* section alignment default 0x1000 */ |
216 | bfd_vma SectionAlignment; /* Section alignment default 0x1000. */ |
180 | bfd_vma FileAlignment; /* file alignment default 0x200 */ |
217 | bfd_vma FileAlignment; /* File alignment default 0x200. */ |
181 | short MajorOperatingSystemVersion; /* minimum version of the operating */ |
218 | short MajorOperatingSystemVersion; /* Minimum version of the operating. */ |
182 | short MinorOperatingSystemVersion; /* system req'd for exe, default to 1*/ |
219 | short MinorOperatingSystemVersion; /* System req'd for exe, default to 1. */ |
183 | short MajorImageVersion; /* user defineable field to store version of */ |
220 | short MajorImageVersion; /* User defineable field to store version of */ |
184 | short MinorImageVersion; /* exe or dll being created, default to 0 */ |
221 | short MinorImageVersion; /* exe or dll being created, default to 0. */ |
185 | short MajorSubsystemVersion; /* minimum subsystem version required to */ |
222 | short MajorSubsystemVersion; /* Minimum subsystem version required to */ |
186 | short MinorSubsystemVersion; /* run exe; default to 3.1 */ |
223 | short MinorSubsystemVersion; /* run exe; default to 3.1. */ |
187 | long Reserved1; /* seems to be 0 */ |
224 | long Reserved1; /* Seems to be 0. */ |
188 | long SizeOfImage; /* size of memory to allocate for prog */ |
225 | long SizeOfImage; /* Size of memory to allocate for prog. */ |
189 | long SizeOfHeaders; /* size of PE header and section table */ |
226 | long SizeOfHeaders; /* Size of PE header and section table. */ |
Line 190... | Line 227... | ||
190 | long CheckSum; /* set to 0 */ |
227 | long CheckSum; /* Set to 0. */ |
191 | short Subsystem; |
228 | short Subsystem; |
192 | 229 | ||
193 | /* type of subsystem exe uses for user interface, |
230 | /* Type of subsystem exe uses for user interface, |
194 | possible values: |
231 | possible values: |
195 | 1 - NATIVE Doesn't require a subsystem |
232 | 1 - NATIVE Doesn't require a subsystem |
196 | 2 - WINDOWS_GUI runs in Windows GUI subsystem |
233 | 2 - WINDOWS_GUI runs in Windows GUI subsystem |
197 | 3 - WINDOWS_CUI runs in Windows char sub. (console app) |
234 | 3 - WINDOWS_CUI runs in Windows char sub. (console app) |
198 | 5 - OS2_CUI runs in OS/2 character subsystem |
235 | 5 - OS2_CUI runs in OS/2 character subsystem |
199 | 7 - POSIX_CUI runs in Posix character subsystem */ |
236 | 7 - POSIX_CUI runs in Posix character subsystem. */ |
200 | unsigned short DllCharacteristics; /* flags for DLL init */ |
237 | unsigned short DllCharacteristics; /* flags for DLL init. */ |
201 | bfd_vma SizeOfStackReserve; /* amount of memory to reserve */ |
238 | bfd_vma SizeOfStackReserve; /* Amount of memory to reserve. */ |
202 | bfd_vma SizeOfStackCommit; /* amount of memory initially committed for |
239 | bfd_vma SizeOfStackCommit; /* Amount of memory initially committed for |
203 | initial thread's stack, default is 0x1000 */ |
240 | initial thread's stack, default is 0x1000. */ |
204 | bfd_vma SizeOfHeapReserve; /* amount of virtual memory to reserve and */ |
241 | bfd_vma SizeOfHeapReserve; /* Amount of virtual memory to reserve and */ |
205 | bfd_vma SizeOfHeapCommit; /* commit, don't know what to defaut it to */ |
242 | bfd_vma SizeOfHeapCommit; /* commit, don't know what to defaut it to. */ |
206 | long LoaderFlags; /* can probably set to 0 */ |
243 | long LoaderFlags; /* Can probably set to 0. */ |
Line 207... | Line 244... | ||
207 | long NumberOfRvaAndSizes; /* number of entries in next entry, 16 */ |
244 | long NumberOfRvaAndSizes; /* Number of entries in next entry, 16. */ |
208 | IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; |
245 | IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; |
Line 549... | Line 586... | ||
549 | unsigned short x_tvndx; /* tv index */ |
586 | unsigned short x_tvndx; /* tv index */ |
550 | } x_sym; |
587 | } x_sym; |
Line 551... | Line 588... | ||
551 | 588 | ||
552 | union |
589 | union |
- | 590 | { |
|
- | 591 | /* PR 17754: We use to FILNMLEN for the size of the x_fname |
|
- | 592 | array, but that cause problems as PE targets use a larger |
|
- | 593 | value. We cannot use their definition of EFILNMLEN as this |
|
553 | { |
594 | header can be used without including any PE headers. */ |
554 | char x_fname[FILNMLEN]; |
595 | char x_fname[20]; |
555 | struct |
596 | struct |
556 | { |
597 | { |
557 | long x_zeroes; |
598 | long x_zeroes; |
558 | long x_offset; |
599 | long x_offset; |