From 919cf4b52cdf3d69e9fb5822ab7c6b5e26a8f148 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 27 Mar 1996 15:44:18 +0000 Subject: [PATCH] * coffswap.h (coff_swap_scnhdr_out): Include section name in overflow error messages. --- bfd/ChangeLog | 5 +++++ bfd/coffswap.h | 19 ++++++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index a44cc79..b771a81 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +Wed Mar 27 10:43:34 1996 Ian Lance Taylor + + * coffswap.h (coff_swap_scnhdr_out): Include section name in + overflow error messages. + Tue Mar 26 15:46:18 1996 Ian Lance Taylor * bfd.c (_bfd_default_error_handler): If _bfd_error_program_name diff --git a/bfd/coffswap.h b/bfd/coffswap.h index 75bbf32..44a1702 100644 --- a/bfd/coffswap.h +++ b/bfd/coffswap.h @@ -621,6 +621,7 @@ coff_swap_aouthdr_in (abfd, aouthdr_ext1, aouthdr_int1) aouthdr_int->o_algntext = bfd_h_get_16(abfd, aouthdr_ext->o_algntext); aouthdr_int->o_algndata = bfd_h_get_16(abfd, aouthdr_ext->o_algndata); aouthdr_int->o_modtype = bfd_h_get_16(abfd, aouthdr_ext->o_modtype); + aouthdr_int->o_cputype = bfd_h_get_16(abfd, aouthdr_ext->o_cputype); aouthdr_int->o_maxstack = bfd_h_get_32(abfd, aouthdr_ext->o_maxstack); aouthdr_int->o_maxdata = bfd_h_get_32(abfd, aouthdr_ext->o_maxdata); #endif @@ -678,9 +679,9 @@ coff_swap_aouthdr_out (abfd, in, out) bfd_h_put_16 (abfd, aouthdr_in->o_algntext, aouthdr_out->o_algntext); bfd_h_put_16 (abfd, aouthdr_in->o_algndata, aouthdr_out->o_algndata); bfd_h_put_16 (abfd, aouthdr_in->o_modtype, aouthdr_out->o_modtype); + bfd_h_put_16 (abfd, aouthdr_in->o_cputype, aouthdr_out->o_cputype); bfd_h_put_32 (abfd, aouthdr_in->o_maxstack, aouthdr_out->o_maxstack); bfd_h_put_32 (abfd, aouthdr_in->o_maxdata, aouthdr_out->o_maxdata); - memset (aouthdr_out->o_resv1, 0, sizeof aouthdr_out->o_resv1); memset (aouthdr_out->o_resv2, 0, sizeof aouthdr_out->o_resv2); #endif @@ -779,9 +780,13 @@ coff_swap_scnhdr_out (abfd, in, out) PUTHALF(abfd, scnhdr_int->s_nlnno, (bfd_byte *) scnhdr_ext->s_nlnno); else { - (*_bfd_error_handler) ("%s: line number overflow: 0x%lx > 0xffff", + char buf[sizeof (scnhdr_int->s_name) + 1]; + + memcpy (buf, scnhdr_int->s_name, sizeof (scnhdr_int->s_name)); + buf[sizeof (scnhdr_int->s_name)] = '\0'; + (*_bfd_error_handler) ("%s: %s: line number overflow: 0x%lx > 0xffff", bfd_get_filename (abfd), - scnhdr_int->s_nlnno); + buf, scnhdr_int->s_nlnno); bfd_set_error (bfd_error_file_truncated); PUTHALF (abfd, 0xffff, (bfd_byte *) scnhdr_ext->s_nlnno); ret = 0; @@ -790,9 +795,13 @@ coff_swap_scnhdr_out (abfd, in, out) PUTHALF(abfd, scnhdr_int->s_nreloc, (bfd_byte *) scnhdr_ext->s_nreloc); else { - (*_bfd_error_handler) ("%s: reloc overflow: 0x%lx > 0xffff", + char buf[sizeof (scnhdr_int->s_name) + 1]; + + memcpy (buf, scnhdr_int->s_name, sizeof (scnhdr_int->s_name)); + buf[sizeof (scnhdr_int->s_name)] = '\0'; + (*_bfd_error_handler) ("%s: %s: reloc overflow: 0x%lx > 0xffff", bfd_get_filename (abfd), - scnhdr_int->s_nreloc); + buf, scnhdr_int->s_nreloc); bfd_set_error (bfd_error_file_truncated); PUTHALF (abfd, 0xffff, (bfd_byte *) scnhdr_ext->s_nreloc); ret = 0; -- 2.7.4