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
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 */
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
107 * names of "special" sections
109 #define _TEXT ".text"
110 #define _DATA ".data"
114 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
117 ** Section types - with additional section type for global
118 ** registers which will be relocatable for the Am29000.
120 ** In instances where it is necessary for a linker to produce an
121 ** output file which contains text or data not based at virtual
122 ** address 0, e.g. for a ROM, then the linker should accept
123 ** address base information as command input and use PAD sections
124 ** to skip over unused addresses.
127 #define STYP_BSSREG 0x1200 /* Global register area (like STYP_INFO) */
128 #define STYP_ENVIR 0x2200 /* Environment (like STYP_INFO) */
129 #define STYP_ABS 0x4000 /* Absolute (allocated, not reloc, loaded) */
131 /*--------------------------------------------------------------*/
134 ** Relocation information declaration and related definitions
137 struct external_reloc
{
138 char r_vaddr
[4]; /* (virtual) address of reference */
139 char r_symndx
[4]; /* index into symbol table */
140 char r_type
[2]; /* relocation type */
143 #define RELOC struct external_reloc
144 #define RELSZ 10 /* sizeof (RELOC) */
146 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
149 ** Relocation types for the Am29000
152 #define R_ABS 0 /* reference is absolute */
154 #define R_IREL 030 /* instruction relative (jmp/call) */
155 #define R_IABS 031 /* instruction absolute (jmp/call) */
156 #define R_ILOHALF 032 /* instruction low half (const) */
157 #define R_IHIHALF 033 /* instruction high half (consth) part 1 */
158 #define R_IHCONST 034 /* instruction high half (consth) part 2 */
159 /* constant offset of R_IHIHALF relocation */
160 #define R_BYTE 035 /* relocatable byte value */
161 #define R_HWORD 036 /* relocatable halfword value */
162 #define R_WORD 037 /* relocatable word value */
164 #define R_IGLBLRC 040 /* instruction global register RC */
165 #define R_IGLBLRA 041 /* instruction global register RA */
166 #define R_IGLBLRB 042 /* instruction global register RB */
170 All the "I" forms refer to 29000 instruction formats. The linker is
171 expected to know how the numeric information is split and/or aligned
172 within the instruction word(s). R_BYTE works for instructions, too.
174 If the parameter to a CONSTH instruction is a relocatable type, two
175 relocation records are written. The first has an r_type of R_IHIHALF
176 (33 octal) and a normal r_vaddr and r_symndx. The second relocation
177 record has an r_type of R_IHCONST (34 octal), a normal r_vaddr (which
178 is redundant), and an r_symndx containing the 32-bit constant offset
179 to the relocation instead of the actual symbol table index. This
180 second record is always written, even if the constant offset is zero.
181 The constant fields of the instruction are set to zero.
184 /*--------------------------------------------------------------*/
187 ** Line number entry declaration and related definitions
190 struct external_lineno
193 char l_symndx
[4]; /* function name symbol index, iff l_lnno == 0*/
194 char l_paddr
[4]; /* (physical) address of line number */
196 char l_lnno
[2]; /* line number */
199 #define LINENO struct external_lineno
200 #define LINESZ 6 /* sizeof (LINENO) */
202 /*--------------------------------------------------------------*/
205 ** Symbol entry declaration and related definitions
208 #define E_SYMNMLEN 8 /* Number of characters in a symbol name */
210 struct external_syment
213 char e_name
[E_SYMNMLEN
];
226 #define SYMENT struct external_syment
229 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
232 ** Storage class definitions - new classes for global registers.
235 #define C_GLBLREG 19 /* global register */
236 #define C_EXTREG 20 /* external global register */
237 #define C_DEFREG 21 /* ext. def. of global register */
240 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
243 ** Derived symbol mask/shifts.
246 #define N_BTMASK (0xf)
248 #define N_TMASK (0x30)
251 /*--------------------------------------------------------------*/
254 ** Auxiliary symbol table entry declaration and related
258 #define E_FILNMLEN 14 /* # characters in a file name */
259 #define E_DIMNUM 4 /* # array dimensions in auxiliary entry */
261 union external_auxent
{
263 char x_tagndx
[4]; /* str, un, or enum tag indx */
266 char x_lnno
[2]; /* declaration line number */
267 char x_size
[2]; /* str/union/array size */
269 char x_fsize
[4]; /* size of function */
272 struct { /* if ISFCN, tag, or .bb */
273 char x_lnnoptr
[4]; /* ptr to fcn line # */
274 char x_endndx
[4]; /* entry ndx past block end */
276 struct { /* if ISARY, up to 4 dimen. */
277 char x_dimen
[E_DIMNUM
][2];
280 char x_tvndx
[2]; /* tv index */
284 char x_fname
[E_FILNMLEN
];
292 char x_scnlen
[4]; /* section length */
293 char x_nreloc
[2]; /* # relocation entries */
294 char x_nlinno
[2]; /* # line numbers */
298 char x_tvfill
[4]; /* tv fill value */
299 char x_tvlen
[2]; /* length of .tv */
300 char x_tvran
[2][2]; /* tv range */
301 } x_tv
; /* info about .tv section (in auxent of symbol .tv)) */
304 #define AUXENT union external_auxent
This page took 0.041799 seconds and 5 git commands to generate.