2001-02-17 Philip Blundell <philb@gnu.org>
[binutils.git] / include / coff / apollo.h
blobd1347f1f532dae92f00cd1979edea3e4ac7eee51
1 /*** coff information for Apollo M68K */
3 /********************** FILE HEADER **********************/
5 struct external_filehdr {
6 char f_magic[2]; /* magic number */
7 char f_nscns[2]; /* number of sections */
8 char f_timdat[4]; /* time & date stamp */
9 char f_symptr[4]; /* file pointer to symtab */
10 char f_nsyms[4]; /* number of symtab entries */
11 char f_opthdr[2]; /* sizeof(optional hdr) */
12 char f_flags[2]; /* flags */
16 /* Motorola 68000/68008/68010/68020 */
17 #define MC68MAGIC 0520
18 #define MC68KWRMAGIC 0520 /* writeable text segments */
19 #define MC68TVMAGIC 0521
20 #define MC68KROMAGIC 0521 /* readonly shareable text segments */
21 #define MC68KPGMAGIC 0522 /* demand paged text segments */
22 #define M68MAGIC 0210
23 #define M68TVMAGIC 0211
25 /* Apollo 68000-based machines have a different magic number. This comes
26 * from /usr/include/apollo/filehdr.h
28 #define APOLLOM68KMAGIC 0627
30 #define OMAGIC M68MAGIC
31 #define M68KBADMAG(x) (((x).f_magic!=MC68MAGIC) && ((x).f_magic!=MC68KWRMAGIC) && ((x).f_magic!=MC68TVMAGIC) && \
32 ((x).f_magic!=MC68KROMAGIC) && ((x).f_magic!=MC68KPGMAGIC) && ((x).f_magic!=M68MAGIC) && ((x).f_magic!=M68TVMAGIC) && \
33 ((x).f_magic!=APOLLOM68KMAGIC) )
36 #define FILHDR struct external_filehdr
37 #define FILHSZ 20
40 /********************** AOUT "OPTIONAL HEADER" **********************/
42 typedef struct
44 char magic[2]; /* type of file */
45 char vstamp[2]; /* version stamp */
46 char tsize[4]; /* text size in bytes, padded to FW bdry*/
47 char dsize[4]; /* initialized data " " */
48 char bsize[4]; /* uninitialized data " " */
49 char entry[4]; /* entry pt. */
50 char text_start[4]; /* base of text used for this file */
51 char data_start[4]; /* base of data used for this file */
52 char o_sri[4]; /* Apollo specific - .sri data pointer */
53 char o_inlib[4]; /* Apollo specific - .inlib data pointer */
54 char vid[8]; /* Apollo specific - 64 bit version ID */
56 AOUTHDR;
58 #define APOLLO_COFF_VERSION_NUMBER 1 /* the value of the aouthdr magic */
59 #define AOUTHDRSZ 44
60 #define AOUTSZ 44
64 /********************** SECTION HEADER **********************/
66 struct external_scnhdr {
67 /* Apollo allow for larger section names by allowing it to be in
68 * the string table.
70 char s_name[8];
71 char s_paddr[4]; /* physical address, aliased s_nlib */
72 char s_vaddr[4]; /* virtual address */
73 char s_size[4]; /* section size */
74 char s_scnptr[4]; /* file ptr to raw data for section */
75 char s_relptr[4]; /* file ptr to relocation */
76 char s_lnnoptr[4]; /* file ptr to line numbers */
77 char s_nreloc[2]; /* number of relocation entries */
78 char s_nlnno[2]; /* number of line number entries*/
79 char s_flags[4]; /* flags */
82 /* If s_zeores is all zeroes, s_offset gives the real location of the name
83 * in the string table.
86 #define s_zeroes section_name.s_name
87 #define s_offset (section_name.s_name+4)
90 * names of "special" sections
92 #define _TEXT ".text"
93 #define _DATA ".data"
94 #define _BSS ".bss"
95 #define _TV ".tv"
96 #define _INIT ".init"
97 #define _FINI ".fini"
98 #define _LINES ".lines"
99 #define _BLOCKS ".blocks"
100 #define _SRI ".sri" /* Static Resource Information (systype,
101 et al.) */
102 #define _MIR ".mir" /* Module Information Records */
103 #define _APTV ".aptv" /* Apollo-style transfer vectors. */
104 #define _INLIB ".inlib" /* Shared Library information */
105 #define _RWDI ".rwdi" /* Read/write data initialization directives for
106 compressed sections */
107 #define _UNWIND ".unwind" /* Stack unwind information */
109 #define SCNHDR struct external_scnhdr
110 #define SCNHSZ 40
113 /********************** LINE NUMBERS **********************/
115 /* 1 line number entry for every "breakpointable" source line in a section.
116 * Line numbers are grouped on a per function basis; first entry in a function
117 * grouping will have l_lnno = 0 and in place of physical address will be the
118 * symbol table index of the function name.
120 struct external_lineno {
121 union {
122 char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/
123 char l_paddr[4]; /* (physical) address of line number */
124 } l_addr;
125 char l_lnno[2]; /* line number */
129 #define LINENO struct external_lineno
130 #define LINESZ 6
133 /********************** SYMBOLS **********************/
135 #define E_SYMNMLEN 8 /* # characters in a symbol name */
136 #define E_FILNMLEN 14 /* # characters in a file name */
137 #define E_DIMNUM 4 /* # array dimensions in auxiliary entry */
139 struct external_syment
141 union {
142 char e_name[E_SYMNMLEN];
143 struct {
144 char e_zeroes[4];
145 char e_offset[4];
146 } e;
147 } e;
148 char e_value[4];
149 char e_scnum[2];
150 char e_type[2];
151 char e_sclass[1];
152 char e_numaux[1];
157 #define N_BTMASK (017)
158 #define N_TMASK (060)
159 #define N_BTSHFT (4)
160 #define N_TSHIFT (2)
163 union external_auxent {
164 struct {
165 char x_tagndx[4]; /* str, un, or enum tag indx */
166 union {
167 struct {
168 char x_lnno[2]; /* declaration line number */
169 char x_size[2]; /* str/union/array size */
170 } x_lnsz;
171 char x_fsize[4]; /* size of function */
172 } x_misc;
173 union {
174 struct { /* if ISFCN, tag, or .bb */
175 char x_lnnoptr[4]; /* ptr to fcn line # */
176 char x_endndx[4]; /* entry ndx past block end */
177 } x_fcn;
178 struct { /* if ISARY, up to 4 dimen. */
179 char x_dimen[E_DIMNUM][2];
180 } x_ary;
181 } x_fcnary;
182 char x_tvndx[2]; /* tv index */
183 } x_sym;
185 union {
186 char x_fname[E_FILNMLEN];
187 struct {
188 char x_zeroes[4];
189 char x_offset[4];
190 } x_n;
191 } x_file;
193 struct {
194 char x_scnlen[4]; /* section length */
195 char x_nreloc[2]; /* # relocation entries */
196 char x_nlinno[2]; /* # line numbers */
197 } x_scn;
199 struct {
200 char x_tvfill[4]; /* tv fill value */
201 char x_tvlen[2]; /* length of .tv */
202 char x_tvran[2][2]; /* tv range */
203 } x_tv; /* info about .tv section (in auxent of symbol .tv)) */
208 #define SYMENT struct external_syment
209 #define SYMESZ 18
210 #define AUXENT union external_auxent
211 #define AUXESZ 18
215 /********************** RELOCATION DIRECTIVES **********************/
218 struct external_reloc {
219 char r_vaddr[4];
220 char r_symndx[4];
221 char r_type[2];
222 #ifdef M68K_COFF_OFFSET
223 char r_offset[4];
224 #endif
229 #define RELOC struct external_reloc
231 #ifdef M68K_COFF_OFFSET
232 #define RELSZ 14
233 #else
234 #define RELSZ 10
235 #endif
237 /* Apollo specific STYP flags */
239 #define STYP_RELOCATED_NOT_LOADED 0x00010000 /* Section is relocated normally during linking, but need
240 not be loaded during program execution */
241 #define STYP_DEBUG 0x00020000 /* debug section */
242 #define STYP_OVERLAY 0x00040000 /* Section is overlayed */
243 #define STYP_INSTRUCTION 0x00200000 /* Section contains executable code */
245 #define STYP_ZERO 0x00800000 /* Section is initialized to zero */
246 #define STYP_INSTALLED 0x02000000 /* Section should be installable in KGT */
247 #define STYP_LOOK_INSTALLED 0x04000000 /* Look for section in KGT */
248 #define STYP_SECALIGN1 0x08000000 /* Specially aligned section */
249 #define STYP_SECALIGN2 0x10000000 /* " " " */
250 #define STYP_COMPRESSED 0x20000000 /* No section data per se (s_scnptr = 0), but there are
251 initialization directives for it in .rwdi section
252 (used in conjunction with STYP_BSS) */