|
|
1.1 root 1: /* @(#)a.out.h 2.4 */
2:
3: /*#include <nlist.h> /* included for all machines */
4:
5: #if u3b || vax || u3b5
6:
7: /* COMMON OBJECT FILE FORMAT
8:
9:
10:
11: File Organization:
12:
13: _______________________________________________ INCLUDE FILE
14: |_______________HEADER_DATA___________________|
15: | |
16: | File Header | "filehdr.h"
17: |.............................................|
18: | |
19: | Auxilliary Header Information | "aouthdr.h"
20: | |
21: |_____________________________________________|
22: | |
23: | ".text" section header | "scnhdr.h"
24: | |
25: |.............................................|
26: | |
27: | ".data" section header | ''
28: | |
29: |.............................................|
30: | |
31: | ".bss" section header | ''
32: | |
33: |_____________________________________________|
34: |______________RAW_DATA_______________________|
35: | |
36: | ".text" section data (rounded to 4 |
37: | bytes) |
38: |.............................................|
39: | |
40: | ".data" section data (rounded to 4 |
41: | bytes) |
42: |_____________________________________________|
43: |____________RELOCATION_DATA__________________|
44: | |
45: | ".text" section relocation data | "reloc.h"
46: | |
47: |.............................................|
48: | |
49: | ".data" section relocation data | ''
50: | |
51: |_____________________________________________|
52: |__________LINE_NUMBER_DATA_(SDB)_____________|
53: | |
54: | ".text" section line numbers | "linenum.h"
55: | |
56: |.............................................|
57: | |
58: | ".data" section line numbers | ''
59: | |
60: |_____________________________________________|
61: |________________SYMBOL_TABLE_________________|
62: | |
63: | ".text", ".data" and ".bss" section | "syms.h"
64: | symbols | "storclass.h"
65: | |
66: |_____________________________________________|
67: |________________STRING_TABLE_________________|
68: | |
69: | long symbol names |
70: |_____________________________________________|
71:
72:
73:
74: OBJECT FILE COMPONENTS
75:
76: HEADER FILES:
77: /usr/include/filehdr.h
78: /usr/include/aouthdr.h
79: /usr/include/scnhdr.h
80: /usr/include/reloc.h
81: /usr/include/linenum.h
82: /usr/include/syms.h
83: /usr/include/storclass.h
84:
85: STANDARD FILE:
86: /usr/include/a.out.h "object file"
87: */
88:
89: #include "filehdr.h"
90: #include "aouthdr.h"
91: #include "scnhdr.h"
92: #include "reloc.h"
93: #include "linenum.h"
94: #include "syms.h"
95:
96:
97: #else /* u370 || pdp11 */
98:
99:
100: /*
101: * Format of an a.out header
102: */
103:
104:
105: struct exec { /* a.out header */
106: short a_magic; /* magic number */
107: unsigned a_text; /* size of text segment */
108: /* in bytes */
109: /* padded out to next */
110: /* page boundary with */
111: /* binary zeros. */
112: unsigned a_data; /* size of initialized data */
113: /* segment in bytes */
114: /* padded out to next */
115: /* page boundary with */
116: /* binary zeros. */
117: unsigned a_bss; /* Actual size of */
118: /* uninitialized data */
119: /* segment in bytes. */
120: unsigned a_syms; /* size of symbol table */
121: unsigned a_entry; /* entry point */
122: #if pdp11
123: char a_unused; /* not used */
124: unsigned char a_hitext; /* high order text bits */
125: char a_flag; /* reloc info stripped */
126: char a_stamp; /* environment stamp */
127: long a_foo; /* fill */
128: #endif
129: };
130:
131: #define A_MAGIC1 0407 /* normal */
132: #define A_MAGIC0 0401 /* lpd (UNIX/RT) */
133: #define A_MAGIC2 0410 /* read-only text */
134: #define A_MAGIC3 0411 /* separated I&D */
135: #define A_MAGIC4 0405 /* overlay */
136: #define A_MAGIC5 0437 /* system overlay, separated I&D */
137:
138: #if u370
139: struct relocation_info {
140: long r_address; /* relative to current segment */
141: unsigned int
142: r_symbolnum:24, /* if extern then symbol table */
143: /* ordinal (0, 1, 2, ...) else */
144: /* segment number (same as symbol types) */
145: r_pcrel:1, /* if so, segment offset has already */
146: /* been subtracted */
147: r_length:2, /* 0=byte, 1=word, 2=long */
148: r_extern:1, /* does not include value */
149: /* of symbol referenced */
150: r_offset:1, /* already includes origin */
151: /* of this segment (?) */
152: r_pad:3; /* nothing, yet */
153: };
154: #endif
155:
156: /* in invocation of BADMAG macro, argument should not be a function. */
157:
158: #define BADMAG(X) (X.a_magic != A_MAGIC1 &&\
159: X.a_magic != A_MAGIC2 &&\
160: X.a_magic != A_MAGIC3 &&\
161: X.a_magic != A_MAGIC4 &&\
162: X.a_magic != A_MAGIC5 &&\
163: X.a_magic != A_MAGIC0)
164:
165: /* values for type flag */
166:
167: #define N_UNDF 0 /* undefined */
168: #define N_TYPE 037
169: #define N_FN 037 /* file name symbol */
170:
171: #if pdp11
172: #define N_ABS 01 /* absolute */
173: #define N_TEXT 02 /* text symbol */
174: #define N_DATA 03 /* data symbol */
175: #define N_BSS 04 /* bss symbol */
176: #define N_REG 024 /* register name */
177: #define N_EXT 040 /* external bit, or'ed in */
178: #define FORMAT "%.6o" /* to print a value */
179: #else
180: #define N_ABS 02 /* absolute */
181: #define N_TEXT 04 /* text */
182: #define N_DATA 06 /* data */
183: #define N_BSS 010
184: #define N_GSYM 0040 /* global sym: name,,type,0 */
185: #define N_FNAME 0042 /* procedure name (f77 kludge): name,,,0 */
186: #define N_FUN 0044 /* procedure: name,,linenumber,address */
187: #define N_STSYM 0046 /* static symbol: name,,type,address */
188: #define N_LCSYM 0050 /* .lcomm symbol: name,,type,address */
189: #define N_BSTR 0060 /* begin structure: name,,, */
190: #define N_RSYM 0100 /* register sym: name,,register,offset */
191: #define N_SLINE 0104 /* src line: ,,linenumber,address */
192: #define N_ESTR 0120 /* end structure: name,,, */
193: #define N_SSYM 0140 /* structure elt: name,,type,struct_offset */
194: #define N_SO 0144 /* source file name: name,,,address */
195: #define N_BENUM 0160 /* begin enum: name,,, */
196: #define N_LSYM 0200 /* local sym: name,,type,offset */
197: #define N_SOL 0204 /* #line source filename: name,,,address */
198: #define N_ENUM 0220 /* enum element: name,,,value */
199: #define N_PSYM 0240 /* parameter: name,,type,offset */
200: #define N_ENTRY 0244 /* alternate entry: name,,linenumber,address */
201: #define N_EENUM 0260 /* end enum: name,,, */
202: #define N_LBRAC 0300 /* left bracket: ,,nesting level,address */
203: #define N_RBRAC 0340 /* right bracket: ,,nesting level,address */
204: #define N_BCOMM 0342 /* begin common: name,,, */
205: #define N_ECOMM 0344 /* end common: name,,, */
206: #define N_ECOML 0350 /* end common (local name): ,,,address */
207: #define N_STRU 0374 /* 2nd entry for structure: str tag,,,length */
208: #define N_LENG 0376 /* second stab entry with length information */
209: #define N_EXT 01 /* external bit, or'ed in */
210: #define FORMAT "%.8x"
211: #define STABTYPES 0340
212: #endif
213:
214: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.