Back to index

cell-binutils  2.17cvs20070401
rs6k64.h
Go to the documentation of this file.
00001 /* IBM RS/6000 "XCOFF64" file definitions for BFD.
00002    Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.  
00003 
00004    This program is free software; you can redistribute it and/or modify
00005    it under the terms of the GNU General Public License as published by
00006    the Free Software Foundation; either version 2 of the License, or
00007    (at your option) any later version.
00008    
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012    GNU General Public License for more details.
00013    
00014    You should have received a copy of the GNU General Public License
00015    along with this program; if not, write to the Free Software
00016    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
00017 
00018 /********************** FILE HEADER **********************/
00019 
00020 struct external_filehdr
00021 {
00022   char f_magic[2];   /* magic number                    */
00023   char f_nscns[2];   /* number of sections              */
00024   char f_timdat[4];  /* time & date stamp        */
00025   char f_symptr[8];  /* file pointer to symtab   */
00026   char f_opthdr[2];  /* sizeof(optional hdr)            */
00027   char f_flags[2];   /* flags                    */
00028   char f_nsyms[4];   /* number of symtab entries */
00029 };
00030 
00031 /* IBM RS/6000.  */
00032 #define U803XTOCMAGIC 0757  /* Aix 4.3 64-bit XCOFF */
00033 #define       U64_TOCMAGIC  0767   /* AIX 5+ 64-bit XCOFF */
00034 #define BADMAG(x) ((x).f_magic != U803XTOCMAGIC && (x).f_magic != U64_TOCMAGIC)
00035 
00036 #define       FILHDR struct external_filehdr
00037 #define       FILHSZ 24
00038 
00039 /********************** AOUT "OPTIONAL HEADER" **********************/
00040 
00041 typedef struct 
00042 {
00043   unsigned char      magic[2];            /* type of file                    */
00044   unsigned char      vstamp[2];           /* version stamp            */
00045   unsigned char      o_debugger[4];              /* reserved                 */
00046   unsigned char      text_start[8];              /* base of text used for this file */
00047   unsigned char      data_start[8];              /* base of data used for this file */
00048   unsigned char      o_toc[8];            /* address of TOC */
00049   unsigned char      o_snentry[2];        /* section number of entry point */
00050   unsigned char      o_sntext[2];         /* section number of .text section */
00051   unsigned char      o_sndata[2];         /* section number of .data section */
00052   unsigned char      o_sntoc[2];          /* section number of TOC */
00053   unsigned char      o_snloader[2];              /* section number of .loader section */
00054   unsigned char      o_snbss[2];          /* section number of .bss section */
00055   unsigned char      o_algntext[2];              /* .text alignment */
00056   unsigned char      o_algndata[2];              /* .data alignment */
00057   unsigned char      o_modtype[2];        /* module type (??) */
00058   unsigned char o_cputype[2];             /* cpu type */
00059   unsigned char      o_resv2[4];          /* reserved                 */
00060   unsigned char      tsize[8];            /* text size bytes, padded to FW bdry */
00061   unsigned char      dsize[8];            /* initialized data "  "    */
00062   unsigned char      bsize[8];            /* uninitialized data "   " */
00063   unsigned char      entry[8];            /* entry pt.                */
00064   unsigned char      o_maxstack[8];              /* max stack size (??)             */
00065   unsigned char o_maxdata[8];             /* max data size (??)              */
00066   unsigned char      o_resv3[16];         /* reserved                 */
00067 }
00068 AOUTHDR;
00069 
00070 #define AOUTSZ 120
00071 #define SMALL_AOUTSZ (0)
00072 #define AOUTHDRSZ 72
00073 
00074 /********************** SECTION HEADER **********************/
00075 
00076 struct external_scnhdr
00077 {
00078   char s_name[8];    /* section name                    */
00079   char s_paddr[8];   /* physical address, aliased s_nlib */
00080   char s_vaddr[8];   /* virtual address          */
00081   char s_size[8];    /* section size                    */
00082   char s_scnptr[8];  /* file ptr to raw data for section */
00083   char s_relptr[8];  /* file ptr to relocation   */
00084   char s_lnnoptr[8]; /* file ptr to line numbers */
00085   char s_nreloc[4];  /* number of relocation entries    */
00086   char s_nlnno[4];   /* number of line number entries*/
00087   char s_flags[4];   /* flags                    */
00088   char  s_pad[4];    /* padding */  
00089 };
00090 
00091 #define       SCNHDR struct external_scnhdr
00092 
00093 #define       SCNHSZ 72
00094 
00095 /********************** LINE NUMBERS **********************/
00096 
00097 /* 1 line number entry for every "breakpointable" source line in a section.
00098    Line numbers are grouped on a per function basis; first entry in a function
00099    grouping will have l_lnno = 0 and in place of physical address will be the
00100    symbol table index of the function name.  */
00101 
00102 struct external_lineno
00103 {
00104   union
00105   {
00106     char l_symndx[4];       /* function name symbol index, iff l_lnno == 0*/
00107     char l_paddr[8]; /* (physical) address of line number      */
00108   } l_addr;
00109 
00110   char l_lnno[4];    /* line number              */
00111 };
00112 
00113 #define       LINENO struct external_lineno
00114 
00115 #define       LINESZ 12
00116 
00117 /********************** SYMBOLS **********************/
00118 
00119 #define E_SYMNMLEN   8      /* # characters in a symbol name   */
00120 #define E_FILNMLEN   14     /* # characters in a file name            */
00121 #define E_DIMNUM     4      /* # array dimensions in auxiliary entry */
00122 
00123 struct external_syment 
00124 {
00125   char e_value[8];
00126   char e_offset[4];
00127   char e_scnum[2];
00128   char e_type[2];
00129   char e_sclass[1];
00130   char e_numaux[1];
00131 };
00132 
00133 #define N_BTMASK     (017)
00134 #define N_TMASK             (060)
00135 #define N_BTSHFT     (4)
00136 #define N_TSHIFT     (2)
00137 
00138 union external_auxent
00139 {
00140     struct {
00141        union {
00142            struct {
00143               char x_lnno[4];      /* declaration line number */
00144               char x_size[2];      /* str/union/array size */
00145            } x_lnsz;
00146            struct {
00147               char x_lnnoptr[8];/* ptr to fcn line */
00148               char x_fsize[4];      /* size of function */
00149               char x_endndx[4];     /* entry ndx past block end */
00150            } x_fcn;
00151        } x_fcnary;
00152     } x_sym;
00153          
00154     union {
00155        char x_fname[E_FILNMLEN];
00156        struct {
00157            char x_zeroes[4];
00158            char x_offset[4];
00159            char          x_pad[6];
00160            unsigned char x_ftype[1];
00161            unsigned char x_resv[2];
00162        } x_n;
00163     } x_file;
00164 
00165     struct {
00166        char x_exptr[8];
00167        char x_fsize[4];
00168        char x_endndx[4];
00169        char x_pad[1];
00170     } x_except;
00171 
00172     struct {
00173            unsigned char x_scnlen_lo[4];
00174            unsigned char x_parmhash[4];
00175            unsigned char x_snhash[2];
00176            unsigned char x_smtyp[1];
00177            unsigned char x_smclas[1];
00178            unsigned char x_scnlen_hi[4];
00179            unsigned char x_pad[1];
00180     } x_csect;       
00181 
00182     struct {
00183        char x_pad[17];
00184        char x_auxtype[1];
00185     } x_auxtype;
00186 };
00187 
00188 #define       SYMENT struct external_syment
00189 #define       SYMESZ 18     
00190 #define       AUXENT union external_auxent
00191 #define       AUXESZ 18
00192 #define DBXMASK 0x80        /* for dbx storage mask */
00193 #define SYMNAME_IN_DEBUG(symptr) ((symptr)->n_sclass & DBXMASK)
00194 
00195 /* Values for auxtype field in XCOFF64, taken from AIX 4.3 sym.h.  */
00196 #define _AUX_EXCEPT     255
00197 #define _AUX_FCN        254
00198 #define _AUX_SYM        253
00199 #define _AUX_FILE       252
00200 #define _AUX_CSECT      251
00201 
00202 /********************** RELOCATION DIRECTIVES **********************/
00203 
00204 struct external_reloc
00205 {
00206   char r_vaddr[8];
00207   char r_symndx[4];
00208   char r_size[1];
00209   char r_type[1];
00210 };
00211 
00212 #define RELOC struct external_reloc
00213 #define RELSZ 14
00214 
00215 #define DEFAULT_DATA_SECTION_ALIGNMENT 4
00216 #define DEFAULT_BSS_SECTION_ALIGNMENT 4
00217 #define DEFAULT_TEXT_SECTION_ALIGNMENT 4
00218 /* For new sections we havn't heard of before */
00219 #define DEFAULT_SECTION_ALIGNMENT 4
00220 
00221 /* The ldhdr structure.  This appears at the start of the .loader
00222    section.  */
00223 
00224 struct external_ldhdr
00225 {
00226   bfd_byte l_version[4];
00227   bfd_byte l_nsyms[4];
00228   bfd_byte l_nreloc[4];
00229   bfd_byte l_istlen[4];
00230   bfd_byte l_nimpid[4];
00231   bfd_byte l_stlen[4];
00232   bfd_byte l_impoff[8];
00233   bfd_byte l_stoff[8];
00234   bfd_byte l_symoff[8];
00235   bfd_byte l_rldoff[8];
00236 };
00237 #define LDHDRSZ (56)
00238 
00239 struct external_ldsym
00240 {
00241   bfd_byte l_value[8];
00242   bfd_byte l_offset[4];
00243   bfd_byte l_scnum[2];
00244   bfd_byte l_smtype[1];
00245   bfd_byte l_smclas[1];
00246   bfd_byte l_ifile[4];
00247   bfd_byte l_parm[4];
00248 };
00249 
00250 #define LDSYMSZ (24)
00251 
00252 struct external_ldrel
00253 {
00254   bfd_byte l_vaddr[8];
00255   bfd_byte l_rtype[2];
00256   bfd_byte l_rsecnm[2];
00257   bfd_byte l_symndx[4];
00258 };
00259 
00260 #define LDRELSZ (16)