]>
Commit | Line | Data |
---|---|---|
252b5132 RH |
1 | /* PE COFF header information */ |
2 | ||
3 | #ifndef _PE_H | |
4 | #define _PE_H | |
5 | ||
6 | /* NT specific file attributes */ | |
7 | #define IMAGE_FILE_RELOCS_STRIPPED 0x0001 | |
8 | #define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002 | |
9 | #define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004 | |
10 | #define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008 | |
11 | #define IMAGE_FILE_BYTES_REVERSED_LO 0x0080 | |
12 | #define IMAGE_FILE_32BIT_MACHINE 0x0100 | |
13 | #define IMAGE_FILE_DEBUG_STRIPPED 0x0200 | |
14 | #define IMAGE_FILE_SYSTEM 0x1000 | |
15 | #define IMAGE_FILE_DLL 0x2000 | |
16 | #define IMAGE_FILE_BYTES_REVERSED_HI 0x8000 | |
17 | ||
18 | /* additional flags to be set for section headers to allow the NT loader to | |
19 | read and write to the section data (to replace the addresses of data in | |
20 | dlls for one thing); also to execute the section in .text's case */ | |
21 | #define IMAGE_SCN_MEM_DISCARDABLE 0x02000000 | |
22 | #define IMAGE_SCN_MEM_EXECUTE 0x20000000 | |
23 | #define IMAGE_SCN_MEM_READ 0x40000000 | |
24 | #define IMAGE_SCN_MEM_WRITE 0x80000000 | |
25 | ||
26 | /* | |
27 | * Section characteristics added for ppc-nt | |
28 | */ | |
29 | ||
30 | #define IMAGE_SCN_TYPE_NO_PAD 0x00000008 /* Reserved. */ | |
31 | ||
32 | #define IMAGE_SCN_CNT_CODE 0x00000020 /* Section contains code. */ | |
33 | #define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040 /* Section contains initialized data. */ | |
34 | #define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080 /* Section contains uninitialized data. */ | |
35 | ||
36 | #define IMAGE_SCN_LNK_OTHER 0x00000100 /* Reserved. */ | |
37 | #define IMAGE_SCN_LNK_INFO 0x00000200 /* Section contains comments or some other type of information. */ | |
38 | #define IMAGE_SCN_LNK_REMOVE 0x00000800 /* Section contents will not become part of image. */ | |
39 | #define IMAGE_SCN_LNK_COMDAT 0x00001000 /* Section contents comdat. */ | |
40 | ||
41 | #define IMAGE_SCN_MEM_FARDATA 0x00008000 | |
42 | ||
43 | #define IMAGE_SCN_MEM_PURGEABLE 0x00020000 | |
44 | #define IMAGE_SCN_MEM_16BIT 0x00020000 | |
45 | #define IMAGE_SCN_MEM_LOCKED 0x00040000 | |
46 | #define IMAGE_SCN_MEM_PRELOAD 0x00080000 | |
47 | ||
48 | #define IMAGE_SCN_ALIGN_1BYTES 0x00100000 | |
49 | #define IMAGE_SCN_ALIGN_2BYTES 0x00200000 | |
50 | #define IMAGE_SCN_ALIGN_4BYTES 0x00300000 | |
51 | #define IMAGE_SCN_ALIGN_8BYTES 0x00400000 | |
52 | #define IMAGE_SCN_ALIGN_16BYTES 0x00500000 /* Default alignment if no others are specified. */ | |
53 | #define IMAGE_SCN_ALIGN_32BYTES 0x00600000 | |
54 | #define IMAGE_SCN_ALIGN_64BYTES 0x00700000 | |
55 | ||
56 | ||
57 | #define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000 /* Section contains extended relocations. */ | |
58 | #define IMAGE_SCN_MEM_NOT_CACHED 0x04000000 /* Section is not cachable. */ | |
59 | #define IMAGE_SCN_MEM_NOT_PAGED 0x08000000 /* Section is not pageable. */ | |
60 | #define IMAGE_SCN_MEM_SHARED 0x10000000 /* Section is shareable. */ | |
61 | ||
62 | /* COMDAT selection codes. */ | |
63 | ||
64 | #define IMAGE_COMDAT_SELECT_NODUPLICATES (1) /* Warn if duplicates. */ | |
65 | #define IMAGE_COMDAT_SELECT_ANY (2) /* No warning. */ | |
66 | #define IMAGE_COMDAT_SELECT_SAME_SIZE (3) /* Warn if different size. */ | |
67 | #define IMAGE_COMDAT_SELECT_EXACT_MATCH (4) /* Warn if different. */ | |
68 | #define IMAGE_COMDAT_SELECT_ASSOCIATIVE (5) /* Base on other section. */ | |
69 | ||
70 | /* Magic values that are true for all dos/nt implementations */ | |
71 | #define DOSMAGIC 0x5a4d | |
72 | #define NT_SIGNATURE 0x00004550 | |
73 | ||
74 | /* NT allows long filenames, we want to accommodate this. This may break | |
75 | some of the bfd functions */ | |
76 | #undef FILNMLEN | |
77 | #define FILNMLEN 18 /* # characters in a file name */ | |
78 | ||
25bcc51d | 79 | struct external_PEI_filehdr |
252b5132 RH |
80 | { |
81 | /* DOS header fields */ | |
82 | char e_magic[2]; /* Magic number, 0x5a4d */ | |
83 | char e_cblp[2]; /* Bytes on last page of file, 0x90 */ | |
84 | char e_cp[2]; /* Pages in file, 0x3 */ | |
85 | char e_crlc[2]; /* Relocations, 0x0 */ | |
86 | char e_cparhdr[2]; /* Size of header in paragraphs, 0x4 */ | |
87 | char e_minalloc[2]; /* Minimum extra paragraphs needed, 0x0 */ | |
88 | char e_maxalloc[2]; /* Maximum extra paragraphs needed, 0xFFFF */ | |
89 | char e_ss[2]; /* Initial (relative) SS value, 0x0 */ | |
90 | char e_sp[2]; /* Initial SP value, 0xb8 */ | |
91 | char e_csum[2]; /* Checksum, 0x0 */ | |
92 | char e_ip[2]; /* Initial IP value, 0x0 */ | |
93 | char e_cs[2]; /* Initial (relative) CS value, 0x0 */ | |
94 | char e_lfarlc[2]; /* File address of relocation table, 0x40 */ | |
95 | char e_ovno[2]; /* Overlay number, 0x0 */ | |
96 | char e_res[4][2]; /* Reserved words, all 0x0 */ | |
97 | char e_oemid[2]; /* OEM identifier (for e_oeminfo), 0x0 */ | |
98 | char e_oeminfo[2]; /* OEM information; e_oemid specific, 0x0 */ | |
99 | char e_res2[10][2]; /* Reserved words, all 0x0 */ | |
100 | char e_lfanew[4]; /* File address of new exe header, 0x80 */ | |
101 | char dos_message[16][4]; /* other stuff, always follow DOS header */ | |
102 | char nt_signature[4]; /* required NT signature, 0x4550 */ | |
103 | ||
104 | /* From standard header */ | |
105 | ||
106 | ||
107 | char f_magic[2]; /* magic number */ | |
108 | char f_nscns[2]; /* number of sections */ | |
109 | char f_timdat[4]; /* time & date stamp */ | |
110 | char f_symptr[4]; /* file pointer to symtab */ | |
111 | char f_nsyms[4]; /* number of symtab entries */ | |
112 | char f_opthdr[2]; /* sizeof(optional hdr) */ | |
113 | char f_flags[2]; /* flags */ | |
114 | ||
115 | }; | |
116 | ||
25bcc51d ILT |
117 | #ifdef COFF_IMAGE_WITH_PE |
118 | ||
119 | /* The filehdr is only weird in images */ | |
252b5132 | 120 | |
25bcc51d ILT |
121 | #undef FILHDR |
122 | #define FILHDR struct external_PEI_filehdr | |
252b5132 RH |
123 | #undef FILHSZ |
124 | #define FILHSZ 152 | |
125 | ||
25bcc51d | 126 | #endif /* COFF_IMAGE_WITH_PE */ |
252b5132 RH |
127 | |
128 | typedef struct | |
129 | { | |
130 | AOUTHDR standard; | |
131 | ||
132 | /* NT extra fields; see internal.h for descriptions */ | |
133 | char ImageBase[4]; | |
134 | char SectionAlignment[4]; | |
135 | char FileAlignment[4]; | |
136 | char MajorOperatingSystemVersion[2]; | |
137 | char MinorOperatingSystemVersion[2]; | |
138 | char MajorImageVersion[2]; | |
139 | char MinorImageVersion[2]; | |
140 | char MajorSubsystemVersion[2]; | |
141 | char MinorSubsystemVersion[2]; | |
142 | char Reserved1[4]; | |
143 | char SizeOfImage[4]; | |
144 | char SizeOfHeaders[4]; | |
145 | char CheckSum[4]; | |
146 | char Subsystem[2]; | |
147 | char DllCharacteristics[2]; | |
148 | char SizeOfStackReserve[4]; | |
149 | char SizeOfStackCommit[4]; | |
150 | char SizeOfHeapReserve[4]; | |
151 | char SizeOfHeapCommit[4]; | |
152 | char LoaderFlags[4]; | |
153 | char NumberOfRvaAndSizes[4]; | |
154 | /* IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; */ | |
155 | char DataDirectory[16][2][4]; /* 16 entries, 2 elements/entry, 4 chars */ | |
156 | ||
157 | } PEAOUTHDR; | |
158 | ||
159 | ||
160 | #undef AOUTSZ | |
161 | #define AOUTSZ (AOUTHDRSZ + 196) | |
162 | ||
163 | #undef E_FILNMLEN | |
164 | #define E_FILNMLEN 18 /* # characters in a file name */ | |
165 | #endif | |
166 | ||
167 | ||
168 |