From 51776a11a69e670c69a5f51c80d54c812b317425 Mon Sep 17 00:00:00 2001 From: Steve Chamberlain Date: Fri, 22 Mar 1996 00:32:05 +0000 Subject: [PATCH] * coffcode.h (coff_write_object_contents): Allocate buffers large enough for any FILEHDR or AOUTHDR. --- bfd/ChangeLog | 17 +++++++++++++++++ bfd/coffcode.h | 30 ++++++++++++++++++++---------- 2 files changed, 37 insertions(+), 10 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 76becd75f85..98b69d4e3ff 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,15 @@ +Thu Mar 21 11:00:47 1996 steve chamberlain + + * coffcode.h (coff_write_object_contents): Allocate + buffers large enough for any FILEHDR or AOUTHDR. + +Thu Mar 21 16:28:17 1996 David Mosberger-Tang + + * ecofflink.c (lookup_line): New static function, renamed and + slighly changed from old _bfd_ecoff_locate_line. + (_bfd_ecoff_locate_line): Cache line number information. Use + lookup_line for actual lookup. + Thu Mar 21 14:59:11 1996 Michael Meissner * peicode.h (pe_print_pdata): Warn if the .pdata section is not a @@ -5,6 +17,11 @@ Thu Mar 21 14:59:11 1996 Michael Meissner Thu Mar 21 13:54:40 1996 Ian Lance Taylor + * ecoff.c (_bfd_ecoff_find_nearest_line): Use bfd_zalloc to + allocate ecoff_find_line, and don't initialize by hand. + * elf32-mips.c (mips_elf_find_nearest_line): Use bfd_zalloc for + mips_elf_find_line, and don't call memset. + * coffcode.h (coff_compute_section_file_positions): If not producing a final executable, don't consider sofar when aligning the section to the correct size. diff --git a/bfd/coffcode.h b/bfd/coffcode.h index 80e655fd555..abdd1199950 100644 --- a/bfd/coffcode.h +++ b/bfd/coffcode.h @@ -2060,9 +2060,15 @@ coff_compute_section_file_positions (abfd) #ifndef I960 /* make sure that this section is of the right size too */ - old_sofar = sofar; - sofar = BFD_ALIGN (sofar, 1 << current->alignment_power); - current->_raw_size += sofar - old_sofar; + if ((abfd->flags & EXEC_P) == 0) + current->_raw_size = BFD_ALIGN (current->_raw_size, + 1 << current->alignment_power); + else + { + old_sofar = sofar; + sofar = BFD_ALIGN (sofar, 1 << current->alignment_power); + current->_raw_size += sofar - old_sofar; + } #endif #ifdef _LIB @@ -2081,7 +2087,11 @@ coff_compute_section_file_positions (abfd) } -#ifndef RS6000COFF_C +#if 0 + +/* This can never work, because it is called too late--after the + section positions have been set. I can't figure out what it is + for, so I am going to disable it--Ian Taylor 20 March 1996. */ /* If .file, .text, .data, .bss symbols are missing, add them. */ /* @@ Should we only be adding missing symbols, or overriding the aux @@ -2151,9 +2161,7 @@ coff_add_missing_symbols (abfd) return true; } -#endif /* ! defined (RS6000COFF_C) */ - - +#endif /* 0 */ /* SUPPRESS 558 */ /* SUPPRESS 529 */ @@ -2542,7 +2550,7 @@ coff_write_object_contents (abfd) if (bfd_get_symcount (abfd) != 0) { int firstundef; -#ifndef RS6000COFF_C +#if 0 if (!coff_add_missing_symbols (abfd)) return false; #endif @@ -2687,14 +2695,16 @@ coff_write_object_contents (abfd) if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) return false; { - FILHDR buff; + char buff[FILHSZ]; coff_swap_filehdr_out (abfd, (PTR) & internal_f, (PTR) & buff); if (bfd_write ((PTR) & buff, 1, FILHSZ, abfd) != FILHSZ) return false; } if (abfd->flags & EXEC_P) { - AOUTHDR buff; + /* Note that peicode.h fills in a PEAOUTHDR, not an AOUTHDR. + include/coff/pe.h sets AOUTSZ == sizeof(PEAOUTHDR)) */ + char buff[AOUTSZ]; coff_swap_aouthdr_out (abfd, (PTR) & internal_a, (PTR) & buff); if (bfd_write ((PTR) & buff, 1, AOUTSZ, abfd) != AOUTSZ) return false; -- 2.30.2