Add prototypes for static functions.
[binutils-gdb.git] / bfd / evax-etir.c
index 067af829bb9f73ba0ad0a4768c0a0b6f97771bd4..3f7339b8fbdb9e168dc97f0ff7156b10b515b025 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, 1998 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
@@ -32,7 +32,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
        qw      quadword (8 byte, 64 bit)
        da      data stream  */
 
-#include <stdio.h>
 #include <ctype.h>
 
 #include "bfd.h"
@@ -300,7 +299,7 @@ etir_sta (abfd, cmd, ptr)
          psect = bfd_getl32 (ptr);
          if (psect >= PRIV(egsd_sec_count))
            {
-             (*_bfd_error_handler) ("Bad section index in ETIR_S_C_STA_PQ");
+             (*_bfd_error_handler) (_("Bad section index in ETIR_S_C_STA_PQ"));
              bfd_set_error (bfd_error_bad_value);
              return false;
            }
@@ -315,12 +314,12 @@ etir_sta (abfd, cmd, ptr)
       case ETIR_S_C_STA_MOD:
       case ETIR_S_C_STA_CKARG:
 
-       (*_bfd_error_handler) ("Unsupported STA cmd %d", cmd);
+       (*_bfd_error_handler) (_("Unsupported STA cmd %d"), cmd);
        return false;
       break;
 
       default:
-       (*_bfd_error_handler) ("Reserved STA cmd %d", cmd);
+       (*_bfd_error_handler) (_("Reserved STA cmd %d"), cmd);
        return false;
       break;
   }
@@ -431,7 +430,7 @@ etir_sto (abfd, cmd, ptr)
        entry = (evax_symbol_entry *)bfd_hash_lookup (PRIV(evax_symbol_table), name, false, false);
        if (entry == (evax_symbol_entry *)NULL)
          {
-           (*_bfd_error_handler) ("ETIR_S_C_STO_GBL: no symbol \"%s\"",
+           (*_bfd_error_handler) (_("ETIR_S_C_STO_GBL: no symbol \"%s\""),
                                   name);
            return false;
          }
@@ -452,7 +451,7 @@ etir_sto (abfd, cmd, ptr)
        entry = (evax_symbol_entry *) bfd_hash_lookup (PRIV(evax_symbol_table), name, false, false);
        if (entry == (evax_symbol_entry *)NULL)
          {
-           (*_bfd_error_handler) ("ETIR_S_C_STO_CA: no symbol \"%s\"",
+           (*_bfd_error_handler) (_("ETIR_S_C_STO_CA: no symbol \"%s\""),
                                   name);
            return false;
          }
@@ -465,7 +464,7 @@ etir_sto (abfd, cmd, ptr)
 
     case ETIR_S_C_STO_RB:
     case ETIR_S_C_STO_AB:
-      (*_bfd_error_handler) ("ETIR_S_C_STO_RB/AB: Not supported");
+      (*_bfd_error_handler) (_("ETIR_S_C_STO_RB/AB: Not supported"));
       break;
 
     /* store offset to psect: pop stack, add low 32 bits to base of psect
@@ -523,23 +522,23 @@ etir_sto (abfd, cmd, ptr)
       /* not supported  */
 
     case ETIR_S_C_STO_LP_PSB:
-      (*_bfd_error_handler) ("ETIR_S_C_STO_LP_PSB: Not supported");
+      (*_bfd_error_handler) (_("ETIR_S_C_STO_LP_PSB: Not supported"));
       break;
 
     /* */
 
     case ETIR_S_C_STO_HINT_GBL:
-      (*_bfd_error_handler) ("ETIR_S_C_STO_HINT_GBL: not implemented");
+      (*_bfd_error_handler) (_("ETIR_S_C_STO_HINT_GBL: not implemented"));
       break;
 
     /* */
 
     case ETIR_S_C_STO_HINT_PS:
-      (*_bfd_error_handler) ("ETIR_S_C_STO_HINT_PS: not implemented");
+      (*_bfd_error_handler) (_("ETIR_S_C_STO_HINT_PS: not implemented"));
       break;
 
     default:
-      (*_bfd_error_handler) ("Reserved STO cmd %d", cmd);
+      (*_bfd_error_handler) (_("Reserved STO cmd %d"), cmd);
       break;
     }
 
@@ -647,7 +646,7 @@ etir_opr (abfd, cmd, ptr)
 
     case ETIR_S_C_OPR_INSV:
       (void)_bfd_evax_pop (abfd, NULL);
-      (*_bfd_error_handler) ("ETIR_S_C_OPR_INSV: Not supported");
+      (*_bfd_error_handler) (_("ETIR_S_C_OPR_INSV: Not supported"));
       break;
 
     /* arithmetic shift  */
@@ -665,13 +664,13 @@ etir_opr (abfd, cmd, ptr)
       /* unsigned shift  */
 
     case ETIR_S_C_OPR_USH:
-      (*_bfd_error_handler) ("ETIR_S_C_OPR_USH: Not supported");
+      (*_bfd_error_handler) (_("ETIR_S_C_OPR_USH: Not supported"));
       break;
 
       /* rotate  */
 
     case ETIR_S_C_OPR_ROT:
-      (*_bfd_error_handler) ("ETIR_S_C_OPR_ROT: Not supported");
+      (*_bfd_error_handler) (_("ETIR_S_C_OPR_ROT: Not supported"));
       break;
 
       /* select  */
@@ -690,17 +689,17 @@ etir_opr (abfd, cmd, ptr)
       /* redefine symbol to current location  */
 
     case ETIR_S_C_OPR_REDEF:
-      (*_bfd_error_handler) ("ETIR_S_C_OPR_REDEF: Not supported");
+      (*_bfd_error_handler) (_("ETIR_S_C_OPR_REDEF: Not supported"));
       break;
 
       /* define a literal  */
 
     case ETIR_S_C_OPR_DFLIT:
-      (*_bfd_error_handler) ("ETIR_S_C_OPR_DFLIT: Not supported");
+      (*_bfd_error_handler) (_("ETIR_S_C_OPR_DFLIT: Not supported"));
       break;
 
     default:
-      (*_bfd_error_handler) ("Reserved OPR cmd %d", cmd);
+      (*_bfd_error_handler) (_("Reserved OPR cmd %d"), cmd);
       break;
     }
 
@@ -764,7 +763,7 @@ etir_ctl (abfd, cmd, ptr)
       break;
 
     default:
-      (*_bfd_error_handler) ("Reserved CTL cmd %d", cmd);
+      (*_bfd_error_handler) (_("Reserved CTL cmd %d"), cmd);
       break;
     }
   return true;
@@ -788,7 +787,7 @@ etir_stc (abfd, cmd, ptr)
         arg:  */
 
     case ETIR_S_C_STC_LP:
-      (*_bfd_error_handler) ("ETIR_S_C_STC_LP: not supported");
+      (*_bfd_error_handler) (_("ETIR_S_C_STC_LP: not supported"));
       break;
 
       /* 201 Store-conditional Linkage Pair with Procedure Signature
@@ -806,7 +805,7 @@ etir_stc (abfd, cmd, ptr)
         cs     global name  */
 
     case ETIR_S_C_STC_GBL:
-      (*_bfd_error_handler) ("ETIR_S_C_STC_GBL: not supported");
+      (*_bfd_error_handler) (_("ETIR_S_C_STC_GBL: not supported"));
       break;
 
       /* 203 Store-conditional Code Address at global address
@@ -814,7 +813,7 @@ etir_stc (abfd, cmd, ptr)
         cs     procedure name  */
 
     case ETIR_S_C_STC_GCA:
-      (*_bfd_error_handler) ("ETIR_S_C_STC_GCA: not supported");
+      (*_bfd_error_handler) (_("ETIR_S_C_STC_GCA: not supported"));
       break;
 
       /* 204 Store-conditional Address at psect + offset
@@ -823,7 +822,7 @@ etir_stc (abfd, cmd, ptr)
         qw     offset  */
 
     case ETIR_S_C_STC_PS:
-      (*_bfd_error_handler) ("ETIR_S_C_STC_PS: not supported");
+      (*_bfd_error_handler) (_("ETIR_S_C_STC_PS: not supported"));
       break;
 
       /* 205 Store-conditional NOP at address of global
@@ -1148,7 +1147,7 @@ _bfd_evax_write_etir (abfd)
 
          if ((i = section->reloc_count) <= 0)
            {
-             (*_bfd_error_handler) ("SEC_RELOC with no relocs in section %s",
+             (*_bfd_error_handler) (_("SEC_RELOC with no relocs in section %s"),
                                     section->name);
            }
 #if EVAX_DEBUG
@@ -1172,7 +1171,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 +1246,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 +1312,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 +1374,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,14 +1394,34 @@ _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",
+                             (*_bfd_error_handler) (_("Unhandled relocation %s"),
                                                     (*rptr)->howto->name);
                              break;
                            }