Commit | Line | Data |
---|---|---|
4a8db330 | 1 | /* BFD support to byte-swap a symbol table in MIPS (Third-Eye, `ecoff') format. |
246ccf5f JG |
2 | Copyright 1992 Free Software Foundation, Inc. |
3 | ||
4 | This file is part of BFD, the Binary File Descriptor library. | |
5 | ||
6 | This program is free software; you can redistribute it and/or modify | |
7 | it under the terms of the GNU General Public License as published by | |
8 | the Free Software Foundation; either version 2 of the License, or | |
9 | (at your option) any later version. | |
10 | ||
11 | This program is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | GNU General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
17 | along with this program; if not, write to the Free Software | |
18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
19 | ||
8fa0d3a0 | 20 | /* The routines in this file convert the external representation of |
246ccf5f JG |
21 | ECOFF symbol tables to the internal (usual struct) representation. |
22 | On a machine with the same byte-order and the same basic type | |
23 | sizes and alignments as a MIPS machine, this is a no-op. | |
24 | If the symbol TEST is defined when this file is compiled, a comparison | |
25 | is made to ensure that, in fact, the output is bit-for-bit the same as | |
26 | the input. Of course, this symbol should only be defined when | |
27 | deliberately testing the code on a machine with the proper byte sex | |
28 | and such. */ | |
29 | ||
30 | #include "bfd.h" | |
79a6ce4f JG |
31 | #include "coff/sym.h" /* MIPS symbols */ |
32 | #include "coff/symconst.h" /* MIPS symbols */ | |
246ccf5f JG |
33 | #include "coff/ecoff-ext.h" /* ECOFF external struct defns */ |
34 | ||
8fa0d3a0 ILT |
35 | /* Swap in the symbolic header. */ |
36 | ||
246ccf5f | 37 | void |
515c4292 ILT |
38 | DEFUN (ecoff_swap_hdr_in, (abfd, ext_copy, intern), |
39 | bfd *abfd AND | |
40 | struct hdr_ext *ext_copy AND | |
41 | HDRR *intern) | |
246ccf5f JG |
42 | { |
43 | struct hdr_ext ext[1]; | |
44 | ||
45 | *ext = *ext_copy; | |
46 | ||
47 | intern->magic = bfd_h_get_16 (abfd, (bfd_byte *)ext->h_magic); | |
48 | intern->vstamp = bfd_h_get_16 (abfd, (bfd_byte *)ext->h_vstamp); | |
49 | intern->ilineMax = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_ilineMax); | |
50 | intern->cbLine = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_cbLine); | |
51 | intern->cbLineOffset = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_cbLineOffset); | |
52 | intern->idnMax = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_idnMax); | |
53 | intern->cbDnOffset = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_cbDnOffset); | |
54 | intern->ipdMax = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_ipdMax); | |
55 | intern->cbPdOffset = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_cbPdOffset); | |
56 | intern->isymMax = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_isymMax); | |
57 | intern->cbSymOffset = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_cbSymOffset); | |
58 | intern->ioptMax = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_ioptMax); | |
59 | intern->cbOptOffset = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_cbOptOffset); | |
60 | intern->iauxMax = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_iauxMax); | |
61 | intern->cbAuxOffset = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_cbAuxOffset); | |
62 | intern->issMax = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_issMax); | |
63 | intern->cbSsOffset = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_cbSsOffset); | |
64 | intern->issExtMax = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_issExtMax); | |
65 | intern->cbSsExtOffset = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_cbSsExtOffset); | |
66 | intern->ifdMax = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_ifdMax); | |
67 | intern->cbFdOffset = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_cbFdOffset); | |
68 | intern->crfd = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_crfd); | |
69 | intern->cbRfdOffset = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_cbRfdOffset); | |
70 | intern->iextMax = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_iextMax); | |
71 | intern->cbExtOffset = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_cbExtOffset); | |
72 | ||
73 | #ifdef TEST | |
74 | if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) | |
75 | abort(); | |
76 | #endif | |
77 | } | |
78 | ||
8fa0d3a0 ILT |
79 | /* Swap out the symbolic header. */ |
80 | ||
81 | void | |
82 | DEFUN (ecoff_swap_hdr_out, (abfd, intern_copy, ext), | |
83 | bfd *abfd AND | |
84 | HDRR *intern_copy AND | |
85 | struct hdr_ext *ext) | |
86 | { | |
87 | HDRR intern[1]; | |
88 | ||
89 | *intern = *intern_copy; | |
90 | ||
91 | bfd_h_put_16 (abfd, intern->magic, (bfd_byte *)ext->h_magic); | |
92 | bfd_h_put_16 (abfd, intern->vstamp, (bfd_byte *)ext->h_vstamp); | |
93 | bfd_h_put_32 (abfd, intern->ilineMax, (bfd_byte *)ext->h_ilineMax); | |
94 | bfd_h_put_32 (abfd, intern->cbLine, (bfd_byte *)ext->h_cbLine); | |
95 | bfd_h_put_32 (abfd, intern->cbLineOffset, (bfd_byte *)ext->h_cbLineOffset); | |
96 | bfd_h_put_32 (abfd, intern->idnMax, (bfd_byte *)ext->h_idnMax); | |
97 | bfd_h_put_32 (abfd, intern->cbDnOffset, (bfd_byte *)ext->h_cbDnOffset); | |
98 | bfd_h_put_32 (abfd, intern->ipdMax, (bfd_byte *)ext->h_ipdMax); | |
99 | bfd_h_put_32 (abfd, intern->cbPdOffset, (bfd_byte *)ext->h_cbPdOffset); | |
100 | bfd_h_put_32 (abfd, intern->isymMax, (bfd_byte *)ext->h_isymMax); | |
101 | bfd_h_put_32 (abfd, intern->cbSymOffset, (bfd_byte *)ext->h_cbSymOffset); | |
102 | bfd_h_put_32 (abfd, intern->ioptMax, (bfd_byte *)ext->h_ioptMax); | |
103 | bfd_h_put_32 (abfd, intern->cbOptOffset, (bfd_byte *)ext->h_cbOptOffset); | |
104 | bfd_h_put_32 (abfd, intern->iauxMax, (bfd_byte *)ext->h_iauxMax); | |
105 | bfd_h_put_32 (abfd, intern->cbAuxOffset, (bfd_byte *)ext->h_cbAuxOffset); | |
106 | bfd_h_put_32 (abfd, intern->issMax, (bfd_byte *)ext->h_issMax); | |
107 | bfd_h_put_32 (abfd, intern->cbSsOffset, (bfd_byte *)ext->h_cbSsOffset); | |
108 | bfd_h_put_32 (abfd, intern->issExtMax, (bfd_byte *)ext->h_issExtMax); | |
109 | bfd_h_put_32 (abfd, intern->cbSsExtOffset, (bfd_byte *)ext->h_cbSsExtOffset); | |
110 | bfd_h_put_32 (abfd, intern->ifdMax, (bfd_byte *)ext->h_ifdMax); | |
111 | bfd_h_put_32 (abfd, intern->cbFdOffset, (bfd_byte *)ext->h_cbFdOffset); | |
112 | bfd_h_put_32 (abfd, intern->crfd, (bfd_byte *)ext->h_crfd); | |
113 | bfd_h_put_32 (abfd, intern->cbRfdOffset, (bfd_byte *)ext->h_cbRfdOffset); | |
114 | bfd_h_put_32 (abfd, intern->iextMax, (bfd_byte *)ext->h_iextMax); | |
115 | bfd_h_put_32 (abfd, intern->cbExtOffset, (bfd_byte *)ext->h_cbExtOffset); | |
116 | ||
117 | #ifdef TEST | |
118 | if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) | |
119 | abort(); | |
120 | #endif | |
121 | } | |
122 | ||
246ccf5f JG |
123 | /* Swap in the file descriptor record. */ |
124 | ||
125 | void | |
515c4292 ILT |
126 | DEFUN (ecoff_swap_fdr_in, (abfd, ext_copy, intern), |
127 | bfd *abfd AND | |
128 | struct fdr_ext *ext_copy AND | |
129 | FDR *intern) | |
246ccf5f JG |
130 | { |
131 | struct fdr_ext ext[1]; | |
132 | ||
133 | *ext = *ext_copy; /* Make it reasonable to do in-place. */ | |
134 | ||
135 | intern->adr = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_adr); | |
136 | intern->rss = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_rss); | |
137 | intern->issBase = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_issBase); | |
138 | intern->cbSs = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_cbSs); | |
139 | intern->isymBase = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_isymBase); | |
140 | intern->csym = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_csym); | |
141 | intern->ilineBase = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_ilineBase); | |
142 | intern->cline = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_cline); | |
143 | intern->ioptBase = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_ioptBase); | |
144 | intern->copt = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_copt); | |
145 | intern->ipdFirst = bfd_h_get_16 (abfd, (bfd_byte *)ext->f_ipdFirst); | |
146 | intern->cpd = bfd_h_get_16 (abfd, (bfd_byte *)ext->f_cpd); | |
147 | intern->iauxBase = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_iauxBase); | |
148 | intern->caux = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_caux); | |
149 | intern->rfdBase = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_rfdBase); | |
150 | intern->crfd = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_crfd); | |
151 | ||
152 | /* now the fun stuff... */ | |
153 | if (abfd->xvec->header_byteorder_big_p != false) { | |
154 | intern->lang = (ext->f_bits1[0] & FDR_BITS1_LANG_BIG) | |
155 | >> FDR_BITS1_LANG_SH_BIG; | |
156 | intern->fMerge = 0 != (ext->f_bits1[0] & FDR_BITS1_FMERGE_BIG); | |
157 | intern->fReadin = 0 != (ext->f_bits1[0] & FDR_BITS1_FREADIN_BIG); | |
158 | intern->fBigendian = 0 != (ext->f_bits1[0] & FDR_BITS1_FBIGENDIAN_BIG); | |
159 | intern->glevel = (ext->f_bits2[0] & FDR_BITS2_GLEVEL_BIG) | |
160 | >> FDR_BITS2_GLEVEL_SH_BIG; | |
246ccf5f JG |
161 | } else { |
162 | intern->lang = (ext->f_bits1[0] & FDR_BITS1_LANG_LITTLE) | |
163 | >> FDR_BITS1_LANG_SH_LITTLE; | |
164 | intern->fMerge = 0 != (ext->f_bits1[0] & FDR_BITS1_FMERGE_LITTLE); | |
165 | intern->fReadin = 0 != (ext->f_bits1[0] & FDR_BITS1_FREADIN_LITTLE); | |
166 | intern->fBigendian = 0 != (ext->f_bits1[0] & FDR_BITS1_FBIGENDIAN_LITTLE); | |
167 | intern->glevel = (ext->f_bits2[0] & FDR_BITS2_GLEVEL_LITTLE) | |
168 | >> FDR_BITS2_GLEVEL_SH_LITTLE; | |
246ccf5f | 169 | } |
63fd1097 | 170 | intern->reserved = 0; |
246ccf5f JG |
171 | |
172 | intern->cbLineOffset = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_cbLineOffset); | |
173 | intern->cbLine = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_cbLine); | |
174 | ||
175 | #ifdef TEST | |
176 | if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) | |
177 | abort(); | |
178 | #endif | |
179 | } | |
180 | ||
8fa0d3a0 ILT |
181 | /* Swap out the file descriptor record. */ |
182 | ||
183 | void | |
184 | DEFUN (ecoff_swap_fdr_out, (abfd, intern_copy, ext), | |
185 | bfd *abfd AND | |
186 | FDR *intern_copy AND | |
187 | struct fdr_ext *ext) | |
188 | { | |
189 | FDR intern[1]; | |
190 | ||
191 | *intern = *intern_copy; /* Make it reasonable to do in-place. */ | |
192 | ||
193 | bfd_h_put_32 (abfd, intern->adr, (bfd_byte *)ext->f_adr); | |
194 | bfd_h_put_32 (abfd, intern->rss, (bfd_byte *)ext->f_rss); | |
195 | bfd_h_put_32 (abfd, intern->issBase, (bfd_byte *)ext->f_issBase); | |
196 | bfd_h_put_32 (abfd, intern->cbSs, (bfd_byte *)ext->f_cbSs); | |
197 | bfd_h_put_32 (abfd, intern->isymBase, (bfd_byte *)ext->f_isymBase); | |
198 | bfd_h_put_32 (abfd, intern->csym, (bfd_byte *)ext->f_csym); | |
199 | bfd_h_put_32 (abfd, intern->ilineBase, (bfd_byte *)ext->f_ilineBase); | |
200 | bfd_h_put_32 (abfd, intern->cline, (bfd_byte *)ext->f_cline); | |
201 | bfd_h_put_32 (abfd, intern->ioptBase, (bfd_byte *)ext->f_ioptBase); | |
202 | bfd_h_put_32 (abfd, intern->copt, (bfd_byte *)ext->f_copt); | |
203 | bfd_h_put_16 (abfd, intern->ipdFirst, (bfd_byte *)ext->f_ipdFirst); | |
204 | bfd_h_put_16 (abfd, intern->cpd, (bfd_byte *)ext->f_cpd); | |
205 | bfd_h_put_32 (abfd, intern->iauxBase, (bfd_byte *)ext->f_iauxBase); | |
206 | bfd_h_put_32 (abfd, intern->caux, (bfd_byte *)ext->f_caux); | |
207 | bfd_h_put_32 (abfd, intern->rfdBase, (bfd_byte *)ext->f_rfdBase); | |
208 | bfd_h_put_32 (abfd, intern->crfd, (bfd_byte *)ext->f_crfd); | |
209 | ||
210 | /* now the fun stuff... */ | |
211 | if (abfd->xvec->header_byteorder_big_p != false) { | |
212 | ext->f_bits1[0] = (((intern->lang << FDR_BITS1_LANG_SH_BIG) | |
213 | & FDR_BITS1_LANG_BIG) | |
214 | | (intern->fMerge ? FDR_BITS1_FMERGE_BIG : 0) | |
215 | | (intern->fReadin ? FDR_BITS1_FREADIN_BIG : 0) | |
216 | | (intern->fBigendian ? FDR_BITS1_FBIGENDIAN_BIG : 0)); | |
217 | ext->f_bits2[0] = ((intern->glevel << FDR_BITS2_GLEVEL_SH_BIG) | |
218 | & FDR_BITS2_GLEVEL_BIG); | |
219 | ext->f_bits2[1] = 0; | |
220 | ext->f_bits2[2] = 0; | |
221 | } else { | |
222 | ext->f_bits1[0] = (((intern->lang << FDR_BITS1_LANG_SH_LITTLE) | |
223 | & FDR_BITS1_LANG_LITTLE) | |
224 | | (intern->fMerge ? FDR_BITS1_FMERGE_LITTLE : 0) | |
225 | | (intern->fReadin ? FDR_BITS1_FREADIN_LITTLE : 0) | |
226 | | (intern->fBigendian ? FDR_BITS1_FBIGENDIAN_LITTLE : 0)); | |
227 | ext->f_bits2[0] = ((intern->glevel << FDR_BITS2_GLEVEL_SH_LITTLE) | |
228 | & FDR_BITS2_GLEVEL_LITTLE); | |
229 | ext->f_bits2[1] = 0; | |
230 | ext->f_bits2[2] = 0; | |
231 | } | |
232 | ||
233 | bfd_h_put_32 (abfd, intern->cbLineOffset, (bfd_byte *)ext->f_cbLineOffset); | |
234 | bfd_h_put_32 (abfd, intern->cbLine, (bfd_byte *)ext->f_cbLine); | |
246ccf5f | 235 | |
8fa0d3a0 ILT |
236 | #ifdef TEST |
237 | if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) | |
238 | abort(); | |
239 | #endif | |
240 | } | |
246ccf5f JG |
241 | |
242 | /* Swap in the procedure descriptor record. */ | |
243 | ||
244 | void | |
515c4292 ILT |
245 | DEFUN (ecoff_swap_pdr_in, (abfd, ext_copy, intern), |
246 | bfd *abfd AND | |
247 | struct pdr_ext *ext_copy AND | |
248 | PDR *intern) | |
246ccf5f JG |
249 | { |
250 | struct pdr_ext ext[1]; | |
251 | ||
252 | *ext = *ext_copy; /* Make it reasonable to do in-place. */ | |
253 | ||
254 | intern->adr = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_adr); | |
255 | intern->isym = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_isym); | |
256 | intern->iline = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_iline); | |
257 | intern->regmask = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_regmask); | |
258 | intern->regoffset = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_regoffset); | |
259 | intern->iopt = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_iopt); | |
260 | intern->fregmask = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_fregmask); | |
261 | intern->fregoffset = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_fregoffset); | |
262 | intern->frameoffset = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_frameoffset); | |
263 | intern->framereg = bfd_h_get_16 (abfd, (bfd_byte *)ext->p_framereg); | |
264 | intern->pcreg = bfd_h_get_16 (abfd, (bfd_byte *)ext->p_pcreg); | |
265 | intern->lnLow = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_lnLow); | |
266 | intern->lnHigh = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_lnHigh); | |
267 | intern->cbLineOffset = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_cbLineOffset); | |
268 | ||
269 | #ifdef TEST | |
270 | if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) | |
271 | abort(); | |
272 | #endif | |
273 | } | |
274 | ||
8fa0d3a0 ILT |
275 | /* Swap out the procedure descriptor record. */ |
276 | ||
277 | void | |
278 | DEFUN (ecoff_swap_pdr_out, (abfd, intern_copy, ext), | |
279 | bfd *abfd AND | |
280 | PDR *intern_copy AND | |
281 | struct pdr_ext *ext) | |
282 | { | |
283 | PDR intern[1]; | |
284 | ||
285 | *intern = *intern_copy; /* Make it reasonable to do in-place. */ | |
286 | ||
287 | bfd_h_put_32 (abfd, intern->adr, (bfd_byte *)ext->p_adr); | |
288 | bfd_h_put_32 (abfd, intern->isym, (bfd_byte *)ext->p_isym); | |
289 | bfd_h_put_32 (abfd, intern->iline, (bfd_byte *)ext->p_iline); | |
290 | bfd_h_put_32 (abfd, intern->regmask, (bfd_byte *)ext->p_regmask); | |
291 | bfd_h_put_32 (abfd, intern->regoffset, (bfd_byte *)ext->p_regoffset); | |
292 | bfd_h_put_32 (abfd, intern->iopt, (bfd_byte *)ext->p_iopt); | |
293 | bfd_h_put_32 (abfd, intern->fregmask, (bfd_byte *)ext->p_fregmask); | |
294 | bfd_h_put_32 (abfd, intern->fregoffset, (bfd_byte *)ext->p_fregoffset); | |
295 | bfd_h_put_32 (abfd, intern->frameoffset, (bfd_byte *)ext->p_frameoffset); | |
296 | bfd_h_put_16 (abfd, intern->framereg, (bfd_byte *)ext->p_framereg); | |
297 | bfd_h_put_16 (abfd, intern->pcreg, (bfd_byte *)ext->p_pcreg); | |
298 | bfd_h_put_32 (abfd, intern->lnLow, (bfd_byte *)ext->p_lnLow); | |
299 | bfd_h_put_32 (abfd, intern->lnHigh, (bfd_byte *)ext->p_lnHigh); | |
300 | bfd_h_put_32 (abfd, intern->cbLineOffset, (bfd_byte *)ext->p_cbLineOffset); | |
301 | ||
302 | #ifdef TEST | |
303 | if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) | |
304 | abort(); | |
305 | #endif | |
306 | } | |
246ccf5f JG |
307 | |
308 | /* Swap in a symbol record. */ | |
309 | ||
310 | void | |
515c4292 ILT |
311 | DEFUN (ecoff_swap_sym_in, (abfd, ext_copy, intern), |
312 | bfd *abfd AND | |
313 | struct sym_ext *ext_copy AND | |
314 | SYMR *intern) | |
246ccf5f JG |
315 | { |
316 | struct sym_ext ext[1]; | |
317 | ||
318 | *ext = *ext_copy; /* Make it reasonable to do in-place. */ | |
319 | ||
320 | intern->iss = bfd_h_get_32 (abfd, (bfd_byte *)ext->s_iss); | |
321 | intern->value = bfd_h_get_32 (abfd, (bfd_byte *)ext->s_value); | |
322 | ||
323 | /* now the fun stuff... */ | |
324 | if (abfd->xvec->header_byteorder_big_p != false) { | |
325 | intern->st = (ext->s_bits1[0] & SYM_BITS1_ST_BIG) | |
326 | >> SYM_BITS1_ST_SH_BIG; | |
327 | intern->sc = ((ext->s_bits1[0] & SYM_BITS1_SC_BIG) | |
328 | << SYM_BITS1_SC_SH_LEFT_BIG) | |
329 | | ((ext->s_bits2[0] & SYM_BITS2_SC_BIG) | |
330 | >> SYM_BITS2_SC_SH_BIG); | |
331 | intern->reserved = 0 != (ext->s_bits2[0] & SYM_BITS2_RESERVED_BIG); | |
dcf5ddb8 | 332 | intern->index = ((ext->s_bits2[0] & SYM_BITS2_INDEX_BIG) |
246ccf5f | 333 | << SYM_BITS2_INDEX_SH_LEFT_BIG) |
dcf5ddb8 ILT |
334 | | (ext->s_bits3[0] << SYM_BITS3_INDEX_SH_LEFT_BIG) |
335 | | (ext->s_bits4[0] << SYM_BITS4_INDEX_SH_LEFT_BIG); | |
246ccf5f JG |
336 | } else { |
337 | intern->st = (ext->s_bits1[0] & SYM_BITS1_ST_LITTLE) | |
338 | >> SYM_BITS1_ST_SH_LITTLE; | |
339 | intern->sc = ((ext->s_bits1[0] & SYM_BITS1_SC_LITTLE) | |
340 | >> SYM_BITS1_SC_SH_LITTLE) | |
341 | | ((ext->s_bits2[0] & SYM_BITS2_SC_LITTLE) | |
342 | << SYM_BITS2_SC_SH_LEFT_LITTLE); | |
343 | intern->reserved = 0 != (ext->s_bits2[0] & SYM_BITS2_RESERVED_LITTLE); | |
dcf5ddb8 | 344 | intern->index = ((ext->s_bits2[0] & SYM_BITS2_INDEX_LITTLE) |
246ccf5f | 345 | >> SYM_BITS2_INDEX_SH_LITTLE) |
dcf5ddb8 ILT |
346 | | (ext->s_bits3[0] << SYM_BITS3_INDEX_SH_LEFT_LITTLE) |
347 | | (ext->s_bits4[0] << SYM_BITS4_INDEX_SH_LEFT_LITTLE); | |
246ccf5f JG |
348 | } |
349 | ||
350 | #ifdef TEST | |
351 | if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) | |
352 | abort(); | |
353 | #endif | |
354 | } | |
355 | ||
8fa0d3a0 ILT |
356 | /* Swap out a symbol record. */ |
357 | ||
358 | void | |
359 | DEFUN (ecoff_swap_sym_out, (abfd, intern_copy, ext), | |
360 | bfd *abfd AND | |
361 | SYMR *intern_copy AND | |
362 | struct sym_ext *ext) | |
363 | { | |
364 | SYMR intern[1]; | |
365 | ||
366 | *intern = *intern_copy; /* Make it reasonable to do in-place. */ | |
367 | ||
368 | bfd_h_put_32 (abfd, intern->iss, (bfd_byte *)ext->s_iss); | |
369 | bfd_h_put_32 (abfd, intern->value, (bfd_byte *)ext->s_value); | |
370 | ||
371 | /* now the fun stuff... */ | |
372 | if (abfd->xvec->header_byteorder_big_p != false) { | |
373 | ext->s_bits1[0] = (((intern->st << SYM_BITS1_ST_SH_BIG) | |
374 | & SYM_BITS1_ST_BIG) | |
375 | | ((intern->sc >> SYM_BITS1_SC_SH_LEFT_BIG) | |
376 | & SYM_BITS1_SC_BIG)); | |
377 | ext->s_bits2[0] = (((intern->sc << SYM_BITS2_SC_SH_BIG) | |
378 | & SYM_BITS2_SC_BIG) | |
379 | | (intern->reserved ? SYM_BITS2_RESERVED_BIG : 0) | |
380 | | ((intern->index >> SYM_BITS2_INDEX_SH_LEFT_BIG) | |
381 | & SYM_BITS2_INDEX_BIG)); | |
382 | ext->s_bits3[0] = (intern->index >> SYM_BITS3_INDEX_SH_LEFT_BIG) & 0xff; | |
383 | ext->s_bits4[0] = (intern->index >> SYM_BITS4_INDEX_SH_LEFT_BIG) & 0xff; | |
384 | } else { | |
385 | ext->s_bits1[0] = (((intern->st << SYM_BITS1_ST_SH_LITTLE) | |
386 | & SYM_BITS1_ST_LITTLE) | |
387 | | ((intern->sc << SYM_BITS1_SC_SH_LITTLE) | |
388 | & SYM_BITS1_SC_LITTLE)); | |
389 | ext->s_bits2[0] = (((intern->sc >> SYM_BITS2_SC_SH_LEFT_LITTLE) | |
390 | & SYM_BITS2_SC_LITTLE) | |
391 | | (intern->reserved ? SYM_BITS2_RESERVED_LITTLE : 0) | |
392 | | ((intern->index << SYM_BITS2_INDEX_SH_LITTLE) | |
393 | & SYM_BITS2_INDEX_LITTLE)); | |
394 | ext->s_bits3[0] = (intern->index >> SYM_BITS3_INDEX_SH_LEFT_LITTLE) & 0xff; | |
395 | ext->s_bits4[0] = (intern->index >> SYM_BITS4_INDEX_SH_LEFT_LITTLE) & 0xff; | |
396 | } | |
397 | ||
398 | #ifdef TEST | |
399 | if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) | |
400 | abort(); | |
401 | #endif | |
402 | } | |
246ccf5f JG |
403 | |
404 | /* Swap in an external symbol record. */ | |
405 | ||
406 | void | |
515c4292 ILT |
407 | DEFUN (ecoff_swap_ext_in, (abfd, ext_copy, intern), |
408 | bfd *abfd AND | |
409 | struct ext_ext *ext_copy AND | |
410 | EXTR *intern) | |
246ccf5f JG |
411 | { |
412 | struct ext_ext ext[1]; | |
413 | ||
414 | *ext = *ext_copy; /* Make it reasonable to do in-place. */ | |
415 | ||
416 | /* now the fun stuff... */ | |
417 | if (abfd->xvec->header_byteorder_big_p != false) { | |
418 | intern->jmptbl = 0 != (ext->es_bits1[0] & EXT_BITS1_JMPTBL_BIG); | |
419 | intern->cobol_main = 0 != (ext->es_bits1[0] & EXT_BITS1_COBOL_MAIN_BIG); | |
79a6ce4f | 420 | intern->weakext = 0 != (ext->es_bits1[0] & EXT_BITS1_WEAKEXT_BIG); |
246ccf5f JG |
421 | } else { |
422 | intern->jmptbl = 0 != (ext->es_bits1[0] & EXT_BITS1_JMPTBL_LITTLE); | |
423 | intern->cobol_main = 0 != (ext->es_bits1[0] & EXT_BITS1_COBOL_MAIN_LITTLE); | |
79a6ce4f | 424 | intern->weakext = 0 != (ext->es_bits1[0] & EXT_BITS1_WEAKEXT_LITTLE); |
246ccf5f | 425 | } |
63fd1097 | 426 | intern->reserved = 0; |
246ccf5f JG |
427 | |
428 | intern->ifd = bfd_h_get_16 (abfd, (bfd_byte *)ext->es_ifd); | |
429 | ecoff_swap_sym_in (abfd, &ext->es_asym, &intern->asym); | |
430 | ||
431 | #ifdef TEST | |
432 | if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) | |
433 | abort(); | |
434 | #endif | |
435 | } | |
436 | ||
8fa0d3a0 ILT |
437 | /* Swap out an external symbol record. */ |
438 | ||
439 | void | |
440 | DEFUN (ecoff_swap_ext_out, (abfd, intern_copy, ext), | |
441 | bfd *abfd AND | |
442 | EXTR *intern_copy AND | |
443 | struct ext_ext *ext) | |
444 | { | |
445 | EXTR intern[1]; | |
446 | ||
447 | *intern = *intern_copy; /* Make it reasonable to do in-place. */ | |
448 | ||
449 | /* now the fun stuff... */ | |
450 | if (abfd->xvec->header_byteorder_big_p != false) { | |
451 | ext->es_bits1[0] = ((intern->jmptbl ? EXT_BITS1_JMPTBL_BIG : 0) | |
452 | | (intern->cobol_main ? EXT_BITS1_COBOL_MAIN_BIG : 0) | |
453 | | (intern->weakext ? EXT_BITS1_WEAKEXT_BIG : 0)); | |
454 | ext->es_bits2[0] = 0; | |
455 | } else { | |
456 | ext->es_bits1[0] = ((intern->jmptbl ? EXT_BITS1_JMPTBL_LITTLE : 0) | |
457 | | (intern->cobol_main ? EXT_BITS1_COBOL_MAIN_LITTLE : 0) | |
458 | | (intern->weakext ? EXT_BITS1_WEAKEXT_LITTLE : 0)); | |
459 | ext->es_bits2[0] = 0; | |
460 | } | |
461 | ||
462 | bfd_h_put_16 (abfd, intern->ifd, (bfd_byte *)ext->es_ifd); | |
463 | ecoff_swap_sym_out (abfd, &intern->asym, &ext->es_asym); | |
464 | ||
465 | #ifdef TEST | |
466 | if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) | |
467 | abort(); | |
468 | #endif | |
469 | } | |
470 | ||
246ccf5f JG |
471 | /* Swap in a type information record. |
472 | BIGEND says whether AUX symbols are big-endian or little-endian; this | |
473 | info comes from the file header record (fh-fBigendian). */ | |
474 | ||
475 | void | |
515c4292 ILT |
476 | DEFUN (ecoff_swap_tir_in, (bigend, ext_copy, intern), |
477 | int bigend AND | |
478 | struct tir_ext *ext_copy AND | |
479 | TIR *intern) | |
246ccf5f JG |
480 | { |
481 | struct tir_ext ext[1]; | |
482 | ||
483 | *ext = *ext_copy; /* Make it reasonable to do in-place. */ | |
484 | ||
485 | /* now the fun stuff... */ | |
486 | if (bigend) { | |
487 | intern->fBitfield = 0 != (ext->t_bits1[0] & TIR_BITS1_FBITFIELD_BIG); | |
488 | intern->continued = 0 != (ext->t_bits1[0] & TIR_BITS1_CONTINUED_BIG); | |
489 | intern->bt = (ext->t_bits1[0] & TIR_BITS1_BT_BIG) | |
490 | >> TIR_BITS1_BT_SH_BIG; | |
491 | intern->tq4 = (ext->t_tq45[0] & TIR_BITS_TQ4_BIG) | |
492 | >> TIR_BITS_TQ4_SH_BIG; | |
493 | intern->tq5 = (ext->t_tq45[0] & TIR_BITS_TQ5_BIG) | |
494 | >> TIR_BITS_TQ5_SH_BIG; | |
495 | intern->tq0 = (ext->t_tq01[0] & TIR_BITS_TQ0_BIG) | |
496 | >> TIR_BITS_TQ0_SH_BIG; | |
497 | intern->tq1 = (ext->t_tq01[0] & TIR_BITS_TQ1_BIG) | |
498 | >> TIR_BITS_TQ1_SH_BIG; | |
499 | intern->tq2 = (ext->t_tq23[0] & TIR_BITS_TQ2_BIG) | |
500 | >> TIR_BITS_TQ2_SH_BIG; | |
501 | intern->tq3 = (ext->t_tq23[0] & TIR_BITS_TQ3_BIG) | |
502 | >> TIR_BITS_TQ3_SH_BIG; | |
503 | } else { | |
504 | intern->fBitfield = 0 != (ext->t_bits1[0] & TIR_BITS1_FBITFIELD_LITTLE); | |
505 | intern->continued = 0 != (ext->t_bits1[0] & TIR_BITS1_CONTINUED_LITTLE); | |
506 | intern->bt = (ext->t_bits1[0] & TIR_BITS1_BT_LITTLE) | |
507 | >> TIR_BITS1_BT_SH_LITTLE; | |
508 | intern->tq4 = (ext->t_tq45[0] & TIR_BITS_TQ4_LITTLE) | |
509 | >> TIR_BITS_TQ4_SH_LITTLE; | |
510 | intern->tq5 = (ext->t_tq45[0] & TIR_BITS_TQ5_LITTLE) | |
511 | >> TIR_BITS_TQ5_SH_LITTLE; | |
512 | intern->tq0 = (ext->t_tq01[0] & TIR_BITS_TQ0_LITTLE) | |
513 | >> TIR_BITS_TQ0_SH_LITTLE; | |
514 | intern->tq1 = (ext->t_tq01[0] & TIR_BITS_TQ1_LITTLE) | |
515 | >> TIR_BITS_TQ1_SH_LITTLE; | |
516 | intern->tq2 = (ext->t_tq23[0] & TIR_BITS_TQ2_LITTLE) | |
517 | >> TIR_BITS_TQ2_SH_LITTLE; | |
518 | intern->tq3 = (ext->t_tq23[0] & TIR_BITS_TQ3_LITTLE) | |
519 | >> TIR_BITS_TQ3_SH_LITTLE; | |
520 | } | |
521 | ||
522 | #ifdef TEST | |
523 | if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) | |
524 | abort(); | |
525 | #endif | |
526 | } | |
527 | ||
528 | /* Swap in a relative symbol record. BIGEND says whether it is in | |
529 | big-endian or little-endian format.*/ | |
530 | ||
531 | void | |
515c4292 ILT |
532 | DEFUN (ecoff_swap_rndx_in, (bigend, ext_copy, intern), |
533 | int bigend AND | |
534 | struct rndx_ext *ext_copy AND | |
535 | RNDXR *intern) | |
246ccf5f JG |
536 | { |
537 | struct rndx_ext ext[1]; | |
538 | ||
539 | *ext = *ext_copy; /* Make it reasonable to do in-place. */ | |
540 | ||
541 | /* now the fun stuff... */ | |
542 | if (bigend) { | |
543 | intern->rfd = (ext->r_bits[0] << RNDX_BITS0_RFD_SH_LEFT_BIG) | |
544 | | ((ext->r_bits[1] & RNDX_BITS1_RFD_BIG) | |
545 | >> RNDX_BITS1_RFD_SH_BIG); | |
dcf5ddb8 | 546 | intern->index = ((ext->r_bits[1] & RNDX_BITS1_INDEX_BIG) |
246ccf5f | 547 | << RNDX_BITS1_INDEX_SH_LEFT_BIG) |
dcf5ddb8 ILT |
548 | | (ext->r_bits[2] << RNDX_BITS2_INDEX_SH_LEFT_BIG) |
549 | | (ext->r_bits[3] << RNDX_BITS3_INDEX_SH_LEFT_BIG); | |
246ccf5f JG |
550 | } else { |
551 | intern->rfd = (ext->r_bits[0] << RNDX_BITS0_RFD_SH_LEFT_LITTLE) | |
552 | | ((ext->r_bits[1] & RNDX_BITS1_RFD_LITTLE) | |
553 | << RNDX_BITS1_RFD_SH_LEFT_LITTLE); | |
dcf5ddb8 | 554 | intern->index = ((ext->r_bits[1] & RNDX_BITS1_INDEX_LITTLE) |
246ccf5f | 555 | >> RNDX_BITS1_INDEX_SH_LITTLE) |
dcf5ddb8 ILT |
556 | | (ext->r_bits[2] << RNDX_BITS2_INDEX_SH_LEFT_LITTLE) |
557 | | (ext->r_bits[3] << RNDX_BITS3_INDEX_SH_LEFT_LITTLE); | |
246ccf5f JG |
558 | } |
559 | ||
560 | #ifdef TEST | |
561 | if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) | |
562 | abort(); | |
563 | #endif | |
564 | } | |
6dc77691 | 565 | |
8fa0d3a0 ILT |
566 | /* Swap out a relative symbol record. BIGEND says whether it is in |
567 | big-endian or little-endian format.*/ | |
568 | ||
569 | void | |
570 | DEFUN (ecoff_swap_rndx_out, (bigend, intern_copy, ext), | |
571 | int bigend AND | |
572 | RNDXR *intern_copy AND | |
573 | struct rndx_ext *ext) | |
574 | { | |
575 | RNDXR intern[1]; | |
576 | ||
577 | *intern = *intern_copy; /* Make it reasonable to do in-place. */ | |
578 | ||
579 | /* now the fun stuff... */ | |
580 | if (bigend) { | |
581 | ext->r_bits[0] = intern->rfd >> RNDX_BITS0_RFD_SH_LEFT_BIG; | |
582 | ext->r_bits[1] = (((intern->rfd << RNDX_BITS1_RFD_SH_BIG) | |
583 | & RNDX_BITS1_RFD_BIG) | |
584 | | ((intern->index >> RNDX_BITS1_INDEX_SH_LEFT_BIG) | |
585 | & RNDX_BITS1_INDEX_BIG)); | |
586 | ext->r_bits[2] = intern->index >> RNDX_BITS2_INDEX_SH_LEFT_BIG; | |
587 | ext->r_bits[3] = intern->index >> RNDX_BITS3_INDEX_SH_LEFT_BIG; | |
588 | } else { | |
589 | ext->r_bits[0] = intern->rfd >> RNDX_BITS0_RFD_SH_LEFT_LITTLE; | |
590 | ext->r_bits[1] = (((intern->rfd >> RNDX_BITS1_RFD_SH_LEFT_LITTLE) | |
591 | & RNDX_BITS1_RFD_LITTLE) | |
592 | | ((intern->index << RNDX_BITS1_INDEX_SH_LITTLE) | |
593 | & RNDX_BITS1_INDEX_LITTLE)); | |
594 | ext->r_bits[2] = intern->index >> RNDX_BITS2_INDEX_SH_LEFT_LITTLE; | |
595 | ext->r_bits[3] = intern->index >> RNDX_BITS3_INDEX_SH_LEFT_LITTLE; | |
596 | } | |
597 | ||
598 | #ifdef TEST | |
599 | if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) | |
600 | abort(); | |
601 | #endif | |
602 | } | |
603 | ||
6dc77691 JG |
604 | /* Swap in a relative file descriptor. */ |
605 | ||
606 | void | |
515c4292 ILT |
607 | DEFUN (ecoff_swap_rfd_in, (abfd, ext, intern), |
608 | bfd *abfd AND | |
609 | struct rfd_ext *ext AND | |
610 | RFDT *intern) | |
6dc77691 JG |
611 | { |
612 | ||
2b7eef3c | 613 | *intern = bfd_h_get_32 (abfd, (bfd_byte *)ext->rfd); |
6dc77691 JG |
614 | |
615 | #ifdef TEST | |
616 | if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) | |
617 | abort(); | |
618 | #endif | |
619 | } | |
8fa0d3a0 ILT |
620 | |
621 | /* Swap out a relative file descriptor. */ | |
622 | ||
623 | void | |
624 | DEFUN (ecoff_swap_rfd_out, (abfd, intern, ext), | |
625 | bfd *abfd AND | |
626 | RFDT *intern AND | |
627 | struct rfd_ext *ext) | |
628 | { | |
629 | bfd_h_put_32 (abfd, *intern, (bfd_byte *)ext->rfd); | |
630 | ||
631 | #ifdef TEST | |
632 | if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) | |
633 | abort(); | |
634 | #endif | |
635 | } | |
636 | ||
637 | /* Swap in an optimization symbol. */ | |
638 | ||
639 | void | |
640 | DEFUN (ecoff_swap_opt_in, (abfd, ext_copy, intern), | |
641 | bfd *abfd AND | |
642 | struct opt_ext *ext_copy AND | |
643 | OPTR *intern) | |
644 | { | |
645 | struct opt_ext ext[1]; | |
646 | ||
647 | *ext = *ext_copy; /* Make it reasonable to do in-place. */ | |
648 | ||
649 | if (abfd->xvec->header_byteorder_big_p != false) | |
650 | { | |
651 | intern->ot = ext->o_bits1[0]; | |
dcf5ddb8 ILT |
652 | intern->value = ((ext->o_bits2[0] << OPT_BITS2_VALUE_SH_LEFT_BIG) |
653 | | (ext->o_bits3[0] << OPT_BITS2_VALUE_SH_LEFT_BIG) | |
654 | | (ext->o_bits4[0] << OPT_BITS2_VALUE_SH_LEFT_BIG)); | |
8fa0d3a0 ILT |
655 | } |
656 | else | |
657 | { | |
658 | intern->ot = ext->o_bits1[0]; | |
dcf5ddb8 ILT |
659 | intern->value = ((ext->o_bits2[0] << OPT_BITS2_VALUE_SH_LEFT_LITTLE) |
660 | | (ext->o_bits3[0] << OPT_BITS2_VALUE_SH_LEFT_LITTLE) | |
661 | | (ext->o_bits4[0] << OPT_BITS2_VALUE_SH_LEFT_LITTLE)); | |
8fa0d3a0 ILT |
662 | } |
663 | ||
664 | ecoff_swap_rndx_in (abfd->xvec->header_byteorder_big_p != false, | |
665 | &ext->o_rndx, &intern->rndx); | |
666 | ||
667 | intern->offset = bfd_h_get_32 (abfd, (bfd_byte *) ext->o_offset); | |
668 | ||
669 | #ifdef TEST | |
670 | if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) | |
671 | abort(); | |
672 | #endif | |
673 | } | |
674 | ||
675 | /* Swap out an optimization symbol. */ | |
676 | ||
677 | void | |
678 | DEFUN (ecoff_swap_opt_out, (abfd, intern_copy, ext), | |
679 | bfd *abfd AND | |
680 | OPTR *intern_copy AND | |
681 | struct opt_ext *ext) | |
682 | { | |
683 | OPTR intern[1]; | |
684 | ||
685 | *intern = *intern_copy; /* Make it reasonable to do in-place. */ | |
686 | ||
687 | if (abfd->xvec->header_byteorder_big_p != false) | |
688 | { | |
689 | ext->o_bits1[0] = intern->ot; | |
690 | ext->o_bits2[0] = intern->value >> OPT_BITS2_VALUE_SH_LEFT_BIG; | |
691 | ext->o_bits3[0] = intern->value >> OPT_BITS3_VALUE_SH_LEFT_BIG; | |
692 | ext->o_bits4[0] = intern->value >> OPT_BITS4_VALUE_SH_LEFT_BIG; | |
693 | } | |
694 | else | |
695 | { | |
696 | ext->o_bits1[0] = intern->ot; | |
697 | ext->o_bits2[0] = intern->value >> OPT_BITS2_VALUE_SH_LEFT_LITTLE; | |
698 | ext->o_bits3[0] = intern->value >> OPT_BITS3_VALUE_SH_LEFT_LITTLE; | |
699 | ext->o_bits4[0] = intern->value >> OPT_BITS4_VALUE_SH_LEFT_LITTLE; | |
700 | } | |
701 | ||
702 | ecoff_swap_rndx_out (abfd->xvec->header_byteorder_big_p != false, | |
703 | &intern->rndx, &ext->o_rndx); | |
704 | ||
705 | bfd_h_put_32 (abfd, intern->value, (bfd_byte *) ext->o_offset); | |
706 | ||
707 | #ifdef TEST | |
708 | if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) | |
709 | abort(); | |
710 | #endif | |
711 | } | |
712 | ||
713 | /* Swap in a dense number. */ | |
714 | ||
715 | void | |
716 | DEFUN (ecoff_swap_dnr_in, (abfd, ext_copy, intern), | |
717 | bfd *abfd AND | |
718 | struct dnr_ext *ext_copy AND | |
719 | DNR *intern) | |
720 | { | |
721 | struct dnr_ext ext[1]; | |
722 | ||
723 | *ext = *ext_copy; /* Make it reasonable to do in-place. */ | |
724 | ||
725 | intern->rfd = bfd_h_get_32 (abfd, (bfd_byte *) ext->d_rfd); | |
726 | intern->index = bfd_h_get_32 (abfd, (bfd_byte *) ext->d_index); | |
727 | ||
728 | #ifdef TEST | |
729 | if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) | |
730 | abort(); | |
731 | #endif | |
732 | } | |
733 | ||
734 | /* Swap out a dense number. */ | |
735 | ||
736 | void | |
737 | DEFUN (ecoff_swap_dnr_out, (abfd, intern_copy, ext), | |
738 | bfd *abfd AND | |
739 | DNR *intern_copy AND | |
740 | struct dnr_ext *ext) | |
741 | { | |
742 | DNR intern[1]; | |
743 | ||
744 | *intern = *intern_copy; /* Make it reasonable to do in-place. */ | |
745 | ||
746 | bfd_h_put_32 (abfd, intern->rfd, (bfd_byte *) ext->d_rfd); | |
747 | bfd_h_put_32 (abfd, intern->index, (bfd_byte *) ext->d_index); | |
748 | ||
749 | #ifdef TEST | |
750 | if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) | |
751 | abort(); | |
752 | #endif | |
753 | } |