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