* archive.c (_bfd_generic_read_ar_hdr_mag): Simplify end-of-name test.
[binutils-gdb.git] / bfd / evax-etir.c
index 067af829bb9f73ba0ad0a4768c0a0b6f97771bd4..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
@@ -1172,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 */
 
@@ -1246,7 +1247,7 @@ _bfd_evax_write_etir (abfd)
                                                            ETIR_S_C_STO_GBL_LW,
                                                            -1);
                                    _bfd_evax_output_counted (abfd,
-                                                             _bfd_evax_case_hack_symbol (abfd, sym->name));
+                                                             _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))
@@ -1312,7 +1313,7 @@ _bfd_evax_write_etir (abfd)
                                                            ETIR_S_C_STO_GBL,
                                                            -1);
                                    _bfd_evax_output_counted (abfd,
-                                                             _bfd_evax_case_hack_symbol (abfd, sym->name));
+                                                             _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))
@@ -1374,29 +1375,11 @@ _bfd_evax_write_etir (abfd)
                                evax_output_long(abfd, (unsigned long)(sec->index));
                                evax_output_quad(abfd, (uquad)addr);
 
-                               evax_output_counted(abfd, _bfd_evax_case_hack_symbol (abfd, sym->name));
+                               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)
@@ -1412,12 +1395,32 @@ _bfd_evax_write_etir (abfd)
                                                       (unsigned long)PRIV(evax_linkage_index));
                                PRIV(evax_linkage_index) += 2;
                                _bfd_evax_output_counted (abfd,
-                                                         _bfd_evax_case_hack_symbol (abfd, sym->name));
+                                                         _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)
+                                 {
+                                   end_etir_record (abfd);
+                                   start_etir_record (abfd,
+                                                      section->index,
+                                                      vaddr, false);
+                                 }
+                               _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;
+
                            default:
                              (*_bfd_error_handler) ("Unhandled relocation %s",
                                                     (*rptr)->howto->name);