Commit | Line | Data |
---|---|---|
f6868b8e SC |
1 | /* Internal format of COFF object file data structures, for GNU BFD. |
2 | This file is part of BFD, the Binary File Descriptor library. */ | |
3 | ||
4 | /* First, make "signed char" work, even on old compilers. */ | |
5 | #ifndef signed | |
6 | #ifndef __STDC__ | |
57115f09 | 7 | #define signed /**/ |
f6868b8e SC |
8 | #endif |
9 | #endif | |
10 | ||
11 | /********************** FILE HEADER **********************/ | |
f581f995 | 12 | |
b2a86278 ILT |
13 | /* extra stuff in a PE header. */ |
14 | ||
15 | struct internal_extra_pe_filehdr | |
f6868b8e | 16 | { |
f581f995 | 17 | /* DOS header data follows for PE stuff */ |
b2a86278 ILT |
18 | unsigned short e_magic; /* Magic number, 0x5a4d */ |
19 | unsigned short e_cblp; /* Bytes on last page of file, 0x90 */ | |
20 | unsigned short e_cp; /* Pages in file, 0x3 */ | |
21 | unsigned short e_crlc; /* Relocations, 0x0 */ | |
22 | unsigned short e_cparhdr; /* Size of header in paragraphs, 0x4 */ | |
23 | unsigned short e_minalloc; /* Minimum extra paragraphs needed, 0x0 */ | |
24 | unsigned short e_maxalloc; /* Maximum extra paragraphs needed, 0xFFFF */ | |
25 | unsigned short e_ss; /* Initial (relative) SS value, 0x0 */ | |
26 | unsigned short e_sp; /* Initial SP value, 0xb8 */ | |
27 | unsigned short e_csum; /* Checksum, 0x0 */ | |
28 | unsigned short e_ip; /* Initial IP value, 0x0 */ | |
29 | unsigned short e_cs; /* Initial (relative) CS value, 0x0 */ | |
30 | unsigned short e_lfarlc; /* File address of relocation table, 0x40 */ | |
31 | unsigned short e_ovno; /* Overlay number, 0x0 */ | |
32 | unsigned short e_res[4]; /* Reserved words, all 0x0 */ | |
33 | unsigned short e_oemid; /* OEM identifier (for e_oeminfo), 0x0 */ | |
34 | unsigned short e_oeminfo; /* OEM information; e_oemid specific, 0x0 */ | |
35 | unsigned short e_res2[10]; /* Reserved words, all 0x0 */ | |
36 | bfd_vma e_lfanew; /* File address of new exe header, 0x80 */ | |
f581f995 SC |
37 | unsigned long dos_message[16]; /* text which always follows dos header */ |
38 | bfd_vma nt_signature; /* required NT signature, 0x4550 */ | |
b2a86278 | 39 | }; |
f581f995 | 40 | |
b2a86278 ILT |
41 | struct internal_filehdr |
42 | { | |
43 | struct internal_extra_pe_filehdr pe; | |
f581f995 SC |
44 | |
45 | /* standard coff internal info */ | |
57115f09 ILT |
46 | unsigned short f_magic; /* magic number */ |
47 | unsigned short f_nscns; /* number of sections */ | |
48 | long f_timdat; /* time & date stamp */ | |
b5823950 | 49 | bfd_vma f_symptr; /* file pointer to symtab */ |
57115f09 ILT |
50 | long f_nsyms; /* number of symtab entries */ |
51 | unsigned short f_opthdr; /* sizeof(optional hdr) */ | |
52 | unsigned short f_flags; /* flags */ | |
f6868b8e SC |
53 | }; |
54 | ||
f581f995 | 55 | |
f6868b8e SC |
56 | /* Bits for f_flags: |
57 | * F_RELFLG relocation info stripped from file | |
58 | * F_EXEC file is executable (no unresolved external references) | |
59 | * F_LNNO line numbers stripped from file | |
60 | * F_LSYMS local symbols stripped from file | |
61 | * F_AR16WR file is 16-bit little-endian | |
62 | * F_AR32WR file is 32-bit little-endian | |
63 | * F_AR32W file is 32-bit big-endian | |
64 | * F_DYNLOAD rs/6000 aix: dynamically loadable w/imports & exports | |
65 | * F_SHROBJ rs/6000 aix: file is a shared object | |
b2a86278 | 66 | * F_DLL PE format DLL |
f6868b8e SC |
67 | */ |
68 | ||
69 | #define F_RELFLG (0x0001) | |
70 | #define F_EXEC (0x0002) | |
71 | #define F_LNNO (0x0004) | |
72 | #define F_LSYMS (0x0008) | |
73 | #define F_AR16WR (0x0080) | |
74 | #define F_AR32WR (0x0100) | |
75 | #define F_AR32W (0x0200) | |
76 | #define F_DYNLOAD (0x1000) | |
77 | #define F_SHROBJ (0x2000) | |
b2a86278 | 78 | #define F_DLL (0x2000) |
f6868b8e | 79 | |
f581f995 SC |
80 | /* extra structure which is used in the optional header */ |
81 | typedef struct _IMAGE_DATA_DIRECTORY | |
82 | { | |
83 | bfd_vma VirtualAddress; | |
84 | long Size; | |
85 | } IMAGE_DATA_DIRECTORY; | |
86 | #define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16 | |
87 | ||
88 | /* default image base for NT */ | |
b2a86278 ILT |
89 | #define NT_EXE_IMAGE_BASE 0x400000 |
90 | #define NT_DLL_IMAGE_BASE 0x10000000 | |
91 | ||
92 | /* Extra stuff in a PE aouthdr */ | |
f581f995 | 93 | |
b2a86278 ILT |
94 | #define PE_DEF_SECTION_ALIGNMENT 0x1000 |
95 | #define PE_DEF_FILE_ALIGNMENT 0x200 | |
96 | ||
97 | struct internal_extra_pe_aouthdr | |
98 | { | |
99 | /* PE stuff */ | |
100 | bfd_vma ImageBase; /* address of specific location in memory that | |
101 | file is located, NT default 0x10000 */ | |
102 | ||
103 | bfd_vma SectionAlignment; /* section alignment default 0x1000 */ | |
104 | bfd_vma FileAlignment; /* file alignment default 0x200 */ | |
105 | short MajorOperatingSystemVersion; /* minimum version of the operating */ | |
106 | short MinorOperatingSystemVersion; /* system req'd for exe, default to 1*/ | |
107 | short MajorImageVersion; /* user defineable field to store version of */ | |
108 | short MinorImageVersion; /* exe or dll being created, default to 0 */ | |
109 | short MajorSubsystemVersion; /* minimum subsystem version required to */ | |
110 | short MinorSubsystemVersion; /* run exe; default to 3.1 */ | |
111 | long Reserved1; /* seems to be 0 */ | |
112 | long SizeOfImage; /* size of memory to allocate for prog */ | |
113 | long SizeOfHeaders; /* size of PE header and section table */ | |
114 | long CheckSum; /* set to 0 */ | |
115 | short Subsystem; | |
116 | ||
117 | /* type of subsystem exe uses for user interface, | |
118 | possible values: | |
119 | 1 - NATIVE Doesn't require a subsystem | |
120 | 2 - WINDOWS_GUI runs in Windows GUI subsystem | |
121 | 3 - WINDOWS_CUI runs in Windows char sub. (console app) | |
122 | 5 - OS2_CUI runs in OS/2 character subsystem | |
123 | 7 - POSIX_CUI runs in Posix character subsystem */ | |
124 | short DllCharacteristics; /* flags for DLL init, use 0 */ | |
125 | bfd_vma SizeOfStackReserve; /* amount of memory to reserve */ | |
126 | bfd_vma SizeOfStackCommit; /* amount of memory initially committed for | |
127 | initial thread's stack, default is 0x1000 */ | |
128 | bfd_vma SizeOfHeapReserve; /* amount of virtual memory to reserve and */ | |
129 | bfd_vma SizeOfHeapCommit; /* commit, don't know what to defaut it to */ | |
130 | long LoaderFlags; /* can probably set to 0 */ | |
131 | long NumberOfRvaAndSizes; /* number of entries in next entry, 16 */ | |
132 | IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; | |
133 | }; | |
f581f995 | 134 | |
f6868b8e | 135 | /********************** AOUT "OPTIONAL HEADER" **********************/ |
57115f09 ILT |
136 | struct internal_aouthdr |
137 | { | |
138 | short magic; /* type of file */ | |
139 | short vstamp; /* version stamp */ | |
b5823950 ILT |
140 | bfd_vma tsize; /* text size in bytes, padded to FW bdry*/ |
141 | bfd_vma dsize; /* initialized data " " */ | |
142 | bfd_vma bsize; /* uninitialized data " " */ | |
143 | bfd_vma entry; /* entry pt. */ | |
144 | bfd_vma text_start; /* base of text used for this file */ | |
145 | bfd_vma data_start; /* base of data used for this file */ | |
57115f09 ILT |
146 | |
147 | /* i960 stuff */ | |
148 | unsigned long tagentries; /* number of tag entries to follow */ | |
149 | ||
150 | /* RS/6000 stuff */ | |
151 | unsigned long o_toc; /* address of TOC */ | |
152 | short o_snentry; /* section number for entry point */ | |
153 | short o_sntext; /* section number for text */ | |
154 | short o_sndata; /* section number for data */ | |
155 | short o_sntoc; /* section number for toc */ | |
156 | short o_snloader; /* section number for loader section */ | |
157 | short o_snbss; /* section number for bss */ | |
158 | short o_algntext; /* max alignment for text */ | |
159 | short o_algndata; /* max alignment for data */ | |
160 | short o_modtype; /* Module type field, 1R,RE,RO */ | |
161 | unsigned long o_maxstack; /* max stack size allowed. */ | |
b2a86278 | 162 | unsigned long o_maxdata; /* max data size allowed. */ |
62aaa2e7 | 163 | |
b5823950 ILT |
164 | /* ECOFF stuff */ |
165 | bfd_vma bss_start; /* Base of bss section. */ | |
166 | bfd_vma gp_value; /* GP register value. */ | |
62aaa2e7 ILT |
167 | unsigned long gprmask; /* General registers used. */ |
168 | unsigned long cprmask[4]; /* Coprocessor registers used. */ | |
b5823950 ILT |
169 | unsigned long fprmask; /* Floating pointer registers used. */ |
170 | ||
171 | /* Apollo stuff */ | |
f581f995 SC |
172 | long o_inlib; /* inlib data */ |
173 | long o_sri; /* Static Resource Information */ | |
174 | long vid[2]; /* Version id */ | |
175 | ||
176 | ||
b2a86278 | 177 | struct internal_extra_pe_aouthdr pe; |
f581f995 | 178 | |
f6868b8e SC |
179 | }; |
180 | ||
181 | /********************** STORAGE CLASSES **********************/ | |
182 | ||
2cf90c44 JK |
183 | /* This used to be defined as -1, but now n_sclass is unsigned. */ |
184 | #define C_EFCN 0xff /* physical end of function */ | |
f6868b8e SC |
185 | #define C_NULL 0 |
186 | #define C_AUTO 1 /* automatic variable */ | |
187 | #define C_EXT 2 /* external symbol */ | |
188 | #define C_STAT 3 /* static */ | |
189 | #define C_REG 4 /* register variable */ | |
190 | #define C_EXTDEF 5 /* external definition */ | |
191 | #define C_LABEL 6 /* label */ | |
192 | #define C_ULABEL 7 /* undefined label */ | |
193 | #define C_MOS 8 /* member of structure */ | |
194 | #define C_ARG 9 /* function argument */ | |
195 | #define C_STRTAG 10 /* structure tag */ | |
196 | #define C_MOU 11 /* member of union */ | |
197 | #define C_UNTAG 12 /* union tag */ | |
198 | #define C_TPDEF 13 /* type definition */ | |
199 | #define C_USTATIC 14 /* undefined static */ | |
200 | #define C_ENTAG 15 /* enumeration tag */ | |
201 | #define C_MOE 16 /* member of enumeration */ | |
202 | #define C_REGPARM 17 /* register parameter */ | |
203 | #define C_FIELD 18 /* bit field */ | |
204 | #define C_AUTOARG 19 /* auto argument */ | |
205 | #define C_LASTENT 20 /* dummy entry (end of block) */ | |
206 | #define C_BLOCK 100 /* ".bb" or ".eb" */ | |
207 | #define C_FCN 101 /* ".bf" or ".ef" */ | |
208 | #define C_EOS 102 /* end of structure */ | |
209 | #define C_FILE 103 /* file name */ | |
210 | #define C_LINE 104 /* line # reformatted as symbol table entry */ | |
211 | #define C_ALIAS 105 /* duplicate tag */ | |
212 | #define C_HIDDEN 106 /* ext symbol in dmert public lib */ | |
213 | ||
f581f995 SC |
214 | /* New storage classes for WINDOWS_NT */ |
215 | #define C_SECTION 104 /* section name */ | |
216 | ||
57115f09 ILT |
217 | /* New storage classes for 80960 */ |
218 | ||
f6868b8e SC |
219 | /* C_LEAFPROC is obsolete. Use C_LEAFEXT or C_LEAFSTAT */ |
220 | #define C_LEAFPROC 108 /* Leaf procedure, "call" via BAL */ | |
221 | ||
222 | #define C_SCALL 107 /* Procedure reachable via system call */ | |
223 | #define C_LEAFEXT 108 /* External leaf */ | |
57115f09 | 224 | #define C_LEAFSTAT 113 /* Static leaf */ |
f6868b8e SC |
225 | #define C_OPTVAR 109 /* Optimized variable */ |
226 | #define C_DEFINE 110 /* Preprocessor #define */ | |
227 | #define C_PRAGMA 111 /* Advice to compiler or linker */ | |
228 | #define C_SEGMENT 112 /* 80960 segment name */ | |
229 | ||
b5823950 ILT |
230 | /* Storage classes for m88k */ |
231 | #define C_SHADOW 107 /* shadow symbol */ | |
232 | #define C_VERSION 108 /* coff version symbol */ | |
233 | ||
57115f09 ILT |
234 | /* New storage classes for RS/6000 */ |
235 | #define C_HIDEXT 107 /* Un-named external symbol */ | |
236 | #define C_BINCL 108 /* Marks beginning of include file */ | |
237 | #define C_EINCL 109 /* Marks ending of include file */ | |
f6868b8e | 238 | |
57115f09 | 239 | /* storage classes for stab symbols for RS/6000 */ |
2cf90c44 JK |
240 | #define C_GSYM (0x80) |
241 | #define C_LSYM (0x81) | |
242 | #define C_PSYM (0x82) | |
243 | #define C_RSYM (0x83) | |
244 | #define C_RPSYM (0x84) | |
245 | #define C_STSYM (0x85) | |
246 | #define C_TCSYM (0x86) | |
247 | #define C_BCOMM (0x87) | |
248 | #define C_ECOML (0x88) | |
249 | #define C_ECOMM (0x89) | |
250 | #define C_DECL (0x8c) | |
251 | #define C_ENTRY (0x8d) | |
252 | #define C_FUN (0x8e) | |
253 | #define C_BSTAT (0x8f) | |
254 | #define C_ESTAT (0x90) | |
f6868b8e SC |
255 | |
256 | /********************** SECTION HEADER **********************/ | |
57115f09 ILT |
257 | struct internal_scnhdr |
258 | { | |
259 | char s_name[8]; /* section name */ | |
b5823950 ILT |
260 | bfd_vma s_paddr; /* physical address, aliased s_nlib */ |
261 | bfd_vma s_vaddr; /* virtual address */ | |
262 | bfd_vma s_size; /* section size */ | |
263 | bfd_vma s_scnptr; /* file ptr to raw data for section */ | |
264 | bfd_vma s_relptr; /* file ptr to relocation */ | |
265 | bfd_vma s_lnnoptr; /* file ptr to line numbers */ | |
57115f09 ILT |
266 | unsigned long s_nreloc; /* number of relocation entries */ |
267 | unsigned long s_nlnno; /* number of line number entries*/ | |
268 | long s_flags; /* flags */ | |
269 | long s_align; /* used on I960 */ | |
f6868b8e SC |
270 | }; |
271 | ||
f6868b8e SC |
272 | /* |
273 | * s_flags "type" | |
274 | */ | |
57115f09 ILT |
275 | #define STYP_REG (0x0000) /* "regular": allocated, relocated, loaded */ |
276 | #define STYP_DSECT (0x0001) /* "dummy": relocated only*/ | |
277 | #define STYP_NOLOAD (0x0002) /* "noload": allocated, relocated, not loaded */ | |
278 | #define STYP_GROUP (0x0004) /* "grouped": formed of input sections */ | |
279 | #define STYP_PAD (0x0008) /* "padding": not allocated, not relocated, loaded */ | |
280 | #define STYP_COPY (0x0010) /* "copy": for decision function used by field update; not allocated, not relocated, | |
281 | loaded; reloc & lineno entries processed normally */ | |
282 | #define STYP_TEXT (0x0020) /* section contains text only */ | |
283 | #define S_SHRSEG (0x0020) /* In 3b Update files (output of ogen), sections which appear in SHARED segments of the Pfile | |
284 | will have the S_SHRSEG flag set by ogen, to inform dufr that updating 1 copy of the proc. will | |
285 | update all process invocations. */ | |
286 | #define STYP_DATA (0x0040) /* section contains data only */ | |
287 | #define STYP_BSS (0x0080) /* section contains bss only */ | |
288 | #define S_NEWFCN (0x0100) /* In a minimal file or an update file, a new function (as compared with a replaced function) */ | |
289 | #define STYP_INFO (0x0200) /* comment: not allocated not relocated, not loaded */ | |
290 | #define STYP_OVER (0x0400) /* overlay: relocated not allocated or loaded */ | |
291 | #define STYP_LIB (0x0800) /* for .lib: same as INFO */ | |
292 | #define STYP_MERGE (0x2000) /* merge section -- combines with text, data or bss sections only */ | |
293 | #define STYP_REVERSE_PAD (0x4000) /* section will be padded with no-op instructions wherever padding is necessary and there is a | |
294 | ||
295 | word of contiguous bytes | |
296 | beginning on a word boundary. */ | |
297 | ||
298 | #define STYP_LIT 0x8020 /* Literal data (like STYP_TEXT) */ | |
f581f995 SC |
299 | |
300 | ||
301 | ||
f6868b8e SC |
302 | /********************** LINE NUMBERS **********************/ |
303 | ||
304 | /* 1 line number entry for every "breakpointable" source line in a section. | |
305 | * Line numbers are grouped on a per function basis; first entry in a function | |
306 | * grouping will have l_lnno = 0 and in place of physical address will be the | |
307 | * symbol table index of the function name. | |
308 | */ | |
309 | ||
57115f09 ILT |
310 | struct internal_lineno |
311 | { | |
312 | union | |
313 | { | |
314 | long l_symndx; /* function name symbol index, iff l_lnno == 0*/ | |
315 | long l_paddr; /* (physical) address of line number */ | |
316 | } l_addr; | |
317 | unsigned long l_lnno; /* line number */ | |
f6868b8e SC |
318 | }; |
319 | ||
f6868b8e SC |
320 | /********************** SYMBOLS **********************/ |
321 | ||
322 | #define SYMNMLEN 8 /* # characters in a symbol name */ | |
323 | #define FILNMLEN 14 /* # characters in a file name */ | |
324 | #define DIMNUM 4 /* # array dimensions in auxiliary entry */ | |
325 | ||
57115f09 ILT |
326 | struct internal_syment |
327 | { | |
328 | union | |
329 | { | |
330 | char _n_name[SYMNMLEN]; /* old COFF version */ | |
331 | struct | |
332 | { | |
333 | long _n_zeroes; /* new == 0 */ | |
334 | long _n_offset; /* offset into string table */ | |
335 | } _n_n; | |
336 | char *_n_nptr[2]; /* allows for overlaying */ | |
337 | } _n; | |
338 | long n_value; /* value of symbol */ | |
339 | short n_scnum; /* section number */ | |
340 | unsigned short n_flags; /* copy of flags from filhdr */ | |
341 | unsigned short n_type; /* type and derived type */ | |
b2a86278 ILT |
342 | unsigned char n_sclass; /* storage class */ |
343 | unsigned char n_numaux; /* number of aux. entries */ | |
f6868b8e | 344 | }; |
57115f09 | 345 | |
f6868b8e SC |
346 | #define n_name _n._n_name |
347 | #define n_zeroes _n._n_n._n_zeroes | |
348 | #define n_offset _n._n_n._n_offset | |
349 | ||
350 | ||
351 | /* Relocatable symbols have number of the section in which they are defined, | |
352 | or one of the following: */ | |
353 | ||
57115f09 ILT |
354 | #define N_UNDEF ((short)0) /* undefined symbol */ |
355 | #define N_ABS ((short)-1) /* value of symbol is absolute */ | |
356 | #define N_DEBUG ((short)-2) /* debugging symbol -- value is meaningless */ | |
357 | #define N_TV ((short)-3) /* indicates symbol needs preload transfer vector */ | |
358 | #define P_TV ((short)-4) /* indicates symbol needs postload transfer vector*/ | |
f6868b8e SC |
359 | |
360 | /* | |
361 | * Type of a symbol, in low N bits of the word | |
362 | */ | |
363 | #define T_NULL 0 | |
364 | #define T_VOID 1 /* function argument (only used by compiler) */ | |
365 | #define T_CHAR 2 /* character */ | |
366 | #define T_SHORT 3 /* short integer */ | |
367 | #define T_INT 4 /* integer */ | |
368 | #define T_LONG 5 /* long integer */ | |
369 | #define T_FLOAT 6 /* floating point */ | |
370 | #define T_DOUBLE 7 /* double word */ | |
371 | #define T_STRUCT 8 /* structure */ | |
372 | #define T_UNION 9 /* union */ | |
373 | #define T_ENUM 10 /* enumeration */ | |
374 | #define T_MOE 11 /* member of enumeration*/ | |
375 | #define T_UCHAR 12 /* unsigned character */ | |
376 | #define T_USHORT 13 /* unsigned short */ | |
377 | #define T_UINT 14 /* unsigned integer */ | |
378 | #define T_ULONG 15 /* unsigned long */ | |
379 | #define T_LNGDBL 16 /* long double */ | |
380 | ||
381 | /* | |
382 | * derived types, in n_type | |
383 | */ | |
384 | #define DT_NON (0) /* no derived type */ | |
385 | #define DT_PTR (1) /* pointer */ | |
386 | #define DT_FCN (2) /* function */ | |
387 | #define DT_ARY (3) /* array */ | |
388 | ||
389 | #define BTYPE(x) ((x) & N_BTMASK) | |
390 | ||
391 | #define ISPTR(x) (((x) & N_TMASK) == (DT_PTR << N_BTSHFT)) | |
392 | #define ISFCN(x) (((x) & N_TMASK) == (DT_FCN << N_BTSHFT)) | |
393 | #define ISARY(x) (((x) & N_TMASK) == (DT_ARY << N_BTSHFT)) | |
394 | #define ISTAG(x) ((x)==C_STRTAG||(x)==C_UNTAG||(x)==C_ENTAG) | |
395 | #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK)) | |
396 | ||
397 | ||
57115f09 | 398 | union internal_auxent |
f6868b8e | 399 | { |
57115f09 ILT |
400 | struct |
401 | { | |
f6868b8e | 402 | |
57115f09 ILT |
403 | union |
404 | { | |
f6868b8e SC |
405 | long l; /* str, un, or enum tag indx */ |
406 | struct coff_ptr_struct *p; | |
57115f09 | 407 | } x_tagndx; |
f6868b8e | 408 | |
57115f09 ILT |
409 | union |
410 | { | |
411 | struct | |
412 | { | |
f6868b8e SC |
413 | unsigned short x_lnno; /* declaration line number */ |
414 | unsigned short x_size; /* str/union/array size */ | |
57115f09 | 415 | } x_lnsz; |
f6868b8e | 416 | long x_fsize; /* size of function */ |
57115f09 | 417 | } x_misc; |
f6868b8e | 418 | |
57115f09 ILT |
419 | union |
420 | { | |
421 | struct | |
422 | { /* if ISFCN, tag, or .bb */ | |
f6868b8e | 423 | long x_lnnoptr; /* ptr to fcn line # */ |
57115f09 ILT |
424 | union |
425 | { /* entry ndx past block end */ | |
426 | long l; | |
f6868b8e | 427 | struct coff_ptr_struct *p; |
57115f09 ILT |
428 | } x_endndx; |
429 | } x_fcn; | |
f6868b8e | 430 | |
57115f09 ILT |
431 | struct |
432 | { /* if ISARY, up to 4 dimen. */ | |
f6868b8e | 433 | unsigned short x_dimen[DIMNUM]; |
57115f09 ILT |
434 | } x_ary; |
435 | } x_fcnary; | |
f6868b8e SC |
436 | |
437 | unsigned short x_tvndx; /* tv index */ | |
57115f09 | 438 | } x_sym; |
f6868b8e | 439 | |
57115f09 ILT |
440 | union |
441 | { | |
f6868b8e | 442 | char x_fname[FILNMLEN]; |
57115f09 ILT |
443 | struct |
444 | { | |
f6868b8e SC |
445 | long x_zeroes; |
446 | long x_offset; | |
57115f09 ILT |
447 | } x_n; |
448 | } x_file; | |
f6868b8e | 449 | |
57115f09 ILT |
450 | struct |
451 | { | |
f6868b8e SC |
452 | long x_scnlen; /* section length */ |
453 | unsigned short x_nreloc; /* # relocation entries */ | |
454 | unsigned short x_nlinno; /* # line numbers */ | |
57115f09 | 455 | } x_scn; |
f6868b8e | 456 | |
57115f09 ILT |
457 | struct |
458 | { | |
459 | long x_tvfill; /* tv fill value */ | |
460 | unsigned short x_tvlen; /* length of .tv */ | |
461 | unsigned short x_tvran[2]; /* tv range */ | |
462 | } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ | |
f6868b8e SC |
463 | |
464 | /****************************************** | |
465 | * RS/6000-specific auxent - last auxent for every external symbol | |
466 | ******************************************/ | |
57115f09 ILT |
467 | struct |
468 | { | |
f581f995 SC |
469 | union |
470 | { /* csect length or enclosing csect */ | |
471 | long l; | |
472 | struct coff_ptr_struct *p; | |
473 | } x_scnlen; | |
57115f09 ILT |
474 | long x_parmhash; /* parm type hash index */ |
475 | unsigned short x_snhash; /* sect num with parm hash */ | |
476 | unsigned char x_smtyp; /* symbol align and type */ | |
477 | /* 0-4 - Log 2 of alignment */ | |
478 | /* 5-7 - symbol type */ | |
479 | unsigned char x_smclas; /* storage mapping class */ | |
480 | long x_stab; /* dbx stab info index */ | |
481 | unsigned short x_snstab; /* sect num with dbx stab */ | |
482 | } x_csect; /* csect definition information */ | |
f6868b8e SC |
483 | |
484 | /* x_smtyp values: */ | |
485 | ||
486 | #define SMTYP_ALIGN(x) ((x) >> 3) /* log2 of alignment */ | |
487 | #define SMTYP_SMTYP(x) ((x) & 0x7) /* symbol type */ | |
488 | /* Symbol type values: */ | |
57115f09 ILT |
489 | #define XTY_ER 0 /* External reference */ |
490 | #define XTY_SD 1 /* Csect definition */ | |
491 | #define XTY_LD 2 /* Label definition */ | |
492 | #define XTY_CM 3 /* .BSS */ | |
493 | #define XTY_EM 4 /* Error message */ | |
494 | #define XTY_US 5 /* "Reserved for internal use" */ | |
f6868b8e SC |
495 | |
496 | /* x_smclas values: */ | |
497 | ||
57115f09 ILT |
498 | #define XMC_PR 0 /* Read-only program code */ |
499 | #define XMC_RO 1 /* Read-only constant */ | |
500 | #define XMC_DB 2 /* Read-only debug dictionary table */ | |
501 | #define XMC_TC 3 /* Read-write general TOC entry */ | |
502 | #define XMC_UA 4 /* Read-write unclassified */ | |
503 | #define XMC_RW 5 /* Read-write data */ | |
504 | #define XMC_GL 6 /* Read-only global linkage */ | |
505 | #define XMC_XO 7 /* Read-only extended operation (simulated insn) */ | |
506 | #define XMC_SV 8 /* Read-only supervisor call */ | |
507 | #define XMC_BS 9 /* Read-write BSS */ | |
508 | #define XMC_DS 10 /* Read-write descriptor csect */ | |
509 | #define XMC_UC 11 /* Read-write unnamed Fortran common */ | |
510 | #define XMC_TI 12 /* Read-only traceback index csect */ | |
511 | #define XMC_TB 13 /* Read-only traceback table csect */ | |
f6868b8e | 512 | /* 14 ??? */ |
57115f09 | 513 | #define XMC_TC0 15 /* Read-write TOC anchor for TOC addressability */ |
f6868b8e SC |
514 | |
515 | ||
516 | /****************************************** | |
517 | * I960-specific *2nd* aux. entry formats | |
518 | ******************************************/ | |
57115f09 ILT |
519 | struct |
520 | { | |
f6868b8e SC |
521 | /* This is a very old typo that keeps getting propagated. */ |
522 | #define x_stdindx x_stindx | |
523 | long x_stindx; /* sys. table entry */ | |
57115f09 | 524 | } x_sc; /* system call entry */ |
f6868b8e | 525 | |
57115f09 ILT |
526 | struct |
527 | { | |
f6868b8e | 528 | unsigned long x_balntry; /* BAL entry point */ |
57115f09 | 529 | } x_bal; /* BAL-callable function */ |
f6868b8e | 530 | |
57115f09 ILT |
531 | struct |
532 | { | |
533 | unsigned long x_timestamp; /* time stamp */ | |
534 | char x_idstring[20]; /* producer identity string */ | |
535 | } x_ident; /* Producer ident info */ | |
f6868b8e SC |
536 | |
537 | }; | |
538 | ||
539 | /********************** RELOCATION DIRECTIVES **********************/ | |
540 | ||
57115f09 | 541 | struct internal_reloc |
f6868b8e | 542 | { |
b5823950 | 543 | bfd_vma r_vaddr; /* Virtual address of reference */ |
57115f09 ILT |
544 | long r_symndx; /* Index into symbol table */ |
545 | unsigned short r_type; /* Relocation type */ | |
b5823950 ILT |
546 | unsigned char r_size; /* Used by RS/6000 and ECOFF */ |
547 | unsigned char r_extern; /* Used by ECOFF */ | |
548 | unsigned long r_offset; /* Used by Alpha ECOFF, SPARC, others */ | |
f6868b8e SC |
549 | }; |
550 | ||
551 | #define R_RELBYTE 017 | |
552 | #define R_RELWORD 020 | |
553 | #define R_PCRBYTE 022 | |
554 | #define R_PCRWORD 023 | |
555 | #define R_PCRLONG 024 | |
556 | ||
b5823950 | 557 | #define R_DIR16 01 |
f6868b8e SC |
558 | #define R_DIR32 06 |
559 | #define R_PCLONG 020 | |
560 | #define R_RELBYTE 017 | |
561 | #define R_RELWORD 020 | |
b2a86278 | 562 | #define R_IMAGEBASE 07 |
f6868b8e SC |
563 | |
564 | ||
565 | #define R_PCR16L 128 | |
566 | #define R_PCR26L 129 | |
567 | #define R_VRT16 130 | |
568 | #define R_HVRT16 131 | |
569 | #define R_LVRT16 132 | |
570 | #define R_VRT32 133 | |
571 | #define R_RELLONG (0x11) /* Direct 32-bit relocation */ | |
572 | #define R_IPRSHORT (0x18) | |
573 | #define R_IPRMED (0x19) /* 24-bit ip-relative relocation */ | |
574 | #define R_IPRLONG (0x1a) | |
575 | #define R_OPTCALL (0x1b) /* 32-bit optimizable call (leafproc/sysproc) */ | |
576 | #define R_OPTCALLX (0x1c) /* 64-bit optimizable call (leafproc/sysproc) */ | |
577 | #define R_GETSEG (0x1d) | |
578 | #define R_GETPA (0x1e) | |
579 | #define R_TAGWORD (0x1f) | |
580 | #define R_JUMPTARG 0x20 /* strange 29k 00xx00xx reloc */ | |
b5823950 ILT |
581 | |
582 | ||
583 | #define R_MOVB1 0x41 /* Special h8 16bit or 8 bit reloc for mov.b */ | |
584 | #define R_MOVB2 0x42 /* Special h8 opcode for 8bit which could be 16 */ | |
585 | #define R_JMP1 0x43 /* Special h8 16bit jmp which could be pcrel */ | |
586 | #define R_JMP2 0x44 /* a branch which used to be a jmp */ | |
587 | #define R_RELLONG_NEG 0x45 | |
588 | ||
589 | #define R_JMPL1 0x46 /* Special h8 24bit jmp which could be pcrel */ | |
590 | #define R_JMPL_B8 0x47 /* a 8 bit pcrel which used to be a jmp */ | |
591 | ||
592 | #define R_MOVLB1 0x48 /* Special h8 24bit or 8 bit reloc for mov.b */ | |
593 | #define R_MOVLB2 0x49 /* Special h8 opcode for 8bit which could be 24 */ | |
eaa0f4f8 | 594 | |
eaa0f4f8 | 595 | /* Z8k modes */ |
62aaa2e7 | 596 | #define R_IMM16 0x01 /* 16 bit abs */ |
57115f09 ILT |
597 | #define R_JR 0x02 /* jr 8 bit disp */ |
598 | #define R_IMM4L 0x23 /* low nibble */ | |
599 | #define R_IMM8 0x22 /* 8 bit abs */ | |
62aaa2e7 | 600 | #define R_IMM32 R_RELLONG /* 32 bit abs */ |
57115f09 ILT |
601 | #define R_CALL R_DA /* Absolute address which could be a callr */ |
602 | #define R_JP R_DA /* Absolute address which could be a jp */ | |
603 | #define R_REL16 0x04 /* 16 bit PC rel */ | |
604 | #define R_CALLR 0x05 /* callr 12 bit disp */ | |
605 | #define R_SEG 0x10 /* set if in segmented mode */ | |
606 | #define R_IMM4H 0x24 /* high nibble */ | |
b5823950 | 607 | #define R_DISP7 0x25 /* djnz displacement */ |
2cf90c44 JK |
608 | |
609 | /* H8500 modes */ | |
610 | ||
611 | #define R_H8500_IMM8 1 /* 8 bit immediate */ | |
612 | #define R_H8500_IMM16 2 /* 16 bit immediate */ | |
613 | #define R_H8500_PCREL8 3 /* 8 bit pcrel */ | |
614 | #define R_H8500_PCREL16 4 /* 16 bit pcrel */ | |
615 | #define R_H8500_HIGH8 5 /* high 8 bits of 24 bit address */ | |
616 | #define R_H8500_LOW16 7 /* low 16 bits of 24 bit immediate */ | |
617 | #define R_H8500_IMM24 6 /* 24 bit immediate */ | |
618 | #define R_H8500_IMM32 8 /* 32 bit immediate */ | |
b5823950 ILT |
619 | #define R_H8500_HIGH16 9 /* high 16 bits of 32 bit immediate */ |
620 | ||
f581f995 SC |
621 | /* W65 modes */ |
622 | ||
623 | #define R_W65_ABS8 1 /* addr & 0xff */ | |
624 | #define R_W65_ABS16 2 /* addr & 0xffff */ | |
625 | #define R_W65_ABS24 3 /* addr & 0xffffff */ | |
626 | ||
627 | #define R_W65_ABS8S8 4 /* (addr >> 8) & 0xff */ | |
628 | #define R_W65_ABS8S16 5 /* (addr >> 16) & 0xff */ | |
629 | ||
630 | #define R_W65_ABS16S8 6 /* (addr >> 8) & 0ffff */ | |
631 | #define R_W65_ABS16S16 7 /* (addr >> 16) & 0ffff */ | |
632 | ||
633 | #define R_W65_PCR8 8 | |
634 | #define R_W65_PCR16 9 | |
635 | ||
636 | #define R_W65_DP 10 /* direct page 8 bits only */ | |
637 |