Back to index

cell-binutils  2.17cvs20070401
m88k.h
Go to the documentation of this file.
00001 /* coff information for 88k bcs
00002    
00003    Copyright 2001 Free Software Foundation, Inc.
00004 
00005    This program is free software; you can redistribute it and/or modify
00006    it under the terms of the GNU General Public License as published by
00007    the Free Software Foundation; either version 2 of the License, or
00008    (at your option) any later version.
00009    
00010    This program is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013    GNU General Public License for more details.
00014    
00015    You should have received a copy of the GNU General Public License
00016    along with this program; if not, write to the Free Software
00017    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
00018 
00019 #define DO_NOT_DEFINE_SCNHDR
00020 #define L_LNNO_SIZE 4
00021 #define DO_NOT_DEFINE_SYMENT
00022 #define DO_NOT_DEFINE_AUXENT
00023 #include "coff/external.h"
00024 
00025 #define MC88MAGIC  0540           /* 88k BCS executable */
00026 #define MC88DMAGIC 0541           /* DG/UX executable   */
00027 #define MC88OMAGIC 0555               /* Object file        */
00028 
00029 #define MC88BADMAG(x) (((x).f_magic != MC88MAGIC) \
00030                     && ((x).f_magic != MC88DMAGIC) \
00031                     && ((x).f_magic != MC88OMAGIC))
00032 
00033 #define PAGEMAGIC3   0414 /* Split i&d, zero mapped */
00034 #define PAGEMAGICBCS 0413
00035 
00036 /********************** SECTION HEADER **********************/
00037 
00038 struct external_scnhdr 
00039 {
00040   char        s_name[8];    /* section name                    */
00041   char        s_paddr[4];   /* physical address, aliased s_nlib */
00042   char        s_vaddr[4];   /* virtual address          */
00043   char        s_size[4];    /* section size                    */
00044   char        s_scnptr[4];  /* file ptr to raw data for section */
00045   char        s_relptr[4];  /* file ptr to relocation   */
00046   char        s_lnnoptr[4]; /* file ptr to line numbers */
00047   char        s_nreloc[4];  /* number of relocation entries    */
00048   char        s_nlnno[4];   /* number of line number entries*/
00049   char        s_flags[4];   /* flags                    */
00050 };
00051 
00052 #define       SCNHDR struct external_scnhdr
00053 #define       SCNHSZ 44
00054 
00055 /* Names of "special" sections.  */
00056 #define _TEXT   ".text"
00057 #define _DATA   ".data"
00058 #define _BSS    ".bss"
00059 #define _COMMENT ".comment"
00060 
00061 
00062 /********************** SYMBOLS **********************/
00063 
00064 #define E_SYMNMLEN   8      /* # characters in a symbol name   */
00065 #define E_FILNMLEN   14     /* # characters in a file name            */
00066 #define E_DIMNUM     4      /* # array dimensions in auxiliary entry */
00067 
00068 struct external_syment 
00069 {
00070   union
00071   {
00072     char e_name[E_SYMNMLEN];
00073 
00074     struct
00075     {
00076       char e_zeroes[4];
00077       char e_offset[4];
00078     } e;
00079 
00080   } e;
00081 
00082   char e_value[4];
00083   char e_scnum[2];
00084   char e_type[2];
00085   char e_sclass[1];
00086   char e_numaux[1];
00087   char pad2[2];
00088 };
00089 
00090 #define N_BTMASK     017
00091 #define N_TMASK             060
00092 #define N_BTSHFT     4
00093 #define N_TSHIFT     2
00094 
00095 /* Note that this isn't the same shape as other coffs */
00096 union external_auxent
00097 {
00098   struct
00099   {
00100     char x_tagndx[4];              /* str, un, or enum tag indx */
00101     /* 4 */
00102     
00103     union
00104     {
00105       char x_fsize[4];             /* size of function */
00106 
00107       struct
00108       {
00109        char  x_lnno[4];     /* declaration line number */
00110        char  x_size[4];     /* str/union/array size */
00111       } x_lnsz;
00112 
00113     } x_misc;
00114     
00115     /* 12 */
00116     union
00117     {
00118       struct                /* if ISFCN, tag, or .bb */
00119       {
00120        char x_lnnoptr[4];   /* ptr to fcn line # */
00121        char x_endndx[4];           /* entry ndx past block end */
00122       } x_fcn;
00123 
00124       struct                /* if ISARY, up to 4 dimen. */
00125       {
00126        char x_dimen[E_DIMNUM][2];
00127       } x_ary;
00128 
00129     } x_fcnary;
00130     /* 20 */
00131     
00132   } x_sym;
00133   
00134   union
00135   {
00136     char x_fname[E_FILNMLEN];
00137 
00138     struct
00139     {
00140       char x_zeroes[4];
00141       char x_offset[4];
00142     } x_n;
00143 
00144   } x_file;
00145   
00146   struct
00147   {
00148     char x_scnlen[4];              /* section length */
00149     char x_nreloc[4];              /* # relocation entries */
00150     char x_nlinno[4];              /* # line numbers */
00151   } x_scn;
00152   
00153   struct
00154   {
00155     char x_tvfill[4];              /* tv fill value */
00156     char x_tvlen[2];        /* length of .tv */
00157     char x_tvran[2][2];            /* tv range */
00158   } x_tv;                   /* info about .tv section (in auxent of symbol .tv)) */
00159 };
00160 
00161 #define GET_LNSZ_SIZE(abfd, ext) \
00162   H_GET_32 (abfd, ext->x_sym.x_misc.x_lnsz.x_size)
00163 #define GET_LNSZ_LNNO(abfd, ext) \
00164   H_GET_32 (abfd, ext->x_sym.x_misc.x_lnsz.x_lnno)
00165 #define PUT_LNSZ_LNNO(abfd, in, ext) \
00166   H_PUT_32 (abfd, in, ext->x_sym.x_misc.x_lnsz.x_lnno)
00167 #define PUT_LNSZ_SIZE(abfd, in, ext) \
00168   H_PUT_32 (abfd, in, ext->x_sym.x_misc.x_lnsz.x_size)
00169 #define GET_SCN_NRELOC(abfd, ext) \
00170   H_GET_32 (abfd, ext->x_scn.x_nreloc)
00171 #define GET_SCN_NLINNO(abfd, ext) \
00172   H_GET_32 (abfd, ext->x_scn.x_nlinno)
00173 #define PUT_SCN_NRELOC(abfd, in, ext) \
00174   H_PUT_32 (abfd, in, ext->x_scn.x_nreloc)
00175 #define PUT_SCN_NLINNO(abfd, in, ext) \
00176   H_PUT_32 (abfd,in, ext->x_scn.x_nlinno)
00177 
00178 #define       SYMENT struct external_syment
00179 #define       SYMESZ 20
00180 #define       AUXENT union external_auxent
00181 #define       AUXESZ 20
00182 
00183 /********************** RELOCATION DIRECTIVES **********************/
00184 
00185 struct external_reloc
00186 {
00187   char r_vaddr[4];
00188   char r_symndx[4];
00189   char r_type[2];
00190   char r_offset[2];
00191 };
00192 
00193 #define RELOC struct external_reloc
00194 #define RELSZ  12
00195 
00196 #define NO_TVNDX