* cgen-asm.in (insert_normal): Handle empty fields and 64 bit hosts.
[deliverable/binutils-gdb.git] / bfd / evax-egsd.c
index cd1203996ddf381196fef2342d7ce513559f2a33..567fe46e1444e8001dc8db04437ba5e02853fb43 100644 (file)
@@ -1,5 +1,5 @@
 /* evax-egsd.c -- BFD back-end for ALPHA EVAX (openVMS/Alpha) files.
-   Copyright 1996, 1997 Free Software Foundation Inc.
+   Copyright 1996, 1997, 1998 Free Software Foundation Inc.
 
    go and read the openVMS linker manual (esp. appendix B)
    if you don't know what's going on here :-)
@@ -22,7 +22,6 @@ along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 
-#include <stdio.h>
 #include <ctype.h>
 
 #include "bfd.h"
@@ -55,7 +54,7 @@ struct sec_flags_struct {
   flagword flags_hassize;      /* flags we set if the section has a size > 0 */
 };
 
-/* These flags are deccrtl/vaxcrtl (openVMS 6.2) compatible  */  */
+/* These flags are deccrtl/vaxcrtl (openVMS 6.2) compatible  */
 
 static struct sec_flags_struct evax_section_flags[] = {
   { EVAX_ABS_NAME,
@@ -369,7 +368,7 @@ _bfd_evax_slurp_egsd (abfd)
          break;
 
        default:
-         (*_bfd_error_handler) ("unknown egsd subtype %d", gsd_type);
+         (*_bfd_error_handler) (_("unknown egsd subtype %d"), gsd_type);
          bfd_set_error (bfd_error_bad_value);
          return -1;
 
@@ -402,7 +401,6 @@ _bfd_evax_write_egsd (abfd)
   char dummy_name[10];
   char *sname;
   flagword new_flags, old_flags;
-  char uname[200];
   char *nptr, *uptr;
 
 #if EVAX_DEBUG
@@ -481,12 +479,20 @@ _bfd_evax_write_egsd (abfd)
          else if ((*sname == 'l') && (strcmp (sname, "lcomm") == 0))
            sname = EVAX_LOCAL_NAME;
        }
+      else
+       sname = _bfd_evax_length_hash_symbol (abfd, sname, EOBJ_S_C_SECSIZ);
 
       _bfd_evax_output_begin (abfd, EGSD_S_C_PSC, -1);
       _bfd_evax_output_short (abfd, section->alignment_power & 0xff);
-      _bfd_evax_output_short (abfd,
-                             evax_esecflag_by_name (sname,
-                                                    section->_raw_size));
+      if (bfd_is_com_section (section))
+       {
+         new_flags = (EGPS_S_V_OVR|EGPS_S_V_REL|EGPS_S_V_GBL|EGPS_S_V_RD|EGPS_S_V_WRT|EGPS_S_V_NOMOD|EGPS_S_V_COM);
+       }
+      else
+       {
+         new_flags = evax_esecflag_by_name (sname, section->_raw_size);
+       }
+      _bfd_evax_output_short (abfd, new_flags);
       _bfd_evax_output_long (abfd, section->_raw_size);
       _bfd_evax_output_counted (abfd, sname);
       _bfd_evax_output_flush (abfd);
@@ -514,15 +520,10 @@ _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 */
+      if (((old_flags & (BSF_GLOBAL|BSF_WEAK)) == 0)   /* not xdef */
          && (!bfd_is_und_section (symbol->section)))   /* and not xref */
        continue;                                       /* dont output */
 
@@ -542,14 +543,18 @@ _bfd_evax_write_egsd (abfd)
       _bfd_evax_output_short (abfd, 0);                        /* data type, alignment */
 
       new_flags = 0;
+
       if (old_flags & BSF_WEAK)
        new_flags |= EGSY_S_V_WEAK;
+      if (bfd_is_com_section (symbol->section))                /* .comm  */
+       new_flags |= (EGSY_S_V_WEAK|EGSY_S_V_COMM);
+
       if (old_flags & BSF_FUNCTION)
        {
          new_flags |= EGSY_S_V_NORM;
          new_flags |= EGSY_S_V_REL;
        }
-      if (old_flags & BSF_GLOBAL)
+      if (old_flags & (BSF_GLOBAL|BSF_WEAK))
        {
          new_flags |= EGSY_S_V_DEF;
          if (!bfd_is_abs_section (symbol->section))
@@ -557,7 +562,7 @@ _bfd_evax_write_egsd (abfd)
        }
       _bfd_evax_output_short (abfd, new_flags);
 
-      if (old_flags & BSF_GLOBAL)                      /* symbol definition */
+      if (old_flags & (BSF_GLOBAL|BSF_WEAK))           /* symbol definition */
        {
          if (old_flags & BSF_FUNCTION)
            {
@@ -574,10 +579,10 @@ _bfd_evax_write_egsd (abfd)
              _bfd_evax_output_quad (abfd, symbol->value);      /* L_VALUE */
              _bfd_evax_output_quad (abfd, 0);                  /* L_CODE_ADDRESS */
              _bfd_evax_output_long (abfd, 0);                  /* L_CA_PSINDX */
-             _bfd_evax_output_long (abfd, symbol->section->index);/* L_PSINDX, FIXME */
+             _bfd_evax_output_long (abfd, symbol->section->index);/* L_PSINDX */
            }
        }
-      _bfd_evax_output_counted (abfd, _bfd_evax_length_hash_symbol (abfd, symbol->name));
+      _bfd_evax_output_counted (abfd, _bfd_evax_length_hash_symbol (abfd, symbol->name, EOBJ_S_C_SYMSIZ));
 
       _bfd_evax_output_flush (abfd);
 
This page took 0.030322 seconds and 4 git commands to generate.