* archive.c (_bfd_generic_read_ar_hdr_mag): Simplify end-of-name test.
[binutils-gdb.git] / bfd / evax-etir.c
index b9c53bc5ddf9ee5ff621ba914a4b3e887e0bac31..187353b80683c11e5a0870293491f9840cb83ee8 100644 (file)
@@ -1,11 +1,11 @@
-/* evax-etir.c -- BFD back-end for ALPHA EVAX (openVMS/AXP) files.
-   Copyright 1996 Free Software Foundation, Inc.
+/* evax-etir.c -- BFD back-end for ALPHA EVAX (openVMS/Alpha) files.
+   Copyright 1996, 1997 Free Software Foundation, Inc.
    ETIR record handling functions
 
    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
@@ -875,7 +875,7 @@ etir_stc (abfd, cmd, ptr)
         arg:  */
 
     case ETIR_S_C_STC_NBH_PS:
-      (*_bfd_error_handler) ("ETIR_S_C_STC_xx: (%d) not supported", cmd);
+/* FIXME     (*_bfd_error_handler) ("ETIR_S_C_STC_xx: (%d) not supported", cmd); */
       break;
 
     default:
@@ -1121,8 +1121,6 @@ _bfd_evax_write_etir (abfd)
   asection *section;
   evax_section *sptr;
   int nextoffset;
-  char uname[200];
-  char *nptr, *uptr;
 
 #if EVAX_DEBUG
   evax_debug (2, "evax_write_etir(%p)\n", abfd);
@@ -1174,7 +1172,8 @@ _bfd_evax_write_etir (abfd)
 #endif
        }
 
-      if (section->flags & SEC_HAS_CONTENTS)
+      if ((section->flags & SEC_HAS_CONTENTS)
+       && (! bfd_is_com_section (section)))
        {
          bfd_vma vaddr;                /* virtual addr in section */
 
@@ -1247,19 +1246,8 @@ _bfd_evax_write_etir (abfd)
                                    _bfd_evax_output_begin (abfd,
                                                            ETIR_S_C_STO_GBL_LW,
                                                            -1);
-                                   uptr = uname;
-                                   nptr = (char *)sym->name;
-                                   while (*nptr)
-                                     {
-                                       if (islower (*nptr))
-                                         *uptr = toupper (*nptr);
-                                       else
-                                         *uptr = *nptr;
-                                       nptr++;
-                                       uptr++;
-                                     }
-                                   *uptr = 0;
-                                   _bfd_evax_output_counted (abfd, uname);
+                                   _bfd_evax_output_counted (abfd,
+                                                             _bfd_evax_length_hash_symbol (abfd, sym->name, EOBJ_S_C_SYMSIZ));
                                    _bfd_evax_output_flush (abfd);
                                  }
                                else if (bfd_is_abs_section (sym->section))
@@ -1324,19 +1312,8 @@ _bfd_evax_write_etir (abfd)
                                    _bfd_evax_output_begin (abfd,
                                                            ETIR_S_C_STO_GBL,
                                                            -1);
-                                   uptr = uname;
-                                   nptr = (char *)sym->name;
-                                   while (*nptr)
-                                     {
-                                       if (islower (*nptr))
-                                         *uptr = toupper (*nptr);
-                                       else
-                                         *uptr = *nptr;
-                                       nptr++;
-                                       uptr++;
-                                     }
-                                   *uptr = 0;
-                                   _bfd_evax_output_counted (abfd, uname);
+                                   _bfd_evax_output_counted (abfd,
+                                                             _bfd_evax_length_hash_symbol (abfd, sym->name, EOBJ_S_C_SYMSIZ));
                                    _bfd_evax_output_flush (abfd);
                                  }
                                else if (bfd_is_abs_section (sym->section))
@@ -1397,42 +1374,12 @@ _bfd_evax_write_etir (abfd)
                                evax_output_begin(abfd, ETIR_S_C_STO_HINT_GBL, -1);
                                evax_output_long(abfd, (unsigned long)(sec->index));
                                evax_output_quad(abfd, (uquad)addr);
-                               uptr = uname;
-                               nptr = (char *)(*(*rptr)->sym_ptr_ptr)->name;
-                               while (*nptr)
-                                 {
-                                   if (islower (*nptr))
-                                     *uptr = toupper (*nptr);
-                                   else
-                                     *uptr = *nptr;
-                                   nptr++;
-                                   uptr++;
-                                 }
-                               *uptr = 0;
 
-                               evax_output_counted(abfd, uname);
+                               evax_output_counted(abfd, _bfd_evax_length_hash_symbol (abfd, sym->name, EOBJ_S_C_SYMSIZ));
                                evax_output_flush(abfd);
 #endif
                              }
                              break;
-#if 0
-                           case ALPHA_R_BRADDR:
-                             break;
-                           case ALPHA_R_SREL16:
-                             break;
-                           case ALPHA_R_SREL32:
-                             break;
-                           case ALPHA_R_SREL64:
-                             break;
-                           case ALPHA_R_OP_PUSH:
-                             break;
-                           case ALPHA_R_OP_STORE:
-                             break;
-                           case ALPHA_R_OP_PSUB:
-                             break;
-                           case ALPHA_R_OP_PRSHIFT:
-                             break;
-#endif
                            case ALPHA_R_LINKAGE:
                              {
                                if (_bfd_evax_output_check (abfd, 64) < 0)
@@ -1447,20 +1394,29 @@ _bfd_evax_write_etir (abfd)
                                _bfd_evax_output_long (abfd,
                                                       (unsigned long)PRIV(evax_linkage_index));
                                PRIV(evax_linkage_index) += 2;
-                               uptr = uname;
-                               nptr = (char *)(*(*rptr)->sym_ptr_ptr)->name;
-                               while (*nptr)
+                               _bfd_evax_output_counted (abfd,
+                                                         _bfd_evax_length_hash_symbol (abfd, sym->name, EOBJ_S_C_SYMSIZ));
+                               _bfd_evax_output_byte (abfd, 0);
+                               _bfd_evax_output_flush (abfd);
+                             }
+                             break;
+
+                           case ALPHA_R_CODEADDR:
+                             {
+                               if (_bfd_evax_output_check (abfd,
+                                                           strlen((char *)sym->name))
+                                   < 0)
                                  {
-                                   if (islower (*nptr))
-                                     *uptr = toupper (*nptr);
-                                   else
-                                     *uptr = *nptr;
-                                   nptr++;
-                                   uptr++;
+                                   end_etir_record (abfd);
+                                   start_etir_record (abfd,
+                                                      section->index,
+                                                      vaddr, false);
                                  }
-                               *uptr = 0;
-                               _bfd_evax_output_counted (abfd, uname);
-                               _bfd_evax_output_byte (abfd, 0);
+                               _bfd_evax_output_begin (abfd,
+                                                       ETIR_S_C_STO_CA,
+                                                       -1);
+                               _bfd_evax_output_counted (abfd,
+                                                         _bfd_evax_length_hash_symbol (abfd, sym->name, EOBJ_S_C_SYMSIZ));
                                _bfd_evax_output_flush (abfd);
                              }
                              break;