1 /*** coff information for M68K */
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 */
18 * F_RELFLG relocation info stripped from file
19 * F_EXEC file is executable (no unresolved external references)
20 * F_LNNO line numbers stripped from file
21 * F_LSYMS local symbols stripped from file
22 * F_AR32WR file has byte ordering of an AR32WR machine (e.g. vax)
25 #define F_RELFLG (0x0001)
26 #define F_EXEC (0x0002)
27 #define F_LNNO (0x0004)
28 #define F_LSYMS (0x0008)
32 #define I386MAGIC 0x14c
33 #define I386BADMAG(x) (((x).f_magic!=I386MAGIC))
36 #define FILHDR struct external_filehdr
37 #define FILHSZ sizeof(FILHDR)
40 /********************** AOUT "OPTIONAL HEADER" **********************/
45 char magic[2]; /* type of file */
46 char vstamp[2]; /* version stamp */
47 char tsize[4]; /* text size in bytes, padded to FW bdry*/
48 char dsize[4]; /* initialized data " " */
49 char bsize[4]; /* uninitialized data " " */
50 char entry[4]; /* entry pt. */
51 char text_start[4]; /* base of text used for this file */
52 char data_start[4]; /* base of data used for this file */
56 #define AOUTSZ (sizeof(AOUTHDR))
59 /********************** STORAGE CLASSES **********************/
61 #define C_EFCN -1 /* physical end of function */
63 #define C_AUTO 1 /* automatic variable */
64 #define C_EXT 2 /* external symbol */
65 #define C_STAT 3 /* static */
66 #define C_REG 4 /* register variable */
67 #define C_EXTDEF 5 /* external definition */
68 #define C_LABEL 6 /* label */
69 #define C_ULABEL 7 /* undefined label */
70 #define C_MOS 8 /* member of structure */
71 #define C_ARG 9 /* function argument */
72 #define C_STRTAG 10 /* structure tag */
73 #define C_MOU 11 /* member of union */
74 #define C_UNTAG 12 /* union tag */
75 #define C_TPDEF 13 /* type definition */
76 #define C_USTATIC 14 /* undefined static */
77 #define C_ENTAG 15 /* enumeration tag */
78 #define C_MOE 16 /* member of enumeration */
79 #define C_REGPARM 17 /* register parameter */
80 #define C_FIELD 18 /* bit field */
81 #define C_AUTOARG 19 /* auto argument */
82 #define C_LASTENT 20 /* dummy entry (end of block) */
83 #define C_BLOCK 100 /* ".bb" or ".eb" */
84 #define C_FCN 101 /* ".bf" or ".ef" */
85 #define C_EOS 102 /* end of structure */
86 #define C_FILE 103 /* file name */
87 #define C_LINE 104 /* line # reformatted as symbol table entry */
88 #define C_ALIAS 105 /* duplicate tag */
89 #define C_HIDDEN 106 /* ext symbol in dmert public lib */
91 /********************** SECTION HEADER **********************/
94 struct external_scnhdr {
95 char s_name[8]; /* section name */
96 char s_paddr[4]; /* physical address, aliased s_nlib */
97 char s_vaddr[4]; /* virtual address */
98 char s_size[4]; /* section size */
99 char s_scnptr[4]; /* file ptr to raw data for section */
100 char s_relptr[4]; /* file ptr to relocation */
101 char s_lnnoptr[4]; /* file ptr to line numbers */
102 char s_nreloc[2]; /* number of relocation entries */
103 char s_nlnno[2]; /* number of line number entries*/
104 char s_flags[4]; /* flags */
108 * names of "special" sections
110 #define _TEXT ".text"
111 #define _DATA ".data"
113 #define _COMMENT ".comment"
118 #define STYP_REG (0x0000) /* "regular": allocated, relocated, loaded */
119 #define STYP_DSECT (0x0001) /* "dummy": relocated only*/
120 #define STYP_NOLOAD (0x0002) /* "noload": allocated, relocated, not loaded */
121 #define STYP_GROUP (0x0004) /* "grouped": formed of input sections */
122 #define STYP_PAD (0x0008) /* "padding": not allocated, not relocated, loaded */
123 #define STYP_COPY (0x0010) /* "copy": for decision function used by field update; not allocated, not relocated,
124 loaded; reloc & lineno entries processed normally */
125 #define STYP_TEXT (0x0020) /* section contains text only */
126 #define S_SHRSEG (0x0020) /* In 3b Update files (output of ogen), sections which appear in SHARED segments of the Pfile
127 will have the S_SHRSEG flag set by ogen, to inform dufr that updating 1 copy of the proc. will
128 update all process invocations. */
129 #define STYP_DATA (0x0040) /* section contains data only */
130 #define STYP_BSS (0x0080) /* section contains bss only */
131 #define S_NEWFCN (0x0100) /* In a minimal file or an update file, a new function (as compared with a replaced function) */
132 #define STYP_INFO (0x0200) /* comment: not allocated not relocated, not loaded */
133 #define STYP_OVER (0x0400) /* overlay: relocated not allocated or loaded */
134 #define STYP_LIB (0x0800) /* for .lib: same as INFO */
135 #define STYP_MERGE (0x2000) /* merge section -- combines with text, data or bss sections only */
136 #define STYP_REVERSE_PAD (0x4000) /* section will be padded with no-op instructions wherever padding is necessary and there is a
137 word of contiguous bytes beginning on a word boundary. */
139 #define SCNHDR struct external_scnhdr
140 #define SCNHSZ sizeof(SCNHDR)
143 /********************** LINE NUMBERS **********************/
145 /* 1 line number entry for every "breakpointable" source line in a section.
146 * Line numbers are grouped on a per function basis; first entry in a function
147 * grouping will have l_lnno = 0 and in place of physical address will be the
148 * symbol table index of the function name.
150 struct external_lineno {
152 char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/
153 char l_paddr[4]; /* (physical) address of line number */
155 char l_lnno[2]; /* line number */
159 #define LINENO struct external_lineno
163 /********************** SYMBOLS **********************/
165 #define E_SYMNMLEN 8 /* # characters in a symbol name */
166 #define E_FILNMLEN 14 /* # characters in a file name */
167 #define E_DIMNUM 4 /* # array dimensions in auxiliary entry */
169 struct external_syment
172 char e_name[E_SYMNMLEN];
186 /*#define n_name _n._n_name
187 #define n_ptr _n._n_nptr[1]
188 #define n_zeroes _n._n_n._n_zeroes
189 #define n_offset _n._n_n._n_offset
193 * Relocatable symbols have number of the section in which they are defined,
194 * or one of the following:
196 #define N_UNDEF ((short)0) /* undefined symbol */
197 #define N_ABS ((short)-1) /* value of symbol is absolute */
198 #define N_DEBUG ((short)-2) /* debugging symbol -- value is meaningless */
199 #define N_TV ((short)-3) /* indicates symbol needs preload transfer vector */
200 #define P_TV ((short)-4) /* indicates symbol needs postload transfer vector*/
203 * Type of a symbol, in low 4 bits of the word
206 #define T_VOID 1 /* function argument (only used by compiler) */
207 #define T_CHAR 2 /* character */
208 #define T_SHORT 3 /* short integer */
209 #define T_INT 4 /* integer */
210 #define T_LONG 5 /* long integer */
211 #define T_FLOAT 6 /* floating point */
212 #define T_DOUBLE 7 /* double word */
213 #define T_STRUCT 8 /* structure */
214 #define T_UNION 9 /* union */
215 #define T_ENUM 10 /* enumeration */
216 #define T_MOE 11 /* member of enumeration*/
217 #define T_UCHAR 12 /* unsigned character */
218 #define T_USHORT 13 /* unsigned short */
219 #define T_UINT 14 /* unsigned integer */
220 #define T_ULONG 15 /* unsigned long */
221 #define T_LNGDBL 16 /* long double */
224 * derived types, in n_type
226 #define DT_NON (0) /* no derived type */
227 #define DT_PTR (1) /* pointer */
228 #define DT_FCN (2) /* function */
229 #define DT_ARY (3) /* array */
231 #define N_BTMASK (0xf)
232 #define N_TMASK (0x30)
236 #define BTYPE(x) ((x) & N_BTMASK)
238 #define ISPTR(x) (((x) & N_TMASK) == (DT_PTR << N_BTSHFT))
239 #define ISFCN(x) (((x) & N_TMASK) == (DT_FCN << N_BTSHFT))
240 #define ISARY(x) (((x) & N_TMASK) == (DT_ARY << N_BTSHFT))
242 #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
244 union external_auxent {
246 char x_tagndx[4]; /* str, un, or enum tag indx */
249 char x_lnno[2]; /* declaration line number */
250 char x_size[2]; /* str/union/array size */
252 char x_fsize[4]; /* size of function */
255 struct { /* if ISFCN, tag, or .bb */
256 char x_lnnoptr[4]; /* ptr to fcn line # */
257 char x_endndx[4]; /* entry ndx past block end */
259 struct { /* if ISARY, up to 4 dimen. */
260 char x_dimen[E_DIMNUM][2];
263 char x_tvndx[2]; /* tv index */
267 char x_fname[E_FILNMLEN];
275 char x_scnlen[4]; /* section length */
276 char x_nreloc[2]; /* # relocation entries */
277 char x_nlinno[2]; /* # line numbers */
281 char x_tvfill[4]; /* tv fill value */
282 char x_tvlen[2]; /* length of .tv */
283 char x_tvran[2][2]; /* tv range */
284 } x_tv; /* info about .tv section (in auxent of symbol .tv)) */
289 #define SYMENT struct external_syment
291 #define AUXENT union external_auxent
295 # define _ETEXT "etext"
298 /********************** RELOCATION DIRECTIVES **********************/
302 struct external_reloc {
309 #define RELOC struct external_reloc
312 #define DEFAULT_DATA_SECTION_ALIGNMENT 4
313 #define DEFAULT_BSS_SECTION_ALIGNMENT 4
314 #define DEFAULT_TEXT_SECTION_ALIGNMENT 4
315 /* For new sections we havn't heard of before */
316 #define DEFAULT_SECTION_ALIGNMENT 4