Commit | Line | Data |
---|---|---|
075caafd | 1 | /* Generic COFF swapping routines, for BFD. |
fbb61b50 | 2 | Copyright 1990, 1991, 1992, 1993 Free Software Foundation, Inc. |
075caafd ILT |
3 | Written by Cygnus Support. |
4 | ||
5 | This file is part of BFD, the Binary File Descriptor library. | |
6 | ||
7 | This program is free software; you can redistribute it and/or modify | |
8 | it under the terms of the GNU General Public License as published by | |
9 | the Free Software Foundation; either version 2 of the License, or | |
10 | (at your option) any later version. | |
11 | ||
12 | This program is distributed in the hope that it will be useful, | |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
18 | along with this program; if not, write to the Free Software | |
19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
20 | ||
21 | /* This file contains routines used to swap COFF data. It is a header | |
22 | file because the details of swapping depend on the details of the | |
23 | structures used by each COFF implementation. This is included by | |
24 | coffcode.h, as well as by the ECOFF backend. | |
25 | ||
26 | Any file which uses this must first include "coff/internal.h" and | |
27 | "coff/CPU.h". The functions will then be correct for that CPU. */ | |
28 | ||
29 | #define PUTWORD bfd_h_put_32 | |
30 | #define PUTHALF bfd_h_put_16 | |
31 | #define PUTBYTE bfd_h_put_8 | |
32 | ||
33 | #ifndef GET_FCN_LNNOPTR | |
34 | #define GET_FCN_LNNOPTR(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_lnnoptr) | |
35 | #endif | |
36 | ||
37 | #ifndef GET_FCN_ENDNDX | |
38 | #define GET_FCN_ENDNDX(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_endndx) | |
39 | #endif | |
40 | ||
41 | #ifndef PUT_FCN_LNNOPTR | |
42 | #define PUT_FCN_LNNOPTR(abfd, in, ext) PUTWORD(abfd, in, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_lnnoptr) | |
43 | #endif | |
44 | #ifndef PUT_FCN_ENDNDX | |
45 | #define PUT_FCN_ENDNDX(abfd, in, ext) PUTWORD(abfd, in, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_endndx) | |
46 | #endif | |
47 | #ifndef GET_LNSZ_LNNO | |
48 | #define GET_LNSZ_LNNO(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *) ext->x_sym.x_misc.x_lnsz.x_lnno) | |
49 | #endif | |
50 | #ifndef GET_LNSZ_SIZE | |
51 | #define GET_LNSZ_SIZE(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *) ext->x_sym.x_misc.x_lnsz.x_size) | |
52 | #endif | |
53 | #ifndef PUT_LNSZ_LNNO | |
54 | #define PUT_LNSZ_LNNO(abfd, in, ext) bfd_h_put_16(abfd, in, (bfd_byte *)ext->x_sym.x_misc.x_lnsz.x_lnno) | |
55 | #endif | |
56 | #ifndef PUT_LNSZ_SIZE | |
57 | #define PUT_LNSZ_SIZE(abfd, in, ext) bfd_h_put_16(abfd, in, (bfd_byte*) ext->x_sym.x_misc.x_lnsz.x_size) | |
58 | #endif | |
59 | #ifndef GET_SCN_SCNLEN | |
60 | #define GET_SCN_SCNLEN(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_scn.x_scnlen) | |
61 | #endif | |
62 | #ifndef GET_SCN_NRELOC | |
63 | #define GET_SCN_NRELOC(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *)ext->x_scn.x_nreloc) | |
64 | #endif | |
65 | #ifndef GET_SCN_NLINNO | |
66 | #define GET_SCN_NLINNO(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *)ext->x_scn.x_nlinno) | |
67 | #endif | |
68 | #ifndef PUT_SCN_SCNLEN | |
69 | #define PUT_SCN_SCNLEN(abfd,in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_scn.x_scnlen) | |
70 | #endif | |
71 | #ifndef PUT_SCN_NRELOC | |
72 | #define PUT_SCN_NRELOC(abfd,in, ext) bfd_h_put_16(abfd, in, (bfd_byte *)ext->x_scn.x_nreloc) | |
73 | #endif | |
74 | #ifndef PUT_SCN_NLINNO | |
75 | #define PUT_SCN_NLINNO(abfd,in, ext) bfd_h_put_16(abfd,in, (bfd_byte *) ext->x_scn.x_nlinno) | |
76 | #endif | |
77 | #ifndef GET_LINENO_LNNO | |
78 | #define GET_LINENO_LNNO(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *) (ext->l_lnno)); | |
79 | #endif | |
80 | #ifndef PUT_LINENO_LNNO | |
81 | #define PUT_LINENO_LNNO(abfd,val, ext) bfd_h_put_16(abfd,val, (bfd_byte *) (ext->l_lnno)); | |
82 | #endif | |
83 | ||
fbb61b50 SC |
84 | /* The f_symptr field in the filehdr is sometimes 64 bits. */ |
85 | #ifndef GET_FILEHDR_SYMPTR | |
86 | #define GET_FILEHDR_SYMPTR bfd_h_get_32 | |
87 | #endif | |
88 | #ifndef PUT_FILEHDR_SYMPTR | |
89 | #define PUT_FILEHDR_SYMPTR bfd_h_put_32 | |
90 | #endif | |
91 | ||
92 | /* Some fields in the aouthdr are sometimes 64 bits. */ | |
93 | #ifndef GET_AOUTHDR_TSIZE | |
94 | #define GET_AOUTHDR_TSIZE bfd_h_get_32 | |
95 | #endif | |
96 | #ifndef PUT_AOUTHDR_TSIZE | |
97 | #define PUT_AOUTHDR_TSIZE bfd_h_put_32 | |
98 | #endif | |
99 | #ifndef GET_AOUTHDR_DSIZE | |
100 | #define GET_AOUTHDR_DSIZE bfd_h_get_32 | |
101 | #endif | |
102 | #ifndef PUT_AOUTHDR_DSIZE | |
103 | #define PUT_AOUTHDR_DSIZE bfd_h_put_32 | |
104 | #endif | |
105 | #ifndef GET_AOUTHDR_BSIZE | |
106 | #define GET_AOUTHDR_BSIZE bfd_h_get_32 | |
107 | #endif | |
108 | #ifndef PUT_AOUTHDR_BSIZE | |
109 | #define PUT_AOUTHDR_BSIZE bfd_h_put_32 | |
110 | #endif | |
111 | #ifndef GET_AOUTHDR_ENTRY | |
112 | #define GET_AOUTHDR_ENTRY bfd_h_get_32 | |
113 | #endif | |
114 | #ifndef PUT_AOUTHDR_ENTRY | |
115 | #define PUT_AOUTHDR_ENTRY bfd_h_put_32 | |
116 | #endif | |
117 | #ifndef GET_AOUTHDR_TEXT_START | |
118 | #define GET_AOUTHDR_TEXT_START bfd_h_get_32 | |
119 | #endif | |
120 | #ifndef PUT_AOUTHDR_TEXT_START | |
121 | #define PUT_AOUTHDR_TEXT_START bfd_h_put_32 | |
122 | #endif | |
123 | #ifndef GET_AOUTHDR_DATA_START | |
124 | #define GET_AOUTHDR_DATA_START bfd_h_get_32 | |
125 | #endif | |
126 | #ifndef PUT_AOUTHDR_DATA_START | |
127 | #define PUT_AOUTHDR_DATA_START bfd_h_put_32 | |
128 | #endif | |
129 | ||
130 | /* Some fields in the scnhdr are sometimes 64 bits. */ | |
131 | #ifndef GET_SCNHDR_PADDR | |
132 | #define GET_SCNHDR_PADDR bfd_h_get_32 | |
133 | #endif | |
134 | #ifndef PUT_SCNHDR_PADDR | |
135 | #define PUT_SCNHDR_PADDR bfd_h_put_32 | |
136 | #endif | |
137 | #ifndef GET_SCNHDR_VADDR | |
138 | #define GET_SCNHDR_VADDR bfd_h_get_32 | |
139 | #endif | |
140 | #ifndef PUT_SCNHDR_VADDR | |
141 | #define PUT_SCNHDR_VADDR bfd_h_put_32 | |
142 | #endif | |
143 | #ifndef GET_SCNHDR_SIZE | |
144 | #define GET_SCNHDR_SIZE bfd_h_get_32 | |
145 | #endif | |
146 | #ifndef PUT_SCNHDR_SIZE | |
147 | #define PUT_SCNHDR_SIZE bfd_h_put_32 | |
148 | #endif | |
149 | #ifndef GET_SCNHDR_SCNPTR | |
150 | #define GET_SCNHDR_SCNPTR bfd_h_get_32 | |
151 | #endif | |
152 | #ifndef PUT_SCNHDR_SCNPTR | |
153 | #define PUT_SCNHDR_SCNPTR bfd_h_put_32 | |
154 | #endif | |
155 | #ifndef GET_SCNHDR_RELPTR | |
156 | #define GET_SCNHDR_RELPTR bfd_h_get_32 | |
157 | #endif | |
158 | #ifndef PUT_SCNHDR_RELPTR | |
159 | #define PUT_SCNHDR_RELPTR bfd_h_put_32 | |
160 | #endif | |
161 | #ifndef GET_SCNHDR_LNNOPTR | |
162 | #define GET_SCNHDR_LNNOPTR bfd_h_get_32 | |
163 | #endif | |
164 | #ifndef PUT_SCNHDR_LNNOPTR | |
165 | #define PUT_SCNHDR_LNNOPTR bfd_h_put_32 | |
166 | #endif | |
167 | ||
168 | #ifndef NO_COFF_RELOCS | |
169 | ||
075caafd ILT |
170 | static void |
171 | DEFUN(bfd_swap_reloc_in,(abfd, reloc_src, reloc_dst), | |
172 | bfd *abfd AND | |
173 | RELOC *reloc_src AND | |
174 | struct internal_reloc *reloc_dst) | |
175 | { | |
176 | reloc_dst->r_vaddr = bfd_h_get_32(abfd, (bfd_byte *)reloc_src->r_vaddr); | |
fbb61b50 | 177 | reloc_dst->r_symndx = bfd_h_get_signed_32(abfd, (bfd_byte *) reloc_src->r_symndx); |
075caafd ILT |
178 | |
179 | #ifdef RS6000COFF_C | |
180 | reloc_dst->r_type = bfd_h_get_8(abfd, reloc_src->r_type); | |
181 | reloc_dst->r_size = bfd_h_get_8(abfd, reloc_src->r_size); | |
182 | #else | |
183 | reloc_dst->r_type = bfd_h_get_16(abfd, (bfd_byte *) reloc_src->r_type); | |
184 | #endif | |
185 | ||
186 | #ifdef SWAP_IN_RELOC_OFFSET | |
187 | reloc_dst->r_offset = SWAP_IN_RELOC_OFFSET(abfd, | |
188 | (bfd_byte *) reloc_src->r_offset); | |
189 | #endif | |
190 | } | |
191 | ||
192 | ||
193 | static unsigned int | |
194 | DEFUN(coff_swap_reloc_out,(abfd, src, dst), | |
195 | bfd *abfd AND | |
196 | PTR src AND | |
197 | PTR dst) | |
198 | { | |
199 | struct internal_reloc *reloc_src = (struct internal_reloc *)src; | |
200 | struct external_reloc *reloc_dst = (struct external_reloc *)dst; | |
201 | bfd_h_put_32(abfd, reloc_src->r_vaddr, (bfd_byte *) reloc_dst->r_vaddr); | |
202 | bfd_h_put_32(abfd, reloc_src->r_symndx, (bfd_byte *) reloc_dst->r_symndx); | |
203 | bfd_h_put_16(abfd, reloc_src->r_type, (bfd_byte *) | |
204 | reloc_dst->r_type); | |
205 | ||
206 | #ifdef SWAP_OUT_RELOC_OFFSET | |
207 | SWAP_OUT_RELOC_OFFSET(abfd, | |
208 | reloc_src->r_offset, | |
209 | (bfd_byte *) reloc_dst->r_offset); | |
210 | #endif | |
211 | #ifdef SWAP_OUT_RELOC_EXTRA | |
212 | SWAP_OUT_RELOC_EXTRA(abfd,reloc_src, reloc_dst); | |
213 | #endif | |
214 | ||
215 | return sizeof(struct external_reloc); | |
216 | } | |
217 | ||
fbb61b50 SC |
218 | #endif /* NO_COFF_RELOCS */ |
219 | ||
075caafd ILT |
220 | static void |
221 | DEFUN(coff_swap_filehdr_in,(abfd, src, dst), | |
222 | bfd *abfd AND | |
223 | PTR src AND | |
224 | PTR dst) | |
225 | { | |
226 | FILHDR *filehdr_src = (FILHDR *) src; | |
227 | struct internal_filehdr *filehdr_dst = (struct internal_filehdr *) dst; | |
228 | filehdr_dst->f_magic = bfd_h_get_16(abfd, (bfd_byte *) filehdr_src->f_magic); | |
229 | filehdr_dst->f_nscns = bfd_h_get_16(abfd, (bfd_byte *)filehdr_src-> f_nscns); | |
230 | filehdr_dst->f_timdat = bfd_h_get_32(abfd, (bfd_byte *)filehdr_src-> f_timdat); | |
fbb61b50 SC |
231 | filehdr_dst->f_symptr = |
232 | GET_FILEHDR_SYMPTR (abfd, (bfd_byte *) filehdr_src->f_symptr); | |
075caafd ILT |
233 | filehdr_dst->f_nsyms = bfd_h_get_32(abfd, (bfd_byte *)filehdr_src-> f_nsyms); |
234 | filehdr_dst->f_opthdr = bfd_h_get_16(abfd, (bfd_byte *)filehdr_src-> f_opthdr); | |
235 | filehdr_dst->f_flags = bfd_h_get_16(abfd, (bfd_byte *)filehdr_src-> f_flags); | |
236 | } | |
237 | ||
238 | static unsigned int | |
239 | DEFUN(coff_swap_filehdr_out,(abfd, in, out), | |
240 | bfd *abfd AND | |
241 | PTR in AND | |
242 | PTR out) | |
243 | { | |
244 | struct internal_filehdr *filehdr_in = (struct internal_filehdr *)in; | |
245 | FILHDR *filehdr_out = (FILHDR *)out; | |
246 | bfd_h_put_16(abfd, filehdr_in->f_magic, (bfd_byte *) filehdr_out->f_magic); | |
247 | bfd_h_put_16(abfd, filehdr_in->f_nscns, (bfd_byte *) filehdr_out->f_nscns); | |
248 | bfd_h_put_32(abfd, filehdr_in->f_timdat, (bfd_byte *) filehdr_out->f_timdat); | |
fbb61b50 SC |
249 | PUT_FILEHDR_SYMPTR (abfd, (bfd_vma) filehdr_in->f_symptr, |
250 | (bfd_byte *) filehdr_out->f_symptr); | |
075caafd ILT |
251 | bfd_h_put_32(abfd, filehdr_in->f_nsyms, (bfd_byte *) filehdr_out->f_nsyms); |
252 | bfd_h_put_16(abfd, filehdr_in->f_opthdr, (bfd_byte *) filehdr_out->f_opthdr); | |
253 | bfd_h_put_16(abfd, filehdr_in->f_flags, (bfd_byte *) filehdr_out->f_flags); | |
254 | return sizeof(FILHDR); | |
255 | } | |
256 | ||
257 | ||
258 | #ifndef NO_COFF_SYMBOLS | |
259 | ||
260 | static void | |
261 | DEFUN(coff_swap_sym_in,(abfd, ext1, in1), | |
262 | bfd *abfd AND | |
263 | PTR ext1 AND | |
264 | PTR in1) | |
265 | { | |
266 | SYMENT *ext = (SYMENT *)ext1; | |
267 | struct internal_syment *in = (struct internal_syment *)in1; | |
268 | ||
269 | if( ext->e.e_name[0] == 0) { | |
270 | in->_n._n_n._n_zeroes = 0; | |
271 | in->_n._n_n._n_offset = bfd_h_get_32(abfd, (bfd_byte *) ext->e.e.e_offset); | |
272 | } | |
273 | else { | |
274 | #if SYMNMLEN != E_SYMNMLEN | |
275 | -> Error, we need to cope with truncating or extending SYMNMLEN!; | |
276 | #else | |
277 | memcpy(in->_n._n_name, ext->e.e_name, SYMNMLEN); | |
278 | #endif | |
279 | } | |
280 | in->n_value = bfd_h_get_32(abfd, (bfd_byte *) ext->e_value); | |
281 | in->n_scnum = bfd_h_get_16(abfd, (bfd_byte *) ext->e_scnum); | |
282 | if (sizeof(ext->e_type) == 2){ | |
283 | in->n_type = bfd_h_get_16(abfd, (bfd_byte *) ext->e_type); | |
284 | } | |
285 | else { | |
286 | in->n_type = bfd_h_get_32(abfd, (bfd_byte *) ext->e_type); | |
287 | } | |
288 | in->n_sclass = bfd_h_get_8(abfd, ext->e_sclass); | |
289 | in->n_numaux = bfd_h_get_8(abfd, ext->e_numaux); | |
290 | } | |
291 | ||
292 | static unsigned int | |
293 | DEFUN(coff_swap_sym_out,(abfd, inp, extp), | |
294 | bfd *abfd AND | |
295 | PTR inp AND | |
296 | PTR extp) | |
297 | { | |
298 | struct internal_syment *in = (struct internal_syment *)inp; | |
299 | SYMENT *ext =(SYMENT *)extp; | |
300 | if(in->_n._n_name[0] == 0) { | |
301 | bfd_h_put_32(abfd, 0, (bfd_byte *) ext->e.e.e_zeroes); | |
302 | bfd_h_put_32(abfd, in->_n._n_n._n_offset, (bfd_byte *) ext->e.e.e_offset); | |
303 | } | |
304 | else { | |
305 | #if SYMNMLEN != E_SYMNMLEN | |
306 | -> Error, we need to cope with truncating or extending SYMNMLEN!; | |
307 | #else | |
308 | memcpy(ext->e.e_name, in->_n._n_name, SYMNMLEN); | |
309 | #endif | |
310 | } | |
311 | bfd_h_put_32(abfd, in->n_value , (bfd_byte *) ext->e_value); | |
312 | bfd_h_put_16(abfd, in->n_scnum , (bfd_byte *) ext->e_scnum); | |
313 | if (sizeof(ext->e_type) == 2) | |
314 | { | |
315 | bfd_h_put_16(abfd, in->n_type , (bfd_byte *) ext->e_type); | |
316 | } | |
317 | else | |
318 | { | |
319 | bfd_h_put_32(abfd, in->n_type , (bfd_byte *) ext->e_type); | |
320 | } | |
321 | bfd_h_put_8(abfd, in->n_sclass , ext->e_sclass); | |
322 | bfd_h_put_8(abfd, in->n_numaux , ext->e_numaux); | |
323 | return sizeof(SYMENT); | |
324 | } | |
325 | ||
326 | static void | |
330595d0 | 327 | DEFUN(coff_swap_aux_in,(abfd, ext1, type, class, indx, numaux, in1), |
075caafd ILT |
328 | bfd *abfd AND |
329 | PTR ext1 AND | |
330 | int type AND | |
331 | int class AND | |
330595d0 ILT |
332 | int indx AND |
333 | int numaux AND | |
075caafd ILT |
334 | PTR in1) |
335 | { | |
336 | AUXENT *ext = (AUXENT *)ext1; | |
337 | union internal_auxent *in = (union internal_auxent *)in1; | |
338 | ||
339 | switch (class) { | |
340 | case C_FILE: | |
341 | if (ext->x_file.x_fname[0] == 0) { | |
342 | in->x_file.x_n.x_zeroes = 0; | |
343 | in->x_file.x_n.x_offset = | |
344 | bfd_h_get_32(abfd, (bfd_byte *) ext->x_file.x_n.x_offset); | |
345 | } else { | |
346 | #if FILNMLEN != E_FILNMLEN | |
347 | -> Error, we need to cope with truncating or extending FILNMLEN!; | |
348 | #else | |
349 | memcpy (in->x_file.x_fname, ext->x_file.x_fname, FILNMLEN); | |
350 | #endif | |
351 | } | |
330595d0 | 352 | return; |
075caafd ILT |
353 | |
354 | /* RS/6000 "csect" auxents */ | |
355 | #ifdef RS6000COFF_C | |
356 | case C_EXT: | |
357 | case C_HIDEXT: | |
330595d0 ILT |
358 | if (indx + 1 == numaux) |
359 | { | |
360 | in->x_csect.x_scnlen = bfd_h_get_32 (abfd, ext->x_csect.x_scnlen); | |
361 | in->x_csect.x_parmhash = bfd_h_get_32 (abfd, | |
362 | ext->x_csect.x_parmhash); | |
363 | in->x_csect.x_snhash = bfd_h_get_16 (abfd, ext->x_csect.x_snhash); | |
364 | /* We don't have to hack bitfields in x_smtyp because it's | |
365 | defined by shifts-and-ands, which are equivalent on all | |
366 | byte orders. */ | |
367 | in->x_csect.x_smtyp = bfd_h_get_8 (abfd, ext->x_csect.x_smtyp); | |
368 | in->x_csect.x_smclas = bfd_h_get_8 (abfd, ext->x_csect.x_smclas); | |
369 | in->x_csect.x_stab = bfd_h_get_32 (abfd, ext->x_csect.x_stab); | |
370 | in->x_csect.x_snstab = bfd_h_get_16 (abfd, ext->x_csect.x_snstab); | |
371 | return; | |
372 | } | |
075caafd ILT |
373 | break; |
374 | #endif | |
375 | ||
376 | case C_STAT: | |
377 | #ifdef C_LEAFSTAT | |
378 | case C_LEAFSTAT: | |
379 | #endif | |
380 | case C_HIDDEN: | |
381 | if (type == T_NULL) { | |
382 | in->x_scn.x_scnlen = GET_SCN_SCNLEN(abfd, ext); | |
383 | in->x_scn.x_nreloc = GET_SCN_NRELOC(abfd, ext); | |
384 | in->x_scn.x_nlinno = GET_SCN_NLINNO(abfd, ext); | |
330595d0 | 385 | return; |
075caafd | 386 | } |
330595d0 ILT |
387 | break; |
388 | } | |
389 | ||
390 | in->x_sym.x_tagndx.l = bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_tagndx); | |
075caafd | 391 | #ifndef NO_TVNDX |
330595d0 | 392 | in->x_sym.x_tvndx = bfd_h_get_16(abfd, (bfd_byte *) ext->x_sym.x_tvndx); |
075caafd ILT |
393 | #endif |
394 | ||
330595d0 | 395 | if (ISARY(type)) { |
075caafd | 396 | #if DIMNUM != E_DIMNUM |
330595d0 | 397 | -> Error, we need to cope with truncating or extending DIMNUM!; |
075caafd | 398 | #else |
330595d0 ILT |
399 | in->x_sym.x_fcnary.x_ary.x_dimen[0] = bfd_h_get_16(abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[0]); |
400 | in->x_sym.x_fcnary.x_ary.x_dimen[1] = bfd_h_get_16(abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[1]); | |
401 | in->x_sym.x_fcnary.x_ary.x_dimen[2] = bfd_h_get_16(abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[2]); | |
402 | in->x_sym.x_fcnary.x_ary.x_dimen[3] = bfd_h_get_16(abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[3]); | |
075caafd | 403 | #endif |
330595d0 ILT |
404 | } |
405 | if (class == C_BLOCK || ISFCN(type) || ISTAG(class)) { | |
406 | in->x_sym.x_fcnary.x_fcn.x_lnnoptr = GET_FCN_LNNOPTR(abfd, ext); | |
407 | in->x_sym.x_fcnary.x_fcn.x_endndx.l = GET_FCN_ENDNDX(abfd, ext); | |
408 | } | |
075caafd | 409 | |
330595d0 ILT |
410 | if (ISFCN(type)) { |
411 | in->x_sym.x_misc.x_fsize = bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_misc.x_fsize); | |
412 | } | |
413 | else { | |
414 | in->x_sym.x_misc.x_lnsz.x_lnno = GET_LNSZ_LNNO(abfd, ext); | |
415 | in->x_sym.x_misc.x_lnsz.x_size = GET_LNSZ_SIZE(abfd, ext); | |
416 | } | |
075caafd ILT |
417 | } |
418 | ||
419 | static unsigned int | |
330595d0 | 420 | DEFUN(coff_swap_aux_out,(abfd, inp, type, class, indx, numaux, extp), |
075caafd ILT |
421 | bfd *abfd AND |
422 | PTR inp AND | |
423 | int type AND | |
424 | int class AND | |
330595d0 ILT |
425 | int indx AND |
426 | int numaux AND | |
075caafd ILT |
427 | PTR extp) |
428 | { | |
429 | union internal_auxent *in = (union internal_auxent *)inp; | |
430 | AUXENT *ext = (AUXENT *)extp; | |
431 | ||
432 | memset((PTR)ext, 0, AUXESZ); | |
433 | switch (class) { | |
434 | case C_FILE: | |
435 | if (in->x_file.x_fname[0] == 0) { | |
436 | PUTWORD(abfd, 0, (bfd_byte *) ext->x_file.x_n.x_zeroes); | |
437 | PUTWORD(abfd, | |
438 | in->x_file.x_n.x_offset, | |
439 | (bfd_byte *) ext->x_file.x_n.x_offset); | |
440 | } | |
441 | else { | |
442 | #if FILNMLEN != E_FILNMLEN | |
443 | -> Error, we need to cope with truncating or extending FILNMLEN!; | |
444 | #else | |
445 | memcpy (ext->x_file.x_fname, in->x_file.x_fname, FILNMLEN); | |
446 | #endif | |
447 | } | |
330595d0 | 448 | return sizeof (AUXENT); |
075caafd ILT |
449 | |
450 | #ifdef RS6000COFF_C | |
451 | /* RS/6000 "csect" auxents */ | |
452 | case C_EXT: | |
453 | case C_HIDEXT: | |
330595d0 ILT |
454 | if (indx + 1 == numaux) |
455 | { | |
456 | PUTWORD (abfd, in->x_csect.x_scnlen, ext->x_csect.x_scnlen); | |
457 | PUTWORD (abfd, in->x_csect.x_parmhash, ext->x_csect.x_parmhash); | |
458 | PUTHALF (abfd, in->x_csect.x_snhash, ext->x_csect.x_snhash); | |
459 | /* We don't have to hack bitfields in x_smtyp because it's | |
460 | defined by shifts-and-ands, which are equivalent on all | |
461 | byte orders. */ | |
462 | PUTBYTE (abfd, in->x_csect.x_smtyp, ext->x_csect.x_smtyp); | |
463 | PUTBYTE (abfd, in->x_csect.x_smclas, ext->x_csect.x_smclas); | |
464 | PUTWORD (abfd, in->x_csect.x_stab, ext->x_csect.x_stab); | |
465 | PUTHALF (abfd, in->x_csect.x_snstab, ext->x_csect.x_snstab); | |
466 | return sizeof (AUXENT); | |
467 | } | |
075caafd ILT |
468 | break; |
469 | #endif | |
470 | ||
471 | case C_STAT: | |
472 | #ifdef C_LEAFSTAT | |
473 | case C_LEAFSTAT: | |
474 | #endif | |
475 | case C_HIDDEN: | |
476 | if (type == T_NULL) { | |
477 | PUT_SCN_SCNLEN(abfd, in->x_scn.x_scnlen, ext); | |
478 | PUT_SCN_NRELOC(abfd, in->x_scn.x_nreloc, ext); | |
479 | PUT_SCN_NLINNO(abfd, in->x_scn.x_nlinno, ext); | |
330595d0 | 480 | return sizeof (AUXENT); |
075caafd | 481 | } |
330595d0 ILT |
482 | break; |
483 | } | |
484 | ||
485 | PUTWORD(abfd, in->x_sym.x_tagndx.l, (bfd_byte *) ext->x_sym.x_tagndx); | |
075caafd | 486 | #ifndef NO_TVNDX |
330595d0 | 487 | bfd_h_put_16(abfd, in->x_sym.x_tvndx , (bfd_byte *) ext->x_sym.x_tvndx); |
075caafd ILT |
488 | #endif |
489 | ||
330595d0 ILT |
490 | if (class == C_BLOCK || ISFCN(type) || ISTAG(class)) { |
491 | PUT_FCN_LNNOPTR(abfd, in->x_sym.x_fcnary.x_fcn.x_lnnoptr, ext); | |
492 | PUT_FCN_ENDNDX(abfd, in->x_sym.x_fcnary.x_fcn.x_endndx.l, ext); | |
493 | } | |
075caafd | 494 | |
330595d0 ILT |
495 | if (ISFCN(type)) { |
496 | PUTWORD(abfd, in->x_sym.x_misc.x_fsize, (bfd_byte *) ext->x_sym.x_misc.x_fsize); | |
497 | } | |
498 | else { | |
499 | if (ISARY(type)) { | |
075caafd | 500 | #if DIMNUM != E_DIMNUM |
330595d0 | 501 | -> Error, we need to cope with truncating or extending DIMNUM!; |
075caafd | 502 | #else |
330595d0 ILT |
503 | bfd_h_put_16(abfd, in->x_sym.x_fcnary.x_ary.x_dimen[0], (bfd_byte *)ext->x_sym.x_fcnary.x_ary.x_dimen[0]); |
504 | bfd_h_put_16(abfd, in->x_sym.x_fcnary.x_ary.x_dimen[1], (bfd_byte *)ext->x_sym.x_fcnary.x_ary.x_dimen[1]); | |
505 | bfd_h_put_16(abfd, in->x_sym.x_fcnary.x_ary.x_dimen[2], (bfd_byte *)ext->x_sym.x_fcnary.x_ary.x_dimen[2]); | |
506 | bfd_h_put_16(abfd, in->x_sym.x_fcnary.x_ary.x_dimen[3], (bfd_byte *)ext->x_sym.x_fcnary.x_ary.x_dimen[3]); | |
075caafd | 507 | #endif |
075caafd | 508 | } |
330595d0 ILT |
509 | PUT_LNSZ_LNNO(abfd, in->x_sym.x_misc.x_lnsz.x_lnno, ext); |
510 | PUT_LNSZ_SIZE(abfd, in->x_sym.x_misc.x_lnsz.x_size, ext); | |
075caafd | 511 | } |
330595d0 | 512 | return sizeof(AUXENT); |
075caafd ILT |
513 | } |
514 | ||
515 | #endif /* NO_COFF_SYMBOLS */ | |
516 | ||
517 | #ifndef NO_COFF_LINENOS | |
518 | ||
519 | static void | |
520 | DEFUN(coff_swap_lineno_in,(abfd, ext1, in1), | |
521 | bfd *abfd AND | |
522 | PTR ext1 AND | |
523 | PTR in1) | |
524 | { | |
525 | LINENO *ext = (LINENO *)ext1; | |
526 | struct internal_lineno *in = (struct internal_lineno *)in1; | |
527 | ||
528 | in->l_addr.l_symndx = bfd_h_get_32(abfd, (bfd_byte *) ext->l_addr.l_symndx); | |
529 | in->l_lnno = GET_LINENO_LNNO(abfd, ext); | |
530 | } | |
531 | ||
532 | static unsigned int | |
533 | DEFUN(coff_swap_lineno_out,(abfd, inp, outp), | |
534 | bfd *abfd AND | |
535 | PTR inp AND | |
536 | PTR outp) | |
537 | { | |
538 | struct internal_lineno *in = (struct internal_lineno *)inp; | |
539 | struct external_lineno *ext = (struct external_lineno *)outp; | |
540 | PUTWORD(abfd, in->l_addr.l_symndx, (bfd_byte *) | |
541 | ext->l_addr.l_symndx); | |
542 | ||
543 | PUT_LINENO_LNNO (abfd, in->l_lnno, ext); | |
544 | return sizeof(struct external_lineno); | |
545 | } | |
546 | ||
547 | #endif /* NO_COFF_LINENOS */ | |
548 | ||
549 | ||
550 | static void | |
551 | DEFUN(coff_swap_aouthdr_in,(abfd, aouthdr_ext1, aouthdr_int1), | |
552 | bfd *abfd AND | |
553 | PTR aouthdr_ext1 AND | |
554 | PTR aouthdr_int1) | |
555 | { | |
556 | AOUTHDR *aouthdr_ext = (AOUTHDR *) aouthdr_ext1; | |
557 | struct internal_aouthdr *aouthdr_int = (struct internal_aouthdr *)aouthdr_int1; | |
558 | ||
559 | aouthdr_int->magic = bfd_h_get_16(abfd, (bfd_byte *) aouthdr_ext->magic); | |
560 | aouthdr_int->vstamp = bfd_h_get_16(abfd, (bfd_byte *) aouthdr_ext->vstamp); | |
fbb61b50 SC |
561 | aouthdr_int->tsize = |
562 | GET_AOUTHDR_TSIZE (abfd, (bfd_byte *) aouthdr_ext->tsize); | |
563 | aouthdr_int->dsize = | |
564 | GET_AOUTHDR_DSIZE (abfd, (bfd_byte *) aouthdr_ext->dsize); | |
565 | aouthdr_int->bsize = | |
566 | GET_AOUTHDR_BSIZE (abfd, (bfd_byte *) aouthdr_ext->bsize); | |
567 | aouthdr_int->entry = | |
568 | GET_AOUTHDR_ENTRY (abfd, (bfd_byte *) aouthdr_ext->entry); | |
569 | aouthdr_int->text_start = | |
570 | GET_AOUTHDR_TEXT_START (abfd, (bfd_byte *) aouthdr_ext->text_start); | |
571 | aouthdr_int->data_start = | |
572 | GET_AOUTHDR_DATA_START (abfd, (bfd_byte *) aouthdr_ext->data_start); | |
573 | ||
075caafd ILT |
574 | #ifdef I960 |
575 | aouthdr_int->tagentries = bfd_h_get_32(abfd, (bfd_byte *) aouthdr_ext->tagentries); | |
576 | #endif | |
577 | ||
330595d0 ILT |
578 | #ifdef APOLLO_M68 |
579 | bfd_h_put_32(abfd, aouthdr_int->o_inlib, (bfd_byte *) aouthdr_ext->o_inlib); | |
580 | bfd_h_put_32(abfd, aouthdr_int->o_sri, (bfd_byte *) aouthdr_ext->o_sri); | |
581 | bfd_h_put_32(abfd, aouthdr_int->vid[0], (bfd_byte *) aouthdr_ext->vid); | |
582 | bfd_h_put_32(abfd, aouthdr_int->vid[1], (bfd_byte *) aouthdr_ext->vid + 4); | |
583 | #endif | |
584 | ||
585 | ||
075caafd ILT |
586 | #ifdef RS6000COFF_C |
587 | aouthdr_int->o_toc = bfd_h_get_32(abfd, aouthdr_ext->o_toc); | |
588 | aouthdr_int->o_snentry = bfd_h_get_16(abfd, aouthdr_ext->o_snentry); | |
589 | aouthdr_int->o_sntext = bfd_h_get_16(abfd, aouthdr_ext->o_sntext); | |
590 | aouthdr_int->o_sndata = bfd_h_get_16(abfd, aouthdr_ext->o_sndata); | |
591 | aouthdr_int->o_sntoc = bfd_h_get_16(abfd, aouthdr_ext->o_sntoc); | |
592 | aouthdr_int->o_snloader = bfd_h_get_16(abfd, aouthdr_ext->o_snloader); | |
593 | aouthdr_int->o_snbss = bfd_h_get_16(abfd, aouthdr_ext->o_snbss); | |
594 | aouthdr_int->o_algntext = bfd_h_get_16(abfd, aouthdr_ext->o_algntext); | |
595 | aouthdr_int->o_algndata = bfd_h_get_16(abfd, aouthdr_ext->o_algndata); | |
596 | aouthdr_int->o_modtype = bfd_h_get_16(abfd, aouthdr_ext->o_modtype); | |
597 | aouthdr_int->o_maxstack = bfd_h_get_32(abfd, aouthdr_ext->o_maxstack); | |
598 | #endif | |
fbb61b50 SC |
599 | |
600 | #ifdef MIPSECOFF | |
601 | aouthdr_int->bss_start = bfd_h_get_32(abfd, aouthdr_ext->bss_start); | |
602 | aouthdr_int->gp_value = bfd_h_get_32(abfd, aouthdr_ext->gp_value); | |
603 | aouthdr_int->gprmask = bfd_h_get_32(abfd, aouthdr_ext->gprmask); | |
604 | aouthdr_int->cprmask[0] = bfd_h_get_32(abfd, aouthdr_ext->cprmask[0]); | |
605 | aouthdr_int->cprmask[1] = bfd_h_get_32(abfd, aouthdr_ext->cprmask[1]); | |
606 | aouthdr_int->cprmask[2] = bfd_h_get_32(abfd, aouthdr_ext->cprmask[2]); | |
607 | aouthdr_int->cprmask[3] = bfd_h_get_32(abfd, aouthdr_ext->cprmask[3]); | |
608 | #endif | |
609 | ||
610 | #ifdef ALPHAECOFF | |
611 | aouthdr_int->bss_start = bfd_h_get_64(abfd, aouthdr_ext->bss_start); | |
612 | aouthdr_int->gp_value = bfd_h_get_64(abfd, aouthdr_ext->gp_value); | |
613 | aouthdr_int->gprmask = bfd_h_get_32(abfd, aouthdr_ext->gprmask); | |
614 | aouthdr_int->fprmask = bfd_h_get_32(abfd, aouthdr_ext->fprmask); | |
615 | #endif | |
075caafd ILT |
616 | } |
617 | ||
618 | static unsigned int | |
619 | DEFUN(coff_swap_aouthdr_out,(abfd, in, out), | |
620 | bfd *abfd AND | |
621 | PTR in AND | |
622 | PTR out) | |
623 | { | |
624 | struct internal_aouthdr *aouthdr_in = (struct internal_aouthdr *)in; | |
625 | AOUTHDR *aouthdr_out = (AOUTHDR *)out; | |
fbb61b50 | 626 | |
075caafd ILT |
627 | bfd_h_put_16(abfd, aouthdr_in->magic, (bfd_byte *) aouthdr_out->magic); |
628 | bfd_h_put_16(abfd, aouthdr_in->vstamp, (bfd_byte *) aouthdr_out->vstamp); | |
fbb61b50 SC |
629 | PUT_AOUTHDR_TSIZE (abfd, aouthdr_in->tsize, (bfd_byte *) aouthdr_out->tsize); |
630 | PUT_AOUTHDR_DSIZE (abfd, aouthdr_in->dsize, (bfd_byte *) aouthdr_out->dsize); | |
631 | PUT_AOUTHDR_BSIZE (abfd, aouthdr_in->bsize, (bfd_byte *) aouthdr_out->bsize); | |
632 | PUT_AOUTHDR_ENTRY (abfd, aouthdr_in->entry, (bfd_byte *) aouthdr_out->entry); | |
633 | PUT_AOUTHDR_TEXT_START (abfd, aouthdr_in->text_start, | |
634 | (bfd_byte *) aouthdr_out->text_start); | |
635 | PUT_AOUTHDR_DATA_START (abfd, aouthdr_in->data_start, | |
636 | (bfd_byte *) aouthdr_out->data_start); | |
075caafd ILT |
637 | #ifdef I960 |
638 | bfd_h_put_32(abfd, aouthdr_in->tagentries, (bfd_byte *) aouthdr_out->tagentries); | |
639 | #endif | |
fbb61b50 SC |
640 | |
641 | #ifdef MIPSECOFF | |
642 | bfd_h_put_32(abfd, aouthdr_in->bss_start, (bfd_byte *) aouthdr_out->bss_start); | |
643 | bfd_h_put_32(abfd, aouthdr_in->gp_value, (bfd_byte *) aouthdr_out->gp_value); | |
644 | bfd_h_put_32(abfd, aouthdr_in->gprmask, (bfd_byte *) aouthdr_out->gprmask); | |
645 | bfd_h_put_32(abfd, aouthdr_in->cprmask[0], (bfd_byte *) aouthdr_out->cprmask[0]); | |
646 | bfd_h_put_32(abfd, aouthdr_in->cprmask[1], (bfd_byte *) aouthdr_out->cprmask[1]); | |
647 | bfd_h_put_32(abfd, aouthdr_in->cprmask[2], (bfd_byte *) aouthdr_out->cprmask[2]); | |
648 | bfd_h_put_32(abfd, aouthdr_in->cprmask[3], (bfd_byte *) aouthdr_out->cprmask[3]); | |
649 | #endif | |
650 | ||
651 | #ifdef ALPHAECOFF | |
330595d0 ILT |
652 | /* FIXME: What does bldrev mean? */ |
653 | bfd_h_put_16(abfd, (bfd_vma) 2, (bfd_byte *) aouthdr_out->bldrev); | |
654 | bfd_h_put_16(abfd, (bfd_vma) 0, (bfd_byte *) aouthdr_out->padding); | |
fbb61b50 SC |
655 | bfd_h_put_64(abfd, aouthdr_in->bss_start, (bfd_byte *) aouthdr_out->bss_start); |
656 | bfd_h_put_64(abfd, aouthdr_in->gp_value, (bfd_byte *) aouthdr_out->gp_value); | |
657 | bfd_h_put_32(abfd, aouthdr_in->gprmask, (bfd_byte *) aouthdr_out->gprmask); | |
658 | bfd_h_put_32(abfd, aouthdr_in->fprmask, (bfd_byte *) aouthdr_out->fprmask); | |
659 | #endif | |
660 | ||
075caafd ILT |
661 | return sizeof(AOUTHDR); |
662 | } | |
663 | ||
664 | static void | |
665 | DEFUN(coff_swap_scnhdr_in,(abfd, ext, in), | |
666 | bfd *abfd AND | |
667 | PTR ext AND | |
668 | PTR in) | |
669 | { | |
670 | SCNHDR *scnhdr_ext = (SCNHDR *) ext; | |
671 | struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in; | |
075caafd | 672 | |
fbb61b50 SC |
673 | memcpy(scnhdr_int->s_name, scnhdr_ext->s_name, sizeof(scnhdr_int->s_name)); |
674 | scnhdr_int->s_vaddr = | |
675 | GET_SCNHDR_VADDR (abfd, (bfd_byte *) scnhdr_ext->s_vaddr); | |
676 | scnhdr_int->s_paddr = | |
677 | GET_SCNHDR_PADDR (abfd, (bfd_byte *) scnhdr_ext->s_paddr); | |
678 | scnhdr_int->s_size = | |
679 | GET_SCNHDR_SIZE (abfd, (bfd_byte *) scnhdr_ext->s_size); | |
680 | ||
681 | scnhdr_int->s_scnptr = | |
682 | GET_SCNHDR_SCNPTR (abfd, (bfd_byte *) scnhdr_ext->s_scnptr); | |
683 | scnhdr_int->s_relptr = | |
684 | GET_SCNHDR_RELPTR (abfd, (bfd_byte *) scnhdr_ext->s_relptr); | |
685 | scnhdr_int->s_lnnoptr = | |
686 | GET_SCNHDR_LNNOPTR (abfd, (bfd_byte *) scnhdr_ext->s_lnnoptr); | |
075caafd ILT |
687 | scnhdr_int->s_flags = bfd_h_get_32(abfd, (bfd_byte *) scnhdr_ext->s_flags); |
688 | #if defined(M88) | |
689 | scnhdr_int->s_nreloc = bfd_h_get_32(abfd, (bfd_byte *) scnhdr_ext->s_nreloc); | |
690 | scnhdr_int->s_nlnno = bfd_h_get_32(abfd, (bfd_byte *) scnhdr_ext->s_nlnno); | |
691 | #else | |
692 | scnhdr_int->s_nreloc = bfd_h_get_16(abfd, (bfd_byte *) scnhdr_ext->s_nreloc); | |
693 | scnhdr_int->s_nlnno = bfd_h_get_16(abfd, (bfd_byte *) scnhdr_ext->s_nlnno); | |
694 | #endif | |
695 | #ifdef I960 | |
696 | scnhdr_int->s_align = bfd_h_get_32(abfd, (bfd_byte *) scnhdr_ext->s_align); | |
697 | #endif | |
698 | } | |
330595d0 ILT |
699 | /* start-sanitize-mpw */ |
700 | #ifndef MPW_C | |
701 | /* end-sanitize-mpw */ | |
075caafd ILT |
702 | |
703 | static unsigned int | |
704 | DEFUN(coff_swap_scnhdr_out,(abfd, in, out), | |
705 | bfd *abfd AND | |
706 | PTR in AND | |
707 | PTR out) | |
708 | { | |
709 | struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *)in; | |
710 | SCNHDR *scnhdr_ext = (SCNHDR *)out; | |
fbb61b50 | 711 | |
075caafd | 712 | memcpy(scnhdr_ext->s_name, scnhdr_int->s_name, sizeof(scnhdr_int->s_name)); |
fbb61b50 SC |
713 | PUT_SCNHDR_VADDR (abfd, scnhdr_int->s_vaddr, |
714 | (bfd_byte *) scnhdr_ext->s_vaddr); | |
715 | PUT_SCNHDR_PADDR (abfd, scnhdr_int->s_paddr, | |
716 | (bfd_byte *) scnhdr_ext->s_paddr); | |
717 | PUT_SCNHDR_SIZE (abfd, scnhdr_int->s_size, | |
718 | (bfd_byte *) scnhdr_ext->s_size); | |
719 | PUT_SCNHDR_SCNPTR (abfd, scnhdr_int->s_scnptr, | |
720 | (bfd_byte *) scnhdr_ext->s_scnptr); | |
721 | PUT_SCNHDR_RELPTR (abfd, scnhdr_int->s_relptr, | |
722 | (bfd_byte *) scnhdr_ext->s_relptr); | |
723 | PUT_SCNHDR_LNNOPTR (abfd, scnhdr_int->s_lnnoptr, | |
724 | (bfd_byte *) scnhdr_ext->s_lnnoptr); | |
075caafd ILT |
725 | PUTWORD(abfd, scnhdr_int->s_flags, (bfd_byte *) scnhdr_ext->s_flags); |
726 | #if defined(M88) | |
727 | PUTWORD(abfd, scnhdr_int->s_nlnno, (bfd_byte *) scnhdr_ext->s_nlnno); | |
728 | PUTWORD(abfd, scnhdr_int->s_nreloc, (bfd_byte *) scnhdr_ext->s_nreloc); | |
729 | #else | |
730 | PUTHALF(abfd, scnhdr_int->s_nlnno, (bfd_byte *) scnhdr_ext->s_nlnno); | |
731 | PUTHALF(abfd, scnhdr_int->s_nreloc, (bfd_byte *) scnhdr_ext->s_nreloc); | |
732 | #endif | |
733 | ||
734 | #if defined(I960) | |
735 | PUTWORD(abfd, scnhdr_int->s_align, (bfd_byte *) scnhdr_ext->s_align); | |
736 | #endif | |
737 | return sizeof(SCNHDR); | |
738 | } | |
330595d0 ILT |
739 | /* start-sanitize-mpw */ |
740 | #else | |
741 | /* Same routine, but with some pre-expanded macros, so ^&%$#&! MPW C doesn't | |
742 | corrupt itself and then freak out. */ | |
743 | ||
744 | static unsigned int | |
745 | DEFUN(coff_swap_scnhdr_out,(abfd, in, out), | |
746 | bfd *abfd AND | |
747 | PTR in AND | |
748 | PTR out) | |
749 | { | |
750 | struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *)in; | |
751 | SCNHDR *scnhdr_ext = (SCNHDR *)out; | |
752 | ||
753 | memcpy(scnhdr_ext->s_name, scnhdr_int->s_name, sizeof(scnhdr_int->s_name)); | |
754 | bfd_h_put_32 (abfd, scnhdr_int->s_vaddr, | |
755 | (bfd_byte *) scnhdr_ext->s_vaddr); | |
756 | bfd_h_put_32 (abfd, scnhdr_int->s_paddr, | |
757 | (bfd_byte *) scnhdr_ext->s_paddr); | |
758 | bfd_h_put_32 (abfd, scnhdr_int->s_size, | |
759 | (bfd_byte *) scnhdr_ext->s_size); | |
760 | PUT_SCNHDR_SCNPTR (abfd, scnhdr_int->s_scnptr, | |
761 | (bfd_byte *) scnhdr_ext->s_scnptr); | |
762 | PUT_SCNHDR_RELPTR (abfd, scnhdr_int->s_relptr, | |
763 | (bfd_byte *) scnhdr_ext->s_relptr); | |
764 | PUT_SCNHDR_LNNOPTR (abfd, scnhdr_int->s_lnnoptr, | |
765 | (bfd_byte *) scnhdr_ext->s_lnnoptr); | |
766 | PUTWORD(abfd, scnhdr_int->s_flags, (bfd_byte *) scnhdr_ext->s_flags); | |
767 | #if defined(M88) | |
768 | PUTWORD(abfd, scnhdr_int->s_nlnno, (bfd_byte *) scnhdr_ext->s_nlnno); | |
769 | PUTWORD(abfd, scnhdr_int->s_nreloc, (bfd_byte *) scnhdr_ext->s_nreloc); | |
770 | #else | |
771 | PUTHALF(abfd, scnhdr_int->s_nlnno, (bfd_byte *) scnhdr_ext->s_nlnno); | |
772 | PUTHALF(abfd, scnhdr_int->s_nreloc, (bfd_byte *) scnhdr_ext->s_nreloc); | |
773 | #endif | |
774 | ||
775 | #if defined(I960) | |
776 | PUTWORD(abfd, scnhdr_int->s_align, (bfd_byte *) scnhdr_ext->s_align); | |
777 | #endif | |
778 | return sizeof(SCNHDR); | |
779 | } | |
780 | ||
781 | #endif | |
782 | /* end-sanitize-mpw */ |