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 0x100
29 #define MC88MAGIC 0540 /* 88k BCS executable */
30 #define MC88DMAGIC 0541 /* DG/UX executable */
31 #define MC88OMAGIC 0555 /* Object file */
33 #define MC88BADMAG(x) (((x).f_magic!=MC88MAGIC) &&((x).f_magic!=MC88DMAGIC) && ((x).f_magic != MC88OMAGIC))
35 #define FILHDR struct filehdr
36 #define FILHSZ sizeof(FILHDR)
39 /********************** AOUT "OPTIONAL HEADER" **********************/
42 #define PAGEMAGIC3 0414 /* Split i&d, zero mapped */
43 #define PAGEMAGICBCS 0413
45 typedef struct aouthdr
{
46 short magic
; /* type of file */
47 short vstamp
; /* version stamp */
48 unsigned long tsize
; /* text size in bytes, padded to FW bdry*/
49 unsigned long dsize
; /* initialized data " " */
50 unsigned long bsize
; /* uninitialized data " " */
52 unsigned long entry
; /* entry pt. */
53 unsigned long text_start
; /* base of text used for this file */
54 unsigned long data_start
; /* base of data used for this file */
59 /* compute size of a header */
61 #define AOUTSZ (sizeof(AOUTHDR))
63 /********************** STORAGE CLASSES **********************/
65 #define C_EFCN -1 /* physical end of function */
67 #define C_AUTO 1 /* automatic variable */
68 #define C_EXT 2 /* external symbol */
69 #define C_STAT 3 /* static */
70 #define C_REG 4 /* register variable */
71 #define C_EXTDEF 5 /* external definition */
72 #define C_LABEL 6 /* label */
73 #define C_ULABEL 7 /* undefined label */
74 #define C_MOS 8 /* member of structure */
75 #define C_ARG 9 /* function argument */
76 #define C_STRTAG 10 /* structure tag */
77 #define C_MOU 11 /* member of union */
78 #define C_UNTAG 12 /* union tag */
79 #define C_TPDEF 13 /* type definition */
80 #define C_USTATIC 14 /* undefined static */
81 #define C_ENTAG 15 /* enumeration tag */
82 #define C_MOE 16 /* member of enumeration */
83 #define C_REGPARM 17 /* register parameter */
84 #define C_FIELD 18 /* bit field */
85 #define C_BLOCK 100 /* ".bb" or ".eb" */
86 #define C_FCN 101 /* ".bf" or ".ef" */
87 #define C_EOS 102 /* end of structure */
88 #define C_FILE 103 /* file name */
89 #define C_LINE 104 /* line # reformatted as symbol table entry */
90 #define C_ALIAS 105 /* duplicate tag */
91 #define C_HIDDEN 106 /* ext symbol in dmert public lib */
92 #define C_SHADOW 107 /* shadow symbol */
93 #define C_VERSION 108 /* coff version symbol */
96 /********************** SECTION HEADER **********************/
99 char s_name
[8]; /* section name */
100 long s_paddr
; /* physical address, aliased s_nlib */
101 long s_vaddr
; /* virtual address */
102 long s_size
; /* section size */
103 long s_scnptr
; /* file ptr to raw data for section */
104 long s_relptr
; /* file ptr to relocation */
105 long s_lnnoptr
; /* file ptr to line numbers */
106 long s_nreloc
; /* number of relocation entries */
107 long s_nlnno
; /* number of line number entries*/
108 long s_flags
; /* flags */
112 * names of "special" sections
114 #define _TEXT ".text"
115 #define _DATA ".data"
121 #define STYP_TEXT 0x20 /* section contains text only */
122 #define STYP_DATA 0x40 /* section contains data only */
123 #define STYP_BSS 0x80 /* section contains bss only */
125 #define SCNHDR struct scnhdr
126 #define SCNHSZ sizeof(SCNHDR)
129 /********************** LINE NUMBERS **********************/
131 /* 1 line number entry for every "breakpointable" source line in a section.
132 * Line numbers are grouped on a per function basis; first entry in a function
133 * grouping will have l_lnno = 0 and in place of physical address will be the
134 * symbol table index of the function name.
136 struct external_lineno
{
138 char l_symndx
[4]; /* function name symbol index, iff l_lnno == 0*/
139 char l_paddr
[4]; /* (physical) address of line number */
145 struct internal_lineno
{
147 long l_symndx
; /* function name symbol index, iff l_lnno == 0*/
148 long l_paddr
; /* (physical) address of line number */
155 #define LINENO struct external_lineno
159 /********************** SYMBOLS **********************/
161 #define SYMNMLEN 8 /* # characters in a symbol name */
162 #define FILNMLEN 14 /* # characters in a file name */
163 #define DIMNUM 4 /* # array dimensions in auxiliary entry */
165 struct external_syment
168 char e_name
[SYMNMLEN
];
182 struct internal_syment
{
184 char _n_name
[SYMNMLEN
]; /* old COFF version */
186 long _n_zeroes
; /* new == 0 */
187 long _n_offset
; /* offset into string table */
189 char *_n_nptr
[2]; /* allows for overlaying */
191 long n_value
; /* value of symbol */
192 short n_scnum
; /* section number */
193 unsigned short n_type
; /* type and derived type */
194 char n_sclass
; /* storage class */
195 char n_numaux
; /* number of aux. entries */
200 * Relocatable symbols have number of the section in which they are defined,
201 * or one of the following:
203 #define N_UNDEF 0 /* undefined symbol */
204 #define N_ABS -1 /* value of symbol is absolute */
205 #define N_DEBUG -2 /* debugging symbol -- symbol value is meaningless */
208 * Type of a symbol, in low 4 bits of the word
211 #define T_VOID 1 /* function argument (only used by compiler) */
212 #define T_CHAR 2 /* character */
213 #define T_SHORT 3 /* short integer */
214 #define T_INT 4 /* integer */
215 #define T_LONG 5 /* long integer */
216 #define T_FLOAT 6 /* floating point */
217 #define T_DOUBLE 7 /* double word */
218 #define T_STRUCT 8 /* structure */
219 #define T_UNION 9 /* union */
220 #define T_ENUM 10 /* enumeration */
221 #define T_MOE 11 /* member of enumeration*/
222 #define T_UCHAR 12 /* unsigned character */
223 #define T_USHORT 13 /* unsigned short */
224 #define T_UINT 14 /* unsigned integer */
225 #define T_ULONG 15 /* unsigned long */
233 #define DT_PTR 1 /* pointer */
234 #define DT_FCN 2 /* function */
235 #define DT_ARY 3 /* array */
242 #define BTYPE(x) ((x) & N_BTMASK)
245 #define ISPTR(x) (((x) & N_TMASK) == (DT_PTR << N_BTSHFT))
246 #define ISFCN(x) (((x) & N_TMASK) == (DT_FCN << N_BTSHFT))
247 #define ISARY(x) (((x) & N_TMASK) == (DT_ARY << N_BTSHFT))
249 #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
251 union external_auxent
{
253 char x_tagndx
[4]; /* str, un, or enum tag indx */
256 char x_lnno
[2]; /* declaration line number */
257 char x_size
[2]; /* str/union/array size */
259 char x_fsize
[4]; /* size of function */
262 struct { /* if ISFCN, tag, or .bb */
263 char x_lnnoptr
[4]; /* ptr to fcn line # */
264 char x_endndx
[4]; /* entry ndx past block end */
266 struct { /* if ISARY, up to 4 dimen. */
267 char x_dimen
[DIMNUM
][2];
270 char x_tvndx
[2]; /* tv index */
274 char x_fname
[FILNMLEN
];
282 char x_scnlen
[4]; /* section length */
283 char x_nreloc
[2]; /* # relocation entries */
284 char x_nlinno
[2]; /* # line numbers */
288 char x_tvfill
[4]; /* tv fill value */
289 char x_tvlen
[2]; /* length of .tv */
290 char x_tvran
[2][2]; /* tv range */
291 } x_tv
; /* info about .tv section (in auxent of symbol .tv)) */
295 union internal_auxent
298 long x_tagndx
; /* str, un, or enum tag indx */
301 unsigned short x_lnno
; /* declaration line number */
302 unsigned short x_size
; /* str/union/array size */
304 long x_fsize
; /* size of function */
307 struct { /* if ISFCN, tag, or .bb */
308 long x_lnnoptr
; /* ptr to fcn line # */
309 long x_endndx
; /* entry ndx past block end */
311 struct { /* if ISARY, up to 4 dimen. */
312 unsigned short x_dimen
[DIMNUM
];
315 unsigned short x_tvndx
; /* tv index */
319 char x_fname
[FILNMLEN
];
327 long x_scnlen
; /* section length */
328 unsigned short x_nreloc
; /* # relocation entries */
329 unsigned short x_nlinno
; /* # line numbers */
333 long x_tvfill
; /* tv fill value */
334 unsigned short x_tvlen
; /* length of .tv */
335 unsigned short x_tvran
[2]; /* tv range */
336 } x_tv
; /* info about .tv section (in auxent of symbol .tv)) */
339 #define SYMENT struct external_syment
341 #define AUXENT union external_auxent
345 /********************** RELOCATION DIRECTIVES **********************/
347 struct external_reloc
{
354 struct internal_reloc
{
355 long r_vaddr
; /* Virtual address of reference */
356 long r_symndx
; /* Index into symbol table */
357 unsigned short r_type
; /* Relocation type */
358 unsigned short r_offset
; /* Hi 16 bits of constant */
361 /* Only values of r_type GNU/88k cares about */
372 #define RELOC struct external_reloc
375 #define DEFAULT_SECTION_ALIGNMENT 8 /* double word */
This page took 0.043844 seconds and 4 git commands to generate.