NEURON
coff.h
Go to the documentation of this file.
1
/*** coff information for Intel 386/486. */
2
3
/********************** FILE HEADER **********************/
4
5
struct
external_filehdr
{
6
unsigned
short
f_magic
;
/* magic number */
7
unsigned
short
f_nscns
;
/* number of sections */
8
unsigned
long
f_timdat
;
/* time & date stamp */
9
unsigned
long
f_symptr
;
/* file pointer to symtab */
10
unsigned
long
f_nsyms
;
/* number of symtab entries */
11
unsigned
short
f_opthdr
;
/* sizeof(optional hdr) */
12
unsigned
short
f_flags
;
/* flags */
13
};
14
15
16
/* Bits for f_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)
22
*/
23
24
#define F_RELFLG (0x0001)
25
#define F_EXEC (0x0002)
26
#define F_LNNO (0x0004)
27
#define F_LSYMS (0x0008)
28
29
30
31
#define I386MAGIC 0x14c
32
#define I386AIXMAGIC 0x175
33
#define I386BADMAG(x) (((x).f_magic!=I386MAGIC) && (x).f_magic!=I386AIXMAGIC)
34
35
36
#define FILHDR struct external_filehdr
37
//#define FILHSZ sizeof(FILHDR)
38
#define FILHSZ 20
39
40
/********************** AOUT "OPTIONAL HEADER" **********************/
41
42
43
typedef
struct
44
{
45
unsigned
short
magic
;
/* type of file */
46
unsigned
short
vstamp
;
/* version stamp */
47
unsigned
long
tsize
;
/* text size in bytes, padded to FW bdry*/
48
unsigned
long
dsize
;
/* initialized data " " */
49
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 */
53
}
54
AOUTHDR
;
55
56
57
typedef
struct
gnu_aout
{
58
unsigned
long
info
;
59
unsigned
long
tsize
;
60
unsigned
long
dsize
;
61
unsigned
long
bsize
;
62
unsigned
long
symsize
;
63
unsigned
long
entry
;
64
unsigned
long
txrel
;
65
unsigned
long
dtrel
;
66
}
GNU_AOUT
;
67
68
#define AOUTSZ (sizeof(AOUTHDR))
69
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 */
74
75
76
/********************** SECTION HEADER **********************/
77
78
79
struct
external_scnhdr
{
80
char
s_name[8];
/* section name */
81
unsigned
long
s_paddr
;
/* physical address, aliased s_nlib */
82
unsigned
long
s_vaddr
;
/* virtual address */
83
unsigned
long
s_size
;
/* section size */
84
unsigned
long
s_scnptr
;
/* file ptr to raw data for section */
85
unsigned
long
s_relptr
;
/* file ptr to relocation */
86
unsigned
long
s_lnnoptr
;
/* file ptr to line numbers */
87
unsigned
short
s_nreloc
;
/* number of relocation entries */
88
unsigned
short
s_nlnno
;
/* number of line number entries*/
89
unsigned
long
s_flags
;
/* flags */
90
};
91
92
#define SCNHDR struct external_scnhdr
93
//#define SCNHSZ sizeof(SCNHDR)
94
#define SCNHSZ 40
95
96
/*
97
* names of "special" sections
98
*/
99
#define _TEXT ".text"
100
#define _DATA ".data"
101
#define _BSS ".bss"
102
#define _COMMENT ".comment"
103
#define _LIB ".lib"
104
105
/*
106
* s_flags "type"
107
*/
108
#define STYP_TEXT (0x0020)
/* section contains text only */
109
#define STYP_DATA (0x0040)
/* section contains data only */
110
#define STYP_BSS (0x0080)
/* section contains bss only */
111
112
/********************** LINE NUMBERS **********************/
113
114
/* 1 line number entry for every "breakpointable" source line in a section.
115
* Line numbers are grouped on a per function basis; first entry in a function
116
* grouping will have l_lnno = 0 and in place of physical address will be the
117
* symbol table index of the function name.
118
*/
119
struct
external_lineno
{
120
union
{
121
unsigned
long
l_symndx
__attribute__
((packed));
/* function name symbol index, iff l_lnno == 0 */
122
unsigned
long
l_paddr
__attribute__
((packed));
/* (physical) address of line number */
123
} l_addr;
124
unsigned
short
l_lnno
;
/* line number */
125
};
126
127
128
#define LINENO struct external_lineno
129
#define LINESZ sizeof(LINENO)
130
131
132
/********************** SYMBOLS **********************/
133
134
#define E_SYMNMLEN 8
/* # characters in a symbol name */
135
#define E_FILNMLEN 14
/* # characters in a file name */
136
#define E_DIMNUM 4
/* # array dimensions in auxiliary entry */
137
138
struct
external_syment
139
{
140
union
{
141
char
e_name[
E_SYMNMLEN
];
142
struct
{
143
unsigned
long
e_zeroes
__attribute__
((packed));
144
unsigned
long
e_offset
__attribute__
((packed));
145
}
e
;
146
}
e
;
147
unsigned
long
e_value
__attribute__
((packed));
148
short
e_scnum
;
149
unsigned
short
e_type
;
150
unsigned
char
e_sclass
;
151
unsigned
char
e_numaux
;
152
};
153
154
#define N_BTMASK (0xf)
155
#define N_TMASK (0x30)
156
#define N_BTSHFT (4)
157
#define N_TSHIFT (2)
158
159
union
external_auxent
{
160
struct
{
161
unsigned
long
x_tagndx
__attribute__
((packed));
/* str, un, or enum tag indx */
162
union
{
163
struct
{
164
unsigned
short
x_lnno
;
/* declaration line number */
165
unsigned
short
x_size
;
/* str/union/array size */
166
} x_lnsz;
167
unsigned
long
x_fsize
__attribute__
((packed));
/* size of function */
168
} x_misc;
169
union
{
170
struct
{
/* if ISFCN, tag, or .bb */
171
unsigned
long
x_lnnoptr
__attribute__
((packed));
/* ptr to fcn line # */
172
unsigned
long
x_endndx
__attribute__
((packed));
/* entry ndx past block end */
173
} x_fcn;
174
struct
{
/* if ISARY, up to 4 dimen. */
175
unsigned
short
x_dimen[
E_DIMNUM
];
176
} x_ary;
177
} x_fcnary;
178
unsigned
short
x_tvndx
;
/* tv index */
179
} x_sym;
180
181
union
{
182
char
x_fname[
E_FILNMLEN
];
183
struct
{
184
unsigned
long
x_zeroes
__attribute__
((packed));
185
unsigned
long
x_offset
__attribute__
((packed));
186
} x_n;
187
} x_file;
188
189
struct
{
190
unsigned
long
x_scnlen
__attribute__
((packed));
/* section length */
191
unsigned
short
x_nreloc
;
/* # relocation entries */
192
unsigned
short
x_nlinno
;
/* # line numbers */
193
} x_scn;
194
195
struct
{
196
unsigned
long
x_tvfill
__attribute__
((packed));
/* tv fill value */
197
unsigned
short
x_tvlen
;
/* length of .tv */
198
unsigned
short
x_tvran[2];
/* tv range */
199
} x_tv;
/* info about .tv section (in auxent of symbol .tv)) */
200
201
202
};
203
204
#define SYMENT struct external_syment
205
//#define SYMESZ sizeof(SYMENT)
206
#define SYMESZ 18
207
#define AUXENT union external_auxent
208
//#define AUXESZ sizeof(AUXENT)
209
#define AUXESZ 18
210
211
212
# define _ETEXT "etext"
213
214
215
/* Relocatable symbols have number of the section in which they are defined,
216
or one of the following: */
217
218
#define N_UNDEF ((short)0)
/* undefined symbol */
219
#define N_ABS ((short)-1)
/* value of symbol is absolute */
220
#define N_DEBUG ((short)-2)
/* debugging symbol -- value is meaningless */
221
#define N_TV ((short)-3)
/* indicates symbol needs preload transfer vector */
222
#define P_TV ((short)-4)
/* indicates symbol needs postload transfer vector*/
223
224
/*
225
* Type of a symbol, in low N bits of the word
226
*/
227
#define T_NULL 0
228
#define T_VOID 1
/* function argument (only used by compiler) */
229
#define T_CHAR 2
/* character */
230
#define T_SHORT 3
/* short integer */
231
#define T_INT 4
/* integer */
232
#define T_LONG 5
/* long integer */
233
#define T_FLOAT 6
/* floating point */
234
#define T_DOUBLE 7
/* double word */
235
#define T_STRUCT 8
/* structure */
236
#define T_UNION 9
/* union */
237
#define T_ENUM 10
/* enumeration */
238
#define T_MOE 11
/* member of enumeration*/
239
#define T_UCHAR 12
/* unsigned character */
240
#define T_USHORT 13
/* unsigned short */
241
#define T_UINT 14
/* unsigned integer */
242
#define T_ULONG 15
/* unsigned long */
243
#define T_LNGDBL 16
/* long double */
244
245
/*
246
* derived types, in n_type
247
*/
248
#define DT_NON (0)
/* no derived type */
249
#define DT_PTR (1)
/* pointer */
250
#define DT_FCN (2)
/* function */
251
#define DT_ARY (3)
/* array */
252
253
#define BTYPE(x) ((x) & N_BTMASK)
254
255
#define ISPTR(x) (((x) & N_TMASK) == (DT_PTR << N_BTSHFT))
256
#define ISFCN(x) (((x) & N_TMASK) == (DT_FCN << N_BTSHFT))
257
#define ISARY(x) (((x) & N_TMASK) == (DT_ARY << N_BTSHFT))
258
#define ISTAG(x) ((x)==C_STRTAG||(x)==C_UNTAG||(x)==C_ENTAG)
259
#define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
260
261
/********************** STORAGE CLASSES **********************/
262
263
/* This used to be defined as -1, but now n_sclass is unsigned. */
264
#define C_EFCN 0xff
/* physical end of function */
265
#define C_NULL 0
266
#define C_AUTO 1
/* automatic variable */
267
#define C_EXT 2
/* external symbol */
268
#define C_STAT 3
/* static */
269
#define C_REG 4
/* register variable */
270
#define C_EXTDEF 5
/* external definition */
271
#define C_LABEL 6
/* label */
272
#define C_ULABEL 7
/* undefined label */
273
#define C_MOS 8
/* member of structure */
274
#define C_ARG 9
/* function argument */
275
#define C_STRTAG 10
/* structure tag */
276
#define C_MOU 11
/* member of union */
277
#define C_UNTAG 12
/* union tag */
278
#define C_TPDEF 13
/* type definition */
279
#define C_USTATIC 14
/* undefined static */
280
#define C_ENTAG 15
/* enumeration tag */
281
#define C_MOE 16
/* member of enumeration */
282
#define C_REGPARM 17
/* register parameter */
283
#define C_FIELD 18
/* bit field */
284
#define C_AUTOARG 19
/* auto argument */
285
#define C_LASTENT 20
/* dummy entry (end of block) */
286
#define C_BLOCK 100
/* ".bb" or ".eb" */
287
#define C_FCN 101
/* ".bf" or ".ef" */
288
#define C_EOS 102
/* end of structure */
289
#define C_FILE 103
/* file name */
290
#define C_LINE 104
/* line # reformatted as symbol table entry */
291
#define C_ALIAS 105
/* duplicate tag */
292
#define C_HIDDEN 106
/* ext symbol in dmert public lib */
293
294
/********************** RELOCATION DIRECTIVES **********************/
295
296
297
298
struct
external_reloc
{
299
unsigned
long
r_vaddr
__attribute__
((packed));
300
unsigned
long
r_symndx
__attribute__
((packed));
301
unsigned
short
r_type
;
302
};
303
304
305
#define RELOC struct external_reloc
306
//#define RELSZ sizeof(RELOC)
307
#define RELSZ 10
308
309
#define DEFAULT_DATA_SECTION_ALIGNMENT 4
310
#define DEFAULT_BSS_SECTION_ALIGNMENT 4
311
#define DEFAULT_TEXT_SECTION_ALIGNMENT 4
312
/* For new sections we havn't heard of before */
313
#define DEFAULT_SECTION_ALIGNMENT 4
gnu_aout::dsize
unsigned long dsize
Definition:
coff.h:60
AOUTHDR::data_start
unsigned long data_start
Definition:
coff.h:52
gnu_aout::bsize
unsigned long bsize
Definition:
coff.h:61
external_syment::e_numaux
unsigned char e_numaux
Definition:
coff.h:151
gnu_aout
Definition:
coff.h:57
AOUTHDR
Definition:
coff.h:43
external_syment::e_type
unsigned short e_type
Definition:
coff.h:149
external_scnhdr::s_paddr
unsigned long s_paddr
Definition:
coff.h:81
external_syment::e_sclass
unsigned char e_sclass
Definition:
coff.h:150
AOUTHDR::tsize
unsigned long tsize
Definition:
coff.h:47
external_filehdr::f_opthdr
unsigned short f_opthdr
Definition:
coff.h:11
gnu_aout::tsize
unsigned long tsize
Definition:
coff.h:59
external_lineno
Definition:
coff.h:119
AOUTHDR::dsize
unsigned long dsize
Definition:
coff.h:48
external_filehdr::f_nscns
unsigned short f_nscns
Definition:
coff.h:7
AOUTHDR::entry
unsigned long entry
Definition:
coff.h:50
__attribute__
#define __attribute__(arg)
Definition:
dll.cpp:14
external_scnhdr::s_nlnno
unsigned short s_nlnno
Definition:
coff.h:88
external_syment::e_scnum
short e_scnum
Definition:
coff.h:148
e
#define e
Definition:
passive0.cpp:24
external_filehdr::f_symptr
unsigned long f_symptr
Definition:
coff.h:9
external_auxent
Definition:
coff.h:159
external_auxent::x_tvndx
unsigned short x_tvndx
Definition:
coff.h:178
AOUTHDR::vstamp
unsigned short vstamp
Definition:
coff.h:46
external_lineno::l_lnno
unsigned short l_lnno
Definition:
coff.h:124
gnu_aout::entry
unsigned long entry
Definition:
coff.h:63
external_auxent::x_nlinno
unsigned short x_nlinno
Definition:
coff.h:192
external_reloc::r_type
unsigned short r_type
Definition:
coff.h:301
external_syment
Definition:
coff.h:138
AOUTHDR::text_start
unsigned long text_start
Definition:
coff.h:51
gnu_aout::dtrel
unsigned long dtrel
Definition:
coff.h:65
external_filehdr::f_magic
unsigned short f_magic
Definition:
coff.h:6
gnu_aout::info
unsigned long info
Definition:
coff.h:58
external_scnhdr::s_scnptr
unsigned long s_scnptr
Definition:
coff.h:84
external_scnhdr::s_nreloc
unsigned short s_nreloc
Definition:
coff.h:87
external_filehdr
Definition:
coff.h:5
external_scnhdr::s_size
unsigned long s_size
Definition:
coff.h:83
external_scnhdr
Definition:
coff.h:79
external_reloc
Definition:
coff.h:298
external_scnhdr::s_relptr
unsigned long s_relptr
Definition:
coff.h:85
external_auxent::x_tvlen
unsigned short x_tvlen
Definition:
coff.h:197
external_scnhdr::s_flags
unsigned long s_flags
Definition:
coff.h:89
E_SYMNMLEN
#define E_SYMNMLEN
Definition:
coff.h:134
external_auxent::x_size
unsigned short x_size
Definition:
coff.h:165
AOUTHDR::magic
unsigned short magic
Definition:
coff.h:45
external_auxent::x_lnno
unsigned short x_lnno
Definition:
coff.h:164
external_scnhdr::s_vaddr
unsigned long s_vaddr
Definition:
coff.h:82
AOUTHDR::bsize
unsigned long bsize
Definition:
coff.h:49
gnu_aout::symsize
unsigned long symsize
Definition:
coff.h:62
external_filehdr::f_flags
unsigned short f_flags
Definition:
coff.h:12
GNU_AOUT
struct gnu_aout GNU_AOUT
external_filehdr::f_timdat
unsigned long f_timdat
Definition:
coff.h:8
E_FILNMLEN
#define E_FILNMLEN
Definition:
coff.h:135
gnu_aout::txrel
unsigned long txrel
Definition:
coff.h:64
external_filehdr::f_nsyms
unsigned long f_nsyms
Definition:
coff.h:10
E_DIMNUM
#define E_DIMNUM
Definition:
coff.h:136
external_auxent::x_nreloc
unsigned short x_nreloc
Definition:
coff.h:191
external_scnhdr::s_lnnoptr
unsigned long s_lnnoptr
Definition:
coff.h:86
src
mswin
windll
coff.h