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