Commit | Line | Data |
---|---|---|
63fa1674 JW |
1 | /*** coff information for HP/Intel IA-64. */ |
2 | ||
3 | ||
4 | /********************** FILE HEADER **********************/ | |
5 | ||
6 | struct external_filehdr { | |
7 | char f_magic[2]; /* magic number */ | |
8 | char f_nscns[2]; /* number of sections */ | |
9 | char f_timdat[4]; /* time & date stamp */ | |
10 | char f_symptr[4]; /* file pointer to symtab */ | |
11 | char f_nsyms[4]; /* number of symtab entries */ | |
12 | char f_opthdr[2]; /* sizeof(optional hdr) */ | |
13 | char f_flags[2]; /* flags */ | |
14 | }; | |
15 | ||
16 | #define IA64MAGIC 0x200 | |
17 | ||
18 | #define IA64BADMAG(x) (((x).f_magic != IA64MAGIC)) | |
19 | ||
20 | /* Bits for f_flags: | |
21 | * F_RELFLG relocation info stripped from file | |
22 | * F_EXEC file is executable (no unresolved external references) | |
23 | * F_LNNO line numbers stripped from file | |
24 | * F_LSYMS local symbols stripped from file | |
25 | * F_AR32WR file has byte ordering of an AR32WR machine (e.g. vax) | |
26 | */ | |
27 | ||
28 | #define F_RELFLG (0x0001) | |
29 | #define F_EXEC (0x0002) | |
30 | #define F_LNNO (0x0004) | |
31 | #define F_LSYMS (0x0008) | |
32 | ||
33 | ||
34 | #define FILHDR struct external_filehdr | |
35 | #define FILHSZ 20 | |
36 | ||
37 | ||
38 | /********************** AOUT "OPTIONAL HEADER" **********************/ | |
39 | ||
40 | ||
41 | typedef struct | |
42 | { | |
43 | char magic[2]; /* type of file */ | |
44 | char vstamp[2]; /* version stamp */ | |
45 | char tsize[4]; /* text size in bytes, padded to FW bdry*/ | |
46 | char dsize[4]; /* initialized data " " */ | |
47 | char bsize[4]; /* uninitialized data " " */ | |
48 | char entry[4]; /* entry pt. */ | |
49 | char text_start[4]; /* base of text used for this file */ | |
50 | #ifndef BFD64 | |
51 | char data_start[4]; /* base of data used for this file */ | |
52 | #endif | |
53 | } | |
54 | AOUTHDR; | |
55 | ||
56 | #define PE32MAGIC 0x10b /* 32-bit image */ | |
57 | #define PE32PMAGIC 0x20b /* 32-bit image inside 64-bit address space */ | |
58 | ||
59 | #define PE32PBADMAG(x) (((x).f_magic != PE32PMAGIC)) | |
60 | ||
61 | #define AOUTSZ 108 | |
62 | #define AOUTHDRSZ 108 | |
63 | ||
64 | #define OMAGIC 0404 /* object files, eg as output */ | |
65 | #define ZMAGIC 0413 /* demand load format, eg normal ld output */ | |
66 | #define STMAGIC 0401 /* target shlib */ | |
67 | #define SHMAGIC 0443 /* host shlib */ | |
68 | ||
69 | ||
70 | /* define some NT default values */ | |
71 | /* #define NT_IMAGE_BASE 0x400000 moved to internal.h */ | |
72 | #define NT_SECTION_ALIGNMENT 0x1000 | |
73 | #define NT_FILE_ALIGNMENT 0x200 | |
74 | #define NT_DEF_RESERVE 0x100000 | |
75 | #define NT_DEF_COMMIT 0x1000 | |
76 | ||
77 | /********************** SECTION HEADER **********************/ | |
78 | ||
79 | ||
80 | struct external_scnhdr { | |
81 | char s_name[8]; /* section name */ | |
82 | char s_paddr[4]; /* physical address, aliased s_nlib */ | |
83 | char s_vaddr[4]; /* virtual address */ | |
84 | char s_size[4]; /* section size */ | |
85 | char s_scnptr[4]; /* file ptr to raw data for section */ | |
86 | char s_relptr[4]; /* file ptr to relocation */ | |
87 | char s_lnnoptr[4]; /* file ptr to line numbers */ | |
88 | char s_nreloc[2]; /* number of relocation entries */ | |
89 | char s_nlnno[2]; /* number of line number entries*/ | |
90 | char s_flags[4]; /* flags */ | |
91 | }; | |
92 | ||
93 | #define SCNHDR struct external_scnhdr | |
94 | #define SCNHSZ 40 | |
95 | ||
96 | /* | |
97 | * names of "special" sections | |
98 | */ | |
99 | #define _TEXT ".text" | |
100 | #define _DATA ".data" | |
101 | #define _BSS ".bss" | |
102 | #define _COMMENT ".comment" | |
103 | #define _LIB ".lib" | |
104 | ||
105 | /********************** LINE NUMBERS **********************/ | |
106 | ||
107 | /* 1 line number entry for every "breakpointable" source line in a section. | |
108 | * Line numbers are grouped on a per function basis; first entry in a function | |
109 | * grouping will have l_lnno = 0 and in place of physical address will be the | |
110 | * symbol table index of the function name. | |
111 | */ | |
112 | struct external_lineno { | |
113 | union { | |
114 | char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/ | |
115 | char l_paddr[4]; /* (physical) address of line number */ | |
116 | } l_addr; | |
117 | char l_lnno[2]; /* line number */ | |
118 | }; | |
119 | ||
120 | ||
121 | #define LINENO struct external_lineno | |
122 | #define LINESZ 6 | |
123 | ||
124 | ||
125 | /********************** SYMBOLS **********************/ | |
126 | ||
127 | #define E_SYMNMLEN 8 /* # characters in a symbol name */ | |
128 | #define E_FILNMLEN 14 /* # characters in a file name */ | |
129 | #define E_DIMNUM 4 /* # array dimensions in auxiliary entry */ | |
130 | ||
131 | struct external_syment | |
132 | { | |
133 | union { | |
134 | char e_name[E_SYMNMLEN]; | |
135 | struct { | |
136 | char e_zeroes[4]; | |
137 | char e_offset[4]; | |
138 | } e; | |
139 | } e; | |
140 | char e_value[4]; | |
141 | char e_scnum[2]; | |
142 | char e_type[2]; | |
143 | char e_sclass[1]; | |
144 | char e_numaux[1]; | |
145 | }; | |
146 | ||
147 | #define N_BTMASK (0xf) | |
148 | #define N_TMASK (0x30) | |
149 | #define N_BTSHFT (4) | |
150 | #define N_TSHIFT (2) | |
151 | ||
152 | union external_auxent { | |
153 | struct { | |
154 | char x_tagndx[4]; /* str, un, or enum tag indx */ | |
155 | union { | |
156 | struct { | |
157 | char x_lnno[2]; /* declaration line number */ | |
158 | char x_size[2]; /* str/union/array size */ | |
159 | } x_lnsz; | |
160 | char x_fsize[4]; /* size of function */ | |
161 | } x_misc; | |
162 | union { | |
163 | struct { /* if ISFCN, tag, or .bb */ | |
164 | char x_lnnoptr[4]; /* ptr to fcn line # */ | |
165 | char x_endndx[4]; /* entry ndx past block end */ | |
166 | } x_fcn; | |
167 | struct { /* if ISARY, up to 4 dimen. */ | |
168 | char x_dimen[E_DIMNUM][2]; | |
169 | } x_ary; | |
170 | } x_fcnary; | |
171 | char x_tvndx[2]; /* tv index */ | |
172 | } x_sym; | |
173 | ||
174 | union { | |
175 | char x_fname[E_FILNMLEN]; | |
176 | struct { | |
177 | char x_zeroes[4]; | |
178 | char x_offset[4]; | |
179 | } x_n; | |
180 | } x_file; | |
181 | ||
182 | struct { | |
183 | char x_scnlen[4]; /* section length */ | |
184 | char x_nreloc[2]; /* # relocation entries */ | |
185 | char x_nlinno[2]; /* # line numbers */ | |
186 | char x_checksum[4]; /* section COMDAT checksum */ | |
187 | char x_associated[2]; /* COMDAT associated section index */ | |
188 | char x_comdat[1]; /* COMDAT selection number */ | |
189 | } x_scn; | |
190 | ||
191 | struct { | |
192 | char x_tvfill[4]; /* tv fill value */ | |
193 | char x_tvlen[2]; /* length of .tv */ | |
194 | char x_tvran[2][2]; /* tv range */ | |
195 | } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ | |
196 | ||
197 | ||
198 | }; | |
199 | ||
200 | #define SYMENT struct external_syment | |
201 | #define SYMESZ 18 | |
202 | #define AUXENT union external_auxent | |
203 | #define AUXESZ 18 | |
204 | ||
205 | ||
206 | # define _ETEXT "etext" | |
207 | ||
208 | ||
209 | /********************** RELOCATION DIRECTIVES **********************/ | |
210 | ||
211 | ||
212 | ||
213 | struct external_reloc { | |
214 | char r_vaddr[4]; | |
215 | char r_symndx[4]; | |
216 | char r_type[2]; | |
217 | }; | |
218 | ||
219 | ||
220 | #define RELOC struct external_reloc | |
221 | #define RELSZ 10 | |
222 |