1 /********************** FILE HEADER **********************/
2 struct internal_filehdr
4 unsigned short f_magic
; /* magic number */
5 unsigned short f_nscns
; /* number of sections */
6 long f_timdat
; /* time & date stamp */
7 long f_symptr
; /* file pointer to symtab */
8 long f_nsyms
; /* number of symtab entries */
9 unsigned short f_opthdr
; /* sizeof(optional hdr) */
10 unsigned short f_flags
; /* flags */
14 * F_RELFLG relocation info stripped from file
15 * F_EXEC file is executable (no unresolved external references)
16 * F_LNNO line numbers stripped from file
17 * F_LSYMS local symbols stripped from file
18 * F_AR32WR file has byte ordering of an AR32WR machine (e.g. vax)
21 #define F_RELFLG (0x0001)
22 #define F_EXEC (0x0002)
23 #define F_LNNO (0x0004)
24 #define F_LSYMS (0x0008)
25 #define F_AR32WR (0x0010)
27 /********************** AOUT "OPTIONAL HEADER" **********************/
28 struct internal_aouthdr
{
29 short magic
; /* type of file */
30 short vstamp
; /* version stamp */
31 unsigned long tsize
; /* text size in bytes, padded to FW bdry*/
32 unsigned long dsize
; /* initialized data " " */
33 unsigned long bsize
; /* uninitialized data " " */
34 unsigned long entry
; /* entry pt. */
35 unsigned long text_start
; /* base of text used for this file */
36 unsigned long data_start
; /* base of data used for this file */
37 unsigned long tagentries
; /* number of tag entries to follow */
40 /********************** STORAGE CLASSES **********************/
42 #define C_EFCN -1 /* physical end of function */
44 #define C_AUTO 1 /* automatic variable */
45 #define C_EXT 2 /* external symbol */
46 #define C_STAT 3 /* static */
47 #define C_REG 4 /* register variable */
48 #define C_EXTDEF 5 /* external definition */
49 #define C_LABEL 6 /* label */
50 #define C_ULABEL 7 /* undefined label */
51 #define C_MOS 8 /* member of structure */
52 #define C_ARG 9 /* function argument */
53 #define C_STRTAG 10 /* structure tag */
54 #define C_MOU 11 /* member of union */
55 #define C_UNTAG 12 /* union tag */
56 #define C_TPDEF 13 /* type definition */
57 #define C_USTATIC 14 /* undefined static */
58 #define C_ENTAG 15 /* enumeration tag */
59 #define C_MOE 16 /* member of enumeration */
60 #define C_REGPARM 17 /* register parameter */
61 #define C_FIELD 18 /* bit field */
62 #define C_AUTOARG 19 /* auto argument */
63 #define C_LASTENT 20 /* dummy entry (end of block) */
64 #define C_BLOCK 100 /* ".bb" or ".eb" */
65 #define C_FCN 101 /* ".bf" or ".ef" */
66 #define C_EOS 102 /* end of structure */
67 #define C_FILE 103 /* file name */
68 #define C_LINE 104 /* line # reformatted as symbol table entry */
69 #define C_ALIAS 105 /* duplicate tag */
70 #define C_HIDDEN 106 /* ext symbol in dmert public lib */
72 /* New storage classes for 80960 */
74 /* C_LEAFPROC is obsolete. Use C_LEAFEXT or C_LEAFSTAT */
75 #define C_LEAFPROC 108 /* Leaf procedure, "call" via BAL */
77 #define C_SCALL 107 /* Procedure reachable via system call */
78 #define C_LEAFEXT 108 /* External leaf */
79 #define C_LEAFSTAT 113 /* Static leaf */
80 #define C_OPTVAR 109 /* Optimized variable */
81 #define C_DEFINE 110 /* Preprocessor #define */
82 #define C_PRAGMA 111 /* Advice to compiler or linker */
83 #define C_SEGMENT 112 /* 80960 segment name */
85 /********************** SECTION HEADER **********************/
86 struct internal_scnhdr
{
87 char s_name
[8]; /* section name */
88 long s_paddr
; /* physical address, aliased s_nlib */
89 long s_vaddr
; /* virtual address */
90 long s_size
; /* section size */
91 long s_scnptr
; /* file ptr to raw data for section */
92 long s_relptr
; /* file ptr to relocation */
93 long s_lnnoptr
; /* file ptr to line numbers */
95 unsigned long s_nreloc
;
96 unsigned long s_nlnno
;
98 unsigned short s_nreloc
; /* number of relocation entries */
99 unsigned short s_nlnno
; /* number of line number entries*/
101 long s_flags
; /* flags */
111 #define STYP_REG (0x0000) /* "regular": allocated, relocated, loaded */
112 #define STYP_DSECT (0x0001) /* "dummy": relocated only*/
113 #define STYP_NOLOAD (0x0002) /* "noload": allocated, relocated, not loaded */
114 #define STYP_GROUP (0x0004) /* "grouped": formed of input sections */
115 #define STYP_PAD (0x0008) /* "padding": not allocated, not relocated, loaded */
116 #define STYP_COPY (0x0010) /* "copy": for decision function used by field update; not allocated, not relocated,
117 loaded; reloc & lineno entries processed normally */
118 #define STYP_TEXT (0x0020) /* section contains text only */
119 #define S_SHRSEG (0x0020) /* In 3b Update files (output of ogen), sections which appear in SHARED segments of the Pfile
120 will have the S_SHRSEG flag set by ogen, to inform dufr that updating 1 copy of the proc. will
121 update all process invocations. */
122 #define STYP_DATA (0x0040) /* section contains data only */
123 #define STYP_BSS (0x0080) /* section contains bss only */
124 #define S_NEWFCN (0x0100) /* In a minimal file or an update file, a new function (as compared with a replaced function) */
125 #define STYP_INFO (0x0200) /* comment: not allocated not relocated, not loaded */
126 #define STYP_OVER (0x0400) /* overlay: relocated not allocated or loaded */
127 #define STYP_LIB (0x0800) /* for .lib: same as INFO */
128 #define STYP_MERGE (0x2000) /* merge section -- combines with text, data or bss sections only */
129 #define STYP_REVERSE_PAD (0x4000) /* section will be padded with no-op instructions wherever padding is necessary and there is a
130 word of contiguous bytes beginning on a word boundary. */
131 /********************** LINE NUMBERS **********************/
133 /* 1 line number entry for every "breakpointable" source line in a section.
134 * Line numbers are grouped on a per function basis; first entry in a function
135 * grouping will have l_lnno = 0 and in place of physical address will be the
136 * symbol table index of the function name.
139 struct internal_lineno
{
141 long l_symndx
; /* function name symbol index, iff l_lnno == 0*/
142 long l_paddr
; /* (physical) address of line number */
145 unsigned long l_lnno
; /* line number */
147 unsigned short l_lnno
; /* line number */
152 /********************** SYMBOLS **********************/
154 #define SYMNMLEN 8 /* # characters in a symbol name */
155 #define FILNMLEN 14 /* # characters in a file name */
156 #define DIMNUM 4 /* # array dimensions in auxiliary entry */
158 struct internal_syment
{
160 char _n_name
[SYMNMLEN
]; /* old COFF version */
162 long _n_zeroes
; /* new == 0 */
163 long _n_offset
; /* offset into string table */
165 char *_n_nptr
[2]; /* allows for overlaying */
167 long n_value
; /* value of symbol */
168 short n_scnum
; /* section number */
169 unsigned short n_flags
; /* copy of flags from filhdr */
170 unsigned short n_type
; /* type and derived type */
174 char n_sclass
; /* storage class */
175 char n_numaux
; /* number of aux. entries */
177 #define n_name _n._n_name
178 #define n_zeroes _n._n_n._n_zeroes
179 #define n_offset _n._n_n._n_offset
182 /* Relocatable symbols have number of the section in which they are defined,
183 or one of the following: */
185 #define N_UNDEF ((short)0) /* undefined symbol */
186 #define N_ABS ((short)-1) /* value of symbol is absolute */
187 #define N_DEBUG ((short)-2) /* debugging symbol -- value is meaningless */
188 #define N_TV ((short)-3) /* indicates symbol needs preload transfer vector */
189 #define P_TV ((short)-4) /* indicates symbol needs postload transfer vector*/
192 * Type of a symbol, in low N bits of the word
195 #define T_VOID 1 /* function argument (only used by compiler) */
196 #define T_CHAR 2 /* character */
197 #define T_SHORT 3 /* short integer */
198 #define T_INT 4 /* integer */
199 #define T_LONG 5 /* long integer */
200 #define T_FLOAT 6 /* floating point */
201 #define T_DOUBLE 7 /* double word */
202 #define T_STRUCT 8 /* structure */
203 #define T_UNION 9 /* union */
204 #define T_ENUM 10 /* enumeration */
205 #define T_MOE 11 /* member of enumeration*/
206 #define T_UCHAR 12 /* unsigned character */
207 #define T_USHORT 13 /* unsigned short */
208 #define T_UINT 14 /* unsigned integer */
209 #define T_ULONG 15 /* unsigned long */
210 #define T_LNGDBL 16 /* long double */
213 * derived types, in n_type
215 #define DT_NON (0) /* no derived type */
216 #define DT_PTR (1) /* pointer */
217 #define DT_FCN (2) /* function */
218 #define DT_ARY (3) /* array */
220 #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))
225 #define ISTAG(x) ((x)==C_STRTAG||(x)==C_UNTAG||(x)==C_ENTAG)
226 #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
229 union internal_auxent
234 long l
; /* str, un, or enum tag indx */
235 struct coff_ptr_struct
*p
;
239 unsigned short x_lnno
; /* declaration line number */
240 unsigned short x_size
; /* str/union/array size */
242 long x_fsize
; /* size of function */
246 struct { /* if ISFCN, tag, or .bb */
247 long x_lnnoptr
; /* ptr to fcn line # */
248 union { /* entry ndx past block end */
250 struct coff_ptr_struct
*p
;
256 struct { /* if ISARY, up to 4 dimen. */
257 unsigned short x_dimen
[DIMNUM
];
260 unsigned short x_tvndx
; /* tv index */
264 char x_fname
[FILNMLEN
];
272 long x_scnlen
; /* section length */
273 unsigned short x_nreloc
; /* # relocation entries */
274 unsigned short x_nlinno
; /* # line numbers */
278 long x_tvfill
; /* tv fill value */
279 unsigned short x_tvlen
; /* length of .tv */
280 unsigned short x_tvran
[2]; /* tv range */
281 } x_tv
; /* info about .tv section (in auxent of symbol .tv)) */
283 /******************************************
284 * I960-specific *2nd* aux. entry formats
285 ******************************************/
287 /* This is a very old typo that keeps getting propagated. */
288 #define x_stdindx x_stindx
289 long x_stindx
; /* sys. table entry */
290 } x_sc
; /* system call entry */
293 unsigned long x_balntry
; /* BAL entry point */
294 } x_bal
; /* BAL-callable function */
297 unsigned long x_timestamp
; /* time stamp */
298 char x_idstring
[20]; /* producer identity string */
299 } x_ident
; /* Producer ident info */
304 /********************** RELOCATION DIRECTIVES **********************/
306 struct internal_reloc
{
307 long r_vaddr
; /* Virtual address of reference */
308 long r_symndx
; /* Index into symbol table */
309 unsigned short r_type
; /* Relocation type */
311 unsigned short r_offset
;
315 #define R_RELBYTE 017
316 #define R_RELWORD 020
317 #define R_PCRBYTE 022
318 #define R_PCRWORD 023
319 #define R_PCRLONG 024
323 #define R_RELBYTE 017
324 #define R_RELWORD 020
326 #define R_PCRBYTE 022
327 #define R_PCRWORD 023
328 #define R_PCRLONG 024
336 #define R_RELLONG (0x11) /* Direct 32-bit relocation */
337 #define R_IPRSHORT (0x18)
338 #define R_IPRMED (0x19) /* 24-bit ip-relative relocation */
339 #define R_IPRLONG (0x1a)
340 #define R_OPTCALL (0x1b) /* 32-bit optimizable call (leafproc/sysproc) */
341 #define R_OPTCALLX (0x1c) /* 64-bit optimizable call (leafproc/sysproc) */
342 #define R_GETSEG (0x1d)
343 #define R_GETPA (0x1e)
344 #define R_TAGWORD (0x1f)
This page took 0.049544 seconds and 4 git commands to generate.