From: Steve Chamberlain Date: Thu, 7 Oct 1993 19:24:22 +0000 (+0000) Subject: * coffswap.h: (bfd_swap_reloc_in): a symndx is signed. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fbb61b502967e8de312d978862eda40baf0bf615;p=binutils-gdb.git * coffswap.h: (bfd_swap_reloc_in): a symndx is signed. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index dfb512a661d..78d05b79ce7 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,7 @@ Thu Oct 7 10:50:38 1993 Steve Chamberlain (sac@phydeaux.cygnus.com) + * coffswap.h: (bfd_swap_reloc_in): a symndx is signed. + Make support for relaxing more generic. * reloc16.c: Add new target entry - bfd_coff_reloc16_estimate, fix bit rot. diff --git a/bfd/coffcode.h b/bfd/coffcode.h index e26f1be7f87..7ca1616606a 100644 --- a/bfd/coffcode.h +++ b/bfd/coffcode.h @@ -303,73 +303,82 @@ CODE_FRAGMENT * in styp_to_sec_flags(). */ static long -DEFUN(sec_to_styp_flags, (sec_name, sec_flags), - CONST char * sec_name AND - flagword sec_flags) +sec_to_styp_flags (sec_name, sec_flags) + CONST char *sec_name; + flagword sec_flags; { long styp_flags = 0; if (!strcmp(sec_name, _TEXT)) - { - styp_flags = STYP_TEXT; - } + { + styp_flags = STYP_TEXT; + } else if (!strcmp(sec_name, _DATA)) - { - styp_flags = STYP_DATA; + { + styp_flags = STYP_DATA; #ifdef TWO_DATA_SECS - } + } else if (!strcmp(sec_name, ".data2")) - { - styp_flags = STYP_DATA; + { + styp_flags = STYP_DATA; #endif /* TWO_DATA_SECS */ - } + } else if (!strcmp(sec_name, _BSS)) - { - styp_flags = STYP_BSS; + { + styp_flags = STYP_BSS; #ifdef _COMMENT - } + } else if (!strcmp(sec_name, _COMMENT)) - { - styp_flags = STYP_INFO; + { + styp_flags = STYP_INFO; #endif /* _COMMENT */ #ifdef _LIB - } + } else if (!strcmp(sec_name, _LIB)) - { - styp_flags = STYP_LIB; + { + styp_flags = STYP_LIB; #endif /* _LIB */ #ifdef _LIT - } + } else if (!strcmp (sec_name, _LIT)) - { - styp_flags = STYP_LIT; + { + styp_flags = STYP_LIT; #endif /* _LIT */ - - } + } + else if (!strcmp(sec_name, ".debug")) + { + styp_flags = STYP_INFO; + } + else if (!strcmp(sec_name, ".stab") + || !strncmp(sec_name, ".stabstr", 8)) + { + styp_flags = STYP_INFO; + } /* Try and figure out what it should be */ else if (sec_flags & SEC_CODE) - { - styp_flags = STYP_TEXT; - } + { + styp_flags = STYP_TEXT; + } else if (sec_flags & SEC_DATA) - { - styp_flags = STYP_DATA; - } + { + styp_flags = STYP_DATA; + } else if (sec_flags & SEC_READONLY) - { + { #ifdef STYP_LIT /* 29k readonly text/data section */ - styp_flags = STYP_LIT; + styp_flags = STYP_LIT; #else - styp_flags = STYP_TEXT; + styp_flags = STYP_TEXT; #endif /* STYP_LIT */ - } + } else if (sec_flags & SEC_LOAD) - { - styp_flags = STYP_TEXT; - } - else { - styp_flags = STYP_BSS; - } + { + styp_flags = STYP_TEXT; + } + else if (sec_flags & SEC_ALLOC) + { + styp_flags = STYP_BSS; + } #ifdef STYP_NOLOAD if (sec_flags & SEC_NEVER_LOAD) @@ -427,9 +436,11 @@ DEFUN(styp_to_sec_flags, (abfd, hdr), sec_flags |= SEC_ALLOC; } else if (styp_flags & STYP_INFO) - { - /* Nothing to do. */ - } + { + /* Assume that any informational section is primarily for debugging + and therefore a prime candidate for stripping. */ + sec_flags |= SEC_DEBUGGING; + } else { sec_flags |= SEC_ALLOC | SEC_LOAD; @@ -574,6 +585,12 @@ dependent COFF routines . bfd_byte *data, . unsigned int *src_ptr, . unsigned int *dst_ptr)); +. int (*_bfd_coff_reloc16_estimate) PARAMS (( +. asection *input_section, +. asymbol **symbols, +. arelent *r, +. unsigned int shrink)); +. .} bfd_coff_backend_data; . .#define coff_backend_info(abfd) ((bfd_coff_backend_data *) (abfd)->xvec->backend_data) @@ -650,6 +667,10 @@ dependent COFF routines .#define bfd_coff_reloc16_extra_cases(abfd, seclet, reloc, data, src_ptr, dst_ptr)\ . ((coff_backend_info (abfd)->_bfd_coff_reloc16_extra_cases)\ . (abfd, seclet, reloc, data, src_ptr, dst_ptr)) +. +.#define bfd_coff_reloc16_estimate(abfd, section, symbols, reloc, shrink)\ +. ((coff_backend_info (abfd)->_bfd_coff_reloc16_estimate)\ +. (section, symbols, reloc, shrink)) . */ @@ -688,6 +709,8 @@ DEFUN (coff_make_section_hook, (abfd, name), char *name) { #ifdef TWO_DATA_SECS + /* FIXME: This predates the call to bfd_make_section_anyway + in make_a_section_from_file, and can probably go away. */ /* On SCO a file created by the Microsoft assembler can have two .data sections. We use .data2 for the second one. */ if (strcmp (name, _DATA) == 0) @@ -1229,6 +1252,10 @@ DEFUN(coff_compute_section_file_positions,(abfd), sofar += AOUTSZ; sofar += abfd->section_count * SCNHSZ; +#ifdef USE_DISCARDED_SECTIONS_COUNT + /* Count any sections that were removed, so overall size doesn't change. */ + sofar += discarded_sections_count * SCNHSZ; +#endif for (current = abfd->sections; current != (asection *)NULL; current = current->next) { @@ -2240,6 +2267,21 @@ bfd *abfd; } #endif +#ifndef coff_reloc16_estimate +#define coff_reloc16_estimate dummy_reloc16_estimate + +static dummy_reloc16_estimate(input_section, symbols, reloc, shrink) + asection *input_section; + asymbol **symbols; + arelent *reloc; + int shrink; +{ + abort(); + +} + +#endif + #ifndef coff_reloc16_extra_cases #define coff_reloc16_extra_cases dummy_reloc16_extra_cases /* This works even if abort is not declared in any header file. */ @@ -2272,7 +2314,8 @@ static CONST bfd_coff_backend_data bfd_coff_std_swap_table = { coff_swap_filehdr_in, coff_swap_aouthdr_in, coff_swap_scnhdr_in, coff_bad_format_hook, coff_set_arch_mach_hook, coff_mkobject_hook, styp_to_sec_flags, coff_make_section_hook, coff_set_alignment_hook, - coff_slurp_symbol_table, symname_in_debug_hook, coff_reloc16_extra_cases + coff_slurp_symbol_table, symname_in_debug_hook, + coff_reloc16_extra_cases, coff_reloc16_estimate }; #define coff_core_file_failing_command _bfd_dummy_core_file_failing_command diff --git a/bfd/coffswap.h b/bfd/coffswap.h index ed1137eb64d..475387a0a32 100644 --- a/bfd/coffswap.h +++ b/bfd/coffswap.h @@ -1,5 +1,5 @@ /* Generic COFF swapping routines, for BFD. - Copyright 1990, 1991, 1992 Free Software Foundation, Inc. + Copyright 1990, 1991, 1992, 1993 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -81,6 +81,92 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #define PUT_LINENO_LNNO(abfd,val, ext) bfd_h_put_16(abfd,val, (bfd_byte *) (ext->l_lnno)); #endif +/* The f_symptr field in the filehdr is sometimes 64 bits. */ +#ifndef GET_FILEHDR_SYMPTR +#define GET_FILEHDR_SYMPTR bfd_h_get_32 +#endif +#ifndef PUT_FILEHDR_SYMPTR +#define PUT_FILEHDR_SYMPTR bfd_h_put_32 +#endif + +/* Some fields in the aouthdr are sometimes 64 bits. */ +#ifndef GET_AOUTHDR_TSIZE +#define GET_AOUTHDR_TSIZE bfd_h_get_32 +#endif +#ifndef PUT_AOUTHDR_TSIZE +#define PUT_AOUTHDR_TSIZE bfd_h_put_32 +#endif +#ifndef GET_AOUTHDR_DSIZE +#define GET_AOUTHDR_DSIZE bfd_h_get_32 +#endif +#ifndef PUT_AOUTHDR_DSIZE +#define PUT_AOUTHDR_DSIZE bfd_h_put_32 +#endif +#ifndef GET_AOUTHDR_BSIZE +#define GET_AOUTHDR_BSIZE bfd_h_get_32 +#endif +#ifndef PUT_AOUTHDR_BSIZE +#define PUT_AOUTHDR_BSIZE bfd_h_put_32 +#endif +#ifndef GET_AOUTHDR_ENTRY +#define GET_AOUTHDR_ENTRY bfd_h_get_32 +#endif +#ifndef PUT_AOUTHDR_ENTRY +#define PUT_AOUTHDR_ENTRY bfd_h_put_32 +#endif +#ifndef GET_AOUTHDR_TEXT_START +#define GET_AOUTHDR_TEXT_START bfd_h_get_32 +#endif +#ifndef PUT_AOUTHDR_TEXT_START +#define PUT_AOUTHDR_TEXT_START bfd_h_put_32 +#endif +#ifndef GET_AOUTHDR_DATA_START +#define GET_AOUTHDR_DATA_START bfd_h_get_32 +#endif +#ifndef PUT_AOUTHDR_DATA_START +#define PUT_AOUTHDR_DATA_START bfd_h_put_32 +#endif + +/* Some fields in the scnhdr are sometimes 64 bits. */ +#ifndef GET_SCNHDR_PADDR +#define GET_SCNHDR_PADDR bfd_h_get_32 +#endif +#ifndef PUT_SCNHDR_PADDR +#define PUT_SCNHDR_PADDR bfd_h_put_32 +#endif +#ifndef GET_SCNHDR_VADDR +#define GET_SCNHDR_VADDR bfd_h_get_32 +#endif +#ifndef PUT_SCNHDR_VADDR +#define PUT_SCNHDR_VADDR bfd_h_put_32 +#endif +#ifndef GET_SCNHDR_SIZE +#define GET_SCNHDR_SIZE bfd_h_get_32 +#endif +#ifndef PUT_SCNHDR_SIZE +#define PUT_SCNHDR_SIZE bfd_h_put_32 +#endif +#ifndef GET_SCNHDR_SCNPTR +#define GET_SCNHDR_SCNPTR bfd_h_get_32 +#endif +#ifndef PUT_SCNHDR_SCNPTR +#define PUT_SCNHDR_SCNPTR bfd_h_put_32 +#endif +#ifndef GET_SCNHDR_RELPTR +#define GET_SCNHDR_RELPTR bfd_h_get_32 +#endif +#ifndef PUT_SCNHDR_RELPTR +#define PUT_SCNHDR_RELPTR bfd_h_put_32 +#endif +#ifndef GET_SCNHDR_LNNOPTR +#define GET_SCNHDR_LNNOPTR bfd_h_get_32 +#endif +#ifndef PUT_SCNHDR_LNNOPTR +#define PUT_SCNHDR_LNNOPTR bfd_h_put_32 +#endif + +#ifndef NO_COFF_RELOCS + static void DEFUN(bfd_swap_reloc_in,(abfd, reloc_src, reloc_dst), bfd *abfd AND @@ -88,7 +174,7 @@ DEFUN(bfd_swap_reloc_in,(abfd, reloc_src, reloc_dst), struct internal_reloc *reloc_dst) { reloc_dst->r_vaddr = bfd_h_get_32(abfd, (bfd_byte *)reloc_src->r_vaddr); - reloc_dst->r_symndx = bfd_h_get_32(abfd, (bfd_byte *) reloc_src->r_symndx); + reloc_dst->r_symndx = bfd_h_get_signed_32(abfd, (bfd_byte *) reloc_src->r_symndx); #ifdef RS6000COFF_C reloc_dst->r_type = bfd_h_get_8(abfd, reloc_src->r_type); @@ -129,6 +215,8 @@ DEFUN(coff_swap_reloc_out,(abfd, src, dst), return sizeof(struct external_reloc); } +#endif /* NO_COFF_RELOCS */ + static void DEFUN(coff_swap_filehdr_in,(abfd, src, dst), bfd *abfd AND @@ -140,7 +228,8 @@ DEFUN(coff_swap_filehdr_in,(abfd, src, dst), 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_symptr = bfd_h_get_32(abfd, (bfd_byte *)filehdr_src-> f_symptr); + filehdr_dst->f_symptr = + GET_FILEHDR_SYMPTR (abfd, (bfd_byte *) filehdr_src->f_symptr); filehdr_dst->f_nsyms = bfd_h_get_32(abfd, (bfd_byte *)filehdr_src-> f_nsyms); filehdr_dst->f_opthdr = bfd_h_get_16(abfd, (bfd_byte *)filehdr_src-> f_opthdr); filehdr_dst->f_flags = bfd_h_get_16(abfd, (bfd_byte *)filehdr_src-> f_flags); @@ -157,7 +246,8 @@ DEFUN(coff_swap_filehdr_out,(abfd, in, out), 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); - bfd_h_put_32(abfd, filehdr_in->f_symptr, (bfd_byte *) filehdr_out->f_symptr); + PUT_FILEHDR_SYMPTR (abfd, (bfd_vma) filehdr_in->f_symptr, + (bfd_byte *) filehdr_out->f_symptr); bfd_h_put_32(abfd, filehdr_in->f_nsyms, (bfd_byte *) filehdr_out->f_nsyms); bfd_h_put_16(abfd, filehdr_in->f_opthdr, (bfd_byte *) filehdr_out->f_opthdr); bfd_h_put_16(abfd, filehdr_in->f_flags, (bfd_byte *) filehdr_out->f_flags); @@ -451,12 +541,19 @@ DEFUN(coff_swap_aouthdr_in,(abfd, aouthdr_ext1, aouthdr_int1), aouthdr_int->magic = bfd_h_get_16(abfd, (bfd_byte *) aouthdr_ext->magic); aouthdr_int->vstamp = bfd_h_get_16(abfd, (bfd_byte *) aouthdr_ext->vstamp); - aouthdr_int->tsize = bfd_h_get_32(abfd, (bfd_byte *) aouthdr_ext->tsize); - aouthdr_int->dsize = bfd_h_get_32(abfd, (bfd_byte *) aouthdr_ext->dsize); - aouthdr_int->bsize = bfd_h_get_32(abfd, (bfd_byte *) aouthdr_ext->bsize); - aouthdr_int->entry = bfd_h_get_32(abfd, (bfd_byte *) aouthdr_ext->entry); - aouthdr_int->text_start = bfd_h_get_32(abfd, (bfd_byte *) aouthdr_ext->text_start); - aouthdr_int->data_start = bfd_h_get_32(abfd, (bfd_byte *) aouthdr_ext->data_start); + aouthdr_int->tsize = + GET_AOUTHDR_TSIZE (abfd, (bfd_byte *) aouthdr_ext->tsize); + aouthdr_int->dsize = + GET_AOUTHDR_DSIZE (abfd, (bfd_byte *) aouthdr_ext->dsize); + aouthdr_int->bsize = + GET_AOUTHDR_BSIZE (abfd, (bfd_byte *) aouthdr_ext->bsize); + aouthdr_int->entry = + GET_AOUTHDR_ENTRY (abfd, (bfd_byte *) aouthdr_ext->entry); + aouthdr_int->text_start = + GET_AOUTHDR_TEXT_START (abfd, (bfd_byte *) aouthdr_ext->text_start); + aouthdr_int->data_start = + GET_AOUTHDR_DATA_START (abfd, (bfd_byte *) aouthdr_ext->data_start); + #ifdef I960 aouthdr_int->tagentries = bfd_h_get_32(abfd, (bfd_byte *) aouthdr_ext->tagentries); #endif @@ -474,6 +571,23 @@ DEFUN(coff_swap_aouthdr_in,(abfd, aouthdr_ext1, aouthdr_int1), aouthdr_int->o_modtype = bfd_h_get_16(abfd, aouthdr_ext->o_modtype); aouthdr_int->o_maxstack = bfd_h_get_32(abfd, aouthdr_ext->o_maxstack); #endif + +#ifdef MIPSECOFF + aouthdr_int->bss_start = bfd_h_get_32(abfd, aouthdr_ext->bss_start); + aouthdr_int->gp_value = bfd_h_get_32(abfd, aouthdr_ext->gp_value); + aouthdr_int->gprmask = bfd_h_get_32(abfd, aouthdr_ext->gprmask); + aouthdr_int->cprmask[0] = bfd_h_get_32(abfd, aouthdr_ext->cprmask[0]); + aouthdr_int->cprmask[1] = bfd_h_get_32(abfd, aouthdr_ext->cprmask[1]); + aouthdr_int->cprmask[2] = bfd_h_get_32(abfd, aouthdr_ext->cprmask[2]); + aouthdr_int->cprmask[3] = bfd_h_get_32(abfd, aouthdr_ext->cprmask[3]); +#endif + +#ifdef ALPHAECOFF + aouthdr_int->bss_start = bfd_h_get_64(abfd, aouthdr_ext->bss_start); + aouthdr_int->gp_value = bfd_h_get_64(abfd, aouthdr_ext->gp_value); + aouthdr_int->gprmask = bfd_h_get_32(abfd, aouthdr_ext->gprmask); + aouthdr_int->fprmask = bfd_h_get_32(abfd, aouthdr_ext->fprmask); +#endif } static unsigned int @@ -484,18 +598,39 @@ DEFUN(coff_swap_aouthdr_out,(abfd, in, out), { struct internal_aouthdr *aouthdr_in = (struct internal_aouthdr *)in; AOUTHDR *aouthdr_out = (AOUTHDR *)out; + bfd_h_put_16(abfd, aouthdr_in->magic, (bfd_byte *) aouthdr_out->magic); bfd_h_put_16(abfd, aouthdr_in->vstamp, (bfd_byte *) aouthdr_out->vstamp); - bfd_h_put_32(abfd, aouthdr_in->tsize, (bfd_byte *) aouthdr_out->tsize); - bfd_h_put_32(abfd, aouthdr_in->dsize, (bfd_byte *) aouthdr_out->dsize); - bfd_h_put_32(abfd, aouthdr_in->bsize, (bfd_byte *) aouthdr_out->bsize); - bfd_h_put_32(abfd, aouthdr_in->entry, (bfd_byte *) aouthdr_out->entry); - bfd_h_put_32(abfd, aouthdr_in->text_start, - (bfd_byte *) aouthdr_out->text_start); - bfd_h_put_32(abfd, aouthdr_in->data_start, (bfd_byte *) aouthdr_out->data_start); + PUT_AOUTHDR_TSIZE (abfd, aouthdr_in->tsize, (bfd_byte *) aouthdr_out->tsize); + PUT_AOUTHDR_DSIZE (abfd, aouthdr_in->dsize, (bfd_byte *) aouthdr_out->dsize); + PUT_AOUTHDR_BSIZE (abfd, aouthdr_in->bsize, (bfd_byte *) aouthdr_out->bsize); + PUT_AOUTHDR_ENTRY (abfd, aouthdr_in->entry, (bfd_byte *) aouthdr_out->entry); + PUT_AOUTHDR_TEXT_START (abfd, aouthdr_in->text_start, + (bfd_byte *) aouthdr_out->text_start); + PUT_AOUTHDR_DATA_START (abfd, aouthdr_in->data_start, + (bfd_byte *) aouthdr_out->data_start); #ifdef I960 bfd_h_put_32(abfd, aouthdr_in->tagentries, (bfd_byte *) aouthdr_out->tagentries); #endif + +#ifdef MIPSECOFF + bfd_h_put_32(abfd, aouthdr_in->bss_start, (bfd_byte *) aouthdr_out->bss_start); + bfd_h_put_32(abfd, aouthdr_in->gp_value, (bfd_byte *) aouthdr_out->gp_value); + bfd_h_put_32(abfd, aouthdr_in->gprmask, (bfd_byte *) aouthdr_out->gprmask); + bfd_h_put_32(abfd, aouthdr_in->cprmask[0], (bfd_byte *) aouthdr_out->cprmask[0]); + bfd_h_put_32(abfd, aouthdr_in->cprmask[1], (bfd_byte *) aouthdr_out->cprmask[1]); + bfd_h_put_32(abfd, aouthdr_in->cprmask[2], (bfd_byte *) aouthdr_out->cprmask[2]); + bfd_h_put_32(abfd, aouthdr_in->cprmask[3], (bfd_byte *) aouthdr_out->cprmask[3]); +#endif + +#ifdef ALPHAECOFF + bfd_h_put_32(abfd, 0, (bfd_byte *) aouthdr_out->padding); + bfd_h_put_64(abfd, aouthdr_in->bss_start, (bfd_byte *) aouthdr_out->bss_start); + bfd_h_put_64(abfd, aouthdr_in->gp_value, (bfd_byte *) aouthdr_out->gp_value); + bfd_h_put_32(abfd, aouthdr_in->gprmask, (bfd_byte *) aouthdr_out->gprmask); + bfd_h_put_32(abfd, aouthdr_in->fprmask, (bfd_byte *) aouthdr_out->fprmask); +#endif + return sizeof(AOUTHDR); } @@ -507,14 +642,21 @@ DEFUN(coff_swap_scnhdr_in,(abfd, ext, in), { SCNHDR *scnhdr_ext = (SCNHDR *) ext; struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in; - memcpy(scnhdr_int->s_name, scnhdr_ext->s_name, sizeof(scnhdr_int->s_name)); - scnhdr_int->s_vaddr = bfd_h_get_32(abfd, (bfd_byte *) scnhdr_ext->s_vaddr); - scnhdr_int->s_paddr = bfd_h_get_32(abfd, (bfd_byte *) scnhdr_ext->s_paddr); - scnhdr_int->s_size = bfd_h_get_32(abfd, (bfd_byte *) scnhdr_ext->s_size); - scnhdr_int->s_scnptr = bfd_h_get_32(abfd, (bfd_byte *) scnhdr_ext->s_scnptr); - scnhdr_int->s_relptr = bfd_h_get_32(abfd, (bfd_byte *) scnhdr_ext->s_relptr); - scnhdr_int->s_lnnoptr = bfd_h_get_32(abfd, (bfd_byte *) scnhdr_ext->s_lnnoptr); + 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); + scnhdr_int->s_paddr = + GET_SCNHDR_PADDR (abfd, (bfd_byte *) scnhdr_ext->s_paddr); + scnhdr_int->s_size = + GET_SCNHDR_SIZE (abfd, (bfd_byte *) scnhdr_ext->s_size); + + scnhdr_int->s_scnptr = + GET_SCNHDR_SCNPTR (abfd, (bfd_byte *) scnhdr_ext->s_scnptr); + scnhdr_int->s_relptr = + GET_SCNHDR_RELPTR (abfd, (bfd_byte *) scnhdr_ext->s_relptr); + scnhdr_int->s_lnnoptr = + GET_SCNHDR_LNNOPTR (abfd, (bfd_byte *) scnhdr_ext->s_lnnoptr); scnhdr_int->s_flags = bfd_h_get_32(abfd, (bfd_byte *) scnhdr_ext->s_flags); #if defined(M88) scnhdr_int->s_nreloc = bfd_h_get_32(abfd, (bfd_byte *) scnhdr_ext->s_nreloc); @@ -536,13 +678,20 @@ DEFUN(coff_swap_scnhdr_out,(abfd, in, out), { struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *)in; SCNHDR *scnhdr_ext = (SCNHDR *)out; + memcpy(scnhdr_ext->s_name, scnhdr_int->s_name, sizeof(scnhdr_int->s_name)); - PUTWORD(abfd, scnhdr_int->s_vaddr, (bfd_byte *) scnhdr_ext->s_vaddr); - PUTWORD(abfd, scnhdr_int->s_paddr, (bfd_byte *) scnhdr_ext->s_paddr); - PUTWORD(abfd, scnhdr_int->s_size, (bfd_byte *) scnhdr_ext->s_size); - PUTWORD(abfd, scnhdr_int->s_scnptr, (bfd_byte *) scnhdr_ext->s_scnptr); - PUTWORD(abfd, scnhdr_int->s_relptr, (bfd_byte *) scnhdr_ext->s_relptr); - PUTWORD(abfd, scnhdr_int->s_lnnoptr, (bfd_byte *) scnhdr_ext->s_lnnoptr); + PUT_SCNHDR_VADDR (abfd, scnhdr_int->s_vaddr, + (bfd_byte *) scnhdr_ext->s_vaddr); + PUT_SCNHDR_PADDR (abfd, scnhdr_int->s_paddr, + (bfd_byte *) scnhdr_ext->s_paddr); + PUT_SCNHDR_SIZE (abfd, scnhdr_int->s_size, + (bfd_byte *) scnhdr_ext->s_size); + PUT_SCNHDR_SCNPTR (abfd, scnhdr_int->s_scnptr, + (bfd_byte *) scnhdr_ext->s_scnptr); + PUT_SCNHDR_RELPTR (abfd, scnhdr_int->s_relptr, + (bfd_byte *) scnhdr_ext->s_relptr); + PUT_SCNHDR_LNNOPTR (abfd, scnhdr_int->s_lnnoptr, + (bfd_byte *) scnhdr_ext->s_lnnoptr); PUTWORD(abfd, scnhdr_int->s_flags, (bfd_byte *) scnhdr_ext->s_flags); #if defined(M88) PUTWORD(abfd, scnhdr_int->s_nlnno, (bfd_byte *) scnhdr_ext->s_nlnno);