* som.c: Include <ctype.h>.
authorIan Lance Taylor <ian@airs.com>
Wed, 6 May 1998 03:37:41 +0000 (03:37 +0000)
committerIan Lance Taylor <ian@airs.com>
Wed, 6 May 1998 03:37:41 +0000 (03:37 +0000)
* som.h: Don't include sysdep.h.

bfd/ChangeLog
bfd/som.c

index fdbbca66b285b6ce51bb9c4c0f22af0ebb7d2dbc..3896d2164d8b532f133fc7272153b034e8b13a61 100644 (file)
@@ -1,3 +1,8 @@
+Tue May  5 23:36:06 1998  Ian Lance Taylor  <ian@cygnus.com>
+
+       * som.c: Include <ctype.h>.
+       * som.h: Don't include sysdep.h.
+
 Tue May  5 18:29:24 1998  Tom Tromey  <tromey@cygnus.com>
 
        * libbfd.h: Rebuilt.
index 2a74377c637ca800e6b0d5b9a630ccb30cf2d5c2..34926cae98e5b0c7821a813e741f04e8c6541997 100644 (file)
--- a/bfd/som.c
+++ b/bfd/som.c
@@ -36,6 +36,7 @@
 #include <machine/reg.h>
 #include <sys/file.h>
 #include <errno.h>
+#include <ctype.h>
 
 /* Magic not defined in standard HP-UX header files until 8.0 */
 
@@ -250,8 +251,8 @@ static boolean som_bfd_prep_for_ar_write PARAMS ((bfd *, unsigned int *,
 static unsigned int som_bfd_ar_symbol_hash PARAMS ((asymbol *));
 static boolean som_bfd_ar_write_symbol_stuff PARAMS ((bfd *, unsigned int,
                                                      unsigned int,
-                                                     struct lst_header));
-static CONST char *normalize PARAMS ((CONST char *file));
+                                                     struct lst_header,
+                                                     unsigned int));
 static boolean som_is_space PARAMS ((asection *));
 static boolean som_is_subspace PARAMS ((asection *));
 static boolean som_is_container PARAMS ((asection *, asection *));
@@ -5044,7 +5045,7 @@ som_sizeof_headers (abfd, reloc)
      bfd *abfd;
      boolean reloc;
 {
-  (*_bfd_error_handler) ("som_sizeof_headers unimplemented");
+  (*_bfd_error_handler) (_("som_sizeof_headers unimplemented"));
   fflush (stderr);
   abort ();
   return (0);
@@ -5518,27 +5519,15 @@ som_bfd_ar_symbol_hash (symbol)
          | (symbol->name[len-2] << 8) | symbol->name[len-1];
 }
 
-static CONST char *
-normalize (file)
-     CONST char *file;
-{
-  CONST char *filename = strrchr (file, '/');
-
-  if (filename != NULL)
-    filename++;
-  else
-    filename = file;
-  return filename;
-}
-
 /* Do the bulk of the work required to write the SOM library
    symbol table.  */
    
 static boolean
-som_bfd_ar_write_symbol_stuff (abfd, nsyms, string_size, lst)
+som_bfd_ar_write_symbol_stuff (abfd, nsyms, string_size, lst, elength)
      bfd *abfd;
      unsigned int nsyms, string_size;
      struct lst_header lst;
+     unsigned elength;
 {
   file_ptr lst_filepos;
   char *strings = NULL, *p;
@@ -5547,8 +5536,7 @@ som_bfd_ar_write_symbol_stuff (abfd, nsyms, string_size, lst)
   unsigned int *hash_table = NULL;
   struct som_entry *som_dict = NULL;
   struct lst_symbol_record **last_hash_entry = NULL;
-  unsigned int curr_som_offset, som_index, extended_name_length = 0;
-  unsigned int maxname = abfd->xvec->ar_max_namelen;
+  unsigned int curr_som_offset, som_index = 0;
 
   hash_table =
     (unsigned int *) bfd_malloc (lst.hash_size * sizeof (unsigned int));
@@ -5584,28 +5572,17 @@ som_bfd_ar_write_symbol_stuff (abfd, nsyms, string_size, lst)
      describes.  We have to compute that information as we iterate
      through the SOMs/symbols.  */
   som_index = 0;
-  curr_som_offset = 8 + 2 * sizeof (struct ar_hdr) + lst.file_end;
 
-  /* Yow!  We have to know the size of the extended name table
-     too.  */
-  for (curr_bfd = abfd->archive_head;
-       curr_bfd != NULL;
-       curr_bfd = curr_bfd->next)
-    {
-      CONST char *normal = normalize (curr_bfd->filename);
-      unsigned int thislen;
-
-      if (!normal)
-       return false;
-      thislen = strlen (normal);
-      if (thislen > maxname)
-       extended_name_length += thislen + 2;
-    }
+  /* We add in the size of the archive header twice as the location
+     in the SOM dictionary is the actual offset of the SOM, not the
+     archive header before the SOM.  */
+  curr_som_offset = 8 + 2 * sizeof (struct ar_hdr) + lst.file_end;
 
   /* Make room for the archive header and the contents of the
-     extended string table.  */
-  if (extended_name_length)
-    curr_som_offset += extended_name_length + sizeof (struct ar_hdr);
+     extended string table.  Note that elength includes the size
+     of the archive header for the extended name table!  */
+  if (elength)
+    curr_som_offset += elength;
 
   /* Make sure we're properly aligned.  */
   curr_som_offset = (curr_som_offset + 0x1) & ~0x1;
@@ -5922,7 +5899,8 @@ som_write_armap (abfd, elength, map, orl_count, stridx)
     return false;
 
   /* Build and write the armap.  */
-  if (som_bfd_ar_write_symbol_stuff (abfd, nsyms, stringsize, lst) == false)
+  if (som_bfd_ar_write_symbol_stuff (abfd, nsyms, stringsize, lst, elength)
+      == false)
     return false;
   
   /* Done.  */
This page took 0.031115 seconds and 4 git commands to generate.