Initial revision
[binutils.git] / include / coff / tic80.h
blob5d938f7b1f004426c7db1f7f0b319a8646b078f2
1 /*** coff information for TI TMS320C80 (MVP) */
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 */
13 char f_target_id[2]; /* target id (TIc80 specific) */
16 #define TIC80_ARCH_MAGIC 0x0C1 /* Goes in the file header magic number field */
17 #define TIC80_TARGET_ID 0x95 /* Goes in the target id field */
19 #define TIC80BADMAG(x) ((x).f_magic != TIC80_ARCH_MAGIC)
21 #define FILHDR struct external_filehdr
22 #define FILHSZ 22
25 /********************** AOUT "OPTIONAL HEADER" **********************/
28 typedef struct
30 char magic[2]; /* type of file */
31 char vstamp[2]; /* version stamp */
32 char tsize[4]; /* text size in bytes, padded to FW bdry*/
33 char dsize[4]; /* initialized data " " */
34 char bsize[4]; /* uninitialized data " " */
35 char entry[4]; /* entry pt. */
36 char text_start[4]; /* base of text used for this file */
37 char data_start[4]; /* base of data used for this file */
39 AOUTHDR;
41 #define TIC80_AOUTHDR_MAGIC 0x108 /* Goes in the optional file header magic number field */
43 #define AOUTHDRSZ 28
44 #define AOUTSZ 28
49 /********************** SECTION HEADER **********************/
52 struct external_scnhdr {
53 char s_name[8]; /* section name */
54 char s_paddr[4]; /* physical address, aliased s_nlib */
55 char s_vaddr[4]; /* virtual address */
56 char s_size[4]; /* section size */
57 char s_scnptr[4]; /* file ptr to raw data for section */
58 char s_relptr[4]; /* file ptr to relocation */
59 char s_lnnoptr[4]; /* file ptr to line numbers */
60 char s_nreloc[2]; /* number of relocation entries */
61 char s_nlnno[2]; /* number of line number entries*/
62 char s_flags[2]; /* flags */
63 char s_reserved[1]; /* reserved (TIc80 specific) */
64 char s_mempage[1]; /* memory page number (TIc80) */
68 * names of "special" sections
70 #define _TEXT ".text"
71 #define _DATA ".data"
72 #define _BSS ".bss"
73 #define _CINIT ".cinit"
74 #define _CONST ".const"
75 #define _SWITCH ".switch"
76 #define _STACK ".stack"
77 #define _SYSMEM ".sysmem"
80 #define SCNHDR struct external_scnhdr
81 #define SCNHSZ 40
84 /********************** LINE NUMBERS **********************/
86 /* 1 line number entry for every "breakpointable" source line in a section.
87 * Line numbers are grouped on a per function basis; first entry in a function
88 * grouping will have l_lnno = 0 and in place of physical address will be the
89 * symbol table index of the function name.
91 struct external_lineno {
92 union {
93 char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/
94 char l_paddr[4]; /* (physical) address of line number */
95 } l_addr;
96 char l_lnno[2]; /* line number */
99 #define GET_LINENO_LNNO(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *) (ext->l_lnno));
100 #define PUT_LINENO_LNNO(abfd,val, ext) bfd_h_put_16(abfd,val, (bfd_byte *) (ext->l_lnno));
102 #define LINENO struct external_lineno
103 #define LINESZ 6
106 /********************** SYMBOLS **********************/
108 #define E_SYMNMLEN 8 /* # characters in a symbol name */
109 #define E_FILNMLEN 14 /* # characters in a file name */
110 #define E_DIMNUM 4 /* # array dimensions in auxiliary entry */
112 struct external_syment
114 union {
115 char e_name[E_SYMNMLEN];
116 struct {
117 char e_zeroes[4];
118 char e_offset[4];
119 } e;
120 } e;
121 char e_value[4];
122 char e_scnum[2];
123 char e_type[2];
124 char e_sclass[1];
125 char e_numaux[1];
130 #define N_BTMASK (017)
131 #define N_TMASK (060)
132 #define N_BTSHFT (4)
133 #define N_TSHIFT (2)
135 /* FIXME - need to correlate with TIc80 Code Generation Tools User's Guide, CG:A-25 */
136 union external_auxent {
137 struct {
138 char x_tagndx[4]; /* str, un, or enum tag indx */
139 union {
140 struct {
141 char x_lnno[2]; /* declaration line number */
142 char x_size[2]; /* str/union/array size */
143 } x_lnsz;
144 char x_fsize[4]; /* size of function */
145 } x_misc;
146 union {
147 struct { /* if ISFCN, tag, or .bb */
148 char x_lnnoptr[4]; /* ptr to fcn line # */
149 char x_endndx[4]; /* entry ndx past block end */
150 } x_fcn;
151 struct { /* if ISARY, up to 4 dimen. */
152 char x_dimen[E_DIMNUM][2];
153 } x_ary;
154 } x_fcnary;
155 char x_tvndx[2]; /* tv index */
156 } x_sym;
158 union {
159 char x_fname[E_FILNMLEN];
160 struct {
161 char x_zeroes[4];
162 char x_offset[4];
163 } x_n;
164 } x_file;
166 struct {
167 char x_scnlen[4]; /* section length */
168 char x_nreloc[2]; /* # relocation entries */
169 char x_nlinno[2]; /* # line numbers */
170 } x_scn;
172 struct {
173 char x_tvfill[4]; /* tv fill value */
174 char x_tvlen[2]; /* length of .tv */
175 char x_tvran[2][2]; /* tv range */
176 } x_tv; /* info about .tv section (in auxent of symbol .tv)) */
181 #define SYMENT struct external_syment
182 #define SYMESZ 18
183 #define AUXENT union external_auxent
184 #define AUXESZ 18
188 /********************** RELOCATION DIRECTIVES **********************/
190 /* The external reloc has an offset field, because some of the reloc
191 types on the h8 don't have room in the instruction for the entire
192 offset - eg the strange jump and high page addressing modes */
194 struct external_reloc {
195 char r_vaddr[4];
196 char r_symndx[4];
197 char r_reserved[2];
198 char r_type[2];
202 #define RELOC struct external_reloc
203 #define RELSZ 12
205 /* TIc80 relocation types. */
207 #define R_ABS 0x00 /* Absolute address - no relocation */
208 #define R_RELLONGX 0x11 /* PP: 32 bits, direct */
209 #define R_PPBASE 0x34 /* PP: Global base address type */
210 #define R_PPLBASE 0x35 /* PP: Local base address type */
211 #define R_PP15 0x38 /* PP: Global 15 bit offset */
212 #define R_PP15W 0x39 /* PP: Global 15 bit offset divided by 4 */
213 #define R_PP15H 0x3A /* PP: Global 15 bit offset divided by 2 */
214 #define R_PP16B 0x3B /* PP: Global 16 bit offset for bytes */
215 #define R_PPL15 0x3C /* PP: Local 15 bit offset */
216 #define R_PPL15W 0x3D /* PP: Local 15 bit offset divided by 4 */
217 #define R_PPL15H 0x3E /* PP: Local 15 bit offset divided by 2 */
218 #define R_PPL16B 0x3F /* PP: Local 16 bit offset for bytes */
219 #define R_PPN15 0x40 /* PP: Global 15 bit negative offset */
220 #define R_PPN15W 0x41 /* PP: Global 15 bit negative offset divided by 4 */
221 #define R_PPN15H 0x42 /* PP: Global 15 bit negative offset divided by 2 */
222 #define R_PPN16B 0x43 /* PP: Global 16 bit negative byte offset */
223 #define R_PPLN15 0x44 /* PP: Local 15 bit negative offset */
224 #define R_PPLN15W 0x45 /* PP: Local 15 bit negative offset divided by 4 */
225 #define R_PPLN15H 0x46 /* PP: Local 15 bit negative offset divided by 2 */
226 #define R_PPLN16B 0x47 /* PP: Local 16 bit negative byte offset */
227 #define R_MPPCR15W 0x4E /* MP: 15 bit PC-relative divided by 4 */
228 #define R_MPPCR 0x4F /* MP: 32 bit PC-relative divided by 4 */