* targets.c (BFD_JUMP_TABLE_ARCHIVE): Add _update_armap_timestamp.
authorIan Lance Taylor <ian@airs.com>
Mon, 22 Aug 1994 21:20:12 +0000 (21:20 +0000)
committerIan Lance Taylor <ian@airs.com>
Mon, 22 Aug 1994 21:20:12 +0000 (21:20 +0000)
(bfd_target): Add field _bfd_update_armap_timestamp.
* bfd.c (bfd_update_armap_timestamp): Define.
* bfd-in2.h: Rebuilt.
* libbfd-in.h (_bfd_noarchive_update_armap_timestamp): Define.
(_bfd_archive_bsd_update_armap_timestamp): Declare.
(_bfd_archive_coff_update_armap_timestamp): Define.
* libbfd.h: Rebuilt.
* archive.c (_bfd_write_archive_contents): Call
bfd_update_armap_timestamp instead of checking for a BSD archive
and calling bsd_update_armap_timestamp.
(_bfd_archive_bsd_update_armap_timestamp): Rename from
_bsd_update_armap_timestamp.  Don't assume that armap_datepos is
already set.
* aout-target.h (MY_update_armap_timestamp): Define if not already
defined.
* coff-rs6000.c (rs6000coff_update_armap_timestamp): Define.
* ieee.c (ieee_update_armap_timestamp): Define.
* libecoff.h (_bfd_ecoff_update_armap_timestamp): Define.
* oasys.c (oasys_update_armap_timestamp): Define.
* som.c (som_update_armap_timestamp): Define.

bfd/ChangeLog
bfd/archive.c

index 22362cf68d93ccf97e06aff678d3b94642245a45..637ba74c66cd61eecfaa2bc8dcd0d4bbbe351cea 100644 (file)
@@ -1,5 +1,27 @@
 Mon Aug 22 12:26:42 1994  Ian Lance Taylor  (ian@sanguine.cygnus.com)
 
+       * targets.c (BFD_JUMP_TABLE_ARCHIVE): Add _update_armap_timestamp.
+       (bfd_target): Add field _bfd_update_armap_timestamp.
+       * bfd.c (bfd_update_armap_timestamp): Define.
+       * bfd-in2.h: Rebuilt.
+       * libbfd-in.h (_bfd_noarchive_update_armap_timestamp): Define.
+       (_bfd_archive_bsd_update_armap_timestamp): Declare.
+       (_bfd_archive_coff_update_armap_timestamp): Define.
+       * libbfd.h: Rebuilt.
+       * archive.c (_bfd_write_archive_contents): Call
+       bfd_update_armap_timestamp instead of checking for a BSD archive
+       and calling bsd_update_armap_timestamp.
+       (_bfd_archive_bsd_update_armap_timestamp): Rename from
+       _bsd_update_armap_timestamp.  Don't assume that armap_datepos is
+       already set.
+       * aout-target.h (MY_update_armap_timestamp): Define if not already
+       defined.
+       * coff-rs6000.c (rs6000coff_update_armap_timestamp): Define.
+       * ieee.c (ieee_update_armap_timestamp): Define.
+       * libecoff.h (_bfd_ecoff_update_armap_timestamp): Define.
+       * oasys.c (oasys_update_armap_timestamp): Define.
+       * som.c (som_update_armap_timestamp): Define.
+
        * hash.c: Copy string hash functions from aoutx.h.
        * aoutx.h: String hash functions moved to hash.c.  Retain
        simplified versions of add_to_stringtab and emit_stringtab.
index 9573994dc6d047c43fc9ecdc7f5d5bbd91f8b203..70a0d47d9e0eea074d7ac8a33cabc0c85c35d3c4 100644 (file)
@@ -183,7 +183,6 @@ static struct areltdata *bfd_ar_hdr_from_filesystem PARAMS ((bfd *abfd,
                                                             const char *));
 static boolean compute_and_write_armap PARAMS ((bfd *arch,
                                                unsigned int elength));
-static boolean bsd_update_armap_timestamp PARAMS ((bfd *arch));
 \f
 boolean
 _bfd_generic_mkarchive (abfd)
@@ -1589,20 +1588,7 @@ _bfd_write_archive_contents (arch)
   tries = 1;
   do
     {
-      /* FIXME!  This kludge is to avoid adding a member to the xvec,
-        while generating a small patch for Adobe.  FIXME!  The
-        update_armap_timestamp function call should be in the xvec,
-        thus:
-
-               if (bfd_update_armap_timestamp (arch) == true) break;
-                     ^
-
-         Instead, we check whether in a BSD archive, and call
-         directly. */
-
-      if (arch->xvec->write_armap != bsd_write_armap)
-       break;
-      if (bsd_update_armap_timestamp (arch) == true) /* FIXME!!!  Vector it */
+      if (bfd_update_armap_timestamp (arch) == true) /* FIXME!!!  Vector it */
        break;
       if (tries > 0)
        fprintf (stderr,
@@ -1693,7 +1679,7 @@ compute_and_write_armap (arch, elength)
                       flags & BSF_WEAK ||
                       flags & BSF_INDIRECT ||
                       bfd_is_com_section (sec))
-                     && (sec != &bfd_und_section))
+                     && ! bfd_is_und_section (sec))
                    {
                      size_t namelen;
                      struct orl *new_map;
@@ -1862,8 +1848,8 @@ bsd_write_armap (arch, elength, map, orl_count, stridx)
    Return true if the timestamp was OK, or an unusual problem happened.
    Return false if we updated the timestamp.  */
 
-static boolean
-bsd_update_armap_timestamp (arch)
+boolean
+_bfd_archive_bsd_update_armap_timestamp (arch)
      bfd *arch;
 {
   struct stat archstat;
@@ -1892,6 +1878,8 @@ bsd_update_armap_timestamp (arch)
       (hdr.ar_date)[i] = ' ';
 
   /* Write it into the file.  */
+  bfd_ardata (arch)->armap_datepos = (SARMAG
+                                     + offsetof (struct ar_hdr, ar_date[0]));
   if (bfd_seek (arch, bfd_ardata (arch)->armap_datepos, SEEK_SET) != 0
       || (bfd_write (hdr.ar_date, sizeof (hdr.ar_date), 1, arch)
          != sizeof (hdr.ar_date)))