/* Generic COFF swapping routines, for BFD.
- Copyright 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
+ Copyright 1990, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
{
FILHDR *filehdr_src = (FILHDR *) src;
struct internal_filehdr *filehdr_dst = (struct internal_filehdr *) dst;
+#ifdef COFF_ADJUST_FILEHDR_IN_PRE
+ COFF_ADJUST_FILEHDR_IN_PRE (abfd, src, dst);
+#endif
filehdr_dst->f_magic = bfd_h_get_16(abfd, (bfd_byte *) filehdr_src->f_magic);
filehdr_dst->f_nscns = bfd_h_get_16(abfd, (bfd_byte *)filehdr_src-> f_nscns);
filehdr_dst->f_timdat = bfd_h_get_32(abfd, (bfd_byte *)filehdr_src-> f_timdat);
filehdr_dst->f_target_id = bfd_h_get_16(abfd, (bfd_byte *)filehdr_src-> f_target_id);
#endif
/* end-sanitize-tic80 */
+
+#ifdef COFF_ADJUST_FILEHDR_IN_POST
+ COFF_ADJUST_FILEHDR_IN_POST (abfd, src, dst);
+#endif
}
static unsigned int
struct internal_filehdr *filehdr_in = (struct internal_filehdr *)in;
FILHDR *filehdr_out = (FILHDR *)out;
+#ifdef COFF_ADJUST_FILEHDR_OUT_PRE
+ COFF_ADJUST_FILEHDR_OUT_PRE (abfd, in, out);
+#endif
bfd_h_put_16(abfd, filehdr_in->f_magic, (bfd_byte *) filehdr_out->f_magic);
bfd_h_put_16(abfd, filehdr_in->f_nscns, (bfd_byte *) filehdr_out->f_nscns);
bfd_h_put_32(abfd, filehdr_in->f_timdat, (bfd_byte *) filehdr_out->f_timdat);
#endif
/* end-sanitize-tic80 */
+#ifdef COFF_ADJUST_FILEHDR_OUT_POST
+ COFF_ADJUST_FILEHDR_OUT_POST (abfd, in, out);
+#endif
return FILHSZ;
}
AUXENT *ext = (AUXENT *)ext1;
union internal_auxent *in = (union internal_auxent *)in1;
+#ifdef COFF_ADJUST_AUX_IN_PRE
+ COFF_ADJUST_AUX_IN_PRE (abfd, ext1, type, class, indx, numaux, in1);
+#endif
switch (class) {
case C_FILE:
if (ext->x_file.x_fname[0] == 0) {
memcpy (in->x_file.x_fname, ext->x_file.x_fname, FILNMLEN);
#endif
}
- return;
+ goto end;
/* RS/6000 "csect" auxents */
#ifdef RS6000COFF_C
in->x_csect.x_smclas = bfd_h_get_8 (abfd, ext->x_csect.x_smclas);
in->x_csect.x_stab = bfd_h_get_32 (abfd, ext->x_csect.x_stab);
in->x_csect.x_snstab = bfd_h_get_16 (abfd, ext->x_csect.x_snstab);
- return;
+ goto end;
}
break;
#endif
in->x_scn.x_associated = 0;
in->x_scn.x_comdat = 0;
- return;
+ goto end;
}
break;
}
in->x_sym.x_misc.x_lnsz.x_lnno = GET_LNSZ_LNNO(abfd, ext);
in->x_sym.x_misc.x_lnsz.x_size = GET_LNSZ_SIZE(abfd, ext);
}
+
+end:
+#ifdef COFF_ADJUST_AUX_IN_POST
+ COFF_ADJUST_AUX_IN_POST (abfd, ext1, type, class, indx, numaux, in1);
+#endif
}
static unsigned int
union internal_auxent *in = (union internal_auxent *)inp;
AUXENT *ext = (AUXENT *)extp;
+#ifdef COFF_ADJUST_AUX_OUT_PRE
+ COFF_ADJUST_AUX_OUT_PRE (abfd, inp, type, class, indx, numaux, extp);
+#endif
memset((PTR)ext, 0, AUXESZ);
switch (class) {
case C_FILE:
memcpy (ext->x_file.x_fname, in->x_file.x_fname, FILNMLEN);
#endif
}
- return AUXESZ;
+ goto end;
#ifdef RS6000COFF_C
/* RS/6000 "csect" auxents */
PUTBYTE (abfd, in->x_csect.x_smclas, ext->x_csect.x_smclas);
PUTWORD (abfd, in->x_csect.x_stab, ext->x_csect.x_stab);
PUTHALF (abfd, in->x_csect.x_snstab, ext->x_csect.x_snstab);
- return AUXESZ;
+ goto end;
}
break;
#endif
PUT_SCN_SCNLEN(abfd, in->x_scn.x_scnlen, ext);
PUT_SCN_NRELOC(abfd, in->x_scn.x_nreloc, ext);
PUT_SCN_NLINNO(abfd, in->x_scn.x_nlinno, ext);
- return AUXESZ;
+ goto end;
}
break;
}
PUT_LNSZ_SIZE (abfd, in->x_sym.x_misc.x_lnsz.x_size, ext);
}
+end:
+#ifdef COFF_ADJUST_AUX_OUT_POST
+ COFF_ADJUST_AUX_OUT_POST (abfd, inp, type, class, indx, numaux, extp);
+#endif
return AUXESZ;
}
SCNHDR *scnhdr_ext = (SCNHDR *) ext;
struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in;
+#ifdef COFF_ADJUST_SCNHDR_IN_PRE
+ COFF_ADJUST_SCNHDR_IN_PRE (abfd, ext, in);
+#endif
memcpy(scnhdr_int->s_name, scnhdr_ext->s_name, sizeof(scnhdr_int->s_name));
scnhdr_int->s_vaddr =
GET_SCNHDR_VADDR (abfd, (bfd_byte *) scnhdr_ext->s_vaddr);
#ifdef I960
scnhdr_int->s_align = bfd_h_get_32(abfd, (bfd_byte *) scnhdr_ext->s_align);
#endif
+#ifdef COFF_ADJUST_SCNHDR_IN_POST
+ COFF_ADJUST_SCNHDR_IN_POST (abfd, ext, in);
+#endif
}
static unsigned int
SCNHDR *scnhdr_ext = (SCNHDR *)out;
unsigned int ret = SCNHSZ;
+#ifdef COFF_ADJUST_SCNHDR_OUT_PRE
+ COFF_ADJUST_SCNHDR_OUT_PRE (abfd, in, out);
+#endif
memcpy(scnhdr_ext->s_name, scnhdr_int->s_name, sizeof(scnhdr_int->s_name));
PUT_SCNHDR_VADDR (abfd, scnhdr_int->s_vaddr,
#if defined(I960)
PUTWORD(abfd, scnhdr_int->s_align, (bfd_byte *) scnhdr_ext->s_align);
+#endif
+#ifdef COFF_ADJUST_SCNHDR_OUT_POST
+ COFF_ADJUST_SCNHDR_OUT_POST (abfd, in, out);
#endif
return ret;
}