+ /* We updated the timestamp successfully. */
+ return FALSE;
+}
+\f
+/* A coff armap looks like :
+ lARMAG
+ struct ar_hdr with name = '/'
+ number of symbols
+ offset of file for symbol 0
+ offset of file for symbol 1
+
+ offset of file for symbol n-1
+ symbol name 0
+ symbol name 1
+
+ symbol name n-1 */
+
+bfd_boolean
+coff_write_armap (bfd *arch,
+ unsigned int elength,
+ struct orl *map,
+ unsigned int symbol_count,
+ int stridx)
+{
+ /* The size of the ranlib is the number of exported symbols in the
+ archive * the number of bytes in an int, + an int for the count. */
+ unsigned int ranlibsize = (symbol_count * 4) + 4;
+ unsigned int stringsize = stridx;
+ unsigned int mapsize = stringsize + ranlibsize;
+ unsigned int archive_member_file_ptr;
+ bfd *current = arch->archive_head;
+ unsigned int count;
+ struct ar_hdr hdr;
+ int padit = mapsize & 1;
+
+ if (padit)
+ mapsize++;
+
+ /* Work out where the first object file will go in the archive. */
+ archive_member_file_ptr = (mapsize
+ + elength
+ + sizeof (struct ar_hdr)
+ + SARMAG);
+
+ memset (&hdr, ' ', sizeof (struct ar_hdr));
+ hdr.ar_name[0] = '/';
+ _bfd_ar_spacepad (hdr.ar_size, sizeof (hdr.ar_size), "%-10ld",
+ mapsize);
+ _bfd_ar_spacepad (hdr.ar_date, sizeof (hdr.ar_date), "%ld",
+ time (NULL));
+ /* This, at least, is what Intel coff sets the values to. */
+ _bfd_ar_spacepad (hdr.ar_uid, sizeof (hdr.ar_uid), "%ld", 0);
+ _bfd_ar_spacepad (hdr.ar_gid, sizeof (hdr.ar_gid), "%ld", 0);
+ _bfd_ar_spacepad (hdr.ar_mode, sizeof (hdr.ar_mode), "%-7lo", 0);
+ memcpy (hdr.ar_fmag, ARFMAG, 2);
+
+ /* Write the ar header for this item and the number of symbols. */
+ if (bfd_bwrite (&hdr, sizeof (struct ar_hdr), arch)
+ != sizeof (struct ar_hdr))
+ return FALSE;
+
+ if (!bfd_write_bigendian_4byte_int (arch, symbol_count))
+ return FALSE;
+
+ /* Two passes, first write the file offsets for each symbol -
+ remembering that each offset is on a two byte boundary. */
+
+ /* Write out the file offset for the file associated with each
+ symbol, and remember to keep the offsets padded out. */
+
+ current = arch->archive_head;
+ count = 0;
+ while (current != NULL && count < symbol_count)
+ {
+ /* For each symbol which is used defined in this object, write
+ out the object file's address in the archive. */
+
+ while (count < symbol_count && map[count].u.abfd == current)
+ {
+ if (!bfd_write_bigendian_4byte_int (arch, archive_member_file_ptr))
+ return FALSE;
+ count++;
+ }
+ /* Add size of this archive entry. */
+ archive_member_file_ptr += arelt_size (current) + sizeof (struct ar_hdr);
+ /* Remember aboout the even alignment. */
+ archive_member_file_ptr += archive_member_file_ptr % 2;
+ current = current->next;
+ }
+
+ /* Now write the strings themselves. */
+ for (count = 0; count < symbol_count; count++)
+ {
+ size_t len = strlen (*map[count].name) + 1;
+
+ if (bfd_bwrite (*map[count].name, len, arch) != len)
+ return FALSE;
+ }
+
+ /* The spec sez this should be a newline. But in order to be
+ bug-compatible for arc960 we use a null. */
+ if (padit)
+ {
+ if (bfd_bwrite ("", 1, arch) != 1)
+ return FALSE;