1 /*** coff information for 88k bcs */
3 /********************** FILE HEADER **********************/
6 unsigned short f_magic
; /* magic number */
7 unsigned short f_nscns
; /* number of sections */
8 long f_timdat
; /* time & date stamp */
9 long f_symptr
; /* file pointer to symtab */
10 long f_nsyms
; /* number of symtab entries */
11 unsigned short f_opthdr
; /* sizeof(optional hdr) */
12 unsigned short f_flags
; /* flags */
16 * F_RELFLG relocation info stripped from file
17 * F_EXEC file is executable (no unresolved externel references)
18 * F_LNNO line nunbers stripped from file
19 * F_LSYMS local symbols stripped from file
20 * F_AR32WR file has byte ordering of an AR32WR machine (e.g. vax)
22 #define F_RELFLG 0000001
23 #define F_EXEC 0000002
24 #define F_LNNO 0000004
25 #define F_LSYMS 0000010
26 #define F_AR32WR 0000400
29 #define MC88MAGIC 0555 /* 88k BCS executable */
30 #define MC88DMAGIC 0541 /* DG/UX executable */
33 #define MC88BADMAG(x) (((x).f_magic!=MC88MAGIC) && ((x).f_magic!=MC88DMAGIC))
35 #define FILHDR struct filehdr
36 #define FILHSZ sizeof(FILHDR)
39 /********************** AOUT "OPTIONAL HEADER" **********************/
42 #define PAGEMAGIC3 0414 /* Split i&d, zero mapped */
43 typedef struct aouthdr
{
44 short magic
; /* type of file */
45 short vstamp
; /* version stamp */
46 unsigned long tsize
; /* text size in bytes, padded to FW bdry*/
47 unsigned long dsize
; /* initialized data " " */
48 unsigned long bsize
; /* uninitialized data " " */
50 unsigned long entry
; /* entry pt. */
51 unsigned long text_start
; /* base of text used for this file */
52 unsigned long data_start
; /* base of data used for this file */
57 /* compute size of a header */
59 #define AOUTSZ (sizeof(AOUTHDR))
61 /********************** STORAGE CLASSES **********************/
63 #define C_EFCN -1 /* physical end of function */
65 #define C_AUTO 1 /* automatic variable */
66 #define C_EXT 2 /* external symbol */
67 #define C_STAT 3 /* static */
68 #define C_REG 4 /* register variable */
69 #define C_EXTDEF 5 /* external definition */
70 #define C_LABEL 6 /* label */
71 #define C_ULABEL 7 /* undefined label */
72 #define C_MOS 8 /* member of structure */
73 #define C_ARG 9 /* function argument */
74 #define C_STRTAG 10 /* structure tag */
75 #define C_MOU 11 /* member of union */
76 #define C_UNTAG 12 /* union tag */
77 #define C_TPDEF 13 /* type definition */
78 #define C_USTATIC 14 /* undefined static */
79 #define C_ENTAG 15 /* enumeration tag */
80 #define C_MOE 16 /* member of enumeration */
81 #define C_REGPARM 17 /* register parameter */
82 #define C_FIELD 18 /* bit field */
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 */
90 #define C_SHADOW 107 /* shadow symbol */
91 #define C_VERSION 108 /* coff version symbol */
94 /********************** SECTION HEADER **********************/
97 char s_name
[8]; /* section name */
98 long s_paddr
; /* physical address, aliased s_nlib */
99 long s_vaddr
; /* virtual address */
100 long s_size
; /* section size */
101 long s_scnptr
; /* file ptr to raw data for section */
102 long s_relptr
; /* file ptr to relocation */
103 long s_lnnoptr
; /* file ptr to line numbers */
104 long s_nreloc
; /* number of relocation entries */
105 long s_nlnno
; /* number of line number entries*/
106 long s_flags
; /* flags */
110 * names of "special" sections
112 #define _TEXT ".text"
113 #define _DATA ".data"
119 #define STYP_TEXT 0x20 /* section contains text only */
120 #define STYP_DATA 0x40 /* section contains data only */
121 #define STYP_BSS 0x80 /* section contains bss only */
123 #define SCNHDR struct scnhdr
124 #define SCNHSZ sizeof(SCNHDR)
127 /********************** LINE NUMBERS **********************/
129 /* 1 line number entry for every "breakpointable" source line in a section.
130 * Line numbers are grouped on a per function basis; first entry in a function
131 * grouping will have l_lnno = 0 and in place of physical address will be the
132 * symbol table index of the function name.
136 long l_symndx
; /* function name symbol index, iff l_lnno == 0*/
137 long l_paddr
; /* (physical) address of line number */
144 #define LINENO struct lineno
145 #define LINESZ sizeof(LINENO)
148 /********************** SYMBOLS **********************/
150 #define SYMNMLEN 8 /* # characters in a symbol name */
151 #define FILNMLEN 14 /* # characters in a file name */
152 #define DIMNUM 4 /* # array dimensions in auxiliary entry */
157 char _n_name
[SYMNMLEN
]; /* old COFF version */
159 long _n_zeroes
; /* new == 0 */
160 long _n_offset
; /* offset into string table */
162 char *_n_nptr
[2]; /* allows for overlaying */
164 long n_value
; /* value of symbol */
165 short n_scnum
; /* section number */
166 unsigned short n_type
; /* type and derived type */
167 char n_sclass
; /* storage class */
168 char n_numaux
; /* number of aux. entries */
169 char pad2
[2]; /* force alignment */
172 #define n_name _n._n_name
173 #define n_zeroes _n._n_n._n_zeroes
174 #define n_offset _n._n_n._n_offset
177 * Relocatable symbols have number of the section in which they are defined,
178 * or one of the following:
180 #define N_UNDEF 0 /* undefined symbol */
181 #define N_ABS -1 /* value of symbol is absolute */
182 #define N_DEBUG -2 /* debugging symbol -- symbol value is meaningless */
185 * Type of a symbol, in low 4 bits of the word
188 #define T_VOID 1 /* function argument (only used by compiler) */
189 #define T_CHAR 2 /* character */
190 #define T_SHORT 3 /* short integer */
191 #define T_INT 4 /* integer */
192 #define T_LONG 5 /* long integer */
193 #define T_FLOAT 6 /* floating point */
194 #define T_DOUBLE 7 /* double word */
195 #define T_STRUCT 8 /* structure */
196 #define T_UNION 9 /* union */
197 #define T_ENUM 10 /* enumeration */
198 #define T_MOE 11 /* member of enumeration*/
199 #define T_UCHAR 12 /* unsigned character */
200 #define T_USHORT 13 /* unsigned short */
201 #define T_UINT 14 /* unsigned integer */
202 #define T_ULONG 15 /* unsigned long */
210 #define DT_PTR 1 /* pointer */
211 #define DT_FCN 2 /* function */
212 #define DT_ARY 3 /* array */
219 #define BTYPE(x) ((x) & N_BTMASK)
222 #define ISPTR(x) (((x) & N_TMASK) == (DT_PTR << N_BTSHFT))
223 #define ISFCN(x) (((x) & N_TMASK) == (DT_FCN << N_BTSHFT))
224 #define ISARY(x) (((x) & N_TMASK) == (DT_ARY << N_BTSHFT))
226 #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
230 long x_tagndx
; /* str, un, or enum tag indx */
233 unsigned long x_lnno
; /* declaration line number */
234 unsigned long x_size
; /* str/union/array size */
236 long x_fsize
; /* size of function */
239 struct { /* if ISFCN, tag, or .bb */
240 long x_lnnoptr
; /* ptr to fcn line # */
241 long x_endndx
; /* entry ndx past block end */
243 struct { /* if ISARY, up to 4 dimen. */
244 unsigned short x_dimen
[DIMNUM
];
247 unsigned short x_tvndx
; /* tv index */
251 char x_fname
[FILNMLEN
];
259 long x_scnlen
; /* section length */
260 unsigned long x_nreloc
; /* # relocation entries */
261 unsigned long x_nlinno
; /* # line numbers */
267 #define SYMENT struct syment
268 #define SYMESZ sizeof(SYMENT)
269 #define AUXENT union auxent
270 #define AUXESZ sizeof(AUXENT)
273 /********************** RELOCATION DIRECTIVES **********************/
276 long r_vaddr
; /* Virtual address of reference */
277 long r_symndx
; /* Index into symbol table */
278 unsigned short r_type
; /* Relocation type */
279 unsigned short r_offset
;/* Hi 16 bits of constant */
282 /* Only values of r_type GNU/88k cares about */
293 #define RELOC struct reloc
294 #define RELSZ sizeof(RELOC)
296 #define DEFAULT_SECTION_ALIGNMENT 8 /* double word */
This page took 0.037297 seconds and 4 git commands to generate.