Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
5191 | serge | 1 | /* Internal format of XCOFF object file data structures for BFD. |
2 | |||
3 | Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, |
||
4 | 2009, 2010 Free Software Foundation, Inc. |
||
5 | Written by Ian Lance Taylor |
||
6 | |||
7 | This file is part of BFD, the Binary File Descriptor library. |
||
8 | |||
9 | This program is free software; you can redistribute it and/or modify |
||
10 | it under the terms of the GNU General Public License as published by |
||
11 | the Free Software Foundation; either version 3 of the License, or |
||
12 | (at your option) any later version. |
||
13 | |||
14 | This program is distributed in the hope that it will be useful, |
||
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
17 | GNU General Public License for more details. |
||
18 | |||
19 | You should have received a copy of the GNU General Public License |
||
20 | along with this program; if not, write to the Free Software |
||
21 | Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, |
||
22 | MA 02110-1301, USA. */ |
||
23 | |||
24 | #ifndef _INTERNAL_XCOFF_H |
||
25 | #define _INTERNAL_XCOFF_H |
||
26 | |||
27 | /* XCOFF specific f_flags. */ |
||
28 | |||
29 | /* File was profiled with fdpr. */ |
||
30 | #define F_FDPR_PROF 0x0010 |
||
31 | |||
32 | /* File was reordered with fdpr. */ |
||
33 | #define F_FDPR_OPTI 0x0020 |
||
34 | |||
35 | /* File use very large program support. */ |
||
36 | #define F_DSA 0x0040 |
||
37 | |||
38 | /* One aux header specifying medium page sizes is non-zero. */ |
||
39 | #define F_VARPG 0x0100 |
||
40 | |||
41 | /* Read/write sections are non-executable. */ |
||
42 | #define F_NONEXEC 0x8000 |
||
43 | |||
44 | /* Linker */ |
||
45 | |||
46 | /* Names of "special" sections. */ |
||
47 | #define _TEXT ".text" |
||
48 | #define _DATA ".data" |
||
49 | #define _BSS ".bss" |
||
50 | #define _PAD ".pad" |
||
51 | #define _LOADER ".loader" |
||
52 | #define _EXCEPT ".except" |
||
53 | #define _TYPCHK ".typchk" |
||
54 | |||
55 | /* XCOFF uses special .dwXXX sections with the type STYP_DWARF. */ |
||
56 | #define STYP_DWARF 0x0010 |
||
57 | |||
58 | /* High-order 16-bits dwarf subtypes. */ |
||
59 | #define SSUBTYP_DWINFO 0x10000 |
||
60 | #define SSUBTYP_DWLINE 0x20000 |
||
61 | #define SSUBTYP_DWPBNMS 0x30000 |
||
62 | #define SSUBTYP_DWPBTYP 0x40000 |
||
63 | #define SSUBTYP_DWARNGE 0x50000 |
||
64 | #define SSUBTYP_DWABREV 0x60000 |
||
65 | #define SSUBTYP_DWSTR 0x70000 |
||
66 | #define SSUBTYP_DWRNGES 0x80000 |
||
67 | |||
68 | /* XCOFF uses a special .loader section with type STYP_LOADER. */ |
||
69 | #define STYP_LOADER 0x1000 |
||
70 | |||
71 | /* Specifies an exception section. A section of this type provides |
||
72 | information to identify the reason that a trap or ececptin occured within |
||
73 | and executable object program */ |
||
74 | #define STYP_EXCEPT 0x0100 |
||
75 | |||
76 | /* Specifies an initialized thread-local data section. */ |
||
77 | #define STYP_TDATA 0x0400 |
||
78 | |||
79 | /* Specifies an uninitialized thread-local data section. */ |
||
80 | #define STYP_TBSS 0x0800 |
||
81 | |||
82 | /* XCOFF uses a special .debug section with type STYP_DEBUG. */ |
||
83 | #define STYP_DEBUG 0x2000 |
||
84 | |||
85 | /* Specifies a type check section. A section of this type contains parameter |
||
86 | argument type check strings used by the AIX binder. */ |
||
87 | #define STYP_TYPCHK 0x4000 |
||
88 | |||
89 | /* XCOFF handles line number or relocation overflow by creating |
||
90 | another section header with STYP_OVRFLO set. */ |
||
91 | #define STYP_OVRFLO 0x8000 |
||
92 | |||
93 | #define RS6K_AOUTHDR_OMAGIC 0x0107 /* old: text & data writeable */ |
||
94 | #define RS6K_AOUTHDR_NMAGIC 0x0108 /* new: text r/o, data r/w */ |
||
95 | #define RS6K_AOUTHDR_ZMAGIC 0x010B /* paged: text r/o, both page-aligned */ |
||
96 | |||
97 | /* XCOFF relocation types. |
||
98 | The relocations are described in the function |
||
99 | xcoff[64]_ppc_relocate_section in coff64-rs6000.c and coff-rs6000.c */ |
||
100 | |||
101 | #define R_POS (0x00) |
||
102 | #define R_NEG (0x01) |
||
103 | #define R_REL (0x02) |
||
104 | #define R_TOC (0x03) |
||
105 | #define R_RTB (0x04) |
||
106 | #define R_GL (0x05) |
||
107 | #define R_TCL (0x06) |
||
108 | #define R_BA (0x08) |
||
109 | #define R_BR (0x0a) |
||
110 | #define R_RL (0x0c) |
||
111 | #define R_RLA (0x0d) |
||
112 | #define R_REF (0x0f) |
||
113 | #define R_TRL (0x12) |
||
114 | #define R_TRLA (0x13) |
||
115 | #define R_RRTBI (0x14) |
||
116 | #define R_RRTBA (0x15) |
||
117 | #define R_CAI (0x16) |
||
118 | #define R_CREL (0x17) |
||
119 | #define R_RBA (0x18) |
||
120 | #define R_RBAC (0x19) |
||
121 | #define R_RBR (0x1a) |
||
122 | #define R_RBRC (0x1b) |
||
123 | #define R_TLS (0x20) |
||
124 | #define R_TLS_IE (0x21) |
||
125 | #define R_TLS_LD (0x22) |
||
126 | #define R_TLS_LE (0x23) |
||
127 | #define R_TLSM (0x24) |
||
128 | #define R_TLSML (0x25) |
||
129 | #define R_TOCU (0x30) |
||
130 | #define R_TOCL (0x31) |
||
131 | |||
132 | /* Storage class #defines, from /usr/include/storclass.h that are not already |
||
133 | defined in internal.h */ |
||
134 | |||
135 | /* Comment string in .info section */ |
||
136 | #define C_INFO 110 |
||
137 | |||
138 | /* Dwarf symbol. */ |
||
139 | #define C_DWARF 112 |
||
140 | |||
141 | /* Auxillary Symbol Entries */ |
||
142 | |||
143 | /* x_smtyp values: */ |
||
144 | #define SMTYP_ALIGN(x) ((x) >> 3) /* log2 of alignment */ |
||
145 | #define SMTYP_SMTYP(x) ((x) & 0x7) /* symbol type */ |
||
146 | /* Symbol type values: */ |
||
147 | #define XTY_ER 0 /* External reference */ |
||
148 | #define XTY_SD 1 /* Csect definition */ |
||
149 | #define XTY_LD 2 /* Label definition */ |
||
150 | #define XTY_CM 3 /* .BSS */ |
||
151 | #define XTY_EM 4 /* Error message */ |
||
152 | #define XTY_US 5 /* "Reserved for internal use" */ |
||
153 | |||
154 | /* x_smclas values: */ |
||
155 | #define XMC_PR 0 /* Read-only program code */ |
||
156 | #define XMC_RO 1 /* Read-only constant */ |
||
157 | #define XMC_DB 2 /* Read-only debug dictionary table */ |
||
158 | #define XMC_TC 3 /* Read-write general TOC entry */ |
||
159 | #define XMC_UA 4 /* Read-write unclassified */ |
||
160 | #define XMC_RW 5 /* Read-write data */ |
||
161 | #define XMC_GL 6 /* Read-only global linkage */ |
||
162 | #define XMC_XO 7 /* Read-only extended operation */ |
||
163 | #define XMC_SV 8 /* Read-only supervisor call */ |
||
164 | #define XMC_BS 9 /* Read-write BSS */ |
||
165 | #define XMC_DS 10 /* Read-write descriptor csect */ |
||
166 | #define XMC_UC 11 /* Read-write unnamed Fortran common */ |
||
167 | #define XMC_TI 12 /* Read-only traceback index csect */ |
||
168 | #define XMC_TB 13 /* Read-only traceback table csect */ |
||
169 | /* 14 ??? */ |
||
170 | #define XMC_TC0 15 /* Read-write TOC anchor */ |
||
171 | #define XMC_TD 16 /* Read-write data in TOC */ |
||
172 | #define XMC_SV64 17 /* Read-only 64 bit supervisor call */ |
||
173 | #define XMC_SV3264 18 /* Read-only 32 or 64 bit supervisor call */ |
||
174 | /* 19 ??? */ |
||
175 | #define XMC_TL 20 /* Read-write initialized TLS data */ |
||
176 | #define XMC_TU 21 /* Read-write uninitialized TLS data */ |
||
177 | #define XMC_TE 22 /* Same as XMC_TC but mapped after it */ |
||
178 | |||
179 | /* The ldhdr structure. This appears at the start of the .loader |
||
180 | section. */ |
||
181 | |||
182 | struct internal_ldhdr |
||
183 | { |
||
184 | /* The version number: |
||
185 | 1 : 32 bit |
||
186 | 2 : 64 bit */ |
||
187 | unsigned long l_version; |
||
188 | |||
189 | /* The number of symbol table entries. */ |
||
190 | bfd_size_type l_nsyms; |
||
191 | |||
192 | /* The number of relocation table entries. */ |
||
193 | bfd_size_type l_nreloc; |
||
194 | |||
195 | /* The length of the import file string table. */ |
||
196 | bfd_size_type l_istlen; |
||
197 | |||
198 | /* The number of import files. */ |
||
199 | bfd_size_type l_nimpid; |
||
200 | |||
201 | /* The offset from the start of the .loader section to the first |
||
202 | entry in the import file table. */ |
||
203 | bfd_size_type l_impoff; |
||
204 | |||
205 | /* The length of the string table. */ |
||
206 | bfd_size_type l_stlen; |
||
207 | |||
208 | /* The offset from the start of the .loader section to the first |
||
209 | entry in the string table. */ |
||
210 | bfd_size_type l_stoff; |
||
211 | |||
212 | /* The offset to start of the symbol table, only in XCOFF64 */ |
||
213 | bfd_vma l_symoff; |
||
214 | |||
215 | /* The offset to the start of the relocation table, only in XCOFF64 */ |
||
216 | bfd_vma l_rldoff; |
||
217 | }; |
||
218 | |||
219 | /* The ldsym structure. This is used to represent a symbol in the |
||
220 | .loader section. */ |
||
221 | |||
222 | struct internal_ldsym |
||
223 | { |
||
224 | union |
||
225 | { |
||
226 | /* The symbol name if <= SYMNMLEN characters. */ |
||
227 | char _l_name[SYMNMLEN]; |
||
228 | struct |
||
229 | { |
||
230 | /* Zero if the symbol name is more than SYMNMLEN characters. */ |
||
231 | long _l_zeroes; |
||
232 | |||
233 | /* The offset in the string table if the symbol name is more |
||
234 | than SYMNMLEN characters. */ |
||
235 | long _l_offset; |
||
236 | } |
||
237 | _l_l; |
||
238 | } |
||
239 | _l; |
||
240 | |||
241 | /* The symbol value. */ |
||
242 | bfd_vma l_value; |
||
243 | |||
244 | /* The symbol section number. */ |
||
245 | short l_scnum; |
||
246 | |||
247 | /* The symbol type and flags. */ |
||
248 | char l_smtype; |
||
249 | |||
250 | /* The symbol storage class. */ |
||
251 | char l_smclas; |
||
252 | |||
253 | /* The import file ID. */ |
||
254 | bfd_size_type l_ifile; |
||
255 | |||
256 | /* Offset to the parameter type check string. */ |
||
257 | bfd_size_type l_parm; |
||
258 | }; |
||
259 | |||
260 | /* These flags are for the l_smtype field (the lower three bits are an |
||
261 | XTY_* value). */ |
||
262 | |||
263 | /* Imported symbol. */ |
||
264 | #define L_IMPORT (0x40) |
||
265 | /* Entry point. */ |
||
266 | #define L_ENTRY (0x20) |
||
267 | /* Exported symbol. */ |
||
268 | #define L_EXPORT (0x10) |
||
269 | /* Weak symbol. */ |
||
270 | #define L_WEAK (0x08) |
||
271 | |||
272 | /* The ldrel structure. This is used to represent a reloc in the |
||
273 | .loader section. */ |
||
274 | |||
275 | struct internal_ldrel |
||
276 | { |
||
277 | /* The reloc address. */ |
||
278 | bfd_vma l_vaddr; |
||
279 | |||
280 | /* The symbol table index in the .loader section symbol table. */ |
||
281 | bfd_size_type l_symndx; |
||
282 | |||
283 | /* The relocation type and size. */ |
||
284 | short l_rtype; |
||
285 | |||
286 | /* The section number this relocation applies to. */ |
||
287 | short l_rsecnm; |
||
288 | }; |
||
289 | |||
290 | /* An entry in the XCOFF linker hash table. */ |
||
291 | struct xcoff_link_hash_entry |
||
292 | { |
||
293 | struct bfd_link_hash_entry root; |
||
294 | |||
295 | /* Symbol index in output file. Set to -1 initially. Set to -2 if |
||
296 | there is a reloc against this symbol. */ |
||
297 | long indx; |
||
298 | |||
299 | /* If we have created a TOC entry for this symbol, this is the .tc |
||
300 | section which holds it. */ |
||
301 | asection *toc_section; |
||
302 | |||
303 | union |
||
304 | { |
||
305 | /* If we have created a TOC entry (the XCOFF_SET_TOC flag is |
||
306 | set), this is the offset in toc_section. */ |
||
307 | bfd_vma toc_offset; |
||
308 | |||
309 | /* If the TOC entry comes from an input file, this is set to the |
||
310 | symbol index of the C_HIDEXT XMC_TC or XMC_TD symbol. */ |
||
311 | long toc_indx; |
||
312 | } |
||
313 | u; |
||
314 | |||
315 | /* If this symbol is a function entry point which is called, this |
||
316 | field holds a pointer to the function descriptor. If this symbol |
||
317 | is a function descriptor, this field holds a pointer to the |
||
318 | function entry point. */ |
||
319 | struct xcoff_link_hash_entry *descriptor; |
||
320 | |||
321 | /* The .loader symbol table entry, if there is one. */ |
||
322 | struct internal_ldsym *ldsym; |
||
323 | |||
324 | /* If XCOFF_BUILT_LDSYM is set, this is the .loader symbol table |
||
325 | index. If XCOFF_BUILD_LDSYM is clear, and XCOFF_IMPORT is set, |
||
326 | this is the l_ifile value. */ |
||
327 | long ldindx; |
||
328 | |||
329 | /* Some linker flags. */ |
||
330 | unsigned long flags; |
||
331 | |||
332 | /* The storage mapping class. */ |
||
333 | unsigned char smclas; |
||
334 | }; |
||
335 | |||
336 | /* Flags for xcoff_link_hash_entry. */ |
||
337 | |||
338 | /* Symbol is referenced by a regular object. */ |
||
339 | #define XCOFF_REF_REGULAR 0x00000001 |
||
340 | /* Symbol is defined by a regular object. */ |
||
341 | #define XCOFF_DEF_REGULAR 0x00000002 |
||
342 | /* Symbol is defined by a dynamic object. */ |
||
343 | #define XCOFF_DEF_DYNAMIC 0x00000004 |
||
344 | /* Symbol is used in a reloc being copied into the .loader section. */ |
||
345 | #define XCOFF_LDREL 0x00000008 |
||
346 | /* Symbol is the entry point. */ |
||
347 | #define XCOFF_ENTRY 0x00000010 |
||
348 | /* Symbol is for a function and is the target of a relocation. |
||
349 | The relocation may or may not be a branch-type relocation. */ |
||
350 | #define XCOFF_CALLED 0x00000020 |
||
351 | /* Symbol needs the TOC entry filled in. */ |
||
352 | #define XCOFF_SET_TOC 0x00000040 |
||
353 | /* Symbol is implicitly or explicitly imported. */ |
||
354 | #define XCOFF_IMPORT 0x00000080 |
||
355 | /* Symbol is explicitly exported. */ |
||
356 | #define XCOFF_EXPORT 0x00000100 |
||
357 | /* Symbol has been processed by xcoff_build_ldsyms. */ |
||
358 | #define XCOFF_BUILT_LDSYM 0x00000200 |
||
359 | /* Symbol is mentioned by a section which was not garbage collected. */ |
||
360 | #define XCOFF_MARK 0x00000400 |
||
361 | /* Symbol size is recorded in size_list list from hash table. */ |
||
362 | #define XCOFF_HAS_SIZE 0x00000800 |
||
363 | /* Symbol is a function descriptor. */ |
||
364 | #define XCOFF_DESCRIPTOR 0x00001000 |
||
365 | /* Multiple definitions have been for the symbol. */ |
||
366 | #define XCOFF_MULTIPLY_DEFINED 0x00002000 |
||
367 | /* Symbol is the __rtinit symbol. */ |
||
368 | #define XCOFF_RTINIT 0x00004000 |
||
369 | /* Symbol is an imported 32 bit syscall. */ |
||
370 | #define XCOFF_SYSCALL32 0x00008000 |
||
371 | /* Symbol is an imported 64 bit syscall. */ |
||
372 | #define XCOFF_SYSCALL64 0x00010000 |
||
373 | /* Symbol was not explicitly defined by the time it was marked. */ |
||
374 | #define XCOFF_WAS_UNDEFINED 0x00020000 |
||
375 | /* We have assigned an output XCOFF entry to this symbol. */ |
||
376 | #define XCOFF_ALLOCATED 0x00040000 |
||
377 | |||
378 | /* The XCOFF linker hash table. */ |
||
379 | |||
380 | #define XCOFF_NUMBER_OF_SPECIAL_SECTIONS 6 |
||
381 | #define XCOFF_SPECIAL_SECTION_TEXT 0 |
||
382 | #define XCOFF_SPECIAL_SECTION_ETEXT 1 |
||
383 | #define XCOFF_SPECIAL_SECTION_DATA 2 |
||
384 | #define XCOFF_SPECIAL_SECTION_EDATA 3 |
||
385 | #define XCOFF_SPECIAL_SECTION_END 4 |
||
386 | #define XCOFF_SPECIAL_SECTION_END2 5 |
||
387 | |||
388 | /* These flags indicate which of -bexpall and -bexpfull are in effect. */ |
||
389 | #define XCOFF_EXPALL 1 |
||
390 | #define XCOFF_EXPFULL 2 |
||
391 | |||
392 | /* This structure is used to pass information through |
||
393 | xcoff_link_hash_traverse. */ |
||
394 | |||
395 | struct xcoff_loader_info |
||
396 | { |
||
397 | /* Set if a problem occurred. */ |
||
398 | bfd_boolean failed; |
||
399 | |||
400 | /* Output BFD. */ |
||
401 | bfd *output_bfd; |
||
402 | |||
403 | /* Link information structure. */ |
||
404 | struct bfd_link_info *info; |
||
405 | |||
406 | /* A mask of XCOFF_EXPALL and XCOFF_EXPFULL flags. */ |
||
407 | unsigned int auto_export_flags; |
||
408 | |||
409 | /* Number of ldsym structures. */ |
||
410 | size_t ldsym_count; |
||
411 | |||
412 | /* Size of string table. */ |
||
413 | size_t string_size; |
||
414 | |||
415 | /* String table. */ |
||
416 | char *strings; |
||
417 | |||
418 | /* Allocated size of string table. */ |
||
419 | size_t string_alc; |
||
420 | }; |
||
421 | |||
422 | /* In case we're on a 32-bit machine, construct a 64-bit "-1" value |
||
423 | from smaller values. Start with zero, widen, *then* decrement. */ |
||
424 | #define MINUS_ONE (((bfd_vma) 0) - 1) |
||
425 | |||
426 | /* __rtinit, from /usr/include/rtinit.h. */ |
||
427 | struct __rtinit |
||
428 | { |
||
429 | /* Pointer to runtime linker. |
||
430 | XXX: Is the parameter really void? */ |
||
431 | int (*rtl) (void); |
||
432 | |||
433 | /* Offset to array of init functions, 0 if none. */ |
||
434 | int init_offset; |
||
435 | |||
436 | /* Offset to array of fini functions, 0 if none. */ |
||
437 | int fini_offset; |
||
438 | |||
439 | /* Size of __RTINIT_DESCRIPTOR. This value should be used instead of |
||
440 | sizeof(__RTINIT_DESCRIPTOR). */ |
||
441 | int __rtinit_descriptor_size; |
||
442 | }; |
||
443 | |||
444 | #define RTINIT_DESCRIPTOR_SIZE (12) |
||
445 | |||
446 | struct __rtinit_descriptor |
||
447 | { |
||
448 | /* Init/fini function. */ |
||
449 | int f; |
||
450 | |||
451 | /* Offset, relative to the start of the __rtinit symbol, to name of the |
||
452 | function. */ |
||
453 | |||
454 | int name_offset; |
||
455 | |||
456 | /* Flags */ |
||
457 | unsigned char flags; |
||
458 | }; |
||
459 | |||
460 | /* Archive */ |
||
461 | |||
462 | #define XCOFFARMAG " |
||
463 | #define XCOFFARMAGBIG " |
||
464 | #define SXCOFFARMAG 8 |
||
465 | |||
466 | /* The size of the ascii archive elements */ |
||
467 | #define XCOFFARMAG_ELEMENT_SIZE 12 |
||
468 | #define XCOFFARMAGBIG_ELEMENT_SIZE 20 |
||
469 | |||
470 | /* This terminates an XCOFF archive member name. */ |
||
471 | |||
472 | #define XCOFFARFMAG "`\012" |
||
473 | #define SXCOFFARFMAG 2 |
||
474 | |||
475 | /* XCOFF archives start with this (printable) structure. */ |
||
476 | |||
477 | struct xcoff_ar_file_hdr |
||
478 | { |
||
479 | /* Magic string. */ |
||
480 | char magic[SXCOFFARMAG]; |
||
481 | |||
482 | /* Offset of the member table (decimal ASCII string). */ |
||
483 | char memoff[XCOFFARMAG_ELEMENT_SIZE]; |
||
484 | |||
485 | /* Offset of the global symbol table (decimal ASCII string). */ |
||
486 | char symoff[XCOFFARMAG_ELEMENT_SIZE]; |
||
487 | |||
488 | /* Offset of the first member in the archive (decimal ASCII string). */ |
||
489 | char firstmemoff[XCOFFARMAG_ELEMENT_SIZE]; |
||
490 | |||
491 | /* Offset of the last member in the archive (decimal ASCII string). */ |
||
492 | char lastmemoff[XCOFFARMAG_ELEMENT_SIZE]; |
||
493 | |||
494 | /* Offset of the first member on the free list (decimal ASCII |
||
495 | string). */ |
||
496 | char freeoff[XCOFFARMAG_ELEMENT_SIZE]; |
||
497 | }; |
||
498 | |||
499 | #define SIZEOF_AR_FILE_HDR (SXCOFFARMAG + 5 * XCOFFARMAG_ELEMENT_SIZE) |
||
500 | |||
501 | /* This is the equivalent data structure for the big archive format. */ |
||
502 | |||
503 | struct xcoff_ar_file_hdr_big |
||
504 | { |
||
505 | /* Magic string. */ |
||
506 | char magic[SXCOFFARMAG]; |
||
507 | |||
508 | /* Offset of the member table (decimal ASCII string). */ |
||
509 | char memoff[XCOFFARMAGBIG_ELEMENT_SIZE]; |
||
510 | |||
511 | /* Offset of the global symbol table for 32-bit objects (decimal ASCII |
||
512 | string). */ |
||
513 | char symoff[XCOFFARMAGBIG_ELEMENT_SIZE]; |
||
514 | |||
515 | /* Offset of the global symbol table for 64-bit objects (decimal ASCII |
||
516 | string). */ |
||
517 | char symoff64[XCOFFARMAGBIG_ELEMENT_SIZE]; |
||
518 | |||
519 | /* Offset of the first member in the archive (decimal ASCII string). */ |
||
520 | char firstmemoff[XCOFFARMAGBIG_ELEMENT_SIZE]; |
||
521 | |||
522 | /* Offset of the last member in the archive (decimal ASCII string). */ |
||
523 | char lastmemoff[XCOFFARMAGBIG_ELEMENT_SIZE]; |
||
524 | |||
525 | /* Offset of the first member on the free list (decimal ASCII |
||
526 | string). */ |
||
527 | char freeoff[XCOFFARMAGBIG_ELEMENT_SIZE]; |
||
528 | }; |
||
529 | |||
530 | #define SIZEOF_AR_FILE_HDR_BIG (SXCOFFARMAG + 6 * XCOFFARMAGBIG_ELEMENT_SIZE) |
||
531 | |||
532 | /* Each XCOFF archive member starts with this (printable) structure. */ |
||
533 | |||
534 | struct xcoff_ar_hdr |
||
535 | { |
||
536 | /* File size not including the header (decimal ASCII string). */ |
||
537 | char size[XCOFFARMAG_ELEMENT_SIZE]; |
||
538 | |||
539 | /* File offset of next archive member (decimal ASCII string). */ |
||
540 | char nextoff[XCOFFARMAG_ELEMENT_SIZE]; |
||
541 | |||
542 | /* File offset of previous archive member (decimal ASCII string). */ |
||
543 | char prevoff[XCOFFARMAG_ELEMENT_SIZE]; |
||
544 | |||
545 | /* File mtime (decimal ASCII string). */ |
||
546 | char date[12]; |
||
547 | |||
548 | /* File UID (decimal ASCII string). */ |
||
549 | char uid[12]; |
||
550 | |||
551 | /* File GID (decimal ASCII string). */ |
||
552 | char gid[12]; |
||
553 | |||
554 | /* File mode (octal ASCII string). */ |
||
555 | char mode[12]; |
||
556 | |||
557 | /* Length of file name (decimal ASCII string). */ |
||
558 | char namlen[4]; |
||
559 | |||
560 | /* This structure is followed by the file name. The length of the |
||
561 | name is given in the namlen field. If the length of the name is |
||
562 | odd, the name is followed by a null byte. The name and optional |
||
563 | null byte are followed by XCOFFARFMAG, which is not included in |
||
564 | namlen. The contents of the archive member follow; the number of |
||
565 | bytes is given in the size field. */ |
||
566 | }; |
||
567 | |||
568 | #define SIZEOF_AR_HDR (3 * XCOFFARMAG_ELEMENT_SIZE + 4 * 12 + 4) |
||
569 | |||
570 | /* The equivalent for the big archive format. */ |
||
571 | |||
572 | struct xcoff_ar_hdr_big |
||
573 | { |
||
574 | /* File size not including the header (decimal ASCII string). */ |
||
575 | char size[XCOFFARMAGBIG_ELEMENT_SIZE]; |
||
576 | |||
577 | /* File offset of next archive member (decimal ASCII string). */ |
||
578 | char nextoff[XCOFFARMAGBIG_ELEMENT_SIZE]; |
||
579 | |||
580 | /* File offset of previous archive member (decimal ASCII string). */ |
||
581 | char prevoff[XCOFFARMAGBIG_ELEMENT_SIZE]; |
||
582 | |||
583 | /* File mtime (decimal ASCII string). */ |
||
584 | char date[12]; |
||
585 | |||
586 | /* File UID (decimal ASCII string). */ |
||
587 | char uid[12]; |
||
588 | |||
589 | /* File GID (decimal ASCII string). */ |
||
590 | char gid[12]; |
||
591 | |||
592 | /* File mode (octal ASCII string). */ |
||
593 | char mode[12]; |
||
594 | |||
595 | /* Length of file name (decimal ASCII string). */ |
||
596 | char namlen[4]; |
||
597 | |||
598 | /* This structure is followed by the file name. The length of the |
||
599 | name is given in the namlen field. If the length of the name is |
||
600 | odd, the name is followed by a null byte. The name and optional |
||
601 | null byte are followed by XCOFFARFMAG, which is not included in |
||
602 | namlen. The contents of the archive member follow; the number of |
||
603 | bytes is given in the size field. */ |
||
604 | }; |
||
605 | |||
606 | #define SIZEOF_AR_HDR_BIG (3 * XCOFFARMAGBIG_ELEMENT_SIZE + 4 * 12 + 4) |
||
607 | |||
608 | /* We often have to distinguish between the old and big file format. |
||
609 | Make it a bit cleaner. We can use `xcoff_ardata' here because the |
||
610 | `hdr' member has the same size and position in both formats. |
||
611 |
|
||
612 | NULL. */ |
||
613 | #ifndef SMALL_ARCHIVE |
||
614 | /* Creates big archives by default */ |
||
615 | #define xcoff_big_format_p(abfd) \ |
||
616 | ((NULL != bfd_ardata (abfd) && NULL == xcoff_ardata (abfd)) || \ |
||
617 | ((NULL != bfd_ardata (abfd)) && \ |
||
618 | (NULL != xcoff_ardata (abfd)) && \ |
||
619 | (xcoff_ardata (abfd)->magic[1] == 'b'))) |
||
620 | #else |
||
621 | /* Creates small archives by default. */ |
||
622 | #define xcoff_big_format_p(abfd) \ |
||
623 | (((NULL != bfd_ardata (abfd)) && \ |
||
624 | (NULL != xcoff_ardata (abfd)) && \ |
||
625 | (xcoff_ardata (abfd)->magic[1] == 'b'))) |
||
626 | #endif |
||
627 | |||
628 | /* We store a copy of the xcoff_ar_file_hdr in the tdata field of the |
||
629 | artdata structure. Similar for the big archive. */ |
||
630 | #define xcoff_ardata(abfd) \ |
||
631 | ((struct xcoff_ar_file_hdr *) bfd_ardata (abfd)->tdata) |
||
632 | #define xcoff_ardata_big(abfd) \ |
||
633 | ((struct xcoff_ar_file_hdr_big *) bfd_ardata (abfd)->tdata) |
||
634 | |||
635 | /* We store a copy of the xcoff_ar_hdr in the arelt_data field of an |
||
636 | archive element. Similar for the big archive. */ |
||
637 | #define arch_eltdata(bfd) ((struct areltdata *) ((bfd)->arelt_data)) |
||
638 | #define arch_xhdr(bfd) \ |
||
639 | ((struct xcoff_ar_hdr *) arch_eltdata (bfd)->arch_header) |
||
640 | #define arch_xhdr_big(bfd) \ |
||
641 | ((struct xcoff_ar_hdr_big *) arch_eltdata (bfd)->arch_header) |
||
642 | |||
643 | /* True if symbols of class CLASS are external. */ |
||
644 | #define EXTERN_SYM_P(CLASS) \ |
||
645 | ((CLASS) == C_EXT || (CLASS) == C_AIX_WEAKEXT) |
||
646 | |||
647 | #endif /* _INTERNAL_XCOFF_H */=> |