Commit | Line | Data |
---|---|---|
252b5132 RH |
1 | /*** coff information for the ARM */ |
2 | ||
3 | #define COFFARM 1 | |
4 | ||
5 | /********************** FILE HEADER **********************/ | |
6 | ||
7 | struct external_filehdr { | |
8 | char f_magic[2]; /* magic number */ | |
9 | char f_nscns[2]; /* number of sections */ | |
10 | char f_timdat[4]; /* time & date stamp */ | |
11 | char f_symptr[4]; /* file pointer to symtab */ | |
12 | char f_nsyms[4]; /* number of symtab entries */ | |
13 | char f_opthdr[2]; /* sizeof(optional hdr) */ | |
14 | char f_flags[2]; /* flags */ | |
15 | }; | |
16 | ||
17 | /* Bits for f_flags: | |
18 | * F_RELFLG relocation info stripped from file | |
19 | * F_EXEC file is executable (no unresolved external references) | |
20 | * F_LNNO line numbers stripped from file | |
21 | * F_LSYMS local symbols stripped from file | |
22 | * F_INTERWORK file supports switching between ARM and Thumb instruction sets | |
23 | * F_INTERWORK_SET the F_INTERWORK bit is valid | |
24 | * F_APCS_FLOAT code passes float arguments in float registers | |
25 | * F_PIC code is reentrant/position-independent | |
26 | * F_AR32WR file has byte ordering of an AR32WR machine (e.g. vax) | |
27 | * F_APCS_26 file uses 26 bit ARM Procedure Calling Standard | |
28 | * F_APCS_SET the F_APCS_26, F_APCS_FLOAT and F_PIC bits have been initialised | |
29 | */ | |
30 | ||
31 | #define F_RELFLG (0x0001) | |
32 | #define F_EXEC (0x0002) | |
33 | #define F_LNNO (0x0004) | |
34 | #define F_LSYMS (0x0008) | |
35 | #define F_INTERWORK (0x0010) | |
36 | #define F_INTERWORK_SET (0x0020) | |
37 | #define F_APCS_FLOAT (0x0040) | |
38 | #undef F_AR16WR | |
39 | #define F_PIC (0x0080) | |
40 | #define F_AR32WR (0x0100) | |
41 | #define F_APCS_26 (0x0400) | |
42 | #define F_APCS_SET (0x0800) | |
43 | ||
44 | /* Bits stored in flags field of the internal_f structure */ | |
45 | ||
46 | #define F_INTERWORK (0x0010) | |
252b5132 | 47 | #define F_APCS_FLOAT (0x0040) |
a74ffb02 NC |
48 | #define F_PIC (0x0080) |
49 | #define F_APCS26 (0x1000) | |
50 | #define F_ARM_ARCHITECTURE_MASK (0x4000+0x0800+0x0400) | |
51 | #define F_ARM_2 (0x0400) | |
52 | #define F_ARM_2a (0x0800) | |
53 | #define F_ARM_3 (0x0c00) | |
54 | #define F_ARM_3M (0x4000) | |
55 | #define F_ARM_4 (0x4400) | |
56 | #define F_ARM_4T (0x4800) | |
849a0ebf | 57 | #define F_ARM_5 (0x4c00) |
252b5132 RH |
58 | |
59 | /* | |
60 | * ARMMAGIC ought to encoded the procesor type, | |
61 | * but it is too late to change it now, instead | |
62 | * the flags field of the internal_f structure | |
63 | * is used as shown above. | |
64 | * | |
65 | * XXX - NC 5/6/97 | |
66 | */ | |
67 | ||
68 | #define ARMMAGIC 0xa00 /* I just made this up */ | |
69 | ||
70 | #define ARMBADMAG(x) (((x).f_magic != ARMMAGIC)) | |
71 | ||
72 | #define FILHDR struct external_filehdr | |
73 | #define FILHSZ 20 | |
74 | ||
75 | ||
76 | /********************** AOUT "OPTIONAL HEADER" **********************/ | |
77 | ||
78 | ||
79 | typedef struct | |
80 | { | |
81 | char magic[2]; /* type of file */ | |
82 | char vstamp[2]; /* version stamp */ | |
83 | char tsize[4]; /* text size in bytes, padded to FW bdry*/ | |
84 | char dsize[4]; /* initialized data " " */ | |
85 | char bsize[4]; /* uninitialized data " " */ | |
86 | char entry[4]; /* entry pt. */ | |
87 | char text_start[4]; /* base of text used for this file */ | |
88 | char data_start[4]; /* base of data used for this file */ | |
89 | ||
90 | ||
91 | } | |
92 | AOUTHDR; | |
93 | ||
94 | ||
95 | #define AOUTSZ 28 | |
96 | #define AOUTHDRSZ 28 | |
97 | ||
98 | #define OMAGIC 0404 /* object files, eg as output */ | |
99 | #define ZMAGIC 0413 /* demand load format, eg normal ld output */ | |
100 | #define STMAGIC 0401 /* target shlib */ | |
101 | #define SHMAGIC 0443 /* host shlib */ | |
102 | ||
103 | ||
104 | /* define some NT default values */ | |
105 | /* #define NT_IMAGE_BASE 0x400000 moved to internal.h */ | |
106 | #define NT_SECTION_ALIGNMENT 0x1000 | |
107 | #define NT_FILE_ALIGNMENT 0x200 | |
108 | #define NT_DEF_RESERVE 0x100000 | |
109 | #define NT_DEF_COMMIT 0x1000 | |
110 | ||
111 | /********************** SECTION HEADER **********************/ | |
112 | ||
113 | ||
114 | struct external_scnhdr { | |
115 | char s_name[8]; /* section name */ | |
116 | char s_paddr[4]; /* physical address, aliased s_nlib */ | |
117 | char s_vaddr[4]; /* virtual address */ | |
118 | char s_size[4]; /* section size */ | |
119 | char s_scnptr[4]; /* file ptr to raw data for section */ | |
120 | char s_relptr[4]; /* file ptr to relocation */ | |
121 | char s_lnnoptr[4]; /* file ptr to line numbers */ | |
122 | char s_nreloc[2]; /* number of relocation entries */ | |
123 | char s_nlnno[2]; /* number of line number entries*/ | |
124 | char s_flags[4]; /* flags */ | |
125 | }; | |
126 | ||
127 | #define SCNHDR struct external_scnhdr | |
128 | #define SCNHSZ 40 | |
129 | ||
130 | /* | |
131 | * names of "special" sections | |
132 | */ | |
133 | #define _TEXT ".text" | |
134 | #define _DATA ".data" | |
135 | #define _BSS ".bss" | |
136 | #define _COMMENT ".comment" | |
137 | #define _LIB ".lib" | |
138 | ||
139 | /* We use the .rdata section to hold read only data. */ | |
140 | #define _LIT ".rdata" | |
141 | ||
142 | /********************** LINE NUMBERS **********************/ | |
143 | ||
144 | /* 1 line number entry for every "breakpointable" source line in a section. | |
145 | * Line numbers are grouped on a per function basis; first entry in a function | |
146 | * grouping will have l_lnno = 0 and in place of physical address will be the | |
147 | * symbol table index of the function name. | |
148 | */ | |
149 | struct external_lineno { | |
150 | union { | |
151 | char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/ | |
152 | char l_paddr[4]; /* (physical) address of line number */ | |
153 | } l_addr; | |
154 | char l_lnno[2]; /* line number */ | |
155 | }; | |
156 | ||
157 | ||
158 | #define LINENO struct external_lineno | |
159 | #define LINESZ 6 | |
160 | ||
161 | ||
162 | /********************** SYMBOLS **********************/ | |
163 | ||
164 | #define E_SYMNMLEN 8 /* # characters in a symbol name */ | |
165 | #define E_FILNMLEN 14 /* # characters in a file name */ | |
166 | #define E_DIMNUM 4 /* # array dimensions in auxiliary entry */ | |
167 | ||
168 | struct external_syment | |
169 | { | |
170 | union { | |
171 | char e_name[E_SYMNMLEN]; | |
172 | struct { | |
173 | char e_zeroes[4]; | |
174 | char e_offset[4]; | |
175 | } e; | |
176 | } e; | |
177 | char e_value[4]; | |
178 | char e_scnum[2]; | |
179 | char e_type[2]; | |
180 | char e_sclass[1]; | |
181 | char e_numaux[1]; | |
182 | }; | |
183 | ||
184 | #define N_BTMASK (0xf) | |
185 | #define N_TMASK (0x30) | |
186 | #define N_BTSHFT (4) | |
187 | #define N_TSHIFT (2) | |
188 | ||
189 | union external_auxent { | |
190 | struct { | |
191 | char x_tagndx[4]; /* str, un, or enum tag indx */ | |
192 | union { | |
193 | struct { | |
194 | char x_lnno[2]; /* declaration line number */ | |
195 | char x_size[2]; /* str/union/array size */ | |
196 | } x_lnsz; | |
197 | char x_fsize[4]; /* size of function */ | |
198 | } x_misc; | |
199 | union { | |
200 | struct { /* if ISFCN, tag, or .bb */ | |
201 | char x_lnnoptr[4]; /* ptr to fcn line # */ | |
202 | char x_endndx[4]; /* entry ndx past block end */ | |
203 | } x_fcn; | |
204 | struct { /* if ISARY, up to 4 dimen. */ | |
205 | char x_dimen[E_DIMNUM][2]; | |
206 | } x_ary; | |
207 | } x_fcnary; | |
208 | char x_tvndx[2]; /* tv index */ | |
209 | } x_sym; | |
210 | ||
211 | union { | |
212 | char x_fname[E_FILNMLEN]; | |
213 | struct { | |
214 | char x_zeroes[4]; | |
215 | char x_offset[4]; | |
216 | } x_n; | |
217 | } x_file; | |
218 | ||
219 | struct { | |
220 | char x_scnlen[4]; /* section length */ | |
221 | char x_nreloc[2]; /* # relocation entries */ | |
222 | char x_nlinno[2]; /* # line numbers */ | |
223 | char x_checksum[4]; /* section COMDAT checksum */ | |
224 | char x_associated[2]; /* COMDAT associated section index */ | |
225 | char x_comdat[1]; /* COMDAT selection number */ | |
226 | } x_scn; | |
227 | ||
228 | struct { | |
229 | char x_tvfill[4]; /* tv fill value */ | |
230 | char x_tvlen[2]; /* length of .tv */ | |
231 | char x_tvran[2][2]; /* tv range */ | |
232 | } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ | |
233 | ||
234 | ||
235 | }; | |
236 | ||
237 | #define SYMENT struct external_syment | |
238 | #define SYMESZ 18 | |
239 | #define AUXENT union external_auxent | |
240 | #define AUXESZ 18 | |
241 | ||
242 | ||
243 | # define _ETEXT "etext" | |
244 | ||
245 | ||
246 | /********************** RELOCATION DIRECTIVES **********************/ | |
247 | ||
248 | ||
249 | ||
250 | struct external_reloc { | |
251 | char r_vaddr[4]; | |
252 | char r_symndx[4]; | |
253 | char r_type[2]; | |
254 | char r_offset[4]; | |
255 | }; | |
256 | ||
257 | ||
258 | #define RELOC struct external_reloc | |
259 | #define RELSZ 14 |