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 */
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
40 /********************** AOUT "OPTIONAL HEADER" **********************/
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 */
58 #define APOLLO_COFF_VERSION_NUMBER 1 /* the value of the aouthdr magic */
64 /********************** SECTION HEADER **********************/
66 struct external_scnhdr
{
67 /* Apollo allow for larger section names by allowing it to be in
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
98 #define _LINES ".lines"
99 #define _BLOCKS ".blocks"
100 #define _SRI ".sri" /* Static Resource Information (systype,
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
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
{
122 char l_symndx
[4]; /* function name symbol index, iff l_lnno == 0*/
123 char l_paddr
[4]; /* (physical) address of line number */
125 char l_lnno
[2]; /* line number */
129 #define LINENO struct external_lineno
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
142 char e_name
[E_SYMNMLEN
];
157 #define N_BTMASK (017)
158 #define N_TMASK (060)
163 union external_auxent
{
165 char x_tagndx
[4]; /* str, un, or enum tag indx */
168 char x_lnno
[2]; /* declaration line number */
169 char x_size
[2]; /* str/union/array size */
171 char x_fsize
[4]; /* size of function */
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 */
178 struct { /* if ISARY, up to 4 dimen. */
179 char x_dimen
[E_DIMNUM
][2];
182 char x_tvndx
[2]; /* tv index */
186 char x_fname
[E_FILNMLEN
];
194 char x_scnlen
[4]; /* section length */
195 char x_nreloc
[2]; /* # relocation entries */
196 char x_nlinno
[2]; /* # line numbers */
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
210 #define AUXENT union external_auxent
215 /********************** RELOCATION DIRECTIVES **********************/
218 struct external_reloc
{
222 #ifdef M68K_COFF_OFFSET
229 #define RELOC struct external_reloc
231 #ifdef M68K_COFF_OFFSET
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) */