Commit | Line | Data |
---|---|---|
056350c6 NC |
1 | /*** coff information for Windows CE with MIPS VR4111 */ |
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 | }; | |
14 | ||
15 | ||
16 | ||
17 | #define MIPS_ARCH_MAGIC_WINCE 0x0166 /* Windows CE - little endian */ | |
5e671ea1 | 18 | #define MIPS_PE_MAGIC 0x010b |
056350c6 NC |
19 | |
20 | #define MIPSBADMAG(x) \ | |
21 | ((x).f_magic!=MIPS_ARCH_MAGIC_WINCE) | |
22 | ||
23 | #define FILHDR struct external_filehdr | |
24 | #define FILHSZ 20 | |
25 | ||
26 | ||
27 | /********************** AOUT "OPTIONAL HEADER" **********************/ | |
28 | ||
29 | ||
30 | typedef struct | |
31 | { | |
32 | char magic[2]; /* type of file */ | |
33 | char vstamp[2]; /* version stamp */ | |
34 | char tsize[4]; /* text size in bytes, padded to FW bdry*/ | |
35 | char dsize[4]; /* initialized data " " */ | |
36 | char bsize[4]; /* uninitialized data " " */ | |
37 | char entry[4]; /* entry pt. */ | |
38 | char text_start[4]; /* base of text used for this file */ | |
39 | char data_start[4]; /* base of data used for this file */ | |
40 | } | |
41 | AOUTHDR; | |
42 | ||
43 | ||
44 | #define AOUTHDRSZ 28 | |
45 | #define AOUTSZ 28 | |
46 | ||
47 | ||
48 | ||
49 | ||
50 | /* define some NT default values */ | |
51 | /* #define NT_IMAGE_BASE 0x400000 moved to internal.h */ | |
52 | #define NT_SECTION_ALIGNMENT 0x1000 | |
53 | #define NT_FILE_ALIGNMENT 0x200 | |
54 | #define NT_DEF_RESERVE 0x100000 | |
55 | #define NT_DEF_COMMIT 0x1000 | |
56 | ||
57 | /********************** SECTION HEADER **********************/ | |
58 | ||
59 | ||
60 | struct external_scnhdr { | |
61 | char s_name[8]; /* section name */ | |
62 | char s_paddr[4]; /* physical address, aliased s_nlib */ | |
63 | char s_vaddr[4]; /* virtual address */ | |
64 | char s_size[4]; /* section size */ | |
65 | char s_scnptr[4]; /* file ptr to raw data for section */ | |
66 | char s_relptr[4]; /* file ptr to relocation */ | |
67 | char s_lnnoptr[4]; /* file ptr to line numbers */ | |
68 | char s_nreloc[2]; /* number of relocation entries */ | |
69 | char s_nlnno[2]; /* number of line number entries*/ | |
70 | char s_flags[4]; /* flags */ | |
71 | }; | |
72 | ||
73 | /* | |
74 | * names of "special" sections | |
75 | */ | |
76 | #define _TEXT ".text" | |
77 | #define _DATA ".data" | |
78 | #define _BSS ".bss" | |
79 | ||
80 | ||
81 | #define SCNHDR struct external_scnhdr | |
82 | #define SCNHSZ 40 | |
83 | ||
84 | ||
85 | /********************** LINE NUMBERS **********************/ | |
86 | ||
87 | /* 1 line number entry for every "breakpointable" source line in a section. | |
88 | * Line numbers are grouped on a per function basis; first entry in a function | |
89 | * grouping will have l_lnno = 0 and in place of physical address will be the | |
90 | * symbol table index of the function name. | |
91 | */ | |
92 | struct external_lineno { | |
93 | union { | |
94 | char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/ | |
95 | char l_paddr[4]; /* (physical) address of line number */ | |
96 | } l_addr; | |
97 | char l_lnno[2]; /* line number */ | |
98 | }; | |
99 | ||
100 | #define GET_LINENO_LNNO(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *) (ext->l_lnno)); | |
101 | #define PUT_LINENO_LNNO(abfd,val, ext) bfd_h_put_16(abfd,val, (bfd_byte *) (ext->l_lnno)); | |
102 | ||
103 | #define LINENO struct external_lineno | |
104 | #define LINESZ 6 | |
105 | ||
106 | ||
107 | /********************** SYMBOLS **********************/ | |
108 | ||
109 | #define E_SYMNMLEN 8 /* # characters in a symbol name */ | |
110 | #define E_FILNMLEN 14 /* # characters in a file name */ | |
111 | #define E_DIMNUM 4 /* # array dimensions in auxiliary entry */ | |
112 | ||
113 | struct external_syment | |
114 | { | |
115 | union { | |
116 | char e_name[E_SYMNMLEN]; | |
117 | struct { | |
118 | char e_zeroes[4]; | |
119 | char e_offset[4]; | |
120 | } e; | |
121 | } e; | |
122 | char e_value[4]; | |
123 | char e_scnum[2]; | |
124 | char e_type[2]; | |
125 | char e_sclass[1]; | |
126 | char e_numaux[1]; | |
127 | }; | |
128 | ||
129 | ||
130 | ||
131 | #define N_BTMASK (017) | |
132 | #define N_TMASK (060) | |
133 | #define N_BTSHFT (4) | |
134 | #define N_TSHIFT (2) | |
135 | ||
136 | ||
137 | union external_auxent { | |
138 | struct { | |
139 | char x_tagndx[4]; /* str, un, or enum tag indx */ | |
140 | union { | |
141 | struct { | |
142 | char x_lnno[2]; /* declaration line number */ | |
143 | char x_size[2]; /* str/union/array size */ | |
144 | } x_lnsz; | |
145 | char x_fsize[4]; /* size of function */ | |
146 | } x_misc; | |
147 | union { | |
148 | struct { /* if ISFCN, tag, or .bb */ | |
149 | char x_lnnoptr[4]; /* ptr to fcn line # */ | |
150 | char x_endndx[4]; /* entry ndx past block end */ | |
151 | } x_fcn; | |
152 | struct { /* if ISARY, up to 4 dimen. */ | |
153 | char x_dimen[E_DIMNUM][2]; | |
154 | } x_ary; | |
155 | } x_fcnary; | |
156 | char x_tvndx[2]; /* tv index */ | |
157 | } x_sym; | |
158 | ||
159 | union { | |
160 | char x_fname[E_FILNMLEN]; | |
161 | struct { | |
162 | char x_zeroes[4]; | |
163 | char x_offset[4]; | |
164 | } x_n; | |
165 | } x_file; | |
166 | ||
167 | struct { | |
168 | char x_scnlen[4]; /* section length */ | |
169 | char x_nreloc[2]; /* # relocation entries */ | |
170 | char x_nlinno[2]; /* # line numbers */ | |
171 | char x_checksum[4]; /* section COMDAT checksum */ | |
172 | char x_associated[2]; /* COMDAT associated section index */ | |
173 | char x_comdat[1]; /* COMDAT selection number */ | |
174 | } x_scn; | |
175 | ||
176 | struct { | |
177 | char x_tvfill[4]; /* tv fill value */ | |
178 | char x_tvlen[2]; /* length of .tv */ | |
179 | char x_tvran[2][2]; /* tv range */ | |
180 | } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ | |
181 | ||
182 | ||
183 | }; | |
184 | ||
185 | #define SYMENT struct external_syment | |
186 | #define SYMESZ 18 | |
187 | #define AUXENT union external_auxent | |
188 | #define AUXESZ 18 | |
189 | ||
190 | ||
191 | ||
192 | /********************** RELOCATION DIRECTIVES **********************/ | |
193 | ||
194 | /* The external reloc has an offset field, because some of the reloc | |
195 | types on the h8 don't have room in the instruction for the entire | |
196 | offset - eg the strange jump and high page addressing modes */ | |
197 | ||
198 | struct external_reloc { | |
199 | char r_vaddr[4]; | |
200 | char r_symndx[4]; | |
201 | char r_type[2]; | |
202 | }; | |
203 | ||
204 | ||
205 | #define RELOC struct external_reloc | |
206 | #define RELSZ 10 | |
207 | ||
208 | /* MIPS PE relocation types. */ | |
209 | ||
210 | #define MIPS_R_ABSOLUTE 0 /* ignored */ | |
211 | #define MIPS_R_REFHALF 1 | |
212 | #define MIPS_R_REFWORD 2 | |
213 | #define MIPS_R_JMPADDR 3 | |
214 | #define MIPS_R_REFHI 4 /* PAIR follows */ | |
215 | #define MIPS_R_REFLO 5 | |
216 | #define MIPS_R_GPREL 6 | |
217 | #define MIPS_R_LITERAL 7 /* same as GPREL */ | |
218 | #define MIPS_R_SECTION 10 | |
219 | #define MIPS_R_SECREL 11 | |
220 | #define MIPS_R_SECRELLO 12 | |
221 | #define MIPS_R_SECRELHI 13 /* PAIR follows */ | |
222 | #define MIPS_R_RVA 34 /* 0x22 */ | |
223 | #define MIPS_R_PAIR 37 /* 0x25 - symndx is really a signed 16-bit addend */ |