5755458 [rkeene@sledge /home/rkeene/devel/cygwin-stuff/cyg-root/usr/include]$ cat -n a.out.h
  1 #ifndef _A_OUT_H_
  2 #define _A_OUT_H_
  3 
  4 #ifdef __cplusplus
  5 extern "C" {
  6 #endif
  7 #define COFF_IMAGE_WITH_PE
  8 #define COFF_LONG_SECTION_NAMES
  9 
 10 /*** coff information for Intel 386/486.  */
 11 
 12 
 13 /********************** FILE HEADER **********************/
 14 
 15 struct external_filehdr {
 16   short f_magic;    /* magic number         */
 17   short f_nscns;    /* number of sections       */
 18   unsigned long f_timdat;   /* time & date stamp        */
 19   unsigned long f_symptr;   /* file pointer to symtab   */
 20   unsigned long f_nsyms;    /* number of symtab entries */
 21   short f_opthdr;   /* sizeof(optional hdr)     */
 22   short f_flags;    /* flags            */
 23 };
 24 
 25 /* Bits for f_flags:
 26  *  F_RELFLG    relocation info stripped from file
 27  *  F_EXEC      file is executable (no unresolved external references)
 28  *  F_LNNO      line numbers stripped from file
 29  *  F_LSYMS     local symbols stripped from file
 30  *  F_AR32WR    file has byte ordering of an AR32WR machine (e.g. vax)
 31  */
 32 
 33 #define F_RELFLG    (0x0001)
 34 #define F_EXEC      (0x0002)
 35 #define F_LNNO      (0x0004)
 36 #define F_LSYMS     (0x0008)
 37 
 38 
 39 
 40 #define I386MAGIC   0x14c
 41 #define I386PTXMAGIC    0x154
 42 #define I386AIXMAGIC    0x175
 43 
 44 /* This is Lynx's all-platform magic number for executables. */
 45 
 46 #define LYNXCOFFMAGIC   0415
 47 
 48 #define I386BADMAG(x) (((x).f_magic != I386MAGIC) \
 49                && (x).f_magic != I386AIXMAGIC \
 50                && (x).f_magic != I386PTXMAGIC \
 51                && (x).f_magic != LYNXCOFFMAGIC)
 52 
 53 #define FILHDR  struct external_filehdr
 54 #define FILHSZ  20
 55 
 56 
 57 /********************** AOUT "OPTIONAL HEADER"=
 58  **********************/
 59 
 60 
 61 typedef struct
 62 {
 63   unsigned short magic;     /* type of file             */
 64   unsigned short vstamp;    /* version stamp            */
 65   unsigned long tsize;      /* text size in bytes, padded to FW bdry*/
 66   unsigned long dsize;      /* initialized data "  "        */
 67   unsigned long bsize;      /* uninitialized data "   "     */
 68   unsigned long entry;      /* entry pt.                */
 69   unsigned long text_start; /* base of text used for this file */
 70   unsigned long data_start; /* base of data used for this file=
 71  */
 72 }
 73 AOUTHDR;
 74 
 75 #define AOUTSZ 28
 76 #define AOUTHDRSZ 28
 77 
 78 #define OMAGIC          0404    /* object files, eg as output */
 79 #define ZMAGIC          0413    /* demand load format, eg normal ld output */
 80 #define STMAGIC     0401    /* target shlib */
 81 #define SHMAGIC     0443    /* host   shlib */
 82 
 83 
 84 /* define some NT default values */
 85 /*  #define NT_IMAGE_BASE        0x400000 moved to internal.h */
 86 #define NT_SECTION_ALIGNMENT 0x1000
 87 #define NT_FILE_ALIGNMENT    0x200
 88 #define NT_DEF_RESERVE       0x100000
 89 #define NT_DEF_COMMIT        0x1000
 90 
 91 /********************** SECTION HEADER **********************/
 92 
 93 
 94 struct external_scnhdr {
 95   char      s_name[8];  /* section name         */
 96   unsigned long s_paddr;    /* physical address, offset
 97                    of last addr in scn */
 98   unsigned long s_vaddr;    /* virtual address      */
 99   unsigned long s_size;     /* section size         */
100   unsigned long s_scnptr;   /* file ptr to raw data for section */
101   unsigned long s_relptr;   /* file ptr to relocation   */
102   unsigned long s_lnnoptr;  /* file ptr to line numbers */
103   unsigned short s_nreloc;  /* number of relocation entries */
104   unsigned short s_nlnno;   /* number of line number entries*/
105   unsigned long s_flags;    /* flags            */
106 };
107 
108 #define SCNHDR  struct external_scnhdr
109 #define SCNHSZ  40
110 
111 /*
112  * names of "special" sections
113  */
114 #define _TEXT   ".text"
115 #define _DATA   ".data"
116 #define _BSS    ".bss"
117 #define _COMMENT ".comment"
118 #define _LIB ".lib"
119 
120 /********************** LINE NUMBERS **********************/
121 
122 /* 1 line number entry for every "breakpointable" source line in a section.
123  * Line numbers are grouped on a per function basis; first entry in a function
124  * grouping will have l_lnno = 0 and in place of physical address will be the
125  * symbol table index of the function name.
126  */
127 struct external_lineno {
128   union {
129     unsigned long l_symndx; /* function name symbol index, iff l_lnno 0 */
130     unsigned long l_paddr;  /* (physical) address of line number    */
131   } l_addr;
132   unsigned short l_lnno;    /* line number      */
133 };
134 
135 #define LINENO  struct external_lineno
136 #define LINESZ  6
137 
138 /********************** SYMBOLS **********************/
139 
140 #define E_SYMNMLEN  8   /* # characters in a symbol name    */
141 #define E_FILNMLEN  14  /* # characters in a file name      */
142 #define E_DIMNUM    4   /* # array dimensions in auxiliary entry */
143 
144 struct external_syment
145 {
146   union {
147     char e_name[E_SYMNMLEN];
148     struct {
149       unsigned long e_zeroes;
150       unsigned long e_offset;
151     } e;
152   } e;
153   unsigned long e_value;
154   unsigned short e_scnum;
155   unsigned short e_type;
156   char e_sclass[1];
157   char e_numaux[1];
158 };
159 
160 #define N_BTMASK    (0xf)
161 #define N_TMASK     (0x30)
162 #define N_BTSHFT    (4)
163 #define N_TSHIFT    (2)
164 
165 union external_auxent {
166   struct {
167     unsigned long x_tagndx; /* str, un, or enum tag indx */
168     union {
169       struct {
170     unsigned short  x_lnno; /* declaration line number */
171     unsigned short  x_size; /* str/union/array size */
172       } x_lnsz;
173       unsigned long x_fsize;    /* size of function */
174     } x_misc;
175     union {
176       struct {          /* if ISFCN, tag, or .bb */
177     unsigned long x_lnnoptr;/* ptr to fcn line # */
178     unsigned long x_endndx; /* entry ndx past block end */
179       } x_fcn;
180       struct {          /* if ISARY, up to 4 dimen. */
181     char x_dimen[E_DIMNUM][2];
182       } x_ary;
183     } x_fcnary;
184     unsigned short x_tvndx; /* tv index */
185   } x_sym;
186 
187   union {
188     char x_fname[E_FILNMLEN];
189     struct {
190       unsigned long x_zeroes;
191       unsigned long x_offset;
192     } x_n;
193   } x_file;
194 
195   struct {
196     unsigned long x_scnlen; /* section length */
197     unsigned short x_nreloc;    /* # relocation entries */
198     unsigned short x_nlinno;    /* # line numbers */
199     unsigned long x_checksum;   /* section COMDAT checksum */
200     unsigned short x_associated;/* COMDAT associated section index */
201     char x_comdat[1];       /* COMDAT selection number */
202   } x_scn;
203 
204   struct {
205     unsigned long x_tvfill; /* tv fill value */
206     unsigned short x_tvlen; /* length of .tv */
207     char x_tvran[2][2];     /* tv range */
208   } x_tv;   /* info about .tv section (in auxent of symbol .tv)) */
209 
210 };
211 
212 #define SYMENT  struct external_syment
213 #define SYMESZ  18
214 #define AUXENT  union external_auxent
215 #define AUXESZ  18
216 
217 #define _ETEXT  "etext"
218 
219 /********************** RELOCATION DIRECTIVES **********************/
220 
221 struct external_reloc {
222   char r_vaddr[4];
223   char r_symndx[4];
224   char r_type[2];
225 };
226 
227 #define RELOC struct external_reloc
228 #define RELSZ 10
229 
230 /* end of coff/i386.h */
231 
232 /* PE COFF header information */
233 
234 #ifndef _PE_H
235 #define _PE_H
236 
237 /* NT specific file attributes */
238 #define IMAGE_FILE_RELOCS_STRIPPED           0x0001
239 #define IMAGE_FILE_EXECUTABLE_IMAGE          0x0002
240 #define IMAGE_FILE_LINE_NUMS_STRIPPED        0x0004
241 #define IMAGE_FILE_LOCAL_SYMS_STRIPPED       0x0008
242 #define IMAGE_FILE_BYTES_REVERSED_LO         0x0080
243 #define IMAGE_FILE_32BIT_MACHINE             0x0100
244 #define IMAGE_FILE_DEBUG_STRIPPED            0x0200
245 #define IMAGE_FILE_SYSTEM                    0x1000
246 #define IMAGE_FILE_DLL                       0x2000
247 #define IMAGE_FILE_BYTES_REVERSED_HI         0x8000
248 
249 /* additional flags to be set for section headers to allow the NT loader to
250    read and write to the section data (to replace the addresses of data in
251    dlls for one thing); also to execute the section in .text's case=
252  */
253 #define IMAGE_SCN_MEM_DISCARDABLE 0x02000000
254 #define IMAGE_SCN_MEM_EXECUTE     0x20000000
255 #define IMAGE_SCN_MEM_READ        0x40000000
256 #define IMAGE_SCN_MEM_WRITE       0x80000000
257 
258 /*
259  * Section characteristics added for ppc-nt
260  */
261 
262 #define IMAGE_SCN_TYPE_NO_PAD                0x00000008  /* Reserved.  */
263 
264 #define IMAGE_SCN_CNT_CODE                   0x00000020  /* Section contains code. */
265 #define IMAGE_SCN_CNT_INITIALIZED_DATA       0x00000040  /* Section contains initialized data. */
266 #define IMAGE_SCN_CNT_UNINITIALIZED_DATA     0x00000080  /* Section contains uninitialized data. */
267 
268 #define IMAGE_SCN_LNK_OTHER                  0x00000100  /* Reserved.  */
269 #define IMAGE_SCN_LNK_INFO                   0x00000200  /* Section contains comments or some other type of information.
	*/
270 #define IMAGE_SCN_LNK_REMOVE                 0x00000800  /* Section contents will not become part of image. */
271 #define IMAGE_SCN_LNK_COMDAT                 0x00001000  /* Section contents comdat. */
272 
273 #define IMAGE_SCN_MEM_FARDATA                0x00008000
274 
275 #define IMAGE_SCN_MEM_PURGEABLE              0x00020000
276 #define IMAGE_SCN_MEM_16BIT                  0x00020000
277 #define IMAGE_SCN_MEM_LOCKED                 0x00040000
278 #define IMAGE_SCN_MEM_PRELOAD                0x00080000
279 
280 #define IMAGE_SCN_ALIGN_1BYTES               0x00100000
281 #define IMAGE_SCN_ALIGN_2BYTES               0x00200000
282 #define IMAGE_SCN_ALIGN_4BYTES               0x00300000
283 #define IMAGE_SCN_ALIGN_8BYTES               0x00400000
284 #define IMAGE_SCN_ALIGN_16BYTES              0x00500000  /* Default alignment if no others are specified. */
285 #define IMAGE_SCN_ALIGN_32BYTES              0x00600000
286 #define IMAGE_SCN_ALIGN_64BYTES              0x00700000
287 
288 
289 #define IMAGE_SCN_LNK_NRELOC_OVFL            0x01000000  /* Section contains extended relocations. */
290 #define IMAGE_SCN_MEM_NOT_CACHED             0x04000000  /* Section is not cachable.               */
291 #define IMAGE_SCN_MEM_NOT_PAGED              0x08000000  /* Section is not pageable.               */
292 #define IMAGE_SCN_MEM_SHARED                 0x10000000  /* Section is shareable.                  */
293 
294 /* COMDAT selection codes.  */
295 
296 #define IMAGE_COMDAT_SELECT_NODUPLICATES     (1) /* Warn if duplicates.  */
297 #define IMAGE_COMDAT_SELECT_ANY          (2) /* No warning.  */
298 #define IMAGE_COMDAT_SELECT_SAME_SIZE        (3) /* Warn if different size.  */
299 #define IMAGE_COMDAT_SELECT_EXACT_MATCH      (4) /* Warn if different.  */
300 #define IMAGE_COMDAT_SELECT_ASSOCIATIVE      (5) /* Base on other section.  */
301 
302 /* Magic values that are true for all dos/nt implementations */
303 #define DOSMAGIC       0x5a4d
304 #define NT_SIGNATURE   0x00004550
305 
306 /* NT allows long filenames, we want to accommodate this.  This may break
307      some of the bfd functions */
308 #undef  FILNMLEN
309 #define FILNMLEN    18  /* # characters in a file name      */
310 
311 
312 #ifdef COFF_IMAGE_WITH_PE
313 /* The filehdr is only weired in images */
314 
315 #undef FILHDR
316 struct external_PE_filehdr
317 {
318   /* DOS header fields */
319   unsigned short e_magic;   /* Magic number, 0x5a4d */
320   unsigned short e_cblp;    /* Bytes on last page of file, 0x90 */
321   unsigned short e_cp;      /* Pages in file, 0x3 */
322   unsigned short e_crlc;    /* Relocations, 0x0 */
323   unsigned short e_cparhdr; /* Size of header in paragraphs, 0x4 */
324   unsigned short e_minalloc;    /* Minimum extra paragraphs needed, 0x0 */
325   unsigned short e_maxalloc;    /* Maximum extra paragraphs needed, 0xFFFF */
326   unsigned short e_ss;      /* Initial (relative) SS value, 0x0 */
327   unsigned short e_sp;      /* Initial SP value, 0xb8 */
328   unsigned short e_csum;    /* Checksum, 0x0 */
329   unsigned short e_ip;      /* Initial IP value, 0x0 */
330   unsigned short e_cs;      /* Initial (relative) CS value, 0x0 */
331   unsigned short e_lfarlc;  /* File address of relocation table, 0x40 */
332   unsigned short e_ovno;    /* Overlay number, 0x0 */
333   char e_res[4][2];     /* Reserved words, all 0x0 */
334   unsigned short e_oemid;   /* OEM identifier (for e_oeminfo), 0x0 */
335   unsigned short e_oeminfo; /* OEM information; e_oemid specific, 0x0 */
336   char e_res2[10][2];       /* Reserved words, all 0x0 */
337   unsigned long e_lfanew;   /* File address of new exe header, 0x80 */
338   char dos_message[16][4];  /* other stuff, always follow DOS header */
339   unsigned int nt_signature;    /* required NT signature, 0x4550 */
340 
341   /* From standard header */
342 
343   unsigned short f_magic;   /* magic number         */
344   unsigned short f_nscns;   /* number of sections       */
345   unsigned long f_timdat;   /* time & date stamp        */
346   unsigned long f_symptr;   /* file pointer to symtab   */
347   unsigned long f_nsyms;    /* number of symtab entries */
348   unsigned short f_opthdr;  /* sizeof(optional hdr)     */
349   unsigned short f_flags;   /* flags            */
350 };
351 
352 
353 #define FILHDR struct external_PE_filehdr
354 #undef FILHSZ
355 #define FILHSZ 152
356 
357 #endif
358 
359 typedef struct
360 {
361   unsigned short magic;     /* type of file             */
362   unsigned short vstamp;    /* version stamp            */
363   unsigned long tsize;      /* text size in bytes, padded to FW bdry*/
364   unsigned long dsize;      /* initialized data "  "        */
365   unsigned long bsize;      /* uninitialized data "   "     */
366   unsigned long entry;      /* entry pt.                */
367   unsigned long text_start; /* base of text used for this file */
368   unsigned long data_start; /* base of all data used for this file */
369 
370   /* NT extra fields; see internal.h for descriptions */
371   unsigned long  ImageBase;
372   unsigned long  SectionAlignment;
373   unsigned long  FileAlignment;
374   unsigned short  MajorOperatingSystemVersion;
375   unsigned short  MinorOperatingSystemVersion;
376   unsigned short  MajorImageVersion;
377   unsigned short  MinorImageVersion;
378   unsigned short  MajorSubsystemVersion;
379   unsigned short  MinorSubsystemVersion;
380   char  Reserved1[4];
381   unsigned long  SizeOfImage;
382   unsigned long  SizeOfHeaders;
383   unsigned long  CheckSum;
384   unsigned short Subsystem;
385   unsigned short DllCharacteristics;
386   unsigned long  SizeOfStackReserve;
387   unsigned long  SizeOfStackCommit;
388   unsigned long  SizeOfHeapReserve;
389   unsigned long  SizeOfHeapCommit;
390   unsigned long  LoaderFlags;
391   unsigned long  NumberOfRvaAndSizes;
392   /* IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; */
393   char  DataDirectory[16][2][4]; /* 16 entries, 2 elements/entry, 4 chars */
394 
395 } PEAOUTHDR;
396 
397 
398 #undef AOUTSZ
399 #define AOUTSZ (AOUTHDRSZ + 196)
400 
401 #undef  E_FILNMLEN
402 #define E_FILNMLEN  18  /* # characters in a file name      */
403 #endif
404 
405 /* end of coff/pe.h */
406 
407 #define DT_NON      (0) /* no derived type */
408 #define DT_PTR      (1) /* pointer */
409 #define DT_FCN      (2) /* function */
410 #define DT_ARY      (3) /* array */
411 
412 #define ISPTR(x)    (((x) & N_TMASK) == (DT_PTR << N_BTSHFT))
413 #define ISFCN(x)    (((x) & N_TMASK) == (DT_FCN << N_BTSHFT))
414 #define ISARY(x)    (((x) & N_TMASK) == (DT_ARY << N_BTSHFT))
415 
416 #ifdef __cplusplus
417 }
418 #endif
419 
420 #endif /* _A_OUT_H_ */
5755459 [rkeene@sledge /home/rkeene/devel/cygwin-stuff/cyg-root/usr/include]$

Click here to go back to the directory listing.
Click here to download this file.
last modified: 2001-01-31 15:09:07