* hppa.h (FLAG_STRICT): Correct comment.
[deliverable/binutils-gdb.git] / bfd / format.c
index 9d9ee86bac40939eb8f316570cdacdc7f26d02a6..4ccca2a3aa789492d7f418a5daf3c5eb5031c97b 100644 (file)
@@ -1,6 +1,6 @@
 /* Generic BFD support for file formats.
-   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1999, 2000, 2001, 2002, 2003
-   Free Software Foundation, Inc.
+   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1999, 2000, 2001, 2002,
+   2003, 2005 Free Software Foundation, Inc.
    Written by Cygnus Support.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -17,7 +17,7 @@
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
 
 /*
 SECTION
@@ -173,6 +173,14 @@ bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching)
          if (matching)
            free (matching_vector);
 
+         /* If the file was opened for update, then `output_has_begun'
+            some time ago when the file was created.  Do not recompute
+            sections sizes or alignments in _bfd_set_section_contents.
+            We can not set this flag until after checking the format,
+            because it will interfere with creation of BFD sections.  */
+         if (abfd->direction == both_direction)
+           abfd->output_has_begun = TRUE;
+
          return TRUE;                  /* File position has moved, BTW.  */
        }
 
@@ -245,16 +253,6 @@ bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching)
            matching_vector[match_count] = temp;
 
          match_count++;
-
-#ifdef GNU960
-         /* Big- and little-endian b.out archives look the same, but it
-            doesn't matter: there is no difference in their headers, and
-            member file byte orders will (I hope) be handled appropriately
-            by bfd.  Ditto for big and little coff archives.  And the 4
-            coff/b.out object formats are unambiguous.  So accept the
-            first match we find.  */
-         break;
-#endif
        }
       else if ((err = bfd_get_error ()) == bfd_error_wrong_object_format
               || err == bfd_error_file_ambiguously_recognized)
@@ -329,6 +327,14 @@ bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching)
       if (matching)
        free (matching_vector);
 
+      /* If the file was opened for update, then `output_has_begun'
+        some time ago when the file was created.  Do not recompute
+        sections sizes or alignments in _bfd_set_section_contents.
+        We can not set this flag until after checking the format,
+        because it will interfere with creation of BFD sections.  */
+      if (abfd->direction == both_direction)
+       abfd->output_has_begun = TRUE;
+
       return TRUE;                     /* File position has moved, BTW.  */
     }
 
This page took 0.038195 seconds and 4 git commands to generate.