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