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