* coffcode.h (coff_write_object_contents): Allocate
authorSteve Chamberlain <sac@cygnus>
Fri, 22 Mar 1996 00:32:05 +0000 (00:32 +0000)
committerSteve Chamberlain <sac@cygnus>
Fri, 22 Mar 1996 00:32:05 +0000 (00:32 +0000)
buffers large enough for any FILEHDR or AOUTHDR.

bfd/ChangeLog
bfd/coffcode.h

index 76becd75f85f802ab71ebd61ae05fd4bc82e71df..98b69d4e3ff22b16b4b5c230ea6510e6720f9a9a 100644 (file)
@@ -1,3 +1,15 @@
+Thu Mar 21 11:00:47 1996  steve chamberlain  <sac@slash.cygnus.com>
+
+       * 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  <davidm@azstarnet.com>
+
+       * 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  <meissner@tiktok.cygnus.com>
 
        * 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  <meissner@tiktok.cygnus.com>
 
 Thu Mar 21 13:54:40 1996  Ian Lance Taylor  <ian@cygnus.com>
 
+       * 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.
index 80e655fd555f161d5a5e403dbc268f50c98282bc..abdd1199950879483f7cb977ead6c9b1ca07a58f 100644 (file)
@@ -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;