Ignore:
Timestamp:
Aug 16, 2003, 6:59:22 PM (22 years ago)
Author:
bird
Message:

binutils v2.14 - offical sources.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/GNU/src/binutils/bfd/vms-tir.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11/* vms-tir.c -- BFD back-end for VAX (openVMS/VAX) and
    22   EVAX (openVMS/Alpha) files.
    3    Copyright 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
     3   Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002
     4   Free Software Foundation, Inc.
    45
    56   TIR record handling functions
     
    1112   Written by Klaus K"ampf (kkaempf@rmi.de)
    1213
    13 This program is free software; you can redistribute it and/or modify
    14 it under the terms of the GNU General Public License as published by
    15 the Free Software Foundation; either version 2 of the License, or
    16 (at your option) any later version.
    17 
    18 This program is distributed in the hope that it will be useful,
    19 but WITHOUT ANY WARRANTY; without even the implied warranty of
    20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    21 GNU General Public License for more details.
    22 
    23 You should have received a copy of the GNU General Public License
    24 along with this program; if not, write to the Free Software
    25 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
     14   This program is free software; you can redistribute it and/or modify
     15   it under the terms of the GNU General Public License as published by
     16   the Free Software Foundation; either version 2 of the License, or
     17   (at your option) any later version.
     18
     19   This program is distributed in the hope that it will be useful,
     20   but WITHOUT ANY WARRANTY; without even the implied warranty of
     21   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     22   GNU General Public License for more details.
     23
     24   You should have received a copy of the GNU General Public License
     25   along with this program; if not, write to the Free Software
     26   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
    2627
    2728/* The following type abbreviations are used:
     
    3435        da      data stream  */
    3536
    36 #include <ctype.h>
    37 
    3837#include "bfd.h"
    3938#include "sysdep.h"
     
    4342#include "vms.h"
    4443
    45 static void image_set_ptr PARAMS ((bfd *abfd, int psect, uquad offset));
    46 static void image_inc_ptr PARAMS ((bfd *abfd, uquad offset));
    47 static void image_dump PARAMS ((bfd *abfd, unsigned char *ptr, int size, int offset));
    48 static void image_write_b PARAMS ((bfd *abfd, unsigned int value));
    49 static void image_write_w PARAMS ((bfd *abfd, unsigned int value));
    50 static void image_write_l PARAMS ((bfd *abfd, unsigned long value));
    51 static void image_write_q PARAMS ((bfd *abfd, uquad value));
    52 
    53 /*-----------------------------------------------------------------------------*/
     44static void image_set_ptr
     45  PARAMS ((bfd *abfd, int psect, uquad offset));
     46static void image_inc_ptr
     47  PARAMS ((bfd *abfd, uquad offset));
     48static void image_dump
     49  PARAMS ((bfd *abfd, unsigned char *ptr, int size, int offset));
     50static void image_write_b
     51  PARAMS ((bfd *abfd, unsigned int value));
     52static void image_write_w
     53  PARAMS ((bfd *abfd, unsigned int value));
     54static void image_write_l
     55  PARAMS ((bfd *abfd, unsigned long value));
     56static void image_write_q
     57  PARAMS ((bfd *abfd, uquad value));
     58static int check_section
     59  PARAMS ((bfd *, int));
     60static bfd_boolean etir_sta
     61  PARAMS ((bfd *, int, unsigned char *));
     62static bfd_boolean etir_sto
     63  PARAMS ((bfd *, int, unsigned char *));
     64static bfd_boolean etir_opr
     65  PARAMS ((bfd *, int, unsigned char *));
     66static bfd_boolean etir_ctl
     67  PARAMS ((bfd *, int, unsigned char *));
     68static bfd_boolean etir_stc
     69  PARAMS ((bfd *, int, unsigned char *));
     70static asection *new_section
     71  PARAMS ((bfd *, int));
     72static int alloc_section
     73  PARAMS ((bfd *, unsigned int));
     74static int etir_cmd
     75  PARAMS ((bfd *, int, unsigned char *));
     76static int analyze_tir
     77  PARAMS ((bfd *, unsigned char *, unsigned int));
     78static int analyze_etir
     79  PARAMS ((bfd *, unsigned char *, unsigned int));
     80static unsigned char * tir_opr
     81  PARAMS ((bfd *, unsigned char *));
     82static const char * tir_cmd_name
     83  PARAMS ((int));
     84static const char * cmd_name
     85  PARAMS ((int));
     86
     87
    5488
    5589static int
     
    5892     int size;
    5993{
    60   int offset;
    61 
    62   offset = PRIV(image_ptr) - PRIV(image_section)->contents;
    63   if ((bfd_size_type) (offset + size) > PRIV(image_section)->_raw_size)
     94  bfd_size_type offset;
     95
     96  offset = PRIV (image_ptr) - PRIV (image_section)->contents;
     97  if (offset + size > PRIV (image_section)->_raw_size)
    6498    {
    65       PRIV(image_section)->contents = bfd_realloc (PRIV(image_section)->contents, offset + size);
    66       if (PRIV(image_section)->contents == 0)
     99      PRIV (image_section)->contents
     100        = bfd_realloc (PRIV (image_section)->contents, offset + size);
     101      if (PRIV (image_section)->contents == 0)
    67102        {
    68103          (*_bfd_error_handler) (_("No Mem !"));
    69104          return -1;
    70105        }
    71       PRIV(image_section)->_raw_size = offset + size;
    72       PRIV(image_ptr) = PRIV(image_section)->contents + offset;
     106      PRIV (image_section)->_raw_size = offset + size;
     107      PRIV (image_ptr) = PRIV (image_section)->contents + offset;
    73108    }
    74109
     
    76111}
    77112
    78 /* routines to fill sections contents during tir/etir read */
    79 
    80 /* Initialize image buffer pointer to be filled  */
     113/* Routines to fill sections contents during tir/etir read. */
     114
     115/* Initialize image buffer pointer to be filled.  */
    81116
    82117static void
     
    88123#if VMS_DEBUG
    89124  _bfd_vms_debug (4, "image_set_ptr (%d=%s, %d)\n",
    90                 psect, PRIV(sections)[psect]->name, offset);
    91 #endif
    92 
    93   PRIV(image_ptr) = PRIV(sections)[psect]->contents + offset;
    94   PRIV(image_section) = PRIV(sections)[psect];
     125                  psect, PRIV (sections)[psect]->name, offset);
     126#endif
     127
     128  PRIV (image_ptr) = PRIV (sections)[psect]->contents + offset;
     129  PRIV (image_section) = PRIV (sections)[psect];
    95130  return;
    96131}
    97132
    98 /* Increment image buffer pointer by offset  */
     133/* Increment image buffer pointer by offset.  */
    99134
    100135static void
     
    107142#endif
    108143
    109   PRIV(image_ptr) += offset;
     144  PRIV (image_ptr) += offset;
    110145
    111146  return;
    112147}
    113148
    114 /* Dump multiple bytes to section image  */
     149/* Dump multiple bytes to section image.  */
    115150
    116151static void
     
    122157{
    123158#if VMS_DEBUG
    124   _bfd_vms_debug (8, "image_dump from (%p, %d) to (%p)\n", ptr, size, PRIV(image_ptr));
     159  _bfd_vms_debug (8, "image_dump from (%p, %d) to (%p)\n", ptr, size,
     160                  PRIV (image_ptr));
    125161  _bfd_hexdump (9, ptr, size, offset);
    126162#endif
    127163
    128   if (PRIV(is_vax) && check_section (abfd, size))
     164  if (PRIV (is_vax) && check_section (abfd, size))
    129165    return;
    130166
    131167  while (size-- > 0)
    132     *PRIV(image_ptr)++ = *ptr++;
     168    *PRIV (image_ptr)++ = *ptr++;
    133169  return;
    134170}
    135171
    136 /* Write byte to section image  */
     172/* Write byte to section image.  */
    137173
    138174static void
     
    142178{
    143179#if VMS_DEBUG
    144   _bfd_vms_debug (6, "image_write_b(%02x)\n", (int)value);
    145 #endif
    146 
    147   if (PRIV(is_vax) && check_section (abfd, 1))
     180  _bfd_vms_debug (6, "image_write_b(%02x)\n", (int) value);
     181#endif
     182
     183  if (PRIV (is_vax) && check_section (abfd, 1))
    148184    return;
    149185
    150   *PRIV(image_ptr)++ = (value & 0xff);
     186  *PRIV (image_ptr)++ = (value & 0xff);
    151187  return;
    152188}
    153189
    154 /* Write 2-byte word to image  */
     190/* Write 2-byte word to image.  */
    155191
    156192static void
     
    160196{
    161197#if VMS_DEBUG
    162   _bfd_vms_debug (6, "image_write_w(%04x)\n", (int)value);
    163 #endif
    164 
    165   if (PRIV(is_vax) && check_section (abfd, 2))
     198  _bfd_vms_debug (6, "image_write_w(%04x)\n", (int) value);
     199#endif
     200
     201  if (PRIV (is_vax) && check_section (abfd, 2))
    166202    return;
    167203
    168   bfd_putl16 (value, PRIV(image_ptr));
    169   PRIV(image_ptr) += 2;
     204  bfd_putl16 ((bfd_vma) value, PRIV (image_ptr));
     205  PRIV (image_ptr) += 2;
    170206
    171207  return;
    172208}
    173209
    174 /* Write 4-byte long to image  */
     210/* Write 4-byte long to image.  */
    175211
    176212static void
     
    183219#endif
    184220
    185   if (PRIV(is_vax) && check_section (abfd, 4))
     221  if (PRIV (is_vax) && check_section (abfd, 4))
    186222    return;
    187223
    188   bfd_putl32 (value, PRIV(image_ptr));
    189   PRIV(image_ptr) += 4;
     224  bfd_putl32 ((bfd_vma) value, PRIV (image_ptr));
     225  PRIV (image_ptr) += 4;
    190226
    191227  return;
    192228}
    193229
    194 /* Write 8-byte quad to image  */
     230/* Write 8-byte quad to image.  */
    195231
    196232static void
     
    203239#endif
    204240
    205   if (PRIV(is_vax) && check_section (abfd, 8))
     241  if (PRIV (is_vax) && check_section (abfd, 8))
    206242    return;
    207243
    208   bfd_putl64 (value, PRIV(image_ptr));
    209   PRIV(image_ptr) += 8;
     244  bfd_putl64 (value, PRIV (image_ptr));
     245  PRIV (image_ptr) += 8;
    210246
    211247  return;
     
    213249
    214250
    215 
     251static const char *
     252cmd_name (cmd)
     253     int cmd;
     254{
     255  switch (cmd)
     256    {
     257    case ETIR_S_C_STA_GBL: return "ETIR_S_C_STA_GBL";
     258    case ETIR_S_C_STA_PQ: return "ETIR_S_C_STA_PQ";
     259    case ETIR_S_C_STA_LI: return "ETIR_S_C_STA_LI";
     260    case ETIR_S_C_STA_MOD: return "ETIR_S_C_STA_MOD";
     261    case ETIR_S_C_STA_CKARG: return "ETIR_S_C_STA_CKARG";
     262    case ETIR_S_C_STO_B: return "ETIR_S_C_STO_B";
     263    case ETIR_S_C_STO_W: return "ETIR_S_C_STO_W";
     264    case ETIR_S_C_STO_GBL: return "ETIR_S_C_STO_GBL";
     265    case ETIR_S_C_STO_CA: return "ETIR_S_C_STO_CA";
     266    case ETIR_S_C_STO_RB: return "ETIR_S_C_STO_RB";
     267    case ETIR_S_C_STO_AB: return "ETIR_S_C_STO_AB";
     268    case ETIR_S_C_STO_GBL_LW: return "ETIR_S_C_STO_GBL_LW";
     269    case ETIR_S_C_STO_LP_PSB: return "ETIR_S_C_STO_LP_PSB";
     270    case ETIR_S_C_STO_HINT_GBL: return "ETIR_S_C_STO_HINT_GBL";
     271    case ETIR_S_C_STO_HINT_PS: return "ETIR_S_C_STO_HINT_PS";
     272    case ETIR_S_C_OPR_INSV: return "ETIR_S_C_OPR_INSV";
     273    case ETIR_S_C_OPR_USH: return "ETIR_S_C_OPR_USH";
     274    case ETIR_S_C_OPR_ROT: return "ETIR_S_C_OPR_ROT";
     275    case ETIR_S_C_OPR_REDEF: return "ETIR_S_C_OPR_REDEF";
     276    case ETIR_S_C_OPR_DFLIT: return "ETIR_S_C_OPR_DFLIT";
     277    case ETIR_S_C_STC_LP: return "ETIR_S_C_STC_LP";
     278    case ETIR_S_C_STC_GBL: return "ETIR_S_C_STC_GBL";
     279    case ETIR_S_C_STC_GCA: return "ETIR_S_C_STC_GCA";
     280    case ETIR_S_C_STC_PS: return "ETIR_S_C_STC_PS";
     281    case ETIR_S_C_STC_NBH_PS: return "ETIR_S_C_STC_NBH_PS";
     282    case ETIR_S_C_STC_NOP_GBL: return "ETIR_S_C_STC_NOP_GBL";
     283    case ETIR_S_C_STC_NOP_PS: return "ETIR_S_C_STC_NOP_PS";
     284    case ETIR_S_C_STC_BSR_GBL: return "ETIR_S_C_STC_BSR_GBL";
     285    case ETIR_S_C_STC_BSR_PS: return "ETIR_S_C_STC_BSR_PS";
     286    case ETIR_S_C_STC_LDA_GBL: return "ETIR_S_C_STC_LDA_GBL";
     287    case ETIR_S_C_STC_LDA_PS: return "ETIR_S_C_STC_LDA_PS";
     288    case ETIR_S_C_STC_BOH_GBL: return "ETIR_S_C_STC_BOH_GBL";
     289    case ETIR_S_C_STC_BOH_PS: return "ETIR_S_C_STC_BOH_PS";
     290    case ETIR_S_C_STC_NBH_GBL: return "ETIR_S_C_STC_NBH_GBL";
     291
     292    default:
     293      /* These names have not yet been added to this switch statement.  */
     294      abort ();
     295    }
     296}
    216297#define HIGHBIT(op) ((op & 0x80000000L) == 0x80000000L)
    217298
     
    223304   ptr points to data area in record
    224305
    225    see table B-8 of the openVMS linker manual  */
    226 
    227 static boolean
     306   see table B-8 of the openVMS linker manual.  */
     307
     308static bfd_boolean
    228309etir_sta (abfd, cmd, ptr)
    229310     bfd *abfd;
     
    234315#if VMS_DEBUG
    235316  _bfd_vms_debug (5, "etir_sta %d/%x\n", cmd, cmd);
    236   _bfd_hexdump (8, ptr, 16, (int)ptr);
     317  _bfd_hexdump (8, ptr, 16, (int) ptr);
    237318#endif
    238319
     
    242323
    243324      /* stack global
    244            arg: cs      symbol name
    245 
    246            stack 32 bit value of symbol (high bits set to 0)  */
    247 
    248       case ETIR_S_C_STA_GBL:
    249         {
    250           char *name;
    251           vms_symbol_entry *entry;
    252 
    253           name = _bfd_vms_save_counted_string (ptr);
    254           entry = (vms_symbol_entry *)
    255                   bfd_hash_lookup (PRIV(vms_symbol_table), name, false, false);
    256           if (entry == (vms_symbol_entry *)NULL)
    257             {
    258 #if VMS_DEBUG
    259               _bfd_vms_debug (3, "ETIR_S_C_STA_GBL: no symbol \"%s\"\n", name);
    260 #endif
    261               _bfd_vms_push (abfd, (uquad)0, -1);
    262             }
    263           else
    264             {
    265               _bfd_vms_push (abfd, (uquad) (entry->symbol->value), -1);
    266             }
    267         }
    268       break;
    269 
    270         /* stack longword
    271            arg: lw      value
    272 
    273            stack 32 bit value, sign extend to 64 bit  */
    274 
    275       case ETIR_S_C_STA_LW:
    276         _bfd_vms_push (abfd, (uquad)bfd_getl32 (ptr), -1);
    277       break;
    278 
    279         /* stack global
    280            arg: qw      value
    281 
    282            stack 64 bit value of symbol  */
    283 
    284       case ETIR_S_C_STA_QW:
    285         _bfd_vms_push (abfd, (uquad)bfd_getl64(ptr), -1);
    286       break;
    287 
    288         /* stack psect base plus quadword offset
    289            arg: lw      section index
    290                 qw      signed quadword offset (low 32 bits)
    291 
    292            stack qw argument and section index
    293            (see ETIR_S_C_STO_OFF, ETIR_S_C_CTL_SETRB)  */
    294 
    295       case ETIR_S_C_STA_PQ:
    296         {
    297           uquad dummy;
    298           unsigned int psect;
    299 
    300           psect = bfd_getl32 (ptr);
    301           if (psect >= PRIV(section_count))
    302             {
    303               (*_bfd_error_handler) (_("Bad section index in ETIR_S_C_STA_PQ"));
    304               bfd_set_error (bfd_error_bad_value);
    305               return false;
    306             }
    307           dummy = bfd_getl64 (ptr+4);
    308           _bfd_vms_push (abfd, dummy, psect);
    309         }
    310       break;
    311 
    312         /* all not supported  */
    313 
    314       case ETIR_S_C_STA_LI:
    315       case ETIR_S_C_STA_MOD:
    316       case ETIR_S_C_STA_CKARG:
    317 
    318         (*_bfd_error_handler) (_("Unsupported STA cmd %d"), cmd);
    319         return false;
    320       break;
    321 
    322       default:
    323         (*_bfd_error_handler) (_("Reserved STA cmd %d"), cmd);
    324         return false;
     325         arg: cs        symbol name
     326
     327         stack 32 bit value of symbol (high bits set to 0)  */
     328
     329    case ETIR_S_C_STA_GBL:
     330      {
     331        char *name;
     332        vms_symbol_entry *entry;
     333
     334        name = _bfd_vms_save_counted_string (ptr);
     335        entry = (vms_symbol_entry *)
     336          bfd_hash_lookup (PRIV (vms_symbol_table), name, FALSE, FALSE);
     337        if (entry == (vms_symbol_entry *) NULL)
     338          {
     339#if VMS_DEBUG
     340            _bfd_vms_debug (3, "%s: no symbol \"%s\"\n",
     341                            cmd_name (cmd), name);
     342#endif
     343            _bfd_vms_push (abfd, (uquad) 0, -1);
     344          }
     345        else
     346          {
     347            _bfd_vms_push (abfd, (uquad) (entry->symbol->value), -1);
     348          }
     349      }
     350      break;
     351
     352      /* stack longword
     353         arg: lw        value
     354
     355         stack 32 bit value, sign extend to 64 bit  */
     356
     357    case ETIR_S_C_STA_LW:
     358      _bfd_vms_push (abfd, (uquad) bfd_getl32 (ptr), -1);
     359      break;
     360
     361      /* stack global
     362         arg: qw        value
     363
     364         stack 64 bit value of symbol    */
     365
     366    case ETIR_S_C_STA_QW:
     367      _bfd_vms_push (abfd, (uquad) bfd_getl64 (ptr), -1);
     368      break;
     369
     370      /* stack psect base plus quadword offset
     371         arg: lw        section index
     372         qw     signed quadword offset (low 32 bits)
     373
     374         stack qw argument and section index
     375         (see ETIR_S_C_STO_OFF, ETIR_S_C_CTL_SETRB)  */
     376
     377    case ETIR_S_C_STA_PQ:
     378      {
     379        uquad dummy;
     380        unsigned int psect;
     381
     382        psect = bfd_getl32 (ptr);
     383        if (psect >= PRIV (section_count))
     384          {
     385            (*_bfd_error_handler) (_("bad section index in %s"),
     386                                   cmd_name (cmd));
     387            bfd_set_error (bfd_error_bad_value);
     388            return FALSE;
     389          }
     390        dummy = bfd_getl64 (ptr+4);
     391        _bfd_vms_push (abfd, dummy, (int) psect);
     392      }
     393      break;
     394
     395    case ETIR_S_C_STA_LI:
     396    case ETIR_S_C_STA_MOD:
     397    case ETIR_S_C_STA_CKARG:
     398      (*_bfd_error_handler) (_("unsupported STA cmd %s"), cmd_name (cmd));
     399      return FALSE;
     400      break;
     401
     402    default:
     403      (*_bfd_error_handler) (_("reserved STA cmd %d"), cmd);
     404      return FALSE;
    325405      break;
    326406    }
     
    328408  _bfd_vms_debug (5, "etir_sta true\n");
    329409#endif
    330   return true;
     410  return TRUE;
    331411}
    332412
     
    339419   ptr points to data area in record
    340420
    341    see table B-9 of the openVMS linker manual  */
    342 
    343 static boolean
     421   see table B-9 of the openVMS linker manual.  */
     422
     423static bfd_boolean
    344424etir_sto (abfd, cmd, ptr)
    345425     bfd *abfd;
     
    352432#if VMS_DEBUG
    353433  _bfd_vms_debug (5, "etir_sto %d/%x\n", cmd, cmd);
    354   _bfd_hexdump (8, ptr, 16, (int)ptr);
     434  _bfd_hexdump (8, ptr, 16, (int) ptr);
    355435#endif
    356436
    357437  switch (cmd)
    358438    {
    359 
    360439      /* store byte: pop stack, write byte
    361440         arg: -  */
     
    365444#if 0
    366445      if (is_share)             /* FIXME */
    367         (*_bfd_error_handler) ("ETIR_S_C_STO_B: byte fixups not supported");
    368 #endif
    369       image_write_b (abfd, dummy & 0xff);       /* FIXME: check top bits */
     446        (*_bfd_error_handler) ("%s: byte fixups not supported",
     447                               cmd_name (cmd));
     448#endif
     449      /* FIXME: check top bits */
     450      image_write_b (abfd, (unsigned int) dummy & 0xff);
    370451      break;
    371452
     
    377458#if 0
    378459      if (is_share)             /* FIXME */
    379         (*_bfd_error_handler) ("ETIR_S_C_STO_B: word fixups not supported");
    380 #endif
    381       image_write_w (abfd, dummy & 0xffff);     /* FIXME: check top bits */
     460        (*_bfd_error_handler) ("%s: word fixups not supported",
     461                               cmd_name (cmd));
     462#endif
     463      /* FIXME: check top bits */
     464      image_write_w (abfd, (unsigned int) dummy & 0xffff);
    382465      break;
    383466
     
    387470    case ETIR_S_C_STO_LW:
    388471      dummy = _bfd_vms_pop (abfd, &psect);
    389       dummy += (PRIV(sections)[psect])->vma;
    390       image_write_l (abfd, dummy & 0xffffffff);/* FIXME: check top bits */
     472      dummy += (PRIV (sections)[psect])->vma;
     473      /* FIXME: check top bits.  */
     474      image_write_l (abfd, (unsigned int) dummy & 0xffffffff);
    391475      break;
    392476
     
    396480    case ETIR_S_C_STO_QW:
    397481      dummy = _bfd_vms_pop (abfd, &psect);
    398       dummy += (PRIV(sections)[psect])->vma;
     482      dummy += (PRIV (sections)[psect])->vma;
    399483      image_write_q (abfd, dummy);              /* FIXME: check top bits */
    400484      break;
     
    406490    case ETIR_S_C_STO_IMMR:
    407491      {
    408         unsigned long size;
     492        int size;
    409493
    410494        size = bfd_getl32 (ptr);
    411         dummy = (unsigned long)_bfd_vms_pop (abfd, NULL);
    412         while (dummy-- > 0L)
     495        dummy = (unsigned long) _bfd_vms_pop (abfd, NULL);
     496        while (dummy-- > 0)
    413497          image_dump (abfd, ptr+4, size, 0);
    414498      }
     
    416500
    417501      /* store global: write symbol value
    418          arg: cs        global symbol name  */
     502         arg: cs        global symbol name.  */
    419503
    420504    case ETIR_S_C_STO_GBL:
     
    424508
    425509        name = _bfd_vms_save_counted_string (ptr);
    426         entry = (vms_symbol_entry *)bfd_hash_lookup (PRIV(vms_symbol_table), name, false, false);
    427         if (entry == (vms_symbol_entry *)NULL)
     510        entry = (vms_symbol_entry *) bfd_hash_lookup (PRIV (vms_symbol_table),
     511                                                      name, FALSE, FALSE);
     512        if (entry == (vms_symbol_entry *) NULL)
    428513          {
    429             (*_bfd_error_handler) (_("ETIR_S_C_STO_GBL: no symbol \"%s\""),
    430                                    name);
    431             return false;
     514            (*_bfd_error_handler) (_("%s: no symbol \"%s\""),
     515                                   cmd_name (cmd), name);
     516            return FALSE;
     517          }
     518        else
     519          /* FIXME, reloc.  */
     520          image_write_q (abfd, (uquad) (entry->symbol->value));
     521      }
     522      break;
     523
     524      /* store code address: write address of entry point
     525         arg: cs        global symbol name (procedure).  */
     526
     527    case ETIR_S_C_STO_CA:
     528      {
     529        vms_symbol_entry *entry;
     530        char *name;
     531
     532        name = _bfd_vms_save_counted_string (ptr);
     533        entry = (vms_symbol_entry *) bfd_hash_lookup (PRIV (vms_symbol_table),
     534                                                      name, FALSE, FALSE);
     535        if (entry == (vms_symbol_entry *) NULL)
     536          {
     537            (*_bfd_error_handler) (_("%s: no symbol \"%s\""),
     538                                   cmd_name (cmd), name);
     539            return FALSE;
    432540          }
    433541        else
     
    436544      break;
    437545
    438       /* store code address: write address of entry point
    439          arg: cs        global symbol name (procedure)  */
    440 
    441     case ETIR_S_C_STO_CA:
    442       {
    443         vms_symbol_entry *entry;
    444         char *name;
    445 
    446         name = _bfd_vms_save_counted_string (ptr);
    447         entry = (vms_symbol_entry *) bfd_hash_lookup (PRIV(vms_symbol_table), name, false, false);
    448         if (entry == (vms_symbol_entry *)NULL)
    449           {
    450             (*_bfd_error_handler) (_("ETIR_S_C_STO_CA: no symbol \"%s\""),
    451                                    name);
    452             return false;
    453           }
    454         else
    455           image_write_q (abfd, (uquad) (entry->symbol->value)); /* FIXME, reloc */
    456       }
    457       break;
    458 
    459       /* not supported  */
    460 
    461     case ETIR_S_C_STO_RB:
    462     case ETIR_S_C_STO_AB:
    463       (*_bfd_error_handler) (_("ETIR_S_C_STO_RB/AB: Not supported"));
    464       break;
    465 
    466     /* store offset to psect: pop stack, add low 32 bits to base of psect
    467        arg: -  */
     546      /* Store offset to psect: pop stack, add low 32 bits to base of psect
     547         arg: none.  */
    468548
    469549    case ETIR_S_C_STO_OFF:
    470550      {
    471551        uquad q;
    472         int psect;
    473 
    474         q = _bfd_vms_pop (abfd, &psect);
    475         q += (PRIV(sections)[psect])->vma;
     552        int psect1;
     553
     554        q = _bfd_vms_pop (abfd, &psect1);
     555        q += (PRIV (sections)[psect1])->vma;
    476556        image_write_q (abfd, q);
    477557      }
    478558      break;
    479559
    480       /* store immediate
     560      /* Store immediate
    481561         arg: lw        count of bytes
    482          da     data  */
     562              da        data.  */
    483563
    484564    case ETIR_S_C_STO_IMM:
     
    491571      break;
    492572
    493       /* this code is 'reserved to digital' according to the openVMS linker manual,
    494          however it is generated by the DEC C compiler and defined in the include file.
     573      /* This code is 'reserved to digital' according to the openVMS
     574         linker manual, however it is generated by the DEC C compiler
     575         and defined in the include file.
    495576         FIXME, since the following is just a guess
    496577         store global longword: store 32bit value of symbol
    497          arg: cs        symbol name  */
     578         arg: cs        symbol name.  */
    498579
    499580    case ETIR_S_C_STO_GBL_LW:
     
    503584
    504585        name = _bfd_vms_save_counted_string (ptr);
    505         entry = (vms_symbol_entry *)bfd_hash_lookup (PRIV(vms_symbol_table), name, false, false);
    506         if (entry == (vms_symbol_entry *)NULL)
     586        entry = (vms_symbol_entry *) bfd_hash_lookup (PRIV (vms_symbol_table),
     587                                                      name, FALSE, FALSE);
     588        if (entry == (vms_symbol_entry *) NULL)
    507589          {
    508590#if VMS_DEBUG
    509             _bfd_vms_debug (3, "ETIR_S_C_STO_GBL_LW: no symbol \"%s\"\n", name);
    510 #endif
    511             image_write_l (abfd, (unsigned long)0);     /* FIXME, reloc */
     591            _bfd_vms_debug (3, "%s: no symbol \"%s\"\n", cmd_name (cmd), name);
     592#endif
     593            image_write_l (abfd, (unsigned long) 0);    /* FIXME, reloc */
    512594          }
    513595        else
    514           image_write_l (abfd, (unsigned long) (entry->symbol->value)); /* FIXME, reloc */
     596          /* FIXME, reloc.  */
     597          image_write_l (abfd, (unsigned long) (entry->symbol->value));
    515598      }
    516599      break;
    517600
    518       /* not supported  */
    519 
     601    case ETIR_S_C_STO_RB:
     602    case ETIR_S_C_STO_AB:
    520603    case ETIR_S_C_STO_LP_PSB:
    521       (*_bfd_error_handler) (_("ETIR_S_C_STO_LP_PSB: Not supported"));
    522       break;
    523 
    524     /* */
     604      (*_bfd_error_handler) (_("%s: not supported"), cmd_name (cmd));
     605      break;
    525606
    526607    case ETIR_S_C_STO_HINT_GBL:
    527       (*_bfd_error_handler) (_("ETIR_S_C_STO_HINT_GBL: not implemented"));
    528       break;
    529 
    530     /* */
    531 
    532608    case ETIR_S_C_STO_HINT_PS:
    533       (*_bfd_error_handler) (_("ETIR_S_C_STO_HINT_PS: not implemented"));
     609      (*_bfd_error_handler) (_("%s: not implemented"), cmd_name (cmd));
    534610      break;
    535611
    536612    default:
    537       (*_bfd_error_handler) (_("Reserved STO cmd %d"), cmd);
     613      (*_bfd_error_handler) (_("reserved STO cmd %d"), cmd);
    538614      break;
    539615    }
    540616
    541   return true;
    542 }
    543 
    544 /* stack operator commands
     617  return TRUE;
     618}
     619
     620/* Stack operator commands
    545621   all 32 bit signed arithmetic
    546622   all word just like a stack calculator
    547623   arguments are popped from stack, results are pushed on stack
    548624
    549    see table B-10 of the openVMS linker manual  */
    550 
    551 static boolean
     625   see table B-10 of the openVMS linker manual.  */
     626
     627static bfd_boolean
    552628etir_opr (abfd, cmd, ptr)
    553629     bfd *abfd;
     
    559635#if VMS_DEBUG
    560636  _bfd_vms_debug (5, "etir_opr %d/%x\n", cmd, cmd);
    561   _bfd_hexdump (8, ptr, 16, (int)ptr);
     637  _bfd_hexdump (8, ptr, 16, (int) ptr);
    562638#endif
    563639
    564640  switch (cmd)
    565641    {
    566       /* operation */
    567 
    568       /* no-op  */
    569 
    570     case ETIR_S_C_OPR_NOP:
    571       break;
    572 
    573       /* add  */
    574 
    575     case ETIR_S_C_OPR_ADD:
    576       op1 = (long)_bfd_vms_pop (abfd, NULL);
    577       op2 = (long)_bfd_vms_pop (abfd, NULL);
     642    case ETIR_S_C_OPR_NOP:      /* no-op  */
     643      break;
     644
     645    case ETIR_S_C_OPR_ADD:      /* add  */
     646      op1 = (long) _bfd_vms_pop (abfd, NULL);
     647      op2 = (long) _bfd_vms_pop (abfd, NULL);
    578648      _bfd_vms_push (abfd, (uquad) (op1 + op2), -1);
    579649      break;
    580650
    581       /* subtract  */
    582 
    583     case ETIR_S_C_OPR_SUB:
    584       op1 = (long)_bfd_vms_pop (abfd, NULL);
    585       op2 = (long)_bfd_vms_pop (abfd, NULL);
     651    case ETIR_S_C_OPR_SUB:      /* subtract  */
     652      op1 = (long) _bfd_vms_pop (abfd, NULL);
     653      op2 = (long) _bfd_vms_pop (abfd, NULL);
    586654      _bfd_vms_push (abfd, (uquad) (op2 - op1), -1);
    587655      break;
    588656
    589       /* multiply  */
    590 
    591     case ETIR_S_C_OPR_MUL:
    592       op1 = (long)_bfd_vms_pop (abfd, NULL);
    593       op2 = (long)_bfd_vms_pop (abfd, NULL);
     657    case ETIR_S_C_OPR_MUL:      /* multiply  */
     658      op1 = (long) _bfd_vms_pop (abfd, NULL);
     659      op2 = (long) _bfd_vms_pop (abfd, NULL);
    594660      _bfd_vms_push (abfd, (uquad) (op1 * op2), -1);
    595661      break;
    596662
    597       /* divide  */
    598 
    599     case ETIR_S_C_OPR_DIV:
    600       op1 = (long)_bfd_vms_pop (abfd, NULL);
    601       op2 = (long)_bfd_vms_pop (abfd, NULL);
     663    case ETIR_S_C_OPR_DIV:      /* divide  */
     664      op1 = (long) _bfd_vms_pop (abfd, NULL);
     665      op2 = (long) _bfd_vms_pop (abfd, NULL);
    602666      if (op2 == 0)
    603         _bfd_vms_push (abfd, (uquad)0L, -1);
     667        _bfd_vms_push (abfd, (uquad) 0, -1);
    604668      else
    605669        _bfd_vms_push (abfd, (uquad) (op2 / op1), -1);
    606670      break;
    607671
    608       /* logical and  */
    609 
    610     case ETIR_S_C_OPR_AND:
    611       op1 = (long)_bfd_vms_pop (abfd, NULL);
    612       op2 = (long)_bfd_vms_pop (abfd, NULL);
     672    case ETIR_S_C_OPR_AND:      /* logical and  */
     673      op1 = (long) _bfd_vms_pop (abfd, NULL);
     674      op2 = (long) _bfd_vms_pop (abfd, NULL);
    613675      _bfd_vms_push (abfd, (uquad) (op1 & op2), -1);
    614676      break;
    615677
    616       /* logical inclusive or    */
    617 
    618     case ETIR_S_C_OPR_IOR:
    619       op1 = (long)_bfd_vms_pop (abfd, NULL);
    620       op2 = (long)_bfd_vms_pop (abfd, NULL);
     678    case ETIR_S_C_OPR_IOR:      /* logical inclusive or  */
     679      op1 = (long) _bfd_vms_pop (abfd, NULL);
     680      op2 = (long) _bfd_vms_pop (abfd, NULL);
    621681      _bfd_vms_push (abfd, (uquad) (op1 | op2), -1);
    622682      break;
    623683
    624       /* logical exclusive or  */
    625 
    626     case ETIR_S_C_OPR_EOR:
    627       op1 = (long)_bfd_vms_pop (abfd, NULL);
    628       op2 = (long)_bfd_vms_pop (abfd, NULL);
     684    case ETIR_S_C_OPR_EOR:      /* logical exclusive or  */
     685      op1 = (long) _bfd_vms_pop (abfd, NULL);
     686      op2 = (long) _bfd_vms_pop (abfd, NULL);
    629687      _bfd_vms_push (abfd, (uquad) (op1 ^ op2), -1);
    630688      break;
    631689
    632       /* negate  */
    633 
    634     case ETIR_S_C_OPR_NEG:
    635       op1 = (long)_bfd_vms_pop (abfd, NULL);
     690    case ETIR_S_C_OPR_NEG:      /* negate  */
     691      op1 = (long) _bfd_vms_pop (abfd, NULL);
    636692      _bfd_vms_push (abfd, (uquad) (-op1), -1);
    637693      break;
    638694
    639       /* complement  */
    640 
    641     case ETIR_S_C_OPR_COM:
    642       op1 = (long)_bfd_vms_pop (abfd, NULL);
     695    case ETIR_S_C_OPR_COM:      /* complement  */
     696      op1 = (long) _bfd_vms_pop (abfd, NULL);
    643697      _bfd_vms_push (abfd, (uquad) (op1 ^ -1L), -1);
    644698      break;
    645699
    646       /* insert field  */
    647 
    648     case ETIR_S_C_OPR_INSV:
    649       (void)_bfd_vms_pop (abfd, NULL);
    650       (*_bfd_error_handler) (_("ETIR_S_C_OPR_INSV: Not supported"));
    651       break;
    652 
    653     /* arithmetic shift  */
    654 
    655     case ETIR_S_C_OPR_ASH:
    656       op1 = (long)_bfd_vms_pop (abfd, NULL);
    657       op2 = (long)_bfd_vms_pop (abfd, NULL);
     700    case ETIR_S_C_OPR_ASH:      /* arithmetic shift  */
     701      op1 = (long) _bfd_vms_pop (abfd, NULL);
     702      op2 = (long) _bfd_vms_pop (abfd, NULL);
    658703      if (op2 < 0)              /* shift right */
    659704        op1 >>= -op2;
    660705      else                      /* shift left */
    661706        op1 <<= op2;
    662       _bfd_vms_push (abfd, (uquad)op1, -1);
    663       break;
    664 
    665       /* unsigned shift  */
    666 
    667     case ETIR_S_C_OPR_USH:
    668       (*_bfd_error_handler) (_("ETIR_S_C_OPR_USH: Not supported"));
    669       break;
    670 
    671       /* rotate  */
    672 
    673     case ETIR_S_C_OPR_ROT:
    674       (*_bfd_error_handler) (_("ETIR_S_C_OPR_ROT: Not supported"));
    675       break;
    676 
    677       /* select  */
    678 
    679     case ETIR_S_C_OPR_SEL:
    680       if ((long)_bfd_vms_pop (abfd, NULL) & 0x01L)
    681         (void)_bfd_vms_pop (abfd, NULL);
     707      _bfd_vms_push (abfd, (uquad) op1, -1);
     708      break;
     709
     710    case ETIR_S_C_OPR_INSV:      /* insert field  */
     711      (void) _bfd_vms_pop (abfd, NULL);
     712    case ETIR_S_C_OPR_USH:       /* unsigned shift  */
     713    case ETIR_S_C_OPR_ROT:       /* rotate  */
     714    case ETIR_S_C_OPR_REDEF:     /* Redefine symbol to current location.  */
     715    case ETIR_S_C_OPR_DFLIT:     /* Define a literal.  */
     716      (*_bfd_error_handler) (_("%s: not supported"), cmd_name (cmd));
     717      break;
     718
     719    case ETIR_S_C_OPR_SEL:      /* select  */
     720      if ((long) _bfd_vms_pop (abfd, NULL) & 0x01L)
     721        (void) _bfd_vms_pop (abfd, NULL);
    682722      else
    683723        {
    684           op1 = (long)_bfd_vms_pop (abfd, NULL);
    685           (void)_bfd_vms_pop (abfd, NULL);
    686           _bfd_vms_push (abfd, (uquad)op1, -1);
     724          op1 = (long) _bfd_vms_pop (abfd, NULL);
     725          (void) _bfd_vms_pop (abfd, NULL);
     726          _bfd_vms_push (abfd, (uquad) op1, -1);
    687727        }
    688728      break;
    689729
    690       /* redefine symbol to current location  */
    691 
    692     case ETIR_S_C_OPR_REDEF:
    693       (*_bfd_error_handler) (_("ETIR_S_C_OPR_REDEF: Not supported"));
    694       break;
    695 
    696       /* define a literal  */
    697 
    698     case ETIR_S_C_OPR_DFLIT:
    699       (*_bfd_error_handler) (_("ETIR_S_C_OPR_DFLIT: Not supported"));
    700       break;
    701 
    702730    default:
    703       (*_bfd_error_handler) (_("Reserved OPR cmd %d"), cmd);
     731      (*_bfd_error_handler) (_("reserved OPR cmd %d"), cmd);
    704732      break;
    705733    }
    706734
    707   return true;
    708 }
    709 
    710 /* control commands
    711 
    712    see table B-11 of the openVMS linker manual  */
    713 
    714 static boolean
     735  return TRUE;
     736}
     737
     738/* Control commands.
     739
     740   See table B-11 of the openVMS linker manual.  */
     741
     742static bfd_boolean
    715743etir_ctl (abfd, cmd, ptr)
    716744     bfd *abfd;
     
    723751#if VMS_DEBUG
    724752  _bfd_vms_debug (5, "etir_ctl %d/%x\n", cmd, cmd);
    725   _bfd_hexdump (8, ptr, 16, (int)ptr);
     753  _bfd_hexdump (8, ptr, 16, (int) ptr);
    726754#endif
    727755
     
    729757    {
    730758      /* set relocation base: pop stack, set image location counter
    731          arg: -  */
     759         arg: none.  */
    732760
    733761    case ETIR_S_C_CTL_SETRB:
     
    745773
    746774      /* define location: pop index, save location counter under index
    747          arg: -  */
     775         arg: none.  */
    748776
    749777    case ETIR_S_C_CTL_DFLOC:
     
    753781
    754782      /* set location: pop index, restore location counter from index
    755          arg: -  */
     783         arg: none.  */
    756784
    757785    case ETIR_S_C_CTL_STLOC:
     
    761789
    762790      /* stack defined location: pop index, push location counter from index
    763          arg: -  */
     791         arg: none.  */
    764792
    765793    case ETIR_S_C_CTL_STKDL:
     
    769797
    770798    default:
    771       (*_bfd_error_handler) (_("Reserved CTL cmd %d"), cmd);
     799      (*_bfd_error_handler) (_("reserved CTL cmd %d"), cmd);
    772800      break;
    773801    }
    774   return true;
     802  return TRUE;
    775803}
    776804
    777805/* store conditional commands
    778806
    779    see table B-12 and B-13 of the openVMS linker manual  */
    780 
    781 static boolean
     807   See table B-12 and B-13 of the openVMS linker manual.  */
     808
     809static bfd_boolean
    782810etir_stc (abfd, cmd, ptr)
    783811     bfd *abfd;
     
    785813     unsigned char *ptr ATTRIBUTE_UNUSED;
    786814{
    787 
    788815#if VMS_DEBUG
    789816  _bfd_vms_debug (5, "etir_stc %d/%x\n", cmd, cmd);
    790   _bfd_hexdump (8, ptr, 16, (int)ptr);
     817  _bfd_hexdump (8, ptr, 16, (int) ptr);
    791818#endif
    792819
     
    794821    {
    795822      /* 200 Store-conditional Linkage Pair
    796          arg: */
     823         arg: none. */
    797824
    798825    case ETIR_S_C_STC_LP:
    799       (*_bfd_error_handler) (_("ETIR_S_C_STC_LP: not supported"));
     826      (*_bfd_error_handler) (_("%s: not supported"), cmd_name (cmd));
    800827      break;
    801828
    802829      /* 201 Store-conditional Linkage Pair with Procedure Signature
    803830         arg:   lw      linkage index
    804          cs     procedure name
    805          by     signature length
    806          da     signature  */
     831                cs      procedure name
     832                by      signature length
     833                da      signature.  */
    807834
    808835    case ETIR_S_C_STC_LP_PSB:
    809       image_inc_ptr (abfd, 16); /* skip entry,procval */
     836      image_inc_ptr (abfd, (uquad) 16); /* skip entry,procval */
    810837      break;
    811838
    812839      /* 202 Store-conditional Address at global address
    813840         arg:   lw      linkage index
    814          cs     global name  */
     841                cs      global name.  */
    815842
    816843    case ETIR_S_C_STC_GBL:
    817       (*_bfd_error_handler) (_("ETIR_S_C_STC_GBL: not supported"));
     844      (*_bfd_error_handler) (_("%s: not supported"), cmd_name (cmd));
    818845      break;
    819846
    820847      /* 203 Store-conditional Code Address at global address
    821848         arg:   lw      linkage index
    822          cs     procedure name  */
     849                cs      procedure name.  */
    823850
    824851    case ETIR_S_C_STC_GCA:
    825       (*_bfd_error_handler) (_("ETIR_S_C_STC_GCA: not supported"));
     852      (*_bfd_error_handler) (_("%s: not supported"), cmd_name (cmd));
    826853      break;
    827854
    828855      /* 204 Store-conditional Address at psect + offset
    829856         arg:   lw      linkage index
    830          lw     psect index
    831          qw     offset  */
     857                lw      psect index
     858                qw      offset.  */
    832859
    833860    case ETIR_S_C_STC_PS:
    834       (*_bfd_error_handler) (_("ETIR_S_C_STC_PS: not supported"));
     861      (*_bfd_error_handler) (_("%s: not supported"), cmd_name (cmd));
    835862      break;
    836863
    837864      /* 205 Store-conditional NOP at address of global
    838          arg: */
     865         arg: none. */
    839866
    840867    case ETIR_S_C_STC_NOP_GBL:
    841868
    842869      /* 206 Store-conditional NOP at pect + offset
    843          arg: */
     870         arg: none. */
    844871
    845872    case ETIR_S_C_STC_NOP_PS:
    846873
    847874      /* 207 Store-conditional BSR at global address
    848          arg: */
     875         arg: none. */
    849876
    850877    case ETIR_S_C_STC_BSR_GBL:
    851878
    852879      /* 208 Store-conditional BSR at pect + offset
    853          arg: */
     880         arg: none. */
    854881
    855882    case ETIR_S_C_STC_BSR_PS:
    856883
    857884      /* 209 Store-conditional LDA at global address
    858          arg: */
     885         arg: none. */
    859886
    860887    case ETIR_S_C_STC_LDA_GBL:
    861888
    862889      /* 210 Store-conditional LDA at psect + offset
    863          arg: */
     890         arg: none. */
    864891
    865892    case ETIR_S_C_STC_LDA_PS:
    866893
    867894      /* 211 Store-conditional BSR or Hint at global address
    868          arg: */
     895         arg: none. */
    869896
    870897    case ETIR_S_C_STC_BOH_GBL:
    871898
    872899      /* 212 Store-conditional BSR or Hint at pect + offset
    873          arg: */
     900         arg: none. */
    874901
    875902    case ETIR_S_C_STC_BOH_PS:
    876903
    877904      /* 213 Store-conditional NOP,BSR or HINT at global address
    878          arg: */
     905         arg: none. */
    879906
    880907    case ETIR_S_C_STC_NBH_GBL:
    881908
    882909      /* 214 Store-conditional NOP,BSR or HINT at psect + offset
    883          arg: */
     910         arg: none. */
    884911
    885912    case ETIR_S_C_STC_NBH_PS:
    886 /* FIXME     (*_bfd_error_handler) ("ETIR_S_C_STC_xx: (%d) not supported", cmd); */
     913      /* FIXME */
     914#if 0
     915      (*_bfd_error_handler) ("%s: not supported", cmd_name (cmd));
     916#endif
    887917      break;
    888918
    889919    default:
    890920#if VMS_DEBUG
    891       _bfd_vms_debug (3,  "Reserved STC cmd %d", cmd);
     921      _bfd_vms_debug (3,  "reserved STC cmd %d", cmd);
    892922#endif
    893923      break;
    894924    }
    895   return true;
     925  return TRUE;
    896926}
    897927
     
    906936
    907937#if VMS_DEBUG
    908   _bfd_vms_debug (5,  "new_section %d\n", idx);
     938  _bfd_vms_debug (5, "new_section %d\n", idx);
    909939#endif
    910940  sprintf (sname, SECTION_NAME_TEMPLATE, idx);
    911941
    912   name = bfd_malloc (strlen (sname) + 1);
     942  name = bfd_malloc ((bfd_size_type) strlen (sname) + 1);
    913943  if (name == 0)
    914944    return 0;
    915945  strcpy (name, sname);
    916946
    917   section = bfd_malloc (sizeof (asection));
     947  section = bfd_malloc ((bfd_size_type) sizeof (asection));
    918948  if (section == 0)
    919949    {
     
    939969     unsigned int idx;
    940970{
    941 #if VMS_DEBUG
    942   _bfd_vms_debug (4,  "alloc_section %d\n", idx);
    943 #endif
    944 
    945   PRIV(sections) = ((asection **)
    946                     bfd_realloc (PRIV(sections), (idx+1) * sizeof (asection *)));
    947   if (PRIV(sections) == 0)
     971  bfd_size_type amt;
     972
     973#if VMS_DEBUG
     974  _bfd_vms_debug (4, "alloc_section %d\n", idx);
     975#endif
     976
     977  amt = idx + 1;
     978  amt *= sizeof (asection *);
     979  PRIV (sections) = (asection **) bfd_realloc (PRIV (sections), amt);
     980  if (PRIV (sections) == 0)
    948981    return -1;
    949982
    950   while (PRIV(section_count) <= idx)
     983  while (PRIV (section_count) <= idx)
    951984    {
    952       PRIV(sections)[PRIV(section_count)] = new_section (abfd, PRIV(section_count));
    953       if (PRIV(sections)[PRIV(section_count)] == 0)
     985      PRIV (sections)[PRIV (section_count)]
     986        = new_section (abfd, (int) PRIV (section_count));
     987      if (PRIV (sections)[PRIV (section_count)] == 0)
    954988        return -1;
    955       PRIV(section_count)++;
     989      PRIV (section_count)++;
    956990    }
    957991
     
    959993}
    960994
    961 /*
    962  * tir_sta
    963  *
    964  * vax stack commands
    965  *
    966  * handle sta_xxx commands in tir section
    967  * ptr points to data area in record
    968  *
    969  * see table 7-3 of the VAX/VMS linker manual
    970  */
     995/* tir_sta
     996
     997   vax stack commands
     998
     999   Handle sta_xxx commands in tir section
     1000   ptr points to data area in record
     1001
     1002   See table 7-3 of the VAX/VMS linker manual.  */
    9711003
    9721004static unsigned char *
     
    9811013  switch (cmd)
    9821014    {
    983   /* stack */
    984       case TIR_S_C_STA_GBL:
    985         /*
    986          * stack global
    987          * arg: cs      symbol name
    988          *
    989          * stack 32 bit value of symbol (high bits set to 0)
    990          */
    991         {
    992           char *name;
    993           vms_symbol_entry *entry;
    994 
    995           name = _bfd_vms_save_counted_string (ptr);
    996 
    997           entry = _bfd_vms_enter_symbol (abfd, name);
    998           if (entry == (vms_symbol_entry *)NULL)
    999             return 0;
    1000 
    1001           _bfd_vms_push (abfd, (unsigned long) (entry->symbol->value), -1);
    1002           ptr += *ptr + 1;
    1003         }
    1004       break;
    1005 
    1006       case TIR_S_C_STA_SB:
    1007         /*
    1008          * stack signed byte
    1009          * arg: by      value
    1010          *
    1011          * stack byte value, sign extend to 32 bit
    1012          */
    1013         _bfd_vms_push (abfd, (long)*ptr++, -1);
    1014       break;
    1015 
    1016       case TIR_S_C_STA_SW:
    1017         /*
    1018          * stack signed short word
    1019          * arg: sh      value
    1020          *
    1021          * stack 16 bit value, sign extend to 32 bit
    1022          */
    1023         _bfd_vms_push (abfd, (long)bfd_getl16(ptr), -1);
     1015      /* stack */
     1016    case TIR_S_C_STA_GBL:
     1017      /* stack global
     1018         arg: cs        symbol name
     1019
     1020         stack 32 bit value of symbol (high bits set to 0).  */
     1021      {
     1022        char *name;
     1023        vms_symbol_entry *entry;
     1024
     1025        name = _bfd_vms_save_counted_string (ptr);
     1026
     1027        entry = _bfd_vms_enter_symbol (abfd, name);
     1028        if (entry == (vms_symbol_entry *) NULL)
     1029          return 0;
     1030
     1031        _bfd_vms_push (abfd, (uquad) (entry->symbol->value), -1);
     1032        ptr += *ptr + 1;
     1033      }
     1034      break;
     1035
     1036    case TIR_S_C_STA_SB:
     1037      /* stack signed byte
     1038         arg: by        value
     1039
     1040         stack byte value, sign extend to 32 bit.  */
     1041      _bfd_vms_push (abfd, (uquad) *ptr++, -1);
     1042      break;
     1043
     1044    case TIR_S_C_STA_SW:
     1045      /* stack signed short word
     1046         arg: sh        value
     1047
     1048         stack 16 bit value, sign extend to 32 bit.  */
     1049      _bfd_vms_push (abfd, (uquad) bfd_getl16 (ptr), -1);
     1050      ptr += 2;
     1051      break;
     1052
     1053    case TIR_S_C_STA_LW:
     1054      /* stack signed longword
     1055         arg: lw        value
     1056
     1057         stack 32 bit value.  */
     1058      _bfd_vms_push (abfd, (uquad) bfd_getl32 (ptr), -1);
     1059      ptr += 4;
     1060      break;
     1061
     1062    case TIR_S_C_STA_PB:
     1063    case TIR_S_C_STA_WPB:
     1064      /* stack psect base plus byte offset (word index)
     1065         arg: by        section index
     1066                (sh     section index)
     1067                by      signed byte offset.  */
     1068      {
     1069        unsigned long dummy;
     1070        unsigned int psect;
     1071
     1072        if (cmd == TIR_S_C_STA_PB)
     1073          psect = *ptr++;
     1074        else
     1075          {
     1076            psect = bfd_getl16 (ptr);
     1077            ptr += 2;
     1078          }
     1079
     1080        if (psect >= PRIV (section_count))
     1081          alloc_section (abfd, psect);
     1082
     1083        dummy = (long) *ptr++;
     1084        dummy += (PRIV (sections)[psect])->vma;
     1085        _bfd_vms_push (abfd, (uquad) dummy, (int) psect);
     1086      }
     1087      break;
     1088
     1089    case TIR_S_C_STA_PW:
     1090    case TIR_S_C_STA_WPW:
     1091      /* stack psect base plus word offset (word index)
     1092         arg: by        section index
     1093                (sh     section index)
     1094                sh      signed short offset.  */
     1095      {
     1096        unsigned long dummy;
     1097        unsigned int psect;
     1098
     1099        if (cmd == TIR_S_C_STA_PW)
     1100          psect = *ptr++;
     1101        else
     1102          {
     1103            psect = bfd_getl16 (ptr);
     1104            ptr += 2;
     1105          }
     1106
     1107        if (psect >= PRIV (section_count))
     1108          alloc_section (abfd, psect);
     1109
     1110        dummy = bfd_getl16 (ptr); ptr+=2;
     1111        dummy += (PRIV (sections)[psect])->vma;
     1112        _bfd_vms_push (abfd, (uquad) dummy, (int) psect);
     1113      }
     1114      break;
     1115
     1116    case TIR_S_C_STA_PL:
     1117    case TIR_S_C_STA_WPL:
     1118      /* stack psect base plus long offset (word index)
     1119         arg: by        section index
     1120                (sh     section index)
     1121                lw      signed longword offset.  */
     1122      {
     1123        unsigned long dummy;
     1124        unsigned int psect;
     1125
     1126        if (cmd == TIR_S_C_STA_PL)
     1127          psect = *ptr++;
     1128        else
     1129          {
     1130            psect = bfd_getl16 (ptr);
     1131            ptr += 2;
     1132          }
     1133
     1134        if (psect >= PRIV (section_count))
     1135          alloc_section (abfd, psect);
     1136
     1137        dummy = bfd_getl32 (ptr); ptr += 4;
     1138        dummy += (PRIV (sections)[psect])->vma;
     1139        _bfd_vms_push (abfd, (uquad) dummy, (int) psect);
     1140      }
     1141      break;
     1142
     1143    case TIR_S_C_STA_UB:
     1144      /* stack unsigned byte
     1145         arg: by        value
     1146
     1147         stack byte value.  */
     1148      _bfd_vms_push (abfd, (uquad) *ptr++, -1);
     1149      break;
     1150
     1151    case TIR_S_C_STA_UW:
     1152      /* stack unsigned short word
     1153         arg: sh        value
     1154
     1155         stack 16 bit value.  */
     1156      _bfd_vms_push (abfd, (uquad) bfd_getl16 (ptr), -1);
     1157      ptr += 2;
     1158      break;
     1159
     1160    case TIR_S_C_STA_BFI:
     1161      /* stack byte from image
     1162         arg: none.  */
     1163      /* FALLTHRU  */
     1164    case TIR_S_C_STA_WFI:
     1165      /* stack byte from image
     1166         arg: none.  */
     1167      /* FALLTHRU */
     1168    case TIR_S_C_STA_LFI:
     1169      /* stack byte from image
     1170         arg: none.  */
     1171      (*_bfd_error_handler) (_("stack-from-image not implemented"));
     1172      return NULL;
     1173
     1174    case TIR_S_C_STA_EPM:
     1175      /* stack entry point mask
     1176         arg: cs        symbol name
     1177
     1178         stack (unsigned) entry point mask of symbol
     1179         err if symbol is no entry point.  */
     1180      {
     1181        char *name;
     1182        vms_symbol_entry *entry;
     1183
     1184        name = _bfd_vms_save_counted_string (ptr);
     1185        entry = _bfd_vms_enter_symbol (abfd, name);
     1186        if (entry == (vms_symbol_entry *) NULL)
     1187          return 0;
     1188
     1189        (*_bfd_error_handler) (_("stack-entry-mask not fully implemented"));
     1190        _bfd_vms_push (abfd, (uquad) 0, -1);
     1191        ptr += *ptr + 1;
     1192      }
     1193      break;
     1194
     1195    case TIR_S_C_STA_CKARG:
     1196      /* compare procedure argument
     1197         arg: cs        symbol name
     1198                by      argument index
     1199                da      argument descriptor
     1200
     1201         compare argument descriptor with symbol argument (ARG$V_PASSMECH)
     1202         and stack TRUE (args match) or FALSE (args dont match) value.  */
     1203      (*_bfd_error_handler) (_("PASSMECH not fully implemented"));
     1204      _bfd_vms_push (abfd, (uquad) 1, -1);
     1205      break;
     1206
     1207    case TIR_S_C_STA_LSY:
     1208      /* stack local symbol value
     1209         arg:   sh      environment index
     1210                cs      symbol name.  */
     1211      {
     1212        int envidx;
     1213        char *name;
     1214        vms_symbol_entry *entry;
     1215
     1216        envidx = bfd_getl16 (ptr);
    10241217        ptr += 2;
    1025       break;
    1026 
    1027       case TIR_S_C_STA_LW:
    1028         /*
    1029          * stack signed longword
    1030          * arg: lw      value
    1031          *
    1032          * stack 32 bit value
    1033          */
    1034         _bfd_vms_push (abfd, (long)bfd_getl32 (ptr), -1);
    1035         ptr += 4;
    1036       break;
    1037 
    1038       case TIR_S_C_STA_PB:
    1039       case TIR_S_C_STA_WPB:
    1040         /*
    1041          * stack psect base plus byte offset (word index)
    1042          * arg: by      section index
    1043          *      (sh     section index)
    1044          *      by      signed byte offset
    1045          *
    1046          */
    1047         {
    1048           unsigned long dummy;
    1049           unsigned int psect;
    1050 
    1051           if (cmd == TIR_S_C_STA_PB)
    1052             psect = *ptr++;
    1053           else
    1054             {
    1055               psect = bfd_getl16(ptr);
    1056               ptr += 2;
    1057             }
    1058 
    1059           if (psect >= PRIV(section_count))
    1060             {
    1061               alloc_section (abfd, psect);
    1062             }
    1063 
    1064           dummy = (long)*ptr++;
    1065           dummy += (PRIV(sections)[psect])->vma;
    1066           _bfd_vms_push (abfd, dummy, psect);
    1067         }
    1068       break;
    1069 
    1070       case TIR_S_C_STA_PW:
    1071       case TIR_S_C_STA_WPW:
    1072         /*
    1073          * stack psect base plus word offset (word index)
    1074          * arg: by      section index
    1075          *      (sh     section index)
    1076          *      sh      signed short offset
    1077          *
    1078          */
    1079         {
    1080           unsigned long dummy;
    1081           unsigned int psect;
    1082 
    1083           if (cmd == TIR_S_C_STA_PW)
    1084             psect = *ptr++;
    1085           else
    1086             {
    1087               psect = bfd_getl16(ptr);
    1088               ptr += 2;
    1089             }
    1090 
    1091           if (psect >= PRIV(section_count))
    1092             {
    1093               alloc_section (abfd, psect);
    1094             }
    1095 
    1096           dummy = bfd_getl16(ptr); ptr+=2;
    1097           dummy += (PRIV(sections)[psect])->vma;
    1098           _bfd_vms_push (abfd, dummy, psect);
    1099         }
    1100       break;
    1101 
    1102       case TIR_S_C_STA_PL:
    1103       case TIR_S_C_STA_WPL:
    1104         /*
    1105          * stack psect base plus long offset (word index)
    1106          * arg: by      section index
    1107          *      (sh     section index)
    1108          *      lw      signed longword offset
    1109          *
    1110          */
    1111         {
    1112           unsigned long dummy;
    1113           unsigned int psect;
    1114 
    1115           if (cmd == TIR_S_C_STA_PL)
    1116             psect = *ptr++;
    1117           else
    1118             {
    1119               psect = bfd_getl16(ptr);
    1120               ptr += 2;
    1121             }
    1122 
    1123           if (psect >= PRIV(section_count))
    1124             {
    1125               alloc_section (abfd, psect);
    1126             }
    1127 
    1128           dummy = bfd_getl32 (ptr); ptr += 4;
    1129           dummy += (PRIV(sections)[psect])->vma;
    1130           _bfd_vms_push (abfd, dummy, psect);
    1131         }
    1132       break;
    1133 
    1134       case TIR_S_C_STA_UB:
    1135         /*
    1136          * stack unsigned byte
    1137          * arg: by      value
    1138          *
    1139          * stack byte value
    1140          */
    1141         _bfd_vms_push (abfd, (unsigned long)*ptr++, -1);
    1142       break;
    1143 
    1144       case TIR_S_C_STA_UW:
    1145         /*
    1146          * stack unsigned short word
    1147          * arg: sh      value
    1148          *
    1149          * stack 16 bit value
    1150          */
    1151         _bfd_vms_push (abfd, (unsigned long)bfd_getl16(ptr), -1);
     1218        name = _bfd_vms_save_counted_string (ptr);
     1219        entry = _bfd_vms_enter_symbol (abfd, name);
     1220        if (entry == (vms_symbol_entry *) NULL)
     1221          return 0;
     1222        (*_bfd_error_handler) (_("stack-local-symbol not fully implemented"));
     1223        _bfd_vms_push (abfd, (uquad) 0, -1);
     1224        ptr += *ptr + 1;
     1225      }
     1226      break;
     1227
     1228    case TIR_S_C_STA_LIT:
     1229      /* stack literal
     1230         arg:   by      literal index
     1231
     1232         stack literal.  */
     1233      ptr++;
     1234      _bfd_vms_push (abfd, (uquad) 0, -1);
     1235      (*_bfd_error_handler) (_("stack-literal not fully implemented"));
     1236      break;
     1237
     1238    case TIR_S_C_STA_LEPM:
     1239      /* stack local symbol entry point mask
     1240         arg:   sh      environment index
     1241                cs      symbol name
     1242
     1243         stack (unsigned) entry point mask of symbol
     1244         err if symbol is no entry point.  */
     1245      {
     1246        int envidx;
     1247        char *name;
     1248        vms_symbol_entry *entry;
     1249
     1250        envidx = bfd_getl16 (ptr);
    11521251        ptr += 2;
    1153       break;
    1154 
    1155       case TIR_S_C_STA_BFI:
    1156         /*
    1157          * stack byte from image
    1158          * arg: -
    1159          *
    1160          */
    1161         /*FALLTHRU*/
    1162       case TIR_S_C_STA_WFI:
    1163         /*
    1164          * stack byte from image
    1165          * arg: -
    1166          *
    1167          */
    1168         /*FALLTHRU*/
    1169       case TIR_S_C_STA_LFI:
    1170         /*
    1171          * stack byte from image
    1172          * arg: -
    1173          *
    1174          */
    1175         (*_bfd_error_handler) (_("Stack-from-image not implemented"));
    1176         return NULL;
    1177 
    1178       case TIR_S_C_STA_EPM:
    1179         /*
    1180          * stack entry point mask
    1181          * arg: cs      symbol name
    1182          *
    1183          * stack (unsigned) entry point mask of symbol
    1184          * err if symbol is no entry point
    1185          */
    1186         {
    1187           char *name;
    1188           vms_symbol_entry *entry;
    1189 
    1190           name = _bfd_vms_save_counted_string (ptr);
    1191           entry = _bfd_vms_enter_symbol (abfd, name);
    1192           if (entry == (vms_symbol_entry *)NULL)
    1193             return 0;
    1194 
    1195           (*_bfd_error_handler) (_("Stack-entry-mask not fully implemented"));
    1196           _bfd_vms_push (abfd, 0L, -1);
    1197           ptr += *ptr + 1;
    1198         }
    1199       break;
    1200 
    1201       case TIR_S_C_STA_CKARG:
    1202         /*
    1203          * compare procedure argument
    1204          * arg: cs      symbol name
    1205          *      by      argument index
    1206          *      da      argument descriptor
    1207          *
    1208          * compare argument descriptor with symbol argument (ARG$V_PASSMECH)
    1209          * and stack TRUE (args match) or FALSE (args dont match) value
    1210          */
    1211         (*_bfd_error_handler) (_("PASSMECH not fully implemented"));
    1212         _bfd_vms_push (abfd, 1L, -1);
    1213         break;
    1214 
    1215       case TIR_S_C_STA_LSY:
    1216         /*
    1217          * stack local symbol value
    1218          * arg: sh      environment index
    1219          *      cs      symbol name
    1220          */
    1221         {
    1222           int envidx;
    1223           char *name;
    1224           vms_symbol_entry *entry;
    1225 
    1226           envidx = bfd_getl16(ptr); ptr += 2;
    1227           name = _bfd_vms_save_counted_string (ptr);
    1228           entry = _bfd_vms_enter_symbol (abfd, name);
    1229           if (entry == (vms_symbol_entry *)NULL)
    1230             return 0;
    1231           (*_bfd_error_handler) (_("Stack-local-symbol not fully implemented"));
    1232           _bfd_vms_push (abfd, 0L, -1);
    1233           ptr += *ptr + 1;
    1234         }
    1235       break;
    1236 
    1237       case TIR_S_C_STA_LIT:
    1238         /*
    1239          * stack literal
    1240          * arg: by      literal index
    1241          *
    1242          * stack literal
    1243          */
    1244         ptr++;
    1245         _bfd_vms_push (abfd, 0L, -1);
    1246         (*_bfd_error_handler) (_("Stack-literal not fully implemented"));
    1247         break;
    1248 
    1249       case TIR_S_C_STA_LEPM:
    1250         /*
    1251          * stack local symbol entry point mask
    1252          * arg: sh      environment index
    1253          *      cs      symbol name
    1254          *
    1255          * stack (unsigned) entry point mask of symbol
    1256          * err if symbol is no entry point
    1257          */
    1258         {
    1259           int envidx;
    1260           char *name;
    1261           vms_symbol_entry *entry;
    1262 
    1263           envidx = bfd_getl16(ptr); ptr += 2;
    1264           name = _bfd_vms_save_counted_string (ptr);
    1265           entry = _bfd_vms_enter_symbol (abfd, name);
    1266           if (entry == (vms_symbol_entry *)NULL)
    1267             return 0;
    1268           (*_bfd_error_handler) (_("Stack-local-symbol-entry-point-mask not fully implemented"));
    1269           _bfd_vms_push (abfd, 0L, -1);
    1270           ptr += *ptr + 1;
    1271         }
    1272       break;
    1273 
    1274       default:
    1275         (*_bfd_error_handler) (_("Reserved STA cmd %d"), ptr[-1]);
    1276         return NULL;
    1277       break;
    1278   }
     1252        name = _bfd_vms_save_counted_string (ptr);
     1253        entry = _bfd_vms_enter_symbol (abfd, name);
     1254        if (entry == (vms_symbol_entry *) NULL)
     1255          return 0;
     1256        (*_bfd_error_handler) (_("stack-local-symbol-entry-point-mask not fully implemented"));
     1257        _bfd_vms_push (abfd, (uquad) 0, -1);
     1258        ptr += *ptr + 1;
     1259      }
     1260      break;
     1261
     1262    default:
     1263      (*_bfd_error_handler) (_("reserved STA cmd %d"), ptr[-1]);
     1264      return NULL;
     1265      break;
     1266    }
    12791267
    12801268  return ptr;
    12811269}
    12821270
    1283 /*
    1284  * tir_sto
    1285  *
    1286  * vax store commands
    1287  *
    1288  * handle sto_xxx commands in tir section
    1289  * ptr points to data area in record
    1290  *
    1291  * see table 7-4 of the VAX/VMS linker manual
    1292  */
     1271static const char *
     1272tir_cmd_name (cmd)
     1273     int cmd;
     1274{
     1275  switch (cmd)
     1276    {
     1277    case TIR_S_C_STO_RSB: return "TIR_S_C_STO_RSB";
     1278    case TIR_S_C_STO_RSW: return "TIR_S_C_STO_RSW";
     1279    case TIR_S_C_STO_RL: return "TIR_S_C_STO_RL";
     1280    case TIR_S_C_STO_VPS: return "TIR_S_C_STO_VPS";
     1281    case TIR_S_C_STO_USB: return "TIR_S_C_STO_USB";
     1282    case TIR_S_C_STO_USW: return "TIR_S_C_STO_USW";
     1283    case TIR_S_C_STO_RUB: return "TIR_S_C_STO_RUB";
     1284    case TIR_S_C_STO_RUW: return "TIR_S_C_STO_RUW";
     1285    case TIR_S_C_STO_PIRR: return "TIR_S_C_STO_PIRR";
     1286    case TIR_S_C_OPR_INSV: return "TIR_S_C_OPR_INSV";
     1287    case TIR_S_C_OPR_DFLIT: return "TIR_S_C_OPR_DFLIT";
     1288    case TIR_S_C_OPR_REDEF: return "TIR_S_C_OPR_REDEF";
     1289    case TIR_S_C_OPR_ROT: return "TIR_S_C_OPR_ROT";
     1290    case TIR_S_C_OPR_USH: return "TIR_S_C_OPR_USH";
     1291    case TIR_S_C_OPR_ASH: return "TIR_S_C_OPR_ASH";
     1292    case TIR_S_C_CTL_DFLOC: return "TIR_S_C_CTL_DFLOC";
     1293    case TIR_S_C_CTL_STLOC: return "TIR_S_C_CTL_STLOC";
     1294    case TIR_S_C_CTL_STKDL: return "TIR_S_C_CTL_STKDL";
     1295
     1296    default:
     1297      /* These strings have not been added yet.  */
     1298      abort ();
     1299    }
     1300}
     1301
     1302/* tir_sto
     1303
     1304   vax store commands
     1305
     1306   handle sto_xxx commands in tir section
     1307   ptr points to data area in record
     1308
     1309   See table 7-4 of the VAX/VMS linker manual.  */
    12931310
    12941311static unsigned char *
     
    13051322  switch (*ptr++)
    13061323    {
    1307       case TIR_S_C_STO_SB:
    1308         /*
    1309          * store signed byte: pop stack, write byte
    1310          * arg: -
    1311          */
    1312         dummy = _bfd_vms_pop (abfd, &psect);
    1313         image_write_b (abfd, dummy & 0xff);     /* FIXME: check top bits */
    1314       break;
    1315 
    1316       case TIR_S_C_STO_SW:
    1317         /*
    1318          * store signed word: pop stack, write word
    1319          * arg: -
    1320          */
    1321         dummy = _bfd_vms_pop (abfd, &psect);
    1322         image_write_w (abfd, dummy & 0xffff);   /* FIXME: check top bits */
    1323       break;
    1324 
    1325       case TIR_S_C_STO_LW:
    1326         /*
    1327          * store longword: pop stack, write longword
    1328          * arg: -
    1329          */
    1330         dummy = _bfd_vms_pop (abfd, &psect);
    1331         image_write_l (abfd, dummy & 0xffffffff);/* FIXME: check top bits */
    1332       break;
    1333 
    1334       case TIR_S_C_STO_BD:
    1335         /*
    1336          * store byte displaced: pop stack, sub lc+1, write byte
    1337          * arg: -
    1338          */
    1339         dummy = _bfd_vms_pop (abfd, &psect);
    1340         dummy -= ((PRIV(sections)[psect])->vma + 1);
    1341         image_write_b (abfd, dummy & 0xff);/* FIXME: check top bits */
    1342       break;
    1343 
    1344       case TIR_S_C_STO_WD:
    1345         /*
    1346          * store word displaced: pop stack, sub lc+2, write word
    1347          * arg: -
    1348          */
    1349         dummy = _bfd_vms_pop (abfd, &psect);
    1350         dummy -= ((PRIV(sections)[psect])->vma + 2);
    1351         image_write_w (abfd, dummy & 0xffff);/* FIXME: check top bits */
    1352       break;
    1353       case TIR_S_C_STO_LD:
    1354         /*
    1355          * store long displaced: pop stack, sub lc+4, write long
    1356          * arg: -
    1357          */
    1358         dummy = _bfd_vms_pop (abfd, &psect);
    1359         dummy -= ((PRIV(sections)[psect])->vma + 4);
    1360         image_write_l (abfd, dummy & 0xffffffff);/* FIXME: check top bits */
    1361       break;
    1362       case TIR_S_C_STO_LI:
    1363         /*
    1364          * store short literal: pop stack, write byte
    1365          * arg: -
    1366          */
    1367         dummy = _bfd_vms_pop (abfd, &psect);
    1368         image_write_b (abfd, dummy & 0xff);/* FIXME: check top bits */
    1369       break;
    1370       case TIR_S_C_STO_PIDR:
    1371         /*
    1372          * store position independent data reference: pop stack, write longword
    1373          * arg: -
    1374          * FIXME: incomplete !
    1375          */
    1376         dummy = _bfd_vms_pop (abfd, &psect);
    1377         image_write_l (abfd, dummy & 0xffffffff);
    1378       break;
    1379       case TIR_S_C_STO_PICR:
    1380         /*
    1381          * store position independent code reference: pop stack, write longword
    1382          * arg: -
    1383          * FIXME: incomplete !
    1384          */
    1385         dummy = _bfd_vms_pop (abfd, &psect);
    1386         image_write_b (abfd, 0x9f);
    1387         image_write_l (abfd, dummy & 0xffffffff);
    1388       break;
    1389       case TIR_S_C_STO_RIVB:
    1390         /*
    1391          * store repeated immediate variable bytes
    1392          * 1-byte count n field followed by n bytes of data
    1393          * pop stack, write n bytes <stack> times
    1394          */
    1395         size = *ptr++;
    1396         dummy = (unsigned long)_bfd_vms_pop (abfd, NULL);
    1397         while (dummy-- > 0L)
    1398           image_dump (abfd, ptr, size, 0);
    1399         ptr += size;
    1400         break;
    1401       case TIR_S_C_STO_B:
    1402         /*
    1403          * store byte from top longword
    1404          */
    1405         dummy = (unsigned long)_bfd_vms_pop (abfd, NULL);
     1324    case TIR_S_C_STO_SB:
     1325      /* store signed byte: pop stack, write byte
     1326         arg: none.  */
     1327      dummy = _bfd_vms_pop (abfd, &psect);
     1328      image_write_b (abfd, dummy & 0xff);       /* FIXME: check top bits */
     1329      break;
     1330
     1331    case TIR_S_C_STO_SW:
     1332      /* store signed word: pop stack, write word
     1333         arg: none.  */
     1334      dummy = _bfd_vms_pop (abfd, &psect);
     1335      image_write_w (abfd, dummy & 0xffff);     /* FIXME: check top bits */
     1336      break;
     1337
     1338    case TIR_S_C_STO_LW:
     1339      /* store longword: pop stack, write longword
     1340         arg: none.  */
     1341      dummy = _bfd_vms_pop (abfd, &psect);
     1342      image_write_l (abfd, dummy & 0xffffffff); /* FIXME: check top bits */
     1343      break;
     1344
     1345    case TIR_S_C_STO_BD:
     1346      /* store byte displaced: pop stack, sub lc+1, write byte
     1347         arg: none.  */
     1348      dummy = _bfd_vms_pop (abfd, &psect);
     1349      dummy -= ((PRIV (sections)[psect])->vma + 1);
     1350      image_write_b (abfd, dummy & 0xff);/* FIXME: check top bits */
     1351      break;
     1352
     1353    case TIR_S_C_STO_WD:
     1354      /* store word displaced: pop stack, sub lc+2, write word
     1355         arg: none.  */
     1356      dummy = _bfd_vms_pop (abfd, &psect);
     1357      dummy -= ((PRIV (sections)[psect])->vma + 2);
     1358      image_write_w (abfd, dummy & 0xffff);/* FIXME: check top bits */
     1359      break;
     1360
     1361    case TIR_S_C_STO_LD:
     1362      /* store long displaced: pop stack, sub lc+4, write long
     1363         arg: none.  */
     1364      dummy = _bfd_vms_pop (abfd, &psect);
     1365      dummy -= ((PRIV (sections)[psect])->vma + 4);
     1366      image_write_l (abfd, dummy & 0xffffffff);/* FIXME: check top bits */
     1367      break;
     1368
     1369    case TIR_S_C_STO_LI:
     1370      /* store short literal: pop stack, write byte
     1371         arg: none.  */
     1372      dummy = _bfd_vms_pop (abfd, &psect);
     1373      image_write_b (abfd, dummy & 0xff);/* FIXME: check top bits */
     1374      break;
     1375
     1376    case TIR_S_C_STO_PIDR:
     1377      /* store position independent data reference: pop stack, write longword
     1378         arg: none.
     1379         FIXME: incomplete !  */
     1380      dummy = _bfd_vms_pop (abfd, &psect);
     1381      image_write_l (abfd, dummy & 0xffffffff);
     1382      break;
     1383
     1384    case TIR_S_C_STO_PICR:
     1385      /* store position independent code reference: pop stack, write longword
     1386         arg: none.
     1387         FIXME: incomplete !  */
     1388      dummy = _bfd_vms_pop (abfd, &psect);
     1389      image_write_b (abfd, 0x9f);
     1390      image_write_l (abfd, dummy & 0xffffffff);
     1391      break;
     1392
     1393    case TIR_S_C_STO_RIVB:
     1394      /* store repeated immediate variable bytes
     1395         1-byte count n field followed by n bytes of data
     1396         pop stack, write n bytes <stack> times.  */
     1397      size = *ptr++;
     1398      dummy = (unsigned long) _bfd_vms_pop (abfd, NULL);
     1399      while (dummy-- > 0L)
     1400        image_dump (abfd, ptr, size, 0);
     1401      ptr += size;
     1402      break;
     1403
     1404    case TIR_S_C_STO_B:
     1405      /* store byte from top longword.  */
     1406      dummy = (unsigned long) _bfd_vms_pop (abfd, NULL);
     1407      image_write_b (abfd, dummy & 0xff);
     1408      break;
     1409
     1410    case TIR_S_C_STO_W:
     1411      /* store word from top longword.  */
     1412      dummy = (unsigned long) _bfd_vms_pop (abfd, NULL);
     1413      image_write_w (abfd, dummy & 0xffff);
     1414      break;
     1415
     1416    case TIR_S_C_STO_RB:
     1417      /* store repeated byte from top longword.  */
     1418      size = (unsigned long) _bfd_vms_pop (abfd, NULL);
     1419      dummy = (unsigned long) _bfd_vms_pop (abfd, NULL);
     1420      while (size-- > 0)
    14061421        image_write_b (abfd, dummy & 0xff);
    1407         break;
    1408       case TIR_S_C_STO_W:
    1409         /*
    1410          * store word from top longword
    1411          */
    1412         dummy = (unsigned long)_bfd_vms_pop (abfd, NULL);
     1422      break;
     1423
     1424    case TIR_S_C_STO_RW:
     1425      /* store repeated word from top longword.  */
     1426      size = (unsigned long) _bfd_vms_pop (abfd, NULL);
     1427      dummy = (unsigned long) _bfd_vms_pop (abfd, NULL);
     1428      while (size-- > 0)
    14131429        image_write_w (abfd, dummy & 0xffff);
    1414         break;
    1415       case TIR_S_C_STO_RB:
    1416         /*
    1417          * store repeated byte from top longword
    1418          */
    1419         size = (unsigned long)_bfd_vms_pop (abfd, NULL);
    1420         dummy = (unsigned long)_bfd_vms_pop (abfd, NULL);
    1421         while (size-- > 0)
    1422           image_write_b (abfd, dummy & 0xff);
    1423         break;
    1424       case TIR_S_C_STO_RW:
    1425         /*
    1426          * store repeated word from top longword
    1427          */
    1428         size = (unsigned long)_bfd_vms_pop (abfd, NULL);
    1429         dummy = (unsigned long)_bfd_vms_pop (abfd, NULL);
    1430         while (size-- > 0)
    1431           image_write_w (abfd, dummy & 0xffff);
    1432         break;
    1433 
    1434       case TIR_S_C_STO_RSB:
    1435       case TIR_S_C_STO_RSW:
    1436       case TIR_S_C_STO_RL:
    1437       case TIR_S_C_STO_VPS:
    1438       case TIR_S_C_STO_USB:
    1439       case TIR_S_C_STO_USW:
    1440       case TIR_S_C_STO_RUB:
    1441       case TIR_S_C_STO_RUW:
    1442       case TIR_S_C_STO_PIRR:
    1443         (*_bfd_error_handler) (_("Unimplemented STO cmd %d"), ptr[-1]);
    1444       break;
    1445 
    1446       default:
    1447         (*_bfd_error_handler) (_("Reserved STO cmd %d"), ptr[-1]);
    1448       break;
    1449   }
     1430      break;
     1431
     1432    case TIR_S_C_STO_RSB:
     1433    case TIR_S_C_STO_RSW:
     1434    case TIR_S_C_STO_RL:
     1435    case TIR_S_C_STO_VPS:
     1436    case TIR_S_C_STO_USB:
     1437    case TIR_S_C_STO_USW:
     1438    case TIR_S_C_STO_RUB:
     1439    case TIR_S_C_STO_RUW:
     1440    case TIR_S_C_STO_PIRR:
     1441      (*_bfd_error_handler) (_("%s: not implemented"), tir_cmd_name (ptr[-1]));
     1442      break;
     1443
     1444    default:
     1445      (*_bfd_error_handler) (_("reserved STO cmd %d"), ptr[-1]);
     1446      break;
     1447    }
    14501448
    14511449  return ptr;
    14521450}
    14531451
    1454 /*
    1455  * stack operator commands
    1456  * all 32 bit signed arithmetic
    1457  * all word just like a stack calculator
    1458  * arguments are popped from stack, results are pushed on stack
    1459  *
    1460  * see table 7-5 of the VAX/VMS linker manual
    1461  */
     1452/* stack operator commands
     1453   all 32 bit signed arithmetic
     1454   all word just like a stack calculator
     1455   arguments are popped from stack, results are pushed on stack
     1456
     1457   See table 7-5 of the VAX/VMS linker manual.  */
    14621458
    14631459static unsigned char *
    1464 tir_opr (bfd *abfd, unsigned char *ptr)
     1460tir_opr (abfd, ptr)
     1461     bfd *abfd;
     1462     unsigned char *ptr;
    14651463{
    14661464  long op1, op2;
     
    14721470  switch (*ptr++)
    14731471    {
    1474   /* operation */
    1475       case TIR_S_C_OPR_NOP:
    1476         /*
    1477          * no-op
    1478          */
    1479       break;
    1480 
    1481       case TIR_S_C_OPR_ADD:
    1482         /*
    1483          * add
    1484          */
    1485         op1 = (long)_bfd_vms_pop (abfd, NULL);
    1486         op2 = (long)_bfd_vms_pop (abfd, NULL);
    1487         _bfd_vms_push (abfd, (unsigned long) (op1 + op2), -1);
    1488       break;
    1489 
    1490       case TIR_S_C_OPR_SUB:
    1491         /*
    1492          * subtract
    1493          */
    1494         op1 = (long)_bfd_vms_pop (abfd, NULL);
    1495         op2 = (long)_bfd_vms_pop (abfd, NULL);
    1496         _bfd_vms_push (abfd, (unsigned long) (op2 - op1), -1);
    1497       break;
    1498 
    1499       case TIR_S_C_OPR_MUL:
    1500         /*
    1501          * multiply
    1502          */
    1503         op1 = (long)_bfd_vms_pop (abfd, NULL);
    1504         op2 = (long)_bfd_vms_pop (abfd, NULL);
    1505         _bfd_vms_push (abfd, (unsigned long) (op1 * op2), -1);
    1506       break;
    1507 
    1508       case TIR_S_C_OPR_DIV:
    1509         /*
    1510          * divide
    1511          */
    1512         op1 = (long)_bfd_vms_pop (abfd, NULL);
    1513         op2 = (long)_bfd_vms_pop (abfd, NULL);
    1514         if (op2 == 0)
    1515           _bfd_vms_push (abfd, (unsigned long)0L, -1);
    1516         else
    1517           _bfd_vms_push (abfd, (unsigned long) (op2 / op1), -1);
    1518       break;
    1519 
    1520       case TIR_S_C_OPR_AND:
    1521         /*
    1522          * logical and
    1523          */
    1524         op1 = (long)_bfd_vms_pop (abfd, NULL);
    1525         op2 = (long)_bfd_vms_pop (abfd, NULL);
    1526         _bfd_vms_push (abfd, (unsigned long) (op1 & op2), -1);
    1527       break;
    1528 
    1529       case TIR_S_C_OPR_IOR:
    1530         op1 = (long)_bfd_vms_pop (abfd, NULL);
    1531         /*
    1532          * logical inclusive or
    1533          */
    1534         op2 = (long)_bfd_vms_pop (abfd, NULL);
    1535         _bfd_vms_push (abfd, (unsigned long) (op1 | op2), -1);
    1536       break;
    1537 
    1538       case TIR_S_C_OPR_EOR:
    1539         /*
    1540          * logical exclusive or
    1541          */
    1542         op1 = (long)_bfd_vms_pop (abfd, NULL);
    1543         op2 = (long)_bfd_vms_pop (abfd, NULL);
    1544         _bfd_vms_push (abfd, (unsigned long) (op1 ^ op2), -1);
    1545       break;
    1546 
    1547       case TIR_S_C_OPR_NEG:
    1548         /*
    1549          * negate
    1550          */
    1551         op1 = (long)_bfd_vms_pop (abfd, NULL);
    1552         _bfd_vms_push (abfd, (unsigned long) (-op1), -1);
    1553       break;
    1554 
    1555       case TIR_S_C_OPR_COM:
    1556         /*
    1557          * complement
    1558          */
    1559         op1 = (long)_bfd_vms_pop (abfd, NULL);
    1560         _bfd_vms_push (abfd, (unsigned long) (op1 ^ -1L), -1);
    1561       break;
    1562 
    1563       case TIR_S_C_OPR_INSV:
    1564         /*
    1565          * insert field
    1566          */
    1567         (void)_bfd_vms_pop (abfd, NULL);
    1568         (*_bfd_error_handler)  ("TIR_S_C_OPR_INSV incomplete");
    1569       break;
    1570 
    1571       case TIR_S_C_OPR_ASH:
    1572         /*
    1573          * arithmetic shift
    1574          */
    1575         op1 = (long)_bfd_vms_pop (abfd, NULL);
    1576         op2 = (long)_bfd_vms_pop (abfd, NULL);
    1577         if (HIGHBIT(op1))               /* shift right */
    1578           op2 >>= op1;
    1579         else                    /* shift left */
    1580           op2 <<= op1;
    1581         _bfd_vms_push (abfd, (unsigned long)op2, -1);
    1582         (*_bfd_error_handler) (_("TIR_S_C_OPR_ASH incomplete"));
    1583       break;
    1584 
    1585       case TIR_S_C_OPR_USH:
    1586         /*
    1587          * unsigned shift
    1588          */
    1589         op1 = (long)_bfd_vms_pop (abfd, NULL);
    1590         op2 = (long)_bfd_vms_pop (abfd, NULL);
    1591         if (HIGHBIT(op1))               /* shift right */
    1592           op2 >>= op1;
    1593         else                    /* shift left */
    1594           op2 <<= op1;
    1595         _bfd_vms_push (abfd, (unsigned long)op2, -1);
    1596         (*_bfd_error_handler) (_("TIR_S_C_OPR_USH incomplete"));
    1597       break;
    1598 
    1599       case TIR_S_C_OPR_ROT:
    1600         /*
    1601          * rotate
    1602          */
    1603         op1 = (long)_bfd_vms_pop (abfd, NULL);
    1604         op2 = (long)_bfd_vms_pop (abfd, NULL);
    1605         if (HIGHBIT(0))         /* shift right */
    1606           op2 >>= op1;
    1607         else                    /* shift left */
    1608           op2 <<= op1;
    1609         _bfd_vms_push (abfd, (unsigned long)op2, -1);
    1610         (*_bfd_error_handler) (_("TIR_S_C_OPR_ROT incomplete"));
    1611       break;
    1612 
    1613       case TIR_S_C_OPR_SEL:
    1614         /*
    1615          * select
    1616          */
    1617         if ((long)_bfd_vms_pop (abfd, NULL) & 0x01L)
    1618           (void)_bfd_vms_pop (abfd, NULL);
    1619         else
    1620           {
    1621             op1 = (long)_bfd_vms_pop (abfd, NULL);
    1622             (void)_bfd_vms_pop (abfd, NULL);
    1623             _bfd_vms_push (abfd, (unsigned long)op1, -1);
    1624           }
    1625       break;
    1626 
    1627       case TIR_S_C_OPR_REDEF:
    1628         /*
    1629          * redefine symbol to current location
    1630          */
    1631         (*_bfd_error_handler) (_("TIR_S_C_OPR_REDEF not supported"));
    1632       break;
    1633 
    1634       case TIR_S_C_OPR_DFLIT:
    1635         /*
    1636          * define a literal
    1637          */
    1638         (*_bfd_error_handler) (_("TIR_S_C_OPR_DFLIT not supported"));
    1639       break;
    1640 
    1641       default:
    1642         (*_bfd_error_handler) (_("Reserved OPR cmd %d"), ptr[-1]);
     1472      /* operation */
     1473    case TIR_S_C_OPR_NOP: /* no-op */
     1474      break;
     1475
     1476    case TIR_S_C_OPR_ADD: /* add */
     1477      op1 = (long) _bfd_vms_pop (abfd, NULL);
     1478      op2 = (long) _bfd_vms_pop (abfd, NULL);
     1479      _bfd_vms_push (abfd, (uquad) (op1 + op2), -1);
     1480      break;
     1481
     1482    case TIR_S_C_OPR_SUB: /* subtract */
     1483      op1 = (long) _bfd_vms_pop (abfd, NULL);
     1484      op2 = (long) _bfd_vms_pop (abfd, NULL);
     1485      _bfd_vms_push (abfd, (uquad) (op2 - op1), -1);
     1486      break;
     1487
     1488    case TIR_S_C_OPR_MUL: /* multiply */
     1489      op1 = (long) _bfd_vms_pop (abfd, NULL);
     1490      op2 = (long) _bfd_vms_pop (abfd, NULL);
     1491      _bfd_vms_push (abfd, (uquad) (op1 * op2), -1);
     1492      break;
     1493
     1494    case TIR_S_C_OPR_DIV: /* divide */
     1495      op1 = (long) _bfd_vms_pop (abfd, NULL);
     1496      op2 = (long) _bfd_vms_pop (abfd, NULL);
     1497      if (op2 == 0)
     1498        _bfd_vms_push (abfd, (uquad) 0, -1);
     1499      else
     1500        _bfd_vms_push (abfd, (uquad) (op2 / op1), -1);
     1501      break;
     1502
     1503    case TIR_S_C_OPR_AND: /* logical and */
     1504      op1 = (long) _bfd_vms_pop (abfd, NULL);
     1505      op2 = (long) _bfd_vms_pop (abfd, NULL);
     1506      _bfd_vms_push (abfd, (uquad) (op1 & op2), -1);
     1507      break;
     1508
     1509    case TIR_S_C_OPR_IOR: /* logical inclusive or */
     1510      op1 = (long) _bfd_vms_pop (abfd, NULL);
     1511      op2 = (long) _bfd_vms_pop (abfd, NULL);
     1512      _bfd_vms_push (abfd, (uquad) (op1 | op2), -1);
     1513      break;
     1514
     1515    case TIR_S_C_OPR_EOR: /* logical exclusive or */
     1516      op1 = (long) _bfd_vms_pop (abfd, NULL);
     1517      op2 = (long) _bfd_vms_pop (abfd, NULL);
     1518      _bfd_vms_push (abfd, (uquad) (op1 ^ op2), -1);
     1519      break;
     1520
     1521    case TIR_S_C_OPR_NEG: /* negate */
     1522      op1 = (long) _bfd_vms_pop (abfd, NULL);
     1523      _bfd_vms_push (abfd, (uquad) (-op1), -1);
     1524      break;
     1525
     1526    case TIR_S_C_OPR_COM: /* complement */
     1527      op1 = (long) _bfd_vms_pop (abfd, NULL);
     1528      _bfd_vms_push (abfd, (uquad) (op1 ^ -1L), -1);
     1529      break;
     1530
     1531    case TIR_S_C_OPR_INSV: /* insert field */
     1532      (void) _bfd_vms_pop (abfd, NULL);
     1533      (*_bfd_error_handler)  (_("%s: not fully implemented"),
     1534                              tir_cmd_name (ptr[-1]));
     1535      break;
     1536
     1537    case TIR_S_C_OPR_ASH: /* arithmetic shift */
     1538      op1 = (long) _bfd_vms_pop (abfd, NULL);
     1539      op2 = (long) _bfd_vms_pop (abfd, NULL);
     1540      if (HIGHBIT (op1))        /* shift right */
     1541        op2 >>= op1;
     1542      else                      /* shift left */
     1543        op2 <<= op1;
     1544      _bfd_vms_push (abfd, (uquad) op2, -1);
     1545      (*_bfd_error_handler)  (_("%s: not fully implemented"),
     1546                              tir_cmd_name (ptr[-1]));
     1547      break;
     1548
     1549    case TIR_S_C_OPR_USH: /* unsigned shift */
     1550      op1 = (long) _bfd_vms_pop (abfd, NULL);
     1551      op2 = (long) _bfd_vms_pop (abfd, NULL);
     1552      if (HIGHBIT (op1))        /* shift right */
     1553        op2 >>= op1;
     1554      else                      /* shift left */
     1555        op2 <<= op1;
     1556      _bfd_vms_push (abfd, (uquad) op2, -1);
     1557      (*_bfd_error_handler)  (_("%s: not fully implemented"),
     1558                              tir_cmd_name (ptr[-1]));
     1559      break;
     1560
     1561    case TIR_S_C_OPR_ROT: /* rotate */
     1562      op1 = (long) _bfd_vms_pop (abfd, NULL);
     1563      op2 = (long) _bfd_vms_pop (abfd, NULL);
     1564      if (HIGHBIT (0))  /* shift right */
     1565        op2 >>= op1;
     1566      else              /* shift left */
     1567        op2 <<= op1;
     1568      _bfd_vms_push (abfd, (uquad) op2, -1);
     1569      (*_bfd_error_handler)  (_("%s: not fully implemented"),
     1570                              tir_cmd_name (ptr[-1]));
     1571      break;
     1572
     1573    case TIR_S_C_OPR_SEL: /* select */
     1574      if ((long) _bfd_vms_pop (abfd, NULL) & 0x01L)
     1575        (void) _bfd_vms_pop (abfd, NULL);
     1576      else
     1577        {
     1578          op1 = (long) _bfd_vms_pop (abfd, NULL);
     1579          (void) _bfd_vms_pop (abfd, NULL);
     1580          _bfd_vms_push (abfd, (uquad) op1, -1);
     1581        }
     1582      break;
     1583
     1584    case TIR_S_C_OPR_REDEF: /* Redefine symbol to current location.  */
     1585    case TIR_S_C_OPR_DFLIT: /* Define a literal.  */
     1586      (*_bfd_error_handler) (_("%s: not supported"),
     1587                             tir_cmd_name (ptr[-1]));
     1588      break;
     1589
     1590    default:
     1591      (*_bfd_error_handler) (_("reserved OPR cmd %d"), ptr[-1]);
    16431592      break;
    16441593    }
     
    16461595  return ptr;
    16471596}
     1597
     1598/* control commands
     1599
     1600   See table 7-6 of the VAX/VMS linker manual.  */
    16481601
    16491602static unsigned char *
    16501603tir_ctl (bfd *abfd, unsigned char *ptr)
    1651 /*
    1652  * control commands
    1653  *
    1654  * see table 7-6 of the VAX/VMS linker manual
    1655  */
    16561604{
    16571605  unsigned long dummy;
     
    16641612  switch (*ptr++)
    16651613    {
    1666       case TIR_S_C_CTL_SETRB:
    1667         /*
    1668          * set relocation base: pop stack, set image location counter
    1669          * arg: -
    1670          */
    1671         dummy = _bfd_vms_pop (abfd, &psect);
    1672         if (psect >= PRIV(section_count))
    1673           {
    1674             alloc_section (abfd, psect);
    1675           }
    1676         image_set_ptr (abfd, psect, dummy);
    1677       break;
    1678       case TIR_S_C_CTL_AUGRB:
    1679         /*
    1680          * augment relocation base: increment image location counter by offset
    1681          * arg: lw      offset value
    1682          */
    1683         dummy = bfd_getl32 (ptr);
    1684         image_inc_ptr (abfd, dummy);
    1685       break;
    1686       case TIR_S_C_CTL_DFLOC:
    1687         /*
    1688          * define location: pop index, save location counter under index
    1689          * arg: -
    1690          */
    1691         dummy = _bfd_vms_pop (abfd, NULL);
    1692         (*_bfd_error_handler) (_("TIR_S_C_CTL_DFLOC not fully implemented"));
    1693       break;
    1694       case TIR_S_C_CTL_STLOC:
    1695         /*
    1696          * set location: pop index, restore location counter from index
    1697          * arg: -
    1698          */
    1699         dummy = _bfd_vms_pop (abfd, &psect);
    1700         (*_bfd_error_handler) (_("TIR_S_C_CTL_STLOC not fully implemented"));
    1701       break;
     1614    case TIR_S_C_CTL_SETRB:
     1615      /* Set relocation base: pop stack, set image location counter
     1616         arg: none.  */
     1617      dummy = _bfd_vms_pop (abfd, &psect);
     1618      if (psect >= PRIV (section_count))
     1619        alloc_section (abfd, psect);
     1620      image_set_ptr (abfd, (int) psect, (uquad) dummy);
     1621      break;
     1622
     1623    case TIR_S_C_CTL_AUGRB:
     1624      /* Augment relocation base: increment image location counter by offset
     1625         arg: lw        offset value.  */
     1626      dummy = bfd_getl32 (ptr);
     1627      image_inc_ptr (abfd, (uquad) dummy);
     1628      break;
     1629
     1630    case TIR_S_C_CTL_DFLOC:
     1631      /* Define location: pop index, save location counter under index
     1632         arg: none.  */
     1633      dummy = _bfd_vms_pop (abfd, NULL);
     1634      (*_bfd_error_handler) (_("%s: not fully implemented"),
     1635                             tir_cmd_name (ptr[-1]));
     1636      break;
     1637
     1638    case TIR_S_C_CTL_STLOC:
     1639      /* Set location: pop index, restore location counter from index
     1640         arg: none.  */
     1641      dummy = _bfd_vms_pop (abfd, &psect);
     1642      (*_bfd_error_handler) (_("%s: not fully implemented"),
     1643                             tir_cmd_name (ptr[-1]));
     1644      break;
     1645
    17021646    case TIR_S_C_CTL_STKDL:
    1703         /*
    1704          * stack defined location: pop index, push location counter from index
    1705          * arg: -
    1706          */
    1707         dummy = _bfd_vms_pop (abfd, &psect);
    1708         (*_bfd_error_handler) (_("TIR_S_C_CTL_STKDL not fully implemented"));
    1709       break;
     1647      /* Stack defined location: pop index, push location counter from index
     1648         arg: none.  */
     1649      dummy = _bfd_vms_pop (abfd, &psect);
     1650      (*_bfd_error_handler) (_("%s: not fully implemented"),
     1651                             tir_cmd_name (ptr[-1]));
     1652      break;
     1653
    17101654    default:
    1711         (*_bfd_error_handler) (_("Reserved CTL cmd %d"), ptr[-1]);
    1712         break;
    1713   }
     1655      (*_bfd_error_handler) (_("reserved CTL cmd %d"), ptr[-1]);
     1656      break;
     1657    }
    17141658  return ptr;
    17151659}
    17161660
    1717 /*
    1718  * handle command from TIR section
    1719  */
     1661/* Handle command from TIR section.  */
    17201662
    17211663static unsigned char *
    17221664tir_cmd (bfd *abfd, unsigned char *ptr)
    17231665{
    1724   struct {
     1666  struct
     1667  {
    17251668    int mincod;
    17261669    int maxcod;
    17271670    unsigned char * (*explain) (bfd *, unsigned char *);
    1728   } tir_table[] = {
    1729     { 0,                 TIR_S_C_MAXSTACOD, tir_sta }
    1730    ,{ TIR_S_C_MINSTOCOD, TIR_S_C_MAXSTOCOD, tir_sto }
    1731    ,{ TIR_S_C_MINOPRCOD, TIR_S_C_MAXOPRCOD, tir_opr }
    1732    ,{ TIR_S_C_MINCTLCOD, TIR_S_C_MAXCTLCOD, tir_ctl }
    1733    ,{ -1, -1, NULL }
     1671  }
     1672  tir_table[] =
     1673  {
     1674    { 0,                 TIR_S_C_MAXSTACOD, tir_sta },
     1675    { TIR_S_C_MINSTOCOD, TIR_S_C_MAXSTOCOD, tir_sto },
     1676    { TIR_S_C_MINOPRCOD, TIR_S_C_MAXOPRCOD, tir_opr },
     1677    { TIR_S_C_MINCTLCOD, TIR_S_C_MAXCTLCOD, tir_ctl },
     1678    { -1, -1, NULL }
    17341679  };
    17351680  int i = 0;
     
    17371682#if VMS_DEBUG
    17381683  _bfd_vms_debug (4, "tir_cmd %d/%x\n", *ptr, *ptr);
    1739   _bfd_hexdump (8, ptr, 16, (int)ptr);
     1684  _bfd_hexdump (8, ptr, 16, (int) ptr);
    17401685#endif
    17411686
     
    17511696        {
    17521697          if ( (tir_table[i].mincod <= *ptr)
    1753             && (*ptr <= tir_table[i].maxcod))
     1698               && (*ptr <= tir_table[i].maxcod))
    17541699            {
    17551700              ptr = tir_table[i].explain (abfd, ptr);
     
    17601705      if (tir_table[i].mincod < 0)
    17611706        {
    1762           (*_bfd_error_handler) (_("Obj code %d not found"), *ptr);
     1707          (*_bfd_error_handler) (_("obj code %d not found"), *ptr);
    17631708          ptr = 0;
    17641709        }
     
    17681713}
    17691714
    1770 /* handle command from ETIR section  */
     1715/* Handle command from ETIR section.  */
    17711716
    17721717static int
     
    17761721     unsigned char *ptr;
    17771722{
    1778   static struct {
     1723  static struct
     1724  {
    17791725    int mincod;
    17801726    int maxcod;
    1781     boolean (*explain) PARAMS((bfd *, int, unsigned char *));
    1782   } etir_table[] = {
     1727    bfd_boolean (*explain) PARAMS ((bfd *, int, unsigned char *));
     1728  }
     1729  etir_table[] =
     1730  {
    17831731    { ETIR_S_C_MINSTACOD, ETIR_S_C_MAXSTACOD, etir_sta },
    17841732    { ETIR_S_C_MINSTOCOD, ETIR_S_C_MAXSTOCOD, etir_sto },
     
    17931741#if VMS_DEBUG
    17941742  _bfd_vms_debug (4, "etir_cmd %d/%x\n", cmd, cmd);
    1795   _bfd_hexdump (8, ptr, 16, (int)ptr);
     1743  _bfd_hexdump (8, ptr, 16, (int) ptr);
    17961744#endif
    17971745
     
    17991747    {
    18001748      if ( (etir_table[i].mincod <= cmd)
    1801         && (cmd <= etir_table[i].maxcod))
     1749           && (cmd <= etir_table[i].maxcod))
    18021750        {
    18031751          if (!etir_table[i].explain (abfd, cmd, ptr))
     
    18151763
    18161764/* Text Information and Relocation Records (OBJ$C_TIR)
    1817    handle tir record  */
     1765   handle tir record.  */
    18181766
    18191767static int
     
    18421790
    18431791/* Text Information and Relocation Records (EOBJ$C_ETIR)
    1844    handle etir record  */
     1792   handle etir record.  */
    18451793
    18461794static int
     
    18771825}
    18781826
    1879 /* process ETIR record
    1880 
    1881    return 0 on success, -1 on error  */
     1827/* Process ETIR record
     1828   Return 0 on success, -1 on error.  */
    18821829
    18831830int
     
    18941841  switch (objtype)
    18951842    {
    1896       case EOBJ_S_C_ETIR:
    1897         PRIV(vms_rec) += 4;     /* skip type, size */
    1898         PRIV(rec_size) -= 4;
    1899         result = analyze_etir (abfd, PRIV(vms_rec), PRIV(rec_size));
    1900         break;
    1901       case OBJ_S_C_TIR:
    1902         PRIV(vms_rec) += 1;     /* skip type */
    1903         PRIV(rec_size) -= 1;
    1904         result = analyze_tir (abfd, PRIV(vms_rec), PRIV(rec_size));
    1905         break;
    1906       default:
    1907         result = -1;
    1908         break;
     1843    case EOBJ_S_C_ETIR:
     1844      PRIV (vms_rec) += 4;      /* skip type, size */
     1845      PRIV (rec_size) -= 4;
     1846      result = analyze_etir (abfd, PRIV (vms_rec), (unsigned) PRIV (rec_size));
     1847      break;
     1848    case OBJ_S_C_TIR:
     1849      PRIV (vms_rec) += 1;      /* skip type */
     1850      PRIV (rec_size) -= 1;
     1851      result = analyze_tir (abfd, PRIV (vms_rec), (unsigned) PRIV (rec_size));
     1852      break;
     1853    default:
     1854      result = -1;
     1855      break;
    19091856    }
    19101857
     
    19121859}
    19131860
    1914 /* process EDBG record
    1915    return 0 on success, -1 on error
    1916 
    1917    not implemented yet  */
     1861/* Process EDBG record
     1862   Return 0 on success, -1 on error
     1863
     1864   Not implemented yet.  */
    19181865
    19191866int
     
    19301877}
    19311878
    1932 /* process ETBT record
    1933    return 0 on success, -1 on error
    1934 
    1935    not implemented yet  */
     1879/* Process ETBT record
     1880   Return 0 on success, -1 on error
     1881
     1882   Not implemented yet.  */
    19361883
    19371884int
     
    19471894}
    19481895
    1949 /* process LNK record
    1950    return 0 on success, -1 on error
    1951 
    1952    not implemented yet  */
     1896/* Process LNK record
     1897   Return 0 on success, -1 on error
     1898
     1899   Not implemented yet.  */
    19531900
    19541901int
     
    19651912
    19661913
    1967 /*----------------------------------------------------------------------*/
    1968 /*                                                                      */
    1969 /*      WRITE ETIR SECTION                                              */
    1970 /*                                                                      */
    1971 /*      this is still under construction and therefore not documented   */
    1972 /*                                                                      */
    1973 /*----------------------------------------------------------------------*/
    1974 
    1975 static void start_etir_record PARAMS ((bfd *abfd, int index, uquad offset, boolean justoffset));
    1976 static void sto_imm PARAMS ((bfd *abfd, vms_section *sptr, bfd_vma vaddr, int index));
    1977 static void end_etir_record PARAMS ((bfd *abfd));
     1914/* WRITE ETIR SECTION
     1915
     1916   This is still under construction and therefore not documented.  */
     1917
     1918static void start_etir_record
     1919  PARAMS ((bfd *abfd, int index, uquad offset, bfd_boolean justoffset));
     1920static void sto_imm
     1921  PARAMS ((bfd *abfd, vms_section *sptr, bfd_vma vaddr, int index));
     1922static void end_etir_record
     1923  PARAMS ((bfd *abfd));
    19781924
    19791925static void
     
    19901936#if VMS_DEBUG
    19911937  _bfd_vms_debug (8, "sto_imm %d bytes\n", sptr->size);
    1992   _bfd_hexdump (9, sptr->contents, (int)sptr->size, (int)vaddr);
     1938  _bfd_hexdump (9, sptr->contents, (int) sptr->size, (int) vaddr);
    19931939#endif
    19941940
     
    19981944  while (ssize > 0)
    19991945    {
    2000 
    20011946      size = ssize;                             /* try all the rest */
    20021947
     
    20041949        {                                       /* doesn't fit, split ! */
    20051950          end_etir_record (abfd);
    2006           start_etir_record (abfd, index, vaddr, false);
     1951          start_etir_record (abfd, index, vaddr, FALSE);
    20071952          size = _bfd_vms_output_check (abfd, 0);       /* get max size */
    20081953          if (size > ssize)                     /* more than what's left ? */
     
    20171962#if VMS_DEBUG
    20181963      _bfd_vms_debug (10, "dumped %d bytes\n", size);
    2019       _bfd_hexdump (10, cptr, (int)size, (int)vaddr);
     1964      _bfd_hexdump (10, cptr, (int) size, (int) vaddr);
    20201965#endif
    20211966
     
    20241969      cptr += size;
    20251970    }
    2026 
    2027   return;
    2028 }
    2029 
    2030 /*-------------------------------------------------------------------*/
    2031 
    2032 /* start ETIR record for section #index at virtual addr offset.  */
     1971}
     1972
     1973/* Start ETIR record for section #index at virtual addr offset.  */
    20331974
    20341975static void
     
    20371978    int index;
    20381979    uquad offset;
    2039     boolean justoffset;
     1980    bfd_boolean justoffset;
    20401981{
    20411982  if (!justoffset)
     
    20461987
    20471988  _bfd_vms_output_begin (abfd, ETIR_S_C_STA_PQ, -1);    /* push start offset */
    2048   _bfd_vms_output_long (abfd, (unsigned long)index);
    2049   _bfd_vms_output_quad (abfd, (uquad)offset);
     1989  _bfd_vms_output_long (abfd, (unsigned long) index);
     1990  _bfd_vms_output_quad (abfd, (uquad) offset);
    20501991  _bfd_vms_output_flush (abfd);
    20511992
    20521993  _bfd_vms_output_begin (abfd, ETIR_S_C_CTL_SETRB, -1); /* start = pop () */
    20531994  _bfd_vms_output_flush (abfd);
    2054 
    2055   return;
    2056 }
    2057 
    2058 /* end etir record  */
     1995}
     1996
     1997/* End etir record.  */
     1998
    20591999static void
    20602000end_etir_record (abfd)
     
    20652005}
    20662006
    2067 /* write section contents for bfd abfd  */
     2007/* Write section contents for bfd abfd.  */
    20682008
    20692009int
     
    20832023
    20842024  nextoffset = 0;
    2085   PRIV(vms_linkage_index) = 1;
    2086 
    2087   /* dump all other sections  */
     2025  PRIV (vms_linkage_index) = 1;
     2026
     2027  /* Dump all other sections.  */
    20882028
    20892029  section = abfd->sections;
     
    20932033
    20942034#if VMS_DEBUG
    2095       _bfd_vms_debug (4, "writing %d. section '%s' (%d bytes)\n", section->index, section->name, (int) (section->_raw_size));
     2035      _bfd_vms_debug (4, "writing %d. section '%s' (%d bytes)\n",
     2036                      section->index, section->name,
     2037                      (int) (section->_raw_size));
    20962038#endif
    20972039
     
    21142056                {
    21152057                  _bfd_vms_debug (4, "sym %s in sec %s, value %08lx, addr %08lx, off %08lx, len %d: %s\n",
    2116                               (*(*rptr)->sym_ptr_ptr)->name,
    2117                               (*(*rptr)->sym_ptr_ptr)->section->name,
    2118                               (long) (*(*rptr)->sym_ptr_ptr)->value,
    2119                               (*rptr)->address, (*rptr)->addend,
    2120                               bfd_get_reloc_size((*rptr)->howto),
    2121                               (*rptr)->howto->name);
     2058                                  (*(*rptr)->sym_ptr_ptr)->name,
     2059                                  (*(*rptr)->sym_ptr_ptr)->section->name,
     2060                                  (long) (*(*rptr)->sym_ptr_ptr)->value,
     2061                                  (*rptr)->address, (*rptr)->addend,
     2062                                  bfd_get_reloc_size ((*rptr)->howto),
     2063                                  (*rptr)->howto->name);
    21222064                  rptr++;
    21232065                }
     
    21272069
    21282070      if ((section->flags & SEC_HAS_CONTENTS)
    2129         && (! bfd_is_com_section (section)))
     2071          && (! bfd_is_com_section (section)))
    21302072        {
    2131           bfd_vma vaddr;                /* virtual addr in section */
     2073          bfd_vma vaddr;                /* Virtual addr in section. */
    21322074
    21332075          sptr = _bfd_get_vms_section (abfd, section->index);
     
    21412083
    21422084          start_etir_record (abfd, section->index, (uquad) sptr->offset,
    2143                              false);
    2144 
    2145           while (sptr != NULL)                          /* one STA_PQ, CTL_SETRB per vms_section */
     2085                             FALSE);
     2086
     2087          while (sptr != NULL)  /* one STA_PQ, CTL_SETRB per vms_section */
    21462088            {
    21472089
    2148               if (section->flags & SEC_RELOC)                   /* check for relocs */
     2090              if (section->flags & SEC_RELOC)   /* check for relocs */
    21492091                {
    21502092                  arelent **rptr = section->orelocation;
    21512093                  int i = section->reloc_count;
     2094
    21522095                  for (;;)
    21532096                    {
    21542097                      bfd_size_type addr = (*rptr)->address;
    21552098                      bfd_size_type len = bfd_get_reloc_size ((*rptr)->howto);
    2156                       if (sptr->offset < addr)          /* sptr starts before reloc */
     2099                      if (sptr->offset < addr)  /* sptr starts before reloc */
    21572100                        {
    21582101                          bfd_size_type before = addr - sptr->offset;
    2159                           if (sptr->size <= before)             /* complete before */
     2102                          if (sptr->size <= before)     /* complete before */
    21602103                            {
    21612104                              sto_imm (abfd, sptr, vaddr, section->index);
     
    21742117                            }
    21752118                        }
    2176                       else if (sptr->offset == addr)    /* sptr starts at reloc */
     2119                      else if (sptr->offset == addr) /* sptr starts at reloc */
    21772120                        {
    21782121                          asymbol *sym = *(*rptr)->sym_ptr_ptr;
     
    21882131                                if (bfd_is_und_section (sym->section))
    21892132                                  {
    2190                                     if (_bfd_vms_output_check (abfd,
    2191                                                                 strlen((char *)sym->name))
    2192                                         < 0)
     2133                                    int slen = strlen ((char *) sym->name);
     2134                                    char *hash;
     2135
     2136                                    if (_bfd_vms_output_check (abfd, slen) < 0)
    21932137                                      {
    21942138                                        end_etir_record (abfd);
    21952139                                        start_etir_record (abfd,
    21962140                                                           section->index,
    2197                                                            vaddr, false);
     2141                                                           vaddr, FALSE);
    21982142                                      }
    21992143                                    _bfd_vms_output_begin (abfd,
    2200                                                             ETIR_S_C_STO_GBL_LW,
    2201                                                             -1);
    2202                                     _bfd_vms_output_counted (abfd,
    2203                                                               _bfd_vms_length_hash_symbol (abfd, sym->name, EOBJ_S_C_SYMSIZ));
     2144                                                           ETIR_S_C_STO_GBL_LW,
     2145                                                           -1);
     2146                                    hash = (_bfd_vms_length_hash_symbol
     2147                                            (abfd, sym->name, EOBJ_S_C_SYMSIZ));
     2148                                    _bfd_vms_output_counted (abfd, hash);
    22042149                                    _bfd_vms_output_flush (abfd);
    22052150                                  }
     
    22112156                                        start_etir_record (abfd,
    22122157                                                           section->index,
    2213                                                            vaddr, false);
     2158                                                           vaddr, FALSE);
    22142159                                      }
    22152160                                    _bfd_vms_output_begin (abfd,
    2216                                                             ETIR_S_C_STA_LW,
    2217                                                             -1);
     2161                                                           ETIR_S_C_STA_LW,
     2162                                                           -1);
    22182163                                    _bfd_vms_output_quad (abfd,
    2219                                                            (uquad)sym->value);
     2164                                                          (uquad) sym->value);
    22202165                                    _bfd_vms_output_flush (abfd);
    22212166                                    _bfd_vms_output_begin (abfd,
    2222                                                             ETIR_S_C_STO_LW,
    2223                                                             -1);
     2167                                                           ETIR_S_C_STO_LW,
     2168                                                           -1);
    22242169                                    _bfd_vms_output_flush (abfd);
    22252170                                  }
     
    22312176                                        start_etir_record (abfd,
    22322177                                                           section->index,
    2233                                                            vaddr, false);
     2178                                                           vaddr, FALSE);
    22342179                                      }
    22352180                                    _bfd_vms_output_begin (abfd,
    2236                                                             ETIR_S_C_STA_PQ,
    2237                                                             -1);
     2181                                                           ETIR_S_C_STA_PQ,
     2182                                                           -1);
    22382183                                    _bfd_vms_output_long (abfd,
    2239                                                            (unsigned long) (sec->index));
     2184                                                          (unsigned long) (sec->index));
    22402185                                    _bfd_vms_output_quad (abfd,
    2241                                                            ((uquad) (*rptr)->addend
    2242                                                             + (uquad)sym->value));
     2186                                                          ((uquad) (*rptr)->addend
     2187                                                           + (uquad) sym->value));
    22432188                                    _bfd_vms_output_flush (abfd);
    22442189                                    _bfd_vms_output_begin (abfd,
    2245                                                             ETIR_S_C_STO_LW,
    2246                                                             -1);
     2190                                                           ETIR_S_C_STO_LW,
     2191                                                           -1);
    22472192                                    _bfd_vms_output_flush (abfd);
    22482193                                  }
     
    22542199                                if (bfd_is_und_section (sym->section))
    22552200                                  {
    2256                                     if (_bfd_vms_output_check (abfd,
    2257                                                                 strlen((char *)sym->name))
    2258                                         < 0)
     2201                                    int slen = strlen ((char *) sym->name);
     2202                                    char *hash;
     2203                                    if (_bfd_vms_output_check (abfd, slen) < 0)
    22592204                                      {
    22602205                                        end_etir_record (abfd);
    22612206                                        start_etir_record (abfd,
    22622207                                                           section->index,
    2263                                                            vaddr, false);
     2208                                                           vaddr, FALSE);
    22642209                                      }
    22652210                                    _bfd_vms_output_begin (abfd,
    2266                                                             ETIR_S_C_STO_GBL,
    2267                                                             -1);
    2268                                     _bfd_vms_output_counted (abfd,
    2269                                                               _bfd_vms_length_hash_symbol (abfd, sym->name, EOBJ_S_C_SYMSIZ));
     2211                                                           ETIR_S_C_STO_GBL,
     2212                                                           -1);
     2213                                    hash = (_bfd_vms_length_hash_symbol
     2214                                            (abfd, sym->name, EOBJ_S_C_SYMSIZ));
     2215                                    _bfd_vms_output_counted (abfd, hash);
    22702216                                    _bfd_vms_output_flush (abfd);
    22712217                                  }
     
    22772223                                        start_etir_record (abfd,
    22782224                                                           section->index,
    2279                                                            vaddr, false);
     2225                                                           vaddr, FALSE);
    22802226                                      }
    22812227                                    _bfd_vms_output_begin (abfd,
    2282                                                             ETIR_S_C_STA_QW,
    2283                                                             -1);
     2228                                                           ETIR_S_C_STA_QW,
     2229                                                           -1);
    22842230                                    _bfd_vms_output_quad (abfd,
    2285                                                            (uquad)sym->value);
     2231                                                          (uquad) sym->value);
    22862232                                    _bfd_vms_output_flush (abfd);
    22872233                                    _bfd_vms_output_begin (abfd,
    2288                                                             ETIR_S_C_STO_QW,
    2289                                                             -1);
     2234                                                           ETIR_S_C_STO_QW,
     2235                                                           -1);
    22902236                                    _bfd_vms_output_flush (abfd);
    22912237                                  }
     
    22972243                                        start_etir_record (abfd,
    22982244                                                           section->index,
    2299                                                            vaddr, false);
     2245                                                           vaddr, FALSE);
    23002246                                      }
    23012247                                    _bfd_vms_output_begin (abfd,
    2302                                                             ETIR_S_C_STA_PQ,
    2303                                                             -1);
     2248                                                           ETIR_S_C_STA_PQ,
     2249                                                           -1);
    23042250                                    _bfd_vms_output_long (abfd,
    2305                                                            (unsigned long) (sec->index));
     2251                                                          (unsigned long) (sec->index));
    23062252                                    _bfd_vms_output_quad (abfd,
    2307                                                            ((uquad) (*rptr)->addend
    2308                                                             + (uquad)sym->value));
     2253                                                          ((uquad) (*rptr)->addend
     2254                                                           + (uquad) sym->value));
    23092255                                    _bfd_vms_output_flush (abfd);
    23102256                                    _bfd_vms_output_begin (abfd,
    2311                                                             ETIR_S_C_STO_OFF,
    2312                                                             -1);
     2257                                                           ETIR_S_C_STO_OFF,
     2258                                                           -1);
    23132259                                    _bfd_vms_output_flush (abfd);
    23142260                                  }
     
    23192265                              {
    23202266                                int hint_size;
     2267                                char *hash ATTRIBUTE_UNUSED;
    23212268
    23222269                                hint_size = sptr->size;
     
    23252272                                sptr->size = hint_size;
    23262273#if 0
    2327                                 vms_output_begin(abfd, ETIR_S_C_STO_HINT_GBL, -1);
    2328                                 vms_output_long(abfd, (unsigned long) (sec->index));
    2329                                 vms_output_quad(abfd, (uquad)addr);
    2330 
    2331                                 vms_output_counted(abfd, _bfd_vms_length_hash_symbol (abfd, sym->name, EOBJ_S_C_SYMSIZ));
    2332                                 vms_output_flush(abfd);
     2274                                vms_output_begin (abfd,
     2275                                                  ETIR_S_C_STO_HINT_GBL, -1);
     2276                                vms_output_long (abfd,
     2277                                                 (unsigned long) (sec->index));
     2278                                vms_output_quad (abfd, (uquad) addr);
     2279
     2280                                hash = (_bfd_vms_length_hash_symbol
     2281                                        (abfd, sym->name, EOBJ_S_C_SYMSIZ));
     2282                                vms_output_counted (abfd, hash);
     2283
     2284                                vms_output_flush (abfd);
    23332285#endif
    23342286                              }
     
    23362288                            case ALPHA_R_LINKAGE:
    23372289                              {
     2290                                char *hash;
     2291
    23382292                                if (_bfd_vms_output_check (abfd, 64) < 0)
    23392293                                  {
    23402294                                    end_etir_record (abfd);
    23412295                                    start_etir_record (abfd, section->index,
    2342                                                        vaddr, false);
     2296                                                       vaddr, FALSE);
    23432297                                  }
    23442298                                _bfd_vms_output_begin (abfd,
    2345                                                         ETIR_S_C_STC_LP_PSB,
    2346                                                         -1);
     2299                                                       ETIR_S_C_STC_LP_PSB,
     2300                                                       -1);
    23472301                                _bfd_vms_output_long (abfd,
    2348                                                        (unsigned long)PRIV(vms_linkage_index));
    2349                                 PRIV(vms_linkage_index) += 2;
    2350                                 _bfd_vms_output_counted (abfd,
    2351                                                           _bfd_vms_length_hash_symbol (abfd, sym->name, EOBJ_S_C_SYMSIZ));
     2302                                                      (unsigned long) PRIV (vms_linkage_index));
     2303                                PRIV (vms_linkage_index) += 2;
     2304                                hash = (_bfd_vms_length_hash_symbol
     2305                                        (abfd, sym->name, EOBJ_S_C_SYMSIZ));
     2306                                _bfd_vms_output_counted (abfd, hash);
    23522307                                _bfd_vms_output_byte (abfd, 0);
    23532308                                _bfd_vms_output_flush (abfd);
     
    23572312                            case ALPHA_R_CODEADDR:
    23582313                              {
    2359                                 if (_bfd_vms_output_check (abfd,
    2360                                                             strlen((char *)sym->name))
    2361                                     < 0)
     2314                                int slen = strlen ((char *) sym->name);
     2315                                char *hash;
     2316                                if (_bfd_vms_output_check (abfd, slen) < 0)
    23622317                                  {
    23632318                                    end_etir_record (abfd);
    23642319                                    start_etir_record (abfd,
    23652320                                                       section->index,
    2366                                                        vaddr, false);
     2321                                                       vaddr, FALSE);
    23672322                                  }
    23682323                                _bfd_vms_output_begin (abfd,
    2369                                                         ETIR_S_C_STO_CA,
    2370                                                         -1);
    2371                                 _bfd_vms_output_counted (abfd,
    2372                                                           _bfd_vms_length_hash_symbol (abfd, sym->name, EOBJ_S_C_SYMSIZ));
     2324                                                       ETIR_S_C_STO_CA,
     2325                                                       -1);
     2326                                hash = (_bfd_vms_length_hash_symbol
     2327                                        (abfd, sym->name, EOBJ_S_C_SYMSIZ));
     2328                                _bfd_vms_output_counted (abfd, hash);
    23732329                                _bfd_vms_output_flush (abfd);
    23742330                              }
     
    23962352                            }
    23972353                        }
    2398                       else                                      /* sptr starts after reloc */
     2354                      else                      /* sptr starts after reloc */
    23992355                        {
    2400                           i--;                          /* check next reloc */
     2356                          i--;                  /* check next reloc */
    24012357                          rptr++;
    24022358                        }
    24032359
    2404                       if (i==0)                         /* all reloc checked */
     2360                      if (i==0)                 /* all reloc checked */
    24052361                        {
    24062362                          if (sptr->size > 0)
    24072363                            {
    2408                               sto_imm (abfd, sptr, vaddr, section->index);      /* dump rest */
     2364                              /* dump rest */
     2365                              sto_imm (abfd, sptr, vaddr, section->index);
    24092366                              vaddr += sptr->size;
    24102367                            }
     
    24132370                    } /* for (;;) */
    24142371                } /* if SEC_RELOC */
    2415               else                                              /* no relocs, just dump */
     2372              else                              /* no relocs, just dump */
    24162373                {
    24172374                  sto_imm (abfd, sptr, vaddr, section->index);
     
    24302387    }
    24312388
    2432   _bfd_vms_output_alignment(abfd, 2);
     2389  _bfd_vms_output_alignment (abfd, 2);
    24332390  return 0;
    24342391}
    24352392
    2436 /* write traceback data for bfd abfd  */
     2393/* Write traceback data for bfd abfd.  */
    24372394
    24382395int
     
    24482405}
    24492406
    2450 /* write debug info for bfd abfd  */
     2407/* Write debug info for bfd abfd.  */
    24512408
    24522409int
Note: See TracChangeset for help on using the changeset viewer.