Commit | Line | Data |
---|---|---|
4f1d9bd8 NC |
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 | |
e172dbf8 | 17 | Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ |
4f1d9bd8 NC |
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" | |
252b5132 RH |
24 | |
25 | #define MC88MAGIC 0540 /* 88k BCS executable */ | |
26 | #define MC88DMAGIC 0541 /* DG/UX executable */ | |
27 | #define MC88OMAGIC 0555 /* Object file */ | |
28 | ||
4f1d9bd8 NC |
29 | #define MC88BADMAG(x) (((x).f_magic != MC88MAGIC) \ |
30 | && ((x).f_magic != MC88DMAGIC) \ | |
31 | && ((x).f_magic != MC88OMAGIC)) | |
252b5132 | 32 | |
4f1d9bd8 | 33 | #define PAGEMAGIC3 0414 /* Split i&d, zero mapped */ |
252b5132 RH |
34 | #define PAGEMAGICBCS 0413 |
35 | ||
252b5132 RH |
36 | /********************** SECTION HEADER **********************/ |
37 | ||
252b5132 RH |
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 | ||
252b5132 RH |
52 | #define SCNHDR struct external_scnhdr |
53 | #define SCNHSZ 44 | |
54 | ||
4f1d9bd8 | 55 | /* Names of "special" sections. */ |
252b5132 RH |
56 | #define _TEXT ".text" |
57 | #define _DATA ".data" | |
58 | #define _BSS ".bss" | |
59 | #define _COMMENT ".comment" | |
60 | ||
252b5132 RH |
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 | { | |
4f1d9bd8 NC |
70 | union |
71 | { | |
252b5132 | 72 | char e_name[E_SYMNMLEN]; |
4f1d9bd8 NC |
73 | |
74 | struct | |
75 | { | |
252b5132 RH |
76 | char e_zeroes[4]; |
77 | char e_offset[4]; | |
78 | } e; | |
4f1d9bd8 | 79 | |
252b5132 | 80 | } e; |
4f1d9bd8 | 81 | |
252b5132 RH |
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 | ||
252b5132 RH |
90 | #define N_BTMASK 017 |
91 | #define N_TMASK 060 | |
92 | #define N_BTSHFT 4 | |
93 | #define N_TSHIFT 2 | |
94 | ||
252b5132 | 95 | /* Note that this isn't the same shape as other coffs */ |
4f1d9bd8 NC |
96 | union external_auxent |
97 | { | |
98 | struct | |
99 | { | |
252b5132 RH |
100 | char x_tagndx[4]; /* str, un, or enum tag indx */ |
101 | /* 4 */ | |
4f1d9bd8 NC |
102 | |
103 | union | |
104 | { | |
252b5132 | 105 | char x_fsize[4]; /* size of function */ |
4f1d9bd8 NC |
106 | |
107 | struct | |
108 | { | |
252b5132 RH |
109 | char x_lnno[4]; /* declaration line number */ |
110 | char x_size[4]; /* str/union/array size */ | |
111 | } x_lnsz; | |
4f1d9bd8 | 112 | |
252b5132 RH |
113 | } x_misc; |
114 | ||
115 | /* 12 */ | |
4f1d9bd8 NC |
116 | union |
117 | { | |
118 | struct /* if ISFCN, tag, or .bb */ | |
119 | { | |
252b5132 RH |
120 | char x_lnnoptr[4]; /* ptr to fcn line # */ |
121 | char x_endndx[4]; /* entry ndx past block end */ | |
122 | } x_fcn; | |
4f1d9bd8 NC |
123 | |
124 | struct /* if ISARY, up to 4 dimen. */ | |
125 | { | |
252b5132 RH |
126 | char x_dimen[E_DIMNUM][2]; |
127 | } x_ary; | |
4f1d9bd8 | 128 | |
252b5132 RH |
129 | } x_fcnary; |
130 | /* 20 */ | |
131 | ||
132 | } x_sym; | |
133 | ||
4f1d9bd8 NC |
134 | union |
135 | { | |
252b5132 | 136 | char x_fname[E_FILNMLEN]; |
4f1d9bd8 NC |
137 | |
138 | struct | |
139 | { | |
252b5132 RH |
140 | char x_zeroes[4]; |
141 | char x_offset[4]; | |
142 | } x_n; | |
4f1d9bd8 | 143 | |
252b5132 RH |
144 | } x_file; |
145 | ||
4f1d9bd8 NC |
146 | struct |
147 | { | |
252b5132 RH |
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 | ||
4f1d9bd8 NC |
153 | struct |
154 | { | |
252b5132 RH |
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)) */ | |
252b5132 RH |
159 | }; |
160 | ||
2eda3bbc AM |
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) | |
252b5132 | 177 | |
252b5132 RH |
178 | #define SYMENT struct external_syment |
179 | #define SYMESZ 20 | |
180 | #define AUXENT union external_auxent | |
181 | #define AUXESZ 20 | |
182 | ||
252b5132 RH |
183 | /********************** RELOCATION DIRECTIVES **********************/ |
184 | ||
4f1d9bd8 NC |
185 | struct external_reloc |
186 | { | |
252b5132 RH |
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 |