]> Git Repo - binutils.git/blob - include/coff-i960.h
bfd.h: added alignment field
[binutils.git] / include / coff-i960.h
1 /*** coff information for 80960.  Origins: Intel corp, natch. */
2
3 /* This include file is also used for rudimentary ECOFF support on MIPS
4    machines.  Such differences as are needed are #ifdef MIPS.  */
5
6 /* NOTE: Tagentries (cf TAGBITS) are not used by the 960 */
7
8 /********************** FILE HEADER **********************/
9
10 struct external_filehdr {
11         char f_magic[2];        /* magic number                 */
12         char f_nscns[2];        /* number of sections           */
13         char f_timdat[4];       /* time & date stamp            */
14         char f_symptr[4];       /* file pointer to symtab       */
15         char f_nsyms[4];        /* number of symtab entries     */
16         char f_opthdr[2];       /* sizeof(optional hdr)         */
17         char f_flags[2];        /* flags                        */
18 };
19
20 #define OMAGIC      (0407)      /* old impure format. data immediately
21                                    follows text. both sections are rw. */
22 #define NMAGIC      (0410)      /* split i&d, read-only text */
23
24 /*
25 *       Intel 80960 (I960) processor flags.
26 *       F_I960TYPE == mask for processor type field. 
27 */
28
29 #define F_I960TYPE      (0xf000)
30 #define F_I960CORE      (0x1000)
31 #define F_I960KB        (0x2000)
32 #define F_I960SB        (0x2000)
33 #define F_I960MC        (0x3000)
34 #define F_I960XA        (0x4000)
35 #define F_I960CA        (0x5000)
36 #define F_I960KA        (0x6000)
37 #define F_I960SA        (0x6000)
38
39
40 /** i80960 Magic Numbers
41 */
42
43 #define I960ROMAGIC     (0x160) /* read-only text segments */
44 #define I960RWMAGIC     (0x161) /* read-write text segments */
45
46 #define I960BADMAG(x) (((x).f_magic!=I960ROMAGIC) && ((x).f_magic!=I960RWMAGIC))
47
48 #define FILHDR  struct external_filehdr
49 #define FILHSZ  20
50
51 /********************** AOUT "OPTIONAL HEADER" **********************/
52
53 typedef struct {
54         unsigned long   phys_addr;
55         unsigned long   bitarray;
56 } TAGBITS;
57
58
59
60 typedef struct 
61 {
62   char  magic[2];               /* type of file                         */
63   char  vstamp[2];              /* version stamp                        */
64   char  tsize[4];               /* text size in bytes, padded to FW bdry*/
65   char  dsize[4];               /* initialized data "  "                */
66   char  bsize[4];               /* uninitialized data "   "             */
67   char  entry[4];               /* entry pt.                            */
68   char  text_start[4];          /* base of text used for this file */
69   char  data_start[4];          /* base of data used for this file */
70   char  tagentries[4];          /* number of tag entries to follow */
71 }
72 AOUTHDR;
73
74 /* return a pointer to the tag bits array */
75
76 #define TAGPTR(aout) ((TAGBITS *) (&(aout.tagentries)+1))
77
78 /* compute size of a header */
79
80 /*#define AOUTSZ(aout) (sizeof(AOUTHDR)+(aout.tagentries*sizeof(TAGBITS)))*/
81 #define AOUTSZ (sizeof(AOUTHDR))
82
83
84
85 /********************** SECTION HEADER **********************/
86
87
88 struct external_scnhdr {
89         char            s_name[8];      /* section name                 */
90         char            s_paddr[4];     /* physical address, aliased s_nlib */
91         char            s_vaddr[4];     /* virtual address              */
92         char            s_size[4];      /* section size                 */
93         char            s_scnptr[4];    /* file ptr to raw data for section */
94         char            s_relptr[4];    /* file ptr to relocation       */
95         char            s_lnnoptr[4];   /* file ptr to line numbers     */
96         char            s_nreloc[2];    /* number of relocation entries */
97         char            s_nlnno[2];     /* number of line number entries*/
98         char            s_flags[4];     /* flags                        */
99         char            s_align[4];     /* section alignment            */
100 };
101
102
103 #define SCNHDR  struct external_scnhdr
104 #define SCNHSZ  sizeof(SCNHDR)
105
106
107 /********************** LINE NUMBERS **********************/
108
109 /* 1 line number entry for every "breakpointable" source line in a section.
110  * Line numbers are grouped on a per function basis; first entry in a function
111  * grouping will have l_lnno = 0 and in place of physical address will be the
112  * symbol table index of the function name.
113  */
114 struct external_lineno {
115         union {
116                 char l_symndx[4];       /* function name symbol index, iff l_lnno == 0*/
117                 char l_paddr[4];        /* (physical) address of line number    */
118         } l_addr;
119         char l_lnno[2];         /* line number          */
120         char padding[2];        /* force alignment      */
121 };
122
123
124 #define LINENO  struct external_lineno
125 #define LINESZ  8
126
127
128 /********************** SYMBOLS **********************/
129
130 #define SYMNMLEN        8       /* # characters in a symbol name        */
131 #define FILNMLEN        14      /* # characters in a file name          */
132 #define DIMNUM          4       /* # array dimensions in auxiliary entry */
133
134 struct external_syment 
135 {
136   union {
137     char e_name[SYMNMLEN];
138     struct {
139       char e_zeroes[4];
140       char e_offset[4];
141     } e;
142   } e;
143   char e_value[4];
144   char e_scnum[2];
145   char e_flags[2];
146   char e_type[4];
147   char e_sclass[1];
148   char e_numaux[1];
149   char pad2[2];
150 };
151
152
153
154
155 #define N_BTMASK        (0x1f)
156 #define N_TMASK         (0x60)
157 #define N_BTSHFT        (5)
158 #define N_TSHIFT        (2)
159   
160 union external_auxent {
161         struct {
162                 char x_tagndx[4];       /* str, un, or enum tag indx */
163                 union {
164                         struct {
165                             char  x_lnno[2]; /* declaration line number */
166                             char  x_size[2]; /* str/union/array size */
167                         } x_lnsz;
168                         char x_fsize[4];        /* size of function */
169                 } x_misc;
170                 union {
171                         struct {                /* if ISFCN, tag, or .bb */
172                             char x_lnnoptr[4];  /* ptr to fcn line # */
173                             char x_endndx[4];   /* entry ndx past block end */
174                         } x_fcn;
175                         struct {                /* if ISARY, up to 4 dimen. */
176                             char x_dimen[DIMNUM][2];
177                         } x_ary;
178                 } x_fcnary;
179                 char x_tvndx[2];                /* tv index */
180         } x_sym;
181
182         union {
183                 char x_fname[FILNMLEN];
184                 struct {
185                         char x_zeroes[4];
186                         char x_offset[4];
187                 } x_n;
188         } x_file;
189
190         struct {
191                 char x_scnlen[4];                       /* section length */
192                 char x_nreloc[2];       /* # relocation entries */
193                 char x_nlinno[2];       /* # line numbers */
194         } x_scn;
195
196         struct {
197                 char x_tvfill[4];       /* tv fill value */
198                 char x_tvlen[2];        /* length of .tv */
199                 char x_tvran[2][2];     /* tv range */
200         } x_tv;         /* info about .tv section (in auxent of symbol .tv)) */
201
202         /******************************************
203          *  I960-specific *2nd* aux. entry formats
204          ******************************************/
205         struct {
206           /* This is a very old typo that keeps getting propagated. */
207 #define x_stdindx x_stindx
208                 char x_stindx[4];       /* sys. table entry */
209         } x_sc; /* system call entry */
210
211         struct {
212                 char x_balntry[4]; /* BAL entry point */
213         } x_bal; /* BAL-callable function */
214
215         struct {
216                 char x_timestamp[4];            /* time stamp */
217                 char    x_idstring[20];         /* producer identity string */
218         } x_ident;                              /* Producer ident info */
219
220 };
221
222
223
224 #define SYMENT  struct external_syment
225 #define SYMESZ  sizeof(SYMENT)                  /* FIXME - calc by hand */
226 #define AUXENT  union external_auxent
227 #define AUXESZ  sizeof(AUXENT)                  /* FIXME - calc by hand */
228
229 #       define _ETEXT   "_etext"
230
231 /********************** RELOCATION DIRECTIVES **********************/
232
233 struct external_reloc {
234   char r_vaddr[4];
235   char r_symndx[4];
236   char r_type[2];
237   char pad[2];
238 };
239
240
241 /* Relevent values for r_type and i960.  Would someone please document them */
242
243
244 #define RELOC struct external_reloc
245 #define RELSZ 12
246
247 #define DEFAULT_DATA_SECTION_ALIGNMENT 4
248 #define DEFAULT_BSS_SECTION_ALIGNMENT 4
249 #define DEFAULT_TEXT_SECTION_ALIGNMENT 16
250 /* For new sections we havn't heard of before */
251 #define DEFAULT_SECTION_ALIGNMENT 4
This page took 0.040259 seconds and 4 git commands to generate.