1
/*** coff information for Intel 386/486. */
4
/********************** FILE HEADER **********************/
6
struct external_filehdr {
7
char f_magic[2]; /* magic number */
8
char f_nscns[2]; /* number of sections */
9
char f_timdat[4]; /* time & date stamp */
10
char f_symptr[4]; /* file pointer to symtab */
11
char f_nsyms[4]; /* number of symtab entries */
12
char f_opthdr[2]; /* sizeof(optional hdr) */
13
char f_flags[2]; /* flags */
17
* F_RELFLG relocation info stripped from file
18
* F_EXEC file is executable (no unresolved external references)
19
* F_LNNO line numbers stripped from file
20
* F_LSYMS local symbols stripped from file
21
* F_AR32WR file has byte ordering of an AR32WR machine (e.g. vax)
24
#define F_RELFLG (0x0001)
25
#define F_EXEC (0x0002)
26
#define F_LNNO (0x0004)
27
#define F_LSYMS (0x0008)
31
#define I386MAGIC 0x14c
32
#define I386PTXMAGIC 0x154
33
#define I386AIXMAGIC 0x175
35
/* This is Lynx's all-platform magic number for executables. */
37
#define LYNXCOFFMAGIC 0415
39
#define I386BADMAG(x) (((x).f_magic != I386MAGIC) \
40
&& (x).f_magic != I386AIXMAGIC \
41
&& (x).f_magic != I386PTXMAGIC \
42
&& (x).f_magic != LYNXCOFFMAGIC)
44
#define FILHDR struct external_filehdr
48
/********************** AOUT "OPTIONAL HEADER" **********************/
53
char magic[2]; /* type of file */
54
char vstamp[2]; /* version stamp */
55
char tsize[4]; /* text size in bytes, padded to FW bdry*/
56
char dsize[4]; /* initialized data " " */
57
char bsize[4]; /* uninitialized data " " */
58
char entry[4]; /* entry pt. */
59
char text_start[4]; /* base of text used for this file */
60
char data_start[4]; /* base of data used for this file */
70
#define OMAGIC 0404 /* object files, eg as output */
71
#define ZMAGIC 0413 /* demand load format, eg normal ld output */
72
#define STMAGIC 0401 /* target shlib */
73
#define SHMAGIC 0443 /* host shlib */
76
/* define some NT default values */
77
/* #define NT_IMAGE_BASE 0x400000 moved to internal.h */
78
#define NT_SECTION_ALIGNMENT 0x1000
79
#define NT_FILE_ALIGNMENT 0x200
80
#define NT_DEF_RESERVE 0x100000
81
#define NT_DEF_COMMIT 0x1000
83
/********************** SECTION HEADER **********************/
86
struct external_scnhdr {
87
char s_name[8]; /* section name */
88
char s_paddr[4]; /* physical address, aliased s_nlib */
89
char s_vaddr[4]; /* virtual address */
90
char s_size[4]; /* section size */
91
char s_scnptr[4]; /* file ptr to raw data for section */
92
char s_relptr[4]; /* file ptr to relocation */
93
char s_lnnoptr[4]; /* file ptr to line numbers */
94
char s_nreloc[2]; /* number of relocation entries */
95
char s_nlnno[2]; /* number of line number entries*/
96
char s_flags[4]; /* flags */
99
#define SCNHDR struct external_scnhdr
103
* names of "special" sections
105
#define _TEXT ".text"
106
#define _DATA ".data"
108
#define _COMMENT ".comment"
111
/********************** LINE NUMBERS **********************/
113
/* 1 line number entry for every "breakpointable" source line in a section.
114
* Line numbers are grouped on a per function basis; first entry in a function
115
* grouping will have l_lnno = 0 and in place of physical address will be the
116
* symbol table index of the function name.
118
struct external_lineno {
120
char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/
121
char l_paddr[4]; /* (physical) address of line number */
123
char l_lnno[2]; /* line number */
127
#define LINENO struct external_lineno
131
/********************** SYMBOLS **********************/
133
#define E_SYMNMLEN 8 /* # characters in a symbol name */
134
#define E_FILNMLEN 14 /* # characters in a file name */
135
#define E_DIMNUM 4 /* # array dimensions in auxiliary entry */
137
struct external_syment
140
char e_name[E_SYMNMLEN];
153
#if !defined(__MINGW32__) && !defined(__CYGWIN__)
155
#define N_BTMASK (0xf)
156
#define N_TMASK (0x30)
162
union external_auxent {
164
char x_tagndx[4]; /* str, un, or enum tag indx */
167
char x_lnno[2]; /* declaration line number */
168
char x_size[2]; /* str/union/array size */
170
char x_fsize[4]; /* size of function */
173
struct { /* if ISFCN, tag, or .bb */
174
char x_lnnoptr[4]; /* ptr to fcn line # */
175
char x_endndx[4]; /* entry ndx past block end */
177
struct { /* if ISARY, up to 4 dimen. */
178
char x_dimen[E_DIMNUM][2];
181
char x_tvndx[2]; /* tv index */
185
char x_fname[E_FILNMLEN];
193
char x_scnlen[4]; /* section length */
194
char x_nreloc[2]; /* # relocation entries */
195
char x_nlinno[2]; /* # line numbers */
196
char x_checksum[4]; /* section COMDAT checksum */
197
char x_associated[2]; /* COMDAT associated section index */
198
char x_comdat[1]; /* COMDAT selection number */
202
char x_tvfill[4]; /* tv fill value */
203
char x_tvlen[2]; /* length of .tv */
204
char x_tvran[2][2]; /* tv range */
205
} x_tv; /* info about .tv section (in auxent of symbol .tv)) */
210
#define SYMENT struct external_syment
212
#define AUXENT union external_auxent
216
#define _ETEXT "etext"
219
/********************** RELOCATION DIRECTIVES **********************/
223
struct external_reloc {
230
#define RELOC struct external_reloc