diff options
author | Steve Chamberlain <sac@cygnus> | 1996-03-22 00:32:05 +0000 |
---|---|---|
committer | Steve Chamberlain <sac@cygnus> | 1996-03-22 00:32:05 +0000 |
commit | 51776a11a69e670c69a5f51c80d54c812b317425 (patch) | |
tree | b1bffdf659f42ff0321208f6eba0c2eef33fa041 /bfd/coffcode.h | |
parent | df928c8f28aab3867ae2283c7425d1a9480c20a1 (diff) | |
download | gdb-51776a11a69e670c69a5f51c80d54c812b317425.zip gdb-51776a11a69e670c69a5f51c80d54c812b317425.tar.gz gdb-51776a11a69e670c69a5f51c80d54c812b317425.tar.bz2 |
* coffcode.h (coff_write_object_contents): Allocate
buffers large enough for any FILEHDR or AOUTHDR.
Diffstat (limited to 'bfd/coffcode.h')
-rw-r--r-- | bfd/coffcode.h | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/bfd/coffcode.h b/bfd/coffcode.h index 80e655f..abdd119 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; |