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