Initial revision
[binutils.git] / include / coff / arm.h
blobdd578b1a76a0eb6b3c434a5fc2f845fc9dd68edf
1 /*** coff information for the ARM */
3 #define COFFARM 1
5 /********************** FILE HEADER **********************/
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 */
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
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)
44 /* Bits stored in flags field of the internal_f structure */
46 #define F_INTERWORK (0x0010)
47 #define F_PIC_INT (0x0020)
48 #define F_APCS_FLOAT (0x0040)
49 #define F_ARM_ARCHITECTURE_MASK (0x0c00)
50 #define F_ARM_2 (0x0000)
51 #define F_ARM_2a (0x0000)
52 #define F_ARM_3 (0x0400)
53 #define F_ARM_3M (0x0400)
54 #define F_ARM_4 (0x0800)
55 #define F_ARM_4T (0x0c00)
56 #define F_APCS26 (0x4000)
59 * ARMMAGIC ought to encoded the procesor type,
60 * but it is too late to change it now, instead
61 * the flags field of the internal_f structure
62 * is used as shown above.
64 * XXX - NC 5/6/97
67 #define ARMMAGIC 0xa00 /* I just made this up */
69 #define ARMBADMAG(x) (((x).f_magic != ARMMAGIC))
71 #define FILHDR struct external_filehdr
72 #define FILHSZ 20
75 /********************** AOUT "OPTIONAL HEADER" **********************/
78 typedef struct
80 char magic[2]; /* type of file */
81 char vstamp[2]; /* version stamp */
82 char tsize[4]; /* text size in bytes, padded to FW bdry*/
83 char dsize[4]; /* initialized data " " */
84 char bsize[4]; /* uninitialized data " " */
85 char entry[4]; /* entry pt. */
86 char text_start[4]; /* base of text used for this file */
87 char data_start[4]; /* base of data used for this file */
91 AOUTHDR;
94 #define AOUTSZ 28
95 #define AOUTHDRSZ 28
97 #define OMAGIC 0404 /* object files, eg as output */
98 #define ZMAGIC 0413 /* demand load format, eg normal ld output */
99 #define STMAGIC 0401 /* target shlib */
100 #define SHMAGIC 0443 /* host shlib */
103 /* define some NT default values */
104 /* #define NT_IMAGE_BASE 0x400000 moved to internal.h */
105 #define NT_SECTION_ALIGNMENT 0x1000
106 #define NT_FILE_ALIGNMENT 0x200
107 #define NT_DEF_RESERVE 0x100000
108 #define NT_DEF_COMMIT 0x1000
110 /********************** SECTION HEADER **********************/
113 struct external_scnhdr {
114 char s_name[8]; /* section name */
115 char s_paddr[4]; /* physical address, aliased s_nlib */
116 char s_vaddr[4]; /* virtual address */
117 char s_size[4]; /* section size */
118 char s_scnptr[4]; /* file ptr to raw data for section */
119 char s_relptr[4]; /* file ptr to relocation */
120 char s_lnnoptr[4]; /* file ptr to line numbers */
121 char s_nreloc[2]; /* number of relocation entries */
122 char s_nlnno[2]; /* number of line number entries*/
123 char s_flags[4]; /* flags */
126 #define SCNHDR struct external_scnhdr
127 #define SCNHSZ 40
130 * names of "special" sections
132 #define _TEXT ".text"
133 #define _DATA ".data"
134 #define _BSS ".bss"
135 #define _COMMENT ".comment"
136 #define _LIB ".lib"
138 /* We use the .rdata section to hold read only data. */
139 #define _LIT ".rdata"
141 /********************** LINE NUMBERS **********************/
143 /* 1 line number entry for every "breakpointable" source line in a section.
144 * Line numbers are grouped on a per function basis; first entry in a function
145 * grouping will have l_lnno = 0 and in place of physical address will be the
146 * symbol table index of the function name.
148 struct external_lineno {
149 union {
150 char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/
151 char l_paddr[4]; /* (physical) address of line number */
152 } l_addr;
153 char l_lnno[2]; /* line number */
157 #define LINENO struct external_lineno
158 #define LINESZ 6
161 /********************** SYMBOLS **********************/
163 #define E_SYMNMLEN 8 /* # characters in a symbol name */
164 #define E_FILNMLEN 14 /* # characters in a file name */
165 #define E_DIMNUM 4 /* # array dimensions in auxiliary entry */
167 struct external_syment
169 union {
170 char e_name[E_SYMNMLEN];
171 struct {
172 char e_zeroes[4];
173 char e_offset[4];
174 } e;
175 } e;
176 char e_value[4];
177 char e_scnum[2];
178 char e_type[2];
179 char e_sclass[1];
180 char e_numaux[1];
183 #define N_BTMASK (0xf)
184 #define N_TMASK (0x30)
185 #define N_BTSHFT (4)
186 #define N_TSHIFT (2)
188 union external_auxent {
189 struct {
190 char x_tagndx[4]; /* str, un, or enum tag indx */
191 union {
192 struct {
193 char x_lnno[2]; /* declaration line number */
194 char x_size[2]; /* str/union/array size */
195 } x_lnsz;
196 char x_fsize[4]; /* size of function */
197 } x_misc;
198 union {
199 struct { /* if ISFCN, tag, or .bb */
200 char x_lnnoptr[4]; /* ptr to fcn line # */
201 char x_endndx[4]; /* entry ndx past block end */
202 } x_fcn;
203 struct { /* if ISARY, up to 4 dimen. */
204 char x_dimen[E_DIMNUM][2];
205 } x_ary;
206 } x_fcnary;
207 char x_tvndx[2]; /* tv index */
208 } x_sym;
210 union {
211 char x_fname[E_FILNMLEN];
212 struct {
213 char x_zeroes[4];
214 char x_offset[4];
215 } x_n;
216 } x_file;
218 struct {
219 char x_scnlen[4]; /* section length */
220 char x_nreloc[2]; /* # relocation entries */
221 char x_nlinno[2]; /* # line numbers */
222 char x_checksum[4]; /* section COMDAT checksum */
223 char x_associated[2]; /* COMDAT associated section index */
224 char x_comdat[1]; /* COMDAT selection number */
225 } x_scn;
227 struct {
228 char x_tvfill[4]; /* tv fill value */
229 char x_tvlen[2]; /* length of .tv */
230 char x_tvran[2][2]; /* tv range */
231 } x_tv; /* info about .tv section (in auxent of symbol .tv)) */
236 #define SYMENT struct external_syment
237 #define SYMESZ 18
238 #define AUXENT union external_auxent
239 #define AUXESZ 18
242 # define _ETEXT "etext"
245 /********************** RELOCATION DIRECTIVES **********************/
249 struct external_reloc {
250 char r_vaddr[4];
251 char r_symndx[4];
252 char r_type[2];
253 char r_offset[4];
257 #define RELOC struct external_reloc
258 #define RELSZ 14