Home | History | Annotate | Download | only in coff
      1 /* coff information for 88k bcs
      2 
      3    Copyright (C) 2001-2014 Free Software Foundation, Inc.
      4 
      5    This program is free software; you can redistribute it and/or modify
      6    it under the terms of the GNU General Public License as published by
      7    the Free Software Foundation; either version 3 of the License, or
      8    (at your option) any later version.
      9 
     10    This program is distributed in the hope that it will be useful,
     11    but WITHOUT ANY WARRANTY; without even the implied warranty of
     12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     13    GNU General Public License for more details.
     14 
     15    You should have received a copy of the GNU General Public License
     16    along with this program; if not, write to the Free Software
     17    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
     18    MA 02110-1301, USA.  */
     19 
     20 #define DO_NOT_DEFINE_SCNHDR
     21 #define L_LNNO_SIZE 4
     22 #define DO_NOT_DEFINE_SYMENT
     23 #define DO_NOT_DEFINE_AUXENT
     24 #include "coff/external.h"
     25 
     26 #define MC88MAGIC  0540           /* 88k BCS executable */
     27 #define MC88DMAGIC 0541           /* DG/UX executable   */
     28 #define MC88OMAGIC 0555	          /* Object file        */
     29 
     30 #define MC88BADMAG(x) (((x).f_magic != MC88MAGIC) \
     31                     && ((x).f_magic != MC88DMAGIC) \
     32                     && ((x).f_magic != MC88OMAGIC))
     33 
     34 #define PAGEMAGIC3   0414 /* Split i&d, zero mapped */
     35 #define PAGEMAGICBCS 0413
     36 
     37 /********************** SECTION HEADER **********************/
     38 
     39 struct external_scnhdr
     40 {
     41   char		s_name[8];	/* section name			*/
     42   char		s_paddr[4];	/* physical address, aliased s_nlib */
     43   char		s_vaddr[4];	/* virtual address		*/
     44   char		s_size[4];	/* section size			*/
     45   char		s_scnptr[4];	/* file ptr to raw data for section */
     46   char		s_relptr[4];	/* file ptr to relocation	*/
     47   char		s_lnnoptr[4];	/* file ptr to line numbers	*/
     48   char		s_nreloc[4];	/* number of relocation entries	*/
     49   char		s_nlnno[4];	/* number of line number entries*/
     50   char		s_flags[4];	/* flags			*/
     51 };
     52 
     53 #define	SCNHDR	struct external_scnhdr
     54 #define	SCNHSZ	44
     55 
     56 /* Names of "special" sections.  */
     57 #define _TEXT   ".text"
     58 #define _DATA   ".data"
     59 #define _BSS    ".bss"
     60 #define _COMMENT ".comment"
     61 
     62 
     63 /********************** SYMBOLS **********************/
     64 
     65 #define E_SYMNMLEN	8	/* # characters in a symbol name	*/
     66 #define E_FILNMLEN	14	/* # characters in a file name		*/
     67 #define E_DIMNUM	4	/* # array dimensions in auxiliary entry */
     68 
     69 struct external_syment
     70 {
     71   union
     72   {
     73     char e_name[E_SYMNMLEN];
     74 
     75     struct
     76     {
     77       char e_zeroes[4];
     78       char e_offset[4];
     79     } e;
     80 
     81   } e;
     82 
     83   char e_value[4];
     84   char e_scnum[2];
     85   char e_type[2];
     86   char e_sclass[1];
     87   char e_numaux[1];
     88   char pad2[2];
     89 };
     90 
     91 #define N_BTMASK	017
     92 #define N_TMASK		060
     93 #define N_BTSHFT	4
     94 #define N_TSHIFT	2
     95 
     96 /* Note that this isn't the same shape as other coffs */
     97 union external_auxent
     98 {
     99   struct
    100   {
    101     char x_tagndx[4];		/* str, un, or enum tag indx */
    102     /* 4 */
    103 
    104     union
    105     {
    106       char x_fsize[4];		/* size of function */
    107 
    108       struct
    109       {
    110 	char  x_lnno[4];	/* declaration line number */
    111 	char  x_size[4];	/* str/union/array size */
    112       } x_lnsz;
    113 
    114     } x_misc;
    115 
    116     /* 12 */
    117     union
    118     {
    119       struct 			/* if ISFCN, tag, or .bb */
    120       {
    121 	char x_lnnoptr[4];	/* ptr to fcn line # */
    122 	char x_endndx[4];		/* entry ndx past block end */
    123       } x_fcn;
    124 
    125       struct 			/* if ISARY, up to 4 dimen. */
    126       {
    127 	char x_dimen[E_DIMNUM][2];
    128       } x_ary;
    129 
    130     } x_fcnary;
    131     /* 20 */
    132 
    133   } x_sym;
    134 
    135   union
    136   {
    137     char x_fname[E_FILNMLEN];
    138 
    139     struct
    140     {
    141       char x_zeroes[4];
    142       char x_offset[4];
    143     } x_n;
    144 
    145   } x_file;
    146 
    147   struct
    148   {
    149     char x_scnlen[4];		/* section length */
    150     char x_nreloc[4];		/* # relocation entries */
    151     char x_nlinno[4];		/* # line numbers */
    152   } x_scn;
    153 
    154   struct
    155   {
    156     char x_tvfill[4];		/* tv fill value */
    157     char x_tvlen[2];		/* length of .tv */
    158     char x_tvran[2][2];		/* tv range */
    159   } x_tv;			/* info about .tv section (in auxent of symbol .tv)) */
    160 };
    161 
    162 #define GET_LNSZ_SIZE(abfd, ext) \
    163   H_GET_32 (abfd, ext->x_sym.x_misc.x_lnsz.x_size)
    164 #define GET_LNSZ_LNNO(abfd, ext) \
    165   H_GET_32 (abfd, ext->x_sym.x_misc.x_lnsz.x_lnno)
    166 #define PUT_LNSZ_LNNO(abfd, in, ext) \
    167   H_PUT_32 (abfd, in, ext->x_sym.x_misc.x_lnsz.x_lnno)
    168 #define PUT_LNSZ_SIZE(abfd, in, ext) \
    169   H_PUT_32 (abfd, in, ext->x_sym.x_misc.x_lnsz.x_size)
    170 #define GET_SCN_NRELOC(abfd, ext) \
    171   H_GET_32 (abfd, ext->x_scn.x_nreloc)
    172 #define GET_SCN_NLINNO(abfd, ext) \
    173   H_GET_32 (abfd, ext->x_scn.x_nlinno)
    174 #define PUT_SCN_NRELOC(abfd, in, ext) \
    175   H_PUT_32 (abfd, in, ext->x_scn.x_nreloc)
    176 #define PUT_SCN_NLINNO(abfd, in, ext) \
    177   H_PUT_32 (abfd,in, ext->x_scn.x_nlinno)
    178 
    179 #define	SYMENT	struct external_syment
    180 #define	SYMESZ	20
    181 #define	AUXENT	union external_auxent
    182 #define	AUXESZ	20
    183 
    184 /********************** RELOCATION DIRECTIVES **********************/
    185 
    186 struct external_reloc
    187 {
    188   char r_vaddr[4];
    189   char r_symndx[4];
    190   char r_type[2];
    191   char r_offset[2];
    192 };
    193 
    194 #define RELOC struct external_reloc
    195 #define RELSZ  12
    196 
    197 #define NO_TVNDX
    198