* elf.c (bfd_elf_string_from_elf_section): Check for an invalid
[deliverable/binutils-gdb.git] / bfd / evax-egsd.c
index f5275a98567a40ea74bf5806f7e7fd5d1fbd4d56..8354b8b84ce7d6bbd8391d1bf0732f75eb70e3cf 100644 (file)
@@ -1,10 +1,10 @@
-/* evax-egsd.c -- BFD back-end for ALPHA EVAX (openVMS/AXP) files.
-   Copyright 1996 Free Software Foundation Inc.
+/* evax-egsd.c -- BFD back-end for ALPHA EVAX (openVMS/Alpha) files.
+   Copyright 1996, 1997 Free Software Foundation Inc.
 
    go and read the openVMS linker manual (esp. appendix B)
    if you don't know what's going on here :-)
 
-   Written by Klaus Kรคmpf (kkaempf@progis.de)
+   Written by Klaus K"ampf (kkaempf@progis.de)
    of proGIS Softwareentwicklung, Aachen, Germany
 
 This program is free software; you can redistribute it and/or modify
@@ -43,6 +43,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #define EVAX_BSS_NAME          "$BSS$"
 #define EVAX_READONLY_NAME     "$READONLY$"
 #define EVAX_LITERAL_NAME      "$LITERAL$"
+#define EVAX_COMMON_NAME       "$COMMON$"
+#define EVAX_LOCAL_NAME                "$LOCAL$"
 
 struct sec_flags_struct {
   char *name;                  /* name of section */
@@ -318,11 +320,12 @@ _bfd_evax_slurp_egsd (abfd)
              }
            else        /* symbol reference */
              {
-#if EVAX_DEBUG
-               evax_debug(3, "egsd sym ref #%d (%s, %04x=%s)\n", abfd->symcount, evax_rec+9, old_flags, flag2str(gsyflagdesc, old_flags));
-#endif
                 symbol->name =
                  _bfd_evax_save_counted_string ((char *)evax_rec+8);
+#if EVAX_DEBUG
+               evax_debug(3, "egsd sym ref #%d (%s, %04x=%s)\n", abfd->symcount,
+                          symbol->name, old_flags, flag2str(gsyflagdesc, old_flags));
+#endif
                 symbol->section = bfd_make_section (abfd, BFD_UND_SECTION_NAME);
              }
 
@@ -462,6 +465,10 @@ _bfd_evax_write_egsd (abfd)
            sname = EVAX_READONLY_NAME;
          else if ((*sname == 'l') && (strcmp (sname, "literal") == 0))
            sname = EVAX_LITERAL_NAME;
+         else if ((*sname == 'c') && (strcmp (sname, "comm") == 0))
+           sname = EVAX_COMMON_NAME;
+         else if ((*sname == 'l') && (strcmp (sname, "lcomm") == 0))
+           sname = EVAX_LOCAL_NAME;
        }
 
       _bfd_evax_output_begin (abfd, EGSD_S_C_PSC, -1);
@@ -496,6 +503,14 @@ _bfd_evax_write_egsd (abfd)
        }
       old_flags = symbol->flags;
 
+      if ((*(symbol->section->name+1) == 'c')
+        && (strcmp (symbol->section->name+1, "comm") == 0)
+        && (strcmp (symbol->name, ".comm") != 0))
+       old_flags |= BSF_GLOBAL;
+
+      if (old_flags & BSF_FILE)
+       continue;
+
       if (((old_flags & BSF_GLOBAL) == 0)              /* not xdef */
          && (!bfd_is_und_section (symbol->section)))   /* and not xref */
        continue;                                       /* dont output */
@@ -551,24 +566,7 @@ _bfd_evax_write_egsd (abfd)
              _bfd_evax_output_long (abfd, symbol->section->index);/* L_PSINDX, FIXME */
            }
        }
-      if (strlen ((char *)symbol->name) > 198)
-       {
-         (*_bfd_error_handler) ("Name '%s' too long\n", symbol->name);
-         abort ();
-       }
-      nptr = (char *)symbol->name;
-      uptr = uname;
-      while (*nptr)
-       {
-         if (islower (*nptr))
-           *uptr = toupper (*nptr);
-         else
-           *uptr = *nptr;
-         uptr++;
-         nptr++;
-       }
-      *uptr = 0;
-      _bfd_evax_output_counted (abfd, uname);
+      _bfd_evax_output_counted (abfd, _bfd_evax_length_hash_symbol (abfd, symbol->name));
 
       _bfd_evax_output_flush (abfd);
 
This page took 0.024677 seconds and 4 git commands to generate.