Back to index

cell-binutils  2.17cvs20070401
xcoff.h
Go to the documentation of this file.
00001 /* Internal format of XCOFF object file data structures for BFD.
00002 
00003    Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005
00004    Free Software Foundation, Inc.
00005    Written by Ian Lance Taylor <ian@cygnus.com>, Cygnus Support.
00006 
00007    This file is part of BFD, the Binary File Descriptor library.
00008 
00009    This program is free software; you can redistribute it and/or modify
00010    it under the terms of the GNU General Public License as published by
00011    the Free Software Foundation; either version 2 of the License, or
00012    (at your option) any later version.
00013    
00014    This program is distributed in the hope that it will be useful,
00015    but WITHOUT ANY WARRANTY; without even the implied warranty of
00016    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017    GNU General Public License for more details.
00018    
00019    You should have received a copy of the GNU General Public License
00020    along with this program; if not, write to the Free Software
00021    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
00022 
00023 #ifndef _INTERNAL_XCOFF_H
00024 #define _INTERNAL_XCOFF_H
00025 
00026 /* Linker */
00027 
00028 /* Names of "special" sections.  */
00029 #define _TEXT ".text"
00030 #define _DATA ".data"
00031 #define _BSS  ".bss"
00032 #define _PAD  ".pad"
00033 #define _LOADER      ".loader"
00034 #define _EXCEPT ".except"
00035 #define _TYPCHK ".typchk"
00036 
00037 /* XCOFF uses a special .loader section with type STYP_LOADER.  */
00038 #define STYP_LOADER 0x1000
00039 
00040 /* XCOFF uses a special .debug section with type STYP_DEBUG.  */
00041 #define STYP_DEBUG 0x2000
00042 
00043 /* XCOFF handles line number or relocation overflow by creating
00044    another section header with STYP_OVRFLO set.  */
00045 #define STYP_OVRFLO 0x8000
00046 
00047 /* Specifies an exception section.  A section of this type provides 
00048    information to identify the reason that a trap or ececptin occured within 
00049    and executable object program */
00050 #define STYP_EXCEPT 0x0100
00051 
00052 /* Specifies a type check section.  A section of this type contains parameter 
00053    argument type check strings used by the AIX binder.  */
00054 #define STYP_TYPCHK 0x4000
00055 
00056 #define       RS6K_AOUTHDR_OMAGIC 0x0107 /* old: text & data writeable */
00057 #define       RS6K_AOUTHDR_NMAGIC 0x0108 /* new: text r/o, data r/w */
00058 #define       RS6K_AOUTHDR_ZMAGIC 0x010B /* paged: text r/o, both page-aligned */
00059 
00060 /* XCOFF relocation types.  
00061    The relocations are described in the function  
00062    xcoff[64]_ppc_relocate_section in coff64-rs6000.c and coff-rs6000.c  */
00063 
00064 #define R_POS   (0x00)
00065 #define R_NEG   (0x01)
00066 #define R_REL   (0x02)
00067 #define R_TOC   (0x03)
00068 #define R_RTB   (0x04)
00069 #define R_GL    (0x05)
00070 #define R_TCL   (0x06)
00071 #define R_BA    (0x08)
00072 #define R_BR    (0x0a)
00073 #define R_RL    (0x0c)
00074 #define R_RLA   (0x0d)
00075 #define R_REF   (0x0f)
00076 #define R_TRL   (0x12)
00077 #define R_TRLA  (0x13)
00078 #define R_RRTBI (0x14)
00079 #define R_RRTBA (0x15)
00080 #define R_CAI   (0x16)
00081 #define R_CREL  (0x17)
00082 #define R_RBA   (0x18)
00083 #define R_RBAC  (0x19)
00084 #define R_RBR   (0x1a)
00085 #define R_RBRC  (0x1b)
00086 
00087 /* Storage class #defines, from /usr/include/storclass.h that are not already 
00088    defined in internal.h */
00089 
00090 /* Comment string in .info section */
00091 #define       C_INFO        110    
00092 
00093 /* Auxillary Symbol Entries  */
00094 
00095 /* x_smtyp values:  */
00096 #define       SMTYP_ALIGN(x)       ((x) >> 3)    /* log2 of alignment */
00097 #define       SMTYP_SMTYP(x)       ((x) & 0x7)   /* symbol type */
00098 /* Symbol type values:  */
00099 #define       XTY_ER 0             /* External reference */
00100 #define       XTY_SD 1             /* Csect definition */
00101 #define       XTY_LD 2             /* Label definition */
00102 #define XTY_CM       3             /* .BSS */
00103 #define       XTY_EM 4             /* Error message */
00104 #define       XTY_US 5             /* "Reserved for internal use" */
00105 
00106 /* x_smclas values:  */
00107 #define       XMC_PR 0             /* Read-only program code */
00108 #define       XMC_RO 1             /* Read-only constant */
00109 #define       XMC_DB 2             /* Read-only debug dictionary table */
00110 #define       XMC_TC 3             /* Read-write general TOC entry */
00111 #define       XMC_UA 4             /* Read-write unclassified */
00112 #define       XMC_RW 5             /* Read-write data */
00113 #define       XMC_GL 6             /* Read-only global linkage */
00114 #define       XMC_XO 7             /* Read-only extended operation */
00115 #define       XMC_SV 8             /* Read-only supervisor call */
00116 #define       XMC_BS 9             /* Read-write BSS */
00117 #define       XMC_DS 10            /* Read-write descriptor csect */
00118 #define       XMC_UC 11            /* Read-write unnamed Fortran common */
00119 #define       XMC_TI 12            /* Read-only traceback index csect */
00120 #define       XMC_TB 13            /* Read-only traceback table csect */
00121 /*            14     ??? */
00122 #define       XMC_TC0       15            /* Read-write TOC anchor */
00123 #define XMC_TD       16            /* Read-write data in TOC */
00124 #define       XMC_SV64   17        /* Read-only 64 bit supervisor call */
00125 #define       XMC_SV3264 18        /* Read-only 32 or 64 bit supervisor call */
00126 
00127 /* The ldhdr structure.  This appears at the start of the .loader
00128    section.  */
00129 
00130 struct internal_ldhdr
00131 {
00132   /* The version number: 
00133      1 : 32 bit
00134      2 : 64 bit */
00135   unsigned long l_version;
00136 
00137   /* The number of symbol table entries.  */
00138   bfd_size_type l_nsyms;
00139 
00140   /* The number of relocation table entries.  */
00141   bfd_size_type l_nreloc;
00142 
00143   /* The length of the import file string table.  */
00144   bfd_size_type l_istlen;
00145 
00146   /* The number of import files.  */
00147   bfd_size_type l_nimpid;
00148 
00149   /* The offset from the start of the .loader section to the first
00150      entry in the import file table.  */
00151   bfd_size_type l_impoff;
00152 
00153   /* The length of the string table.  */
00154   bfd_size_type l_stlen;
00155 
00156   /* The offset from the start of the .loader section to the first
00157      entry in the string table.  */
00158   bfd_size_type l_stoff;
00159 
00160   /* The offset to start of the symbol table, only in XCOFF64 */
00161   bfd_vma l_symoff;
00162 
00163   /* The offset to the start of the relocation table, only in XCOFF64 */
00164   bfd_vma l_rldoff;
00165 };
00166 
00167 /* The ldsym structure.  This is used to represent a symbol in the
00168    .loader section.  */
00169 
00170 struct internal_ldsym
00171 {
00172   union
00173   {
00174     /* The symbol name if <= SYMNMLEN characters.  */
00175     char _l_name[SYMNMLEN];
00176     struct
00177     {
00178       /* Zero if the symbol name is more than SYMNMLEN characters.  */
00179        long _l_zeroes;
00180       
00181       /* The offset in the string table if the symbol name is more
00182         than SYMNMLEN characters.  */
00183       long _l_offset;
00184     } 
00185     _l_l;
00186   }
00187   _l;
00188 
00189   /* The symbol value.  */
00190   bfd_vma l_value;
00191 
00192   /* The symbol section number.  */
00193   short l_scnum;
00194 
00195   /* The symbol type and flags.  */
00196   char l_smtype;
00197 
00198   /* The symbol storage class.  */
00199   char l_smclas;
00200 
00201   /* The import file ID.  */
00202   bfd_size_type l_ifile;
00203 
00204   /* Offset to the parameter type check string.  */
00205   bfd_size_type l_parm;
00206 };
00207 
00208 /* These flags are for the l_smtype field (the lower three bits are an
00209    XTY_* value).  */
00210 
00211 /* Imported symbol.  */
00212 #define L_IMPORT (0x40)
00213 /* Entry point.  */
00214 #define L_ENTRY (0x20)
00215 /* Exported symbol.  */
00216 #define L_EXPORT (0x10)
00217 
00218 /* The ldrel structure.  This is used to represent a reloc in the
00219    .loader section.  */
00220 
00221 struct internal_ldrel
00222 {
00223   /* The reloc address.  */
00224   bfd_vma l_vaddr;
00225 
00226   /* The symbol table index in the .loader section symbol table.  */
00227   bfd_size_type l_symndx;
00228 
00229   /* The relocation type and size.  */
00230   short l_rtype;
00231 
00232   /* The section number this relocation applies to.  */
00233   short l_rsecnm;
00234 };
00235 
00236 /* An entry in the XCOFF linker hash table.  */
00237 struct xcoff_link_hash_entry
00238 {
00239   struct bfd_link_hash_entry root;
00240 
00241   /* Symbol index in output file.  Set to -1 initially.  Set to -2 if
00242      there is a reloc against this symbol.  */
00243   long indx;
00244 
00245   /* If we have created a TOC entry for this symbol, this is the .tc
00246      section which holds it.  */
00247   asection *toc_section;
00248 
00249   union
00250   {
00251     /* If we have created a TOC entry (the XCOFF_SET_TOC flag is
00252        set), this is the offset in toc_section.  */
00253     bfd_vma toc_offset;
00254     
00255     /* If the TOC entry comes from an input file, this is set to the
00256        symbol index of the C_HIDEXT XMC_TC or XMC_TD symbol.  */
00257     long toc_indx;
00258   } 
00259   u;
00260 
00261   /* If this symbol is a function entry point which is called, this
00262      field holds a pointer to the function descriptor.  If this symbol
00263      is a function descriptor, this field holds a pointer to the
00264      function entry point.  */
00265   struct xcoff_link_hash_entry *descriptor;
00266 
00267   /* The .loader symbol table entry, if there is one.  */
00268   struct internal_ldsym *ldsym;
00269 
00270   /* If XCOFF_BUILT_LDSYM is set, this is the .loader symbol table
00271      index.  If XCOFF_BUILD_LDSYM is clear, and XCOFF_IMPORT is set,
00272      this is the l_ifile value.  */
00273   long ldindx;
00274 
00275   /* Some linker flags.  */
00276   unsigned long flags;
00277 
00278   /* The storage mapping class.  */
00279   unsigned char smclas;
00280 };
00281 
00282 /*  Flags for xcoff_link_hash_entry.  */
00283 
00284 /* Symbol is referenced by a regular object. */
00285 #define XCOFF_REF_REGULAR      0x00000001
00286 /* Symbol is defined by a regular object. */
00287 #define XCOFF_DEF_REGULAR      0x00000002
00288 /* Symbol is defined by a dynamic object. */
00289 #define XCOFF_DEF_DYNAMIC      0x00000004
00290 /* Symbol is used in a reloc being copied into the .loader section.  */
00291 #define XCOFF_LDREL            0x00000008
00292 /* Symbol is the entry point.  */
00293 #define XCOFF_ENTRY            0x00000010
00294 /* Symbol is called; this is, it appears in a R_BR reloc.  */
00295 #define XCOFF_CALLED           0x00000020
00296 /* Symbol needs the TOC entry filled in.  */
00297 #define XCOFF_SET_TOC          0x00000040
00298 /* Symbol is explicitly imported.  */
00299 #define XCOFF_IMPORT           0x00000080
00300 /* Symbol is explicitly exported.  */
00301 #define XCOFF_EXPORT           0x00000100
00302 /* Symbol has been processed by xcoff_build_ldsyms.  */
00303 #define XCOFF_BUILT_LDSYM      0x00000200
00304 /* Symbol is mentioned by a section which was not garbage collected. */
00305 #define XCOFF_MARK             0x00000400
00306 /* Symbol size is recorded in size_list list from hash table.  */
00307 #define XCOFF_HAS_SIZE         0x00000800
00308 /* Symbol is a function descriptor.  */
00309 #define XCOFF_DESCRIPTOR       0x00001000
00310 /* Multiple definitions have been for the symbol. */
00311 #define XCOFF_MULTIPLY_DEFINED 0x00002000
00312 /* Symbol is the __rtinit symbol.  */
00313 #define XCOFF_RTINIT           0x00004000
00314 /* Symbol is an imported 32 bit syscall.  */
00315 #define XCOFF_SYSCALL32        0x00008000
00316 /* Symbol is an imported 64 bit syscall.  */
00317 #define XCOFF_SYSCALL64        0x00010000 
00318 
00319 /* The XCOFF linker hash table.  */
00320 
00321 #define XCOFF_NUMBER_OF_SPECIAL_SECTIONS 6
00322 #define XCOFF_SPECIAL_SECTION_TEXT       0
00323 #define XCOFF_SPECIAL_SECTION_ETEXT      1 
00324 #define XCOFF_SPECIAL_SECTION_DATA       2
00325 #define XCOFF_SPECIAL_SECTION_EDATA      3
00326 #define XCOFF_SPECIAL_SECTION_END        4
00327 #define XCOFF_SPECIAL_SECTION_END2       5
00328 
00329 struct xcoff_link_hash_table
00330 {
00331   struct bfd_link_hash_table root;
00332 
00333   /* The .debug string hash table.  We need to compute this while
00334      reading the input files, so that we know how large the .debug
00335      section will be before we assign section positions.  */
00336   struct bfd_strtab_hash *debug_strtab;
00337 
00338   /* The .debug section we will use for the final output.  */
00339   asection *debug_section;
00340 
00341   /* The .loader section we will use for the final output.  */
00342   asection *loader_section;
00343 
00344   /* A count of non TOC relative relocs which will need to be
00345      allocated in the .loader section.  */
00346   size_t ldrel_count;
00347 
00348   /* The .loader section header.  */
00349   struct internal_ldhdr ldhdr;
00350 
00351   /* The .gl section we use to hold global linkage code.  */
00352   asection *linkage_section;
00353 
00354   /* The .tc section we use to hold toc entries we build for global
00355      linkage code.  */
00356   asection *toc_section;
00357 
00358   /* The .ds section we use to hold function descriptors which we
00359      create for exported symbols.  */
00360   asection *descriptor_section;
00361 
00362   /* The list of import files.  */
00363   struct xcoff_import_file *imports;
00364 
00365   /* Required alignment of sections within the output file.  */
00366   unsigned long file_align;
00367 
00368   /* Whether the .text section must be read-only.  */
00369   bfd_boolean textro;
00370 
00371   /* Whether garbage collection was done.  */
00372   bfd_boolean gc;
00373 
00374   /* A linked list of symbols for which we have size information.  */
00375   struct xcoff_link_size_list
00376   {
00377     struct xcoff_link_size_list *next;
00378     struct xcoff_link_hash_entry *h;
00379     bfd_size_type size;
00380   } 
00381   *size_list;
00382 
00383   /* Magic sections: _text, _etext, _data, _edata, _end, end. */
00384   asection *special_sections[XCOFF_NUMBER_OF_SPECIAL_SECTIONS];
00385 };
00386 
00387 
00388 /* This structure is used to pass information through
00389    xcoff_link_hash_traverse.  */
00390 
00391 struct xcoff_loader_info
00392 {
00393   /* Set if a problem occurred.  */
00394   bfd_boolean failed;
00395 
00396   /* Output BFD.  */
00397   bfd *output_bfd;
00398 
00399   /* Link information structure.  */
00400   struct bfd_link_info *info;
00401 
00402   /* Whether all defined symbols should be exported.  */
00403   bfd_boolean export_defineds;
00404 
00405   /* Number of ldsym structures.  */
00406   size_t ldsym_count;
00407 
00408   /* Size of string table.  */
00409   size_t string_size;
00410 
00411   /* String table.  */
00412   char *strings;
00413 
00414   /* Allocated size of string table.  */
00415   size_t string_alc;
00416 };
00417 
00418 /* In case we're on a 32-bit machine, construct a 64-bit "-1" value
00419    from smaller values.  Start with zero, widen, *then* decrement.  */
00420 #define MINUS_ONE       (((bfd_vma) 0) - 1)
00421 
00422 /* __rtinit, from /usr/include/rtinit.h.  */
00423 struct __rtinit 
00424 {
00425   /* Pointer to runtime linker.     
00426      XXX: Is the parameter really void?  */
00427   int  (*rtl) (void);       
00428 
00429   /* Offset to array of init functions, 0 if none. */
00430   int  init_offset;
00431 
00432   /* Offset to array of fini functions, 0 if none. */             
00433   int  fini_offset;         
00434 
00435   /* Size of __RTINIT_DESCRIPTOR. This value should be used instead of 
00436      sizeof(__RTINIT_DESCRIPTOR). */
00437   int  __rtinit_descriptor_size; 
00438 };
00439 
00440 #define RTINIT_DESCRIPTOR_SIZE (12)
00441 
00442 struct __rtinit_descriptor 
00443 {
00444   /* Init/fini function. */
00445   int  f;
00446 
00447   /* Offset, relative to the start of the __rtinit symbol, to name of the 
00448      function. */
00449 
00450   int  name_offset;  
00451 
00452   /* Flags */                  
00453   unsigned char      flags; 
00454 };
00455 
00456 /* Archive */
00457 
00458 #define XCOFFARMAG    "<aiaff>\012"
00459 #define XCOFFARMAGBIG "<bigaf>\012"
00460 #define SXCOFFARMAG   8
00461 
00462 /* The size of the ascii archive elements */
00463 #define XCOFFARMAG_ELEMENT_SIZE 12
00464 #define XCOFFARMAGBIG_ELEMENT_SIZE 20
00465 
00466 /* This terminates an XCOFF archive member name.  */
00467 
00468 #define XCOFFARFMAG "`\012"
00469 #define SXCOFFARFMAG 2
00470 
00471 /* XCOFF archives start with this (printable) structure.  */
00472 
00473 struct xcoff_ar_file_hdr
00474 {
00475   /* Magic string.  */
00476   char magic[SXCOFFARMAG];
00477 
00478   /* Offset of the member table (decimal ASCII string).  */
00479   char memoff[XCOFFARMAG_ELEMENT_SIZE];
00480 
00481   /* Offset of the global symbol table (decimal ASCII string).  */
00482   char symoff[XCOFFARMAG_ELEMENT_SIZE];
00483 
00484   /* Offset of the first member in the archive (decimal ASCII string).  */
00485   char firstmemoff[XCOFFARMAG_ELEMENT_SIZE];
00486 
00487   /* Offset of the last member in the archive (decimal ASCII string).  */
00488   char lastmemoff[XCOFFARMAG_ELEMENT_SIZE];
00489 
00490   /* Offset of the first member on the free list (decimal ASCII
00491      string).  */
00492   char freeoff[XCOFFARMAG_ELEMENT_SIZE];
00493 };
00494 
00495 #define SIZEOF_AR_FILE_HDR (SXCOFFARMAG + 5 * XCOFFARMAG_ELEMENT_SIZE)
00496 
00497 /* This is the equivalent data structure for the big archive format.  */
00498 
00499 struct xcoff_ar_file_hdr_big
00500 {
00501   /* Magic string.  */
00502   char magic[SXCOFFARMAG];
00503 
00504   /* Offset of the member table (decimal ASCII string).  */
00505   char memoff[XCOFFARMAGBIG_ELEMENT_SIZE];
00506 
00507   /* Offset of the global symbol table for 32-bit objects (decimal ASCII
00508      string).  */
00509   char symoff[XCOFFARMAGBIG_ELEMENT_SIZE];
00510 
00511   /* Offset of the global symbol table for 64-bit objects (decimal ASCII
00512      string).  */
00513   char symoff64[XCOFFARMAGBIG_ELEMENT_SIZE];
00514 
00515   /* Offset of the first member in the archive (decimal ASCII string).  */
00516   char firstmemoff[XCOFFARMAGBIG_ELEMENT_SIZE];
00517 
00518   /* Offset of the last member in the archive (decimal ASCII string).  */
00519   char lastmemoff[XCOFFARMAGBIG_ELEMENT_SIZE];
00520 
00521   /* Offset of the first member on the free list (decimal ASCII
00522      string).  */
00523   char freeoff[XCOFFARMAGBIG_ELEMENT_SIZE];
00524 };
00525 
00526 #define SIZEOF_AR_FILE_HDR_BIG (SXCOFFARMAG + 6 * XCOFFARMAGBIG_ELEMENT_SIZE)
00527 
00528 /* Each XCOFF archive member starts with this (printable) structure.  */
00529 
00530 struct xcoff_ar_hdr
00531 {
00532   /* File size not including the header (decimal ASCII string).  */
00533   char size[XCOFFARMAG_ELEMENT_SIZE];
00534 
00535   /* File offset of next archive member (decimal ASCII string).  */
00536   char nextoff[XCOFFARMAG_ELEMENT_SIZE];
00537 
00538   /* File offset of previous archive member (decimal ASCII string).  */
00539   char prevoff[XCOFFARMAG_ELEMENT_SIZE];
00540 
00541   /* File mtime (decimal ASCII string).  */
00542   char date[12];
00543 
00544   /* File UID (decimal ASCII string).  */
00545   char uid[12];
00546 
00547   /* File GID (decimal ASCII string).  */
00548   char gid[12];
00549 
00550   /* File mode (octal ASCII string).  */
00551   char mode[12];
00552 
00553   /* Length of file name (decimal ASCII string).  */
00554   char namlen[4];
00555 
00556   /* This structure is followed by the file name.  The length of the
00557      name is given in the namlen field.  If the length of the name is
00558      odd, the name is followed by a null byte.  The name and optional
00559      null byte are followed by XCOFFARFMAG, which is not included in
00560      namlen.  The contents of the archive member follow; the number of
00561      bytes is given in the size field.  */
00562 };
00563 
00564 #define SIZEOF_AR_HDR (3 * XCOFFARMAG_ELEMENT_SIZE + 4 * 12 + 4)
00565 
00566 /* The equivalent for the big archive format.  */
00567 
00568 struct xcoff_ar_hdr_big
00569 {
00570   /* File size not including the header (decimal ASCII string).  */
00571   char size[XCOFFARMAGBIG_ELEMENT_SIZE];
00572 
00573   /* File offset of next archive member (decimal ASCII string).  */
00574   char nextoff[XCOFFARMAGBIG_ELEMENT_SIZE];
00575 
00576   /* File offset of previous archive member (decimal ASCII string).  */
00577   char prevoff[XCOFFARMAGBIG_ELEMENT_SIZE];
00578 
00579   /* File mtime (decimal ASCII string).  */
00580   char date[12];
00581 
00582   /* File UID (decimal ASCII string).  */
00583   char uid[12];
00584 
00585   /* File GID (decimal ASCII string).  */
00586   char gid[12];
00587 
00588   /* File mode (octal ASCII string).  */
00589   char mode[12];
00590 
00591   /* Length of file name (decimal ASCII string).  */
00592   char namlen[4];
00593 
00594   /* This structure is followed by the file name.  The length of the
00595      name is given in the namlen field.  If the length of the name is
00596      odd, the name is followed by a null byte.  The name and optional
00597      null byte are followed by XCOFFARFMAG, which is not included in
00598      namlen.  The contents of the archive member follow; the number of
00599      bytes is given in the size field.  */
00600 };
00601 
00602 #define SIZEOF_AR_HDR_BIG (3 * XCOFFARMAGBIG_ELEMENT_SIZE + 4 * 12 + 4)
00603 
00604 /* We often have to distinguish between the old and big file format.
00605    Make it a bit cleaner.  We can use `xcoff_ardata' here because the
00606    `hdr' member has the same size and position in both formats.  
00607    <bigaf> is the default format, return TRUE even when xcoff_ardata is 
00608    NULL. */
00609 #ifndef SMALL_ARCHIVE
00610 /* Creates big archives by default */
00611 #define xcoff_big_format_p(abfd) \
00612   ((NULL != bfd_ardata (abfd) && NULL == xcoff_ardata (abfd)) || \
00613    ((NULL != bfd_ardata (abfd)) && \
00614     (NULL != xcoff_ardata (abfd)) && \
00615     (xcoff_ardata (abfd)->magic[1] == 'b')))
00616 #else
00617 /* Creates small archives by default. */
00618 #define xcoff_big_format_p(abfd) \
00619   (((NULL != bfd_ardata (abfd)) && \
00620     (NULL != xcoff_ardata (abfd)) && \
00621     (xcoff_ardata (abfd)->magic[1] == 'b')))
00622 #endif
00623 
00624 /* We store a copy of the xcoff_ar_file_hdr in the tdata field of the
00625    artdata structure.  Similar for the big archive.  */
00626 #define xcoff_ardata(abfd) \
00627   ((struct xcoff_ar_file_hdr *) bfd_ardata (abfd)->tdata)
00628 #define xcoff_ardata_big(abfd) \
00629   ((struct xcoff_ar_file_hdr_big *) bfd_ardata (abfd)->tdata)
00630 
00631 /* We store a copy of the xcoff_ar_hdr in the arelt_data field of an
00632    archive element.  Similar for the big archive.  */
00633 #define arch_eltdata(bfd) ((struct areltdata *) ((bfd)->arelt_data))
00634 #define arch_xhdr(bfd) \
00635   ((struct xcoff_ar_hdr *) arch_eltdata (bfd)->arch_header)
00636 #define arch_xhdr_big(bfd) \
00637   ((struct xcoff_ar_hdr_big *) arch_eltdata (bfd)->arch_header)
00638 
00639 #endif /* _INTERNAL_XCOFF_H */