1 /* COFF spec for AMD 290*0
2 Contributed by David Wood @ New York University.
9 /****************************************************************/
12 ** File Header and related definitions
15 struct external_filehdr
17 char f_magic
[2]; /* magic number */
18 char f_nscns
[2]; /* number of sections */
19 char f_timdat
[4]; /* time & date stamp */
20 char f_symptr
[4]; /* file pointer to symtab */
21 char f_nsyms
[4]; /* number of symtab entries */
22 char f_opthdr
[2]; /* sizeof(optional hdr) */
23 char f_flags
[2]; /* flags */
26 #define FILHDR struct external_filehdr
27 #define FILHSZ sizeof (FILHDR)
29 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
32 ** Magic numbers for Am29000
33 ** (AT&T will assign the "real" magic number)
36 #define SIPFBOMAGIC 0572 /* Am29000 (Byte 0 is MSB) */
37 #define SIPRBOMAGIC 0573 /* Am29000 (Byte 0 is LSB) */
40 #define A29K_MAGIC_BIG SIPFBOMAGIC
41 #define A29K_MAGIC_LITTLE SIPRBOMAGIC
42 #define A29KBADMAG(x) (((x).f_magic!=A29K_MAGIC_BIG) && \
43 ((x).f_magic!=A29K_MAGIC_LITTLE))
45 #define OMAGIC A29K_MAGIC_BIG
46 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
49 ** File header flags currently known to us.
51 ** Am29000 will use the F_AR32WR and F_AR32W flags to indicate
52 ** the byte ordering in the file.
55 /*--------------------------------------------------------------*/
58 ** Optional (a.out) header
61 typedef struct external_aouthdr
63 char magic
[2]; /* type of file */
64 char vstamp
[2]; /* version stamp */
65 char tsize
[4]; /* text size in bytes, padded to FW bdry*/
66 char dsize
[4]; /* initialized data " " */
67 char bsize
[4]; /* uninitialized data " " */
68 char entry
[4]; /* entry pt. */
69 char text_start
[4]; /* base of text used for this file */
70 char data_start
[4]; /* base of data used for this file */
73 #define AOUTSZ (sizeof(AOUTHDR))
74 #define AOUTHDRSZ (sizeof(AOUTHDR))
76 /* aouthdr magic numbers */
77 #define NMAGIC 0410 /* separate i/d executable */
78 #define SHMAGIC 0406 /* NYU/Ultra3 shared data executable
81 #define _ETEXT "_etext"
83 /*--------------------------------------------------------------*/
86 ** Section header and related definitions
89 struct external_scnhdr
91 char s_name
[8]; /* section name */
92 char s_paddr
[4]; /* physical address, aliased s_nlib */
93 char s_vaddr
[4]; /* virtual address */
94 char s_size
[4]; /* section size */
95 char s_scnptr
[4]; /* file ptr to raw data for section */
96 char s_relptr
[4]; /* file ptr to relocation */
97 char s_lnnoptr
[4]; /* file ptr to line numbers */
98 char s_nreloc
[2]; /* number of relocation entries */
99 char s_nlnno
[2]; /* number of line number entries*/
100 char s_flags
[4]; /* flags */
103 #define SCNHDR struct external_scnhdr
104 #define SCNHSZ sizeof (SCNHDR)
107 * names of "special" sections
109 #define _TEXT ".text"
110 #define _DATA ".data"
113 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
116 ** Section types - with additional section type for global
117 ** registers which will be relocatable for the Am29000.
119 ** In instances where it is necessary for a linker to produce an
120 ** output file which contains text or data not based at virtual
121 ** address 0, e.g. for a ROM, then the linker should accept
122 ** address base information as command input and use PAD sections
123 ** to skip over unused addresses.
126 #define STYP_BSSREG 0x1200 /* Global register area (like STYP_INFO) */
127 #define STYP_ENVIR 0x2200 /* Environment (like STYP_INFO) */
128 #define STYP_ABS 0x4000 /* Absolute (allocated, not reloc, loaded) */
130 /*--------------------------------------------------------------*/
133 ** Relocation information declaration and related definitions
136 struct external_reloc
{
137 char r_vaddr
[4]; /* (virtual) address of reference */
138 char r_symndx
[4]; /* index into symbol table */
139 char r_type
[2]; /* relocation type */
142 #define RELOC struct external_reloc
143 #define RELSZ 10 /* sizeof (RELOC) */
145 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
148 ** Relocation types for the Am29000
151 #define R_ABS 0 /* reference is absolute */
153 #define R_IREL 030 /* instruction relative (jmp/call) */
154 #define R_IABS 031 /* instruction absolute (jmp/call) */
155 #define R_ILOHALF 032 /* instruction low half (const) */
156 #define R_IHIHALF 033 /* instruction high half (consth) part 1 */
157 #define R_IHCONST 034 /* instruction high half (consth) part 2 */
158 /* constant offset of R_IHIHALF relocation */
159 #define R_BYTE 035 /* relocatable byte value */
160 #define R_HWORD 036 /* relocatable halfword value */
161 #define R_WORD 037 /* relocatable word value */
163 #define R_IGLBLRC 040 /* instruction global register RC */
164 #define R_IGLBLRA 041 /* instruction global register RA */
165 #define R_IGLBLRB 042 /* instruction global register RB */
169 All the "I" forms refer to 29000 instruction formats. The linker is
170 expected to know how the numeric information is split and/or aligned
171 within the instruction word(s). R_BYTE works for instructions, too.
173 If the parameter to a CONSTH instruction is a relocatable type, two
174 relocation records are written. The first has an r_type of R_IHIHALF
175 (33 octal) and a normal r_vaddr and r_symndx. The second relocation
176 record has an r_type of R_IHCONST (34 octal), a normal r_vaddr (which
177 is redundant), and an r_symndx containing the 32-bit constant offset
178 to the relocation instead of the actual symbol table index. This
179 second record is always written, even if the constant offset is zero.
180 The constant fields of the instruction are set to zero.
183 /*--------------------------------------------------------------*/
186 ** Line number entry declaration and related definitions
189 struct external_lineno
192 char l_symndx
[4]; /* function name symbol index, iff l_lnno == 0*/
193 char l_paddr
[4]; /* (physical) address of line number */
195 char l_lnno
[2]; /* line number */
198 #define LINENO struct external_lineno
199 #define LINESZ 6 /* sizeof (LINENO) */
201 /*--------------------------------------------------------------*/
204 ** Symbol entry declaration and related definitions
207 #define E_SYMNMLEN 8 /* Number of characters in a symbol name */
209 struct external_syment
212 char e_name
[E_SYMNMLEN
];
225 #define SYMENT struct external_syment
226 #define SYMESZ sizeof(SYMENT)
228 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
231 ** Storage class definitions - new classes for global registers.
234 #define C_GLBLREG 19 /* global register */
235 #define C_EXTREG 20 /* external global register */
236 #define C_DEFREG 21 /* ext. def. of global register */
239 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
242 ** Derived symbol mask/shifts.
245 #define N_BTMASK (0xf)
247 #define N_TMASK (0x30)
250 /*--------------------------------------------------------------*/
253 ** Auxiliary symbol table entry declaration and related
257 #define E_FILNMLEN 14 /* # characters in a file name */
258 #define E_DIMNUM 4 /* # array dimensions in auxiliary entry */
260 union external_auxent
{
262 char x_tagndx
[4]; /* str, un, or enum tag indx */
265 char x_lnno
[2]; /* declaration line number */
266 char x_size
[2]; /* str/union/array size */
268 char x_fsize
[4]; /* size of function */
271 struct { /* if ISFCN, tag, or .bb */
272 char x_lnnoptr
[4]; /* ptr to fcn line # */
273 char x_endndx
[4]; /* entry ndx past block end */
275 struct { /* if ISARY, up to 4 dimen. */
276 char x_dimen
[E_DIMNUM
][2];
279 char x_tvndx
[2]; /* tv index */
283 char x_fname
[E_FILNMLEN
];
291 char x_scnlen
[4]; /* section length */
292 char x_nreloc
[2]; /* # relocation entries */
293 char x_nlinno
[2]; /* # line numbers */
297 char x_tvfill
[4]; /* tv fill value */
298 char x_tvlen
[2]; /* length of .tv */
299 char x_tvran
[2][2]; /* tv range */
300 } x_tv
; /* info about .tv section (in auxent of symbol .tv)) */
303 #define AUXENT union external_auxent
This page took 0.034863 seconds and 4 git commands to generate.