Back to index

cell-binutils  2.17cvs20070401
vms.h
Go to the documentation of this file.
00001 #undef vms
00002 /* vms.h -- Header file for VMS (Alpha and Vax) support.
00003    Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005
00004    Free Software Foundation, Inc.
00005 
00006    Written by Klaus K"ampf (kkaempf@rmi.de)
00007 
00008    This file is part of BFD, the Binary File Descriptor library.
00009 
00010    This program is free software; you can redistribute it and/or modify
00011    it under the terms of the GNU General Public License as published by
00012    the Free Software Foundation; either version 2 of the License, or
00013    (at your option) any later version.
00014 
00015    This program is distributed in the hope that it will be useful,
00016    but WITHOUT ANY WARRANTY; without even the implied warranty of
00017    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018    GNU General Public License for more details.
00019 
00020    You should have received a copy of the GNU General Public License
00021    along with this program; if not, write to the Free Software
00022    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
00023 
00024 #ifndef VMS_H
00025 #define VMS_H
00026 
00027 /* Constants starting with 'Exxx_' are for openVMS/Alpha (EVAX object language)  */
00028 
00029 /* VMS Text, information and relocation record (TIR/ETIR) definitions.  */
00030 
00031 #define TIR_S_C_STA_GBL            0
00032 #define TIR_S_C_STA_SB             1
00033 #define TIR_S_C_STA_SW             2
00034 #define TIR_S_C_STA_LW             3
00035 #define TIR_S_C_STA_PB             4
00036 #define TIR_S_C_STA_PW             5
00037 #define TIR_S_C_STA_PL             6
00038 #define TIR_S_C_STA_UB      7
00039 #define TIR_S_C_STA_UW      8
00040 #define TIR_S_C_STA_BFI     9
00041 #define TIR_S_C_STA_WFI     10
00042 #define TIR_S_C_STA_LFI     11
00043 #define TIR_S_C_STA_EPM     12
00044 #define TIR_S_C_STA_CKARG       13
00045 #define TIR_S_C_STA_WPB     14
00046 #define TIR_S_C_STA_WPW     15
00047 #define TIR_S_C_STA_WPL     16
00048 #define TIR_S_C_STA_LSY     17
00049 #define TIR_S_C_STA_LIT     18
00050 #define TIR_S_C_STA_LEPM        19
00051 #define TIR_S_C_MAXSTACOD       19
00052 #define TIR_S_C_MINSTOCOD       20
00053 #define TIR_S_C_STO_SB      20
00054 #define TIR_S_C_STO_SW      21
00055 #define TIR_S_C_STO_L       22
00056 #define TIR_S_C_STO_LW      22
00057 #define TIR_S_C_STO_BD      23
00058 #define TIR_S_C_STO_WD      24
00059 #define TIR_S_C_STO_LD      25
00060 #define TIR_S_C_STO_LI      26
00061 #define TIR_S_C_STO_PIDR        27
00062 #define TIR_S_C_STO_PICR        28
00063 #define TIR_S_C_STO_RSB     29
00064 #define TIR_S_C_STO_RSW     30
00065 #define TIR_S_C_STO_RL      31
00066 #define TIR_S_C_STO_VPS     32
00067 #define TIR_S_C_STO_USB     33
00068 #define TIR_S_C_STO_USW     34
00069 #define TIR_S_C_STO_RUB     35
00070 #define TIR_S_C_STO_RUW     36
00071 #define TIR_S_C_STO_B       37
00072 #define TIR_S_C_STO_W       38
00073 #define TIR_S_C_STO_RB      39
00074 #define TIR_S_C_STO_RW      40
00075 #define TIR_S_C_STO_RIVB        41
00076 #define TIR_S_C_STO_PIRR        42
00077 #define TIR_S_C_MAXSTOCOD       42
00078 #define TIR_S_C_MINOPRCOD       50
00079 #define TIR_S_C_OPR_NOP     50
00080 #define TIR_S_C_OPR_ADD     51
00081 #define TIR_S_C_OPR_SUB     52
00082 #define TIR_S_C_OPR_MUL     53
00083 #define TIR_S_C_OPR_DIV     54
00084 #define TIR_S_C_OPR_AND     55
00085 #define TIR_S_C_OPR_IOR     56
00086 #define TIR_S_C_OPR_EOR     57
00087 #define TIR_S_C_OPR_NEG     58
00088 #define TIR_S_C_OPR_COM     59
00089 #define TIR_S_C_OPR_INSV        60
00090 #define TIR_S_C_OPR_ASH     61
00091 #define TIR_S_C_OPR_USH     62
00092 #define TIR_S_C_OPR_ROT     63
00093 #define TIR_S_C_OPR_SEL     64
00094 #define TIR_S_C_OPR_REDEF       65
00095 #define TIR_S_C_OPR_DFLIT       66
00096 #define TIR_S_C_MAXOPRCOD       66
00097 #define TIR_S_C_MINCTLCOD       80
00098 #define TIR_S_C_CTL_SETRB       80
00099 #define TIR_S_C_CTL_AUGRB       81
00100 #define TIR_S_C_CTL_DFLOC       82
00101 #define TIR_S_C_CTL_STLOC       83
00102 #define TIR_S_C_CTL_STKDL       84
00103 #define TIR_S_C_MAXCTLCOD       84
00104 
00105 #define ETIR_S_C_MINSTACOD 0              /* Minimum store code.             */
00106 #define ETIR_S_C_STA_GBL 0         /* Stack global symbol value.      */
00107 #define ETIR_S_C_STA_LW 1          /* Stack longword.          */
00108 #define ETIR_S_C_STA_QW 2          /* Stack quadword.          */
00109 #define ETIR_S_C_STA_PQ 3          /* Stack psect base plus quadword offset.  */
00110 #define ETIR_S_C_STA_LI 4          /* Stack literal.           */
00111 #define ETIR_S_C_STA_MOD 5         /* Stack module.            */
00112 #define ETIR_S_C_STA_CKARG 6              /* Check Arguments.         */
00113 #define ETIR_S_C_MAXSTACOD 6              /* Maximum stack code.             */
00114 #define ETIR_S_C_MINSTOCOD 50             /* Minimum store code.             */
00115 #define ETIR_S_C_STO_B 50          /* Store byte.                     */
00116 #define ETIR_S_C_STO_W 51          /* Store word.                     */
00117 #define ETIR_S_C_STO_LW 52         /* Store longword.          */
00118 #define ETIR_S_C_STO_QW 53         /* Store quadword.          */
00119 #define ETIR_S_C_STO_IMMR 54              /* Store immediate Repeated.       */
00120 #define ETIR_S_C_STO_GBL 55        /* Store global.            */
00121 #define ETIR_S_C_STO_CA 56         /* Store code address.             */
00122 #define ETIR_S_C_STO_RB 57         /* Store relative branch.   */
00123 #define ETIR_S_C_STO_AB 58         /* Store absolute branch.   */
00124 #define ETIR_S_C_STO_OFF 59        /* Store offset within psect.      */
00125 #define ETIR_S_C_STO_IMM 61        /* Store immediate.         */
00126 #define ETIR_S_C_STO_GBL_LW 62            /* Store global Longword.   */
00127 #define ETIR_S_C_STO_LP_PSB 63            /* STO_LP_PSB not valid in level 2 use STC_LP_PSB.  */
00128 #define ETIR_S_C_STO_HINT_GBL 64   /* Store 14 bit HINT at global address.  */
00129 #define ETIR_S_C_STO_HINT_PS 65           /* Store 14 bit HINT at psect + offset */
00130 #define ETIR_S_C_MAXSTOCOD 65             /* Maximum store code.             */
00131 #define ETIR_S_C_MINOPRCOD 100            /* Minimum operate code.    */
00132 #define ETIR_S_C_OPR_NOP 100              /* No-op.                   */
00133 #define ETIR_S_C_OPR_ADD 101              /* Add.                            */
00134 #define ETIR_S_C_OPR_SUB 102              /* Subtract.                */
00135 #define ETIR_S_C_OPR_MUL 103              /* Multiply.                */
00136 #define ETIR_S_C_OPR_DIV 104              /* Divide.                  */
00137 #define ETIR_S_C_OPR_AND 105              /* Logical AND.                    */
00138 #define ETIR_S_C_OPR_IOR 106              /* Logical inclusive OR.    */
00139 #define ETIR_S_C_OPR_EOR 107              /* Logical exclusive OR.    */
00140 #define ETIR_S_C_OPR_NEG 108              /* Negate.                  */
00141 #define ETIR_S_C_OPR_COM 109              /* Complement.                     */
00142 #define ETIR_S_C_OPR_INSV 110             /* Insert bit field.        */
00143 #define ETIR_S_C_OPR_ASH 111              /* Arithmetic shift.        */
00144 #define ETIR_S_C_OPR_USH 112              /* Unsigned shift.          */
00145 #define ETIR_S_C_OPR_ROT 113              /* Rotate.                  */
00146 #define ETIR_S_C_OPR_SEL 114              /* Select one of three longwords on top of stack.   */
00147 #define ETIR_S_C_OPR_REDEF 115            /* Redefine this symbol after pass 2.  */
00148 #define ETIR_S_C_OPR_DFLIT 116            /* Define a literal.        */
00149 #define ETIR_S_C_MAXOPRCOD 116            /* Maximum operate code.    */
00150 #define ETIR_S_C_MINCTLCOD 150            /* Minimum control code.    */
00151 #define ETIR_S_C_CTL_SETRB 150            /* Set relocation base.            */
00152 #define ETIR_S_C_CTL_AUGRB 151            /* Augment relocation base. */
00153 #define ETIR_S_C_CTL_DFLOC 152            /* Define debug location.   */
00154 #define ETIR_S_C_CTL_STLOC 153            /* Set debug location.             */
00155 #define ETIR_S_C_CTL_STKDL 154            /* Stack debug location.    */
00156 #define ETIR_S_C_MAXCTLCOD 154            /* Maximum control code.    */
00157 #define ETIR_S_C_MINSTCCOD 200            /* Minimum store-conditional code.   */
00158 #define ETIR_S_C_STC_LP 200        /* Store-conditional Linkage Pair.   */
00159 #define ETIR_S_C_STC_LP_PSB 201           /* Store-conditional Linkage Pair with Procedure Signature.  */
00160 #define ETIR_S_C_STC_GBL 202              /* Store-conditional Address at global address.  */
00161 #define ETIR_S_C_STC_GCA 203              /* Store-conditional Code Address at global address.  */
00162 #define ETIR_S_C_STC_PS 204        /* Store-conditional Address at psect + offset.  */
00163 #define ETIR_S_C_STC_NOP_GBL 205   /* Store-conditional NOP at address of global.  */
00164 #define ETIR_S_C_STC_NOP_PS 206           /* Store-conditional NOP at pect + offset.  */
00165 #define ETIR_S_C_STC_BSR_GBL 207   /* Store-conditional BSR at global address.  */
00166 #define ETIR_S_C_STC_BSR_PS 208           /* Store-conditional BSR at pect + offset.  */
00167 #define ETIR_S_C_STC_LDA_GBL 209   /* Store-conditional LDA at global address.  */
00168 #define ETIR_S_C_STC_LDA_PS 210           /* Store-conditional LDA at psect + offset.  */
00169 #define ETIR_S_C_STC_BOH_GBL 211   /* Store-conditional BSR or Hint at global address.  */
00170 #define ETIR_S_C_STC_BOH_PS 212           /* Store-conditional BSR or Hint at pect + offset.  */
00171 #define ETIR_S_C_STC_NBH_GBL 213   /* Store-conditional NOP,BSR or HINT at global address.  */
00172 #define ETIR_S_C_STC_NBH_PS 214           /* Store-conditional NOP,BSR or HINT at psect + offset.  */
00173 #define ETIR_S_C_MAXSTCCOD 214            /* Maximum store-conditional code.   */
00174 
00175 /* VMS Global symbol definition record (GSD/EGSD).  */
00176 
00177 #define GSD_S_K_ENTRIES 1
00178 #define GSD_S_C_ENTRIES 1
00179 #define GSD_S_C_PSC     0
00180 #define GSD_S_C_SYM     1
00181 #define GSD_S_C_EPM     2
00182 #define GSD_S_C_PRO     3
00183 #define GSD_S_C_SYMW    4
00184 #define GSD_S_C_EPMW    5
00185 #define GSD_S_C_PROW    6
00186 #define GSD_S_C_IDC     7
00187 #define GSD_S_C_ENV     8
00188 #define GSD_S_C_LSY     9
00189 #define GSD_S_C_LEPM    10
00190 #define GSD_S_C_LPRO    11
00191 #define GSD_S_C_SPSC    12
00192 #define GSD_S_C_SYMV    13
00193 #define GSD_S_C_EPMV    14
00194 #define GSD_S_C_PROV    15
00195 #define GSD_S_C_MAXRECTYP       15
00196 
00197 #define EGSD_S_K_ENTRIES 2  /* Offset to first entry in record.       */
00198 #define EGSD_S_C_ENTRIES 2  /* Offset to first entry in record.       */
00199 #define EGSD_S_C_PSC 0             /* Psect definition.               */
00200 #define EGSD_S_C_SYM 1             /* Symbol specification.           */
00201 #define EGSD_S_C_IDC 2             /* Random entity check.                   */
00202 #define EGSD_S_C_SPSC 5            /* Shareable image psect definition.      */
00203 #define EGSD_S_C_SYMV 6            /* Vectored (dual-valued) versions of SYM.  */
00204 #define EGSD_S_C_SYMM 7            /* Masked versions of SYM.         */
00205 #define EGSD_S_C_SYMG 8            /* EGST - gst version of SYM.             */
00206 #define EGSD_S_C_MAXRECTYP 8       /* Maximum entry type defined.            */
00207 
00208 #define GPS_S_M_PIC     1
00209 #define GPS_S_M_LIB     2
00210 #define GPS_S_M_OVR     4
00211 #define GPS_S_M_REL     8
00212 #define GPS_S_M_GBL     16
00213 #define GPS_S_M_SHR     32
00214 #define GPS_S_M_EXE     64
00215 #define GPS_S_M_RD      128
00216 #define GPS_S_M_WRT     256
00217 #define GPS_S_M_VEC     512
00218 #define GPS_S_K_NAME    9
00219 #define GPS_S_C_NAME    9
00220 
00221 #define EGPS_S_V_PIC 0x0001
00222 #define EGPS_S_V_LIB 0x0002
00223 #define EGPS_S_V_OVR 0x0004
00224 #define EGPS_S_V_REL 0x0008
00225 #define EGPS_S_V_GBL 0x0010
00226 #define EGPS_S_V_SHR 0x0020
00227 #define EGPS_S_V_EXE 0x0040
00228 #define EGPS_S_V_RD  0x0080
00229 #define EGPS_S_V_WRT 0x0100
00230 #define EGPS_S_V_VEC 0x0200
00231 #define EGPS_S_V_NOMOD      0x0400
00232 #define EGPS_S_V_COM 0x0800
00233 
00234 #define GSY_S_M_WEAK    1
00235 #define GSY_S_M_DEF     2
00236 #define GSY_S_M_UNI     4
00237 #define GSY_S_M_REL     8
00238 
00239 #define EGSY_S_V_WEAK       0x0001
00240 #define EGSY_S_V_DEF 0x0002
00241 #define EGSY_S_V_UNI 0x0004
00242 #define EGSY_S_V_REL 0x0008
00243 #define EGSY_S_V_COMM       0x0010
00244 #define EGSY_S_V_VECEP      0x0020
00245 #define EGSY_S_V_NORM       0x0040
00246 
00247 #define LSY_S_M_DEF     2
00248 #define LSY_S_M_REL     8
00249 
00250 #define ENV_S_M_DEF     1
00251 #define ENV_S_M_NESTED  2
00252 
00253 /* Debugger symbol definitions:  These are done by hand,
00254    as no machine-readable version seems to be available.  */
00255 #define DST_S_C_C             7    /* Language == "C".  */
00256 #define DST_S_C_CXX          15    /* Language == "C++".       */
00257 #define DST_S_C_VERSION            153
00258 #define       DST_S_C_SOURCE              155    /* Source file.             */
00259 #define DST_S_C_PROLOG             162
00260 #define       DST_S_C_BLKBEG              176    /* Beginning of block.      */
00261 #define       DST_S_C_BLKEND              177    /* End of block.     */
00262 #define DST_S_C_ENTRY              181
00263 #define DST_S_C_PSECT              184
00264 #define       DST_S_C_LINE_NUM     185    /* Line Number.             */
00265 #define DST_S_C_LBLORLIT    186
00266 #define DST_S_C_LABEL              187
00267 #define       DST_S_C_MODBEG              188    /* Beginning of module. */
00268 #define       DST_S_C_MODEND              189    /* End of module.    */
00269 #define       DST_S_C_RTNBEG              190    /* Beginning of routine.*/
00270 #define       DST_S_C_RTNEND              191    /* End of routine.   */
00271 #define       DST_S_C_DELTA_PC_W   1      /* Incr PC.          */
00272 #define       DST_S_C_INCR_LINUM   2      /* Incr Line #.      */
00273 #define       DST_S_C_INCR_LINUM_W 3      /* Incr Line #.      */
00274 #define DST_S_C_SET_LINUM_INCR     4
00275 #define DST_S_C_SET_LINUM_INCR_W 5
00276 #define DST_S_C_RESET_LINUM_INCR 6
00277 #define DST_S_C_BEG_STMT_MODE      7
00278 #define DST_S_C_END_STMT_MODE      8
00279 #define       DST_S_C_SET_LINE_NUM 9      /* Set Line #.              */
00280 #define DST_S_C_SET_PC             10
00281 #define DST_S_C_SET_PC_W    11
00282 #define DST_S_C_SET_PC_L    12
00283 #define DST_S_C_SET_STMTNUM 13
00284 #define DST_S_C_TERM        14     /* End of lines.     */
00285 #define DST_S_C_TERM_W             15     /* End of lines.     */
00286 #define       DST_S_C_SET_ABS_PC   16     /* Set PC.           */
00287 #define       DST_S_C_DELTA_PC_L   17     /* Incr PC.          */
00288 #define DST_S_C_INCR_LINUM_L       18     /* Incr Line #.             */
00289 #define DST_S_C_SET_LINUM_B 19     /* Set Line #.              */
00290 #define DST_S_C_SET_LINUM_L 20     /* Set Line #.              */
00291 #define       DST_S_C_TERM_L              21     /* End of lines.     */
00292 /* These are used with DST_S_C_SOURCE */
00293 #define DST_S_C_SRC_DECLFILE        1     /* Declare source file.  */
00294 #define DST_S_C_SRC_SETFILE  2     /* Set source file.   */
00295 #define DST_S_C_SRC_SETREC_L        3     /* Set record, longword value.  */
00296 #define DST_S_C_SRC_SETREC_W        4     /* Set record, word value.  */
00297 #define DST_S_C_SRC_DEFLINES_W     10     /* # of line, word counter.  */
00298 #define DST_S_C_SRC_DEFLINES_B     11     /* # of line, byte counter.  */
00299 #define DST_S_C_SRC_FORMFEED       16     /* ^L counts as a record.  */
00300 /* The following are the codes for the various data types.  Anything not on
00301    the list is included under 'advanced_type'.  */
00302 #define DBG_S_C_UCHAR              0x02
00303 #define DBG_S_C_USINT              0x03
00304 #define DBG_S_C_ULINT              0x04
00305 #define DBG_S_C_UQUAD              0x05
00306 #define DBG_S_C_SCHAR              0x06
00307 #define DBG_S_C_SSINT              0x07
00308 #define DBG_S_C_SLINT              0x08
00309 #define DBG_S_C_SQUAD              0x09
00310 #define DBG_S_C_REAL4              0x0a
00311 #define DBG_S_C_REAL8              0x0b   /* D_float double.  */
00312 #define DBG_S_C_COMPLX4            0x0c   /* 2xF_float complex float.  */
00313 #define DBG_S_C_COMPLX8            0x0d   /* 2xD_float complex double.  */
00314 #define DBG_S_C_REAL8_G            0x1b   /* G_float double.  */
00315 #define DBG_S_C_COMPLX8_G   0x1d   /* 2xG_float complex double.  */
00316 #define DBG_S_C_FUNCTION_ADDR      0x17
00317 #define DBG_S_C_ADVANCED_TYPE      0xa3
00318 /*  Some of these are just for future reference.  [pr].  */
00319 #define DBG_S_C_UBITA              0x01   /* Unsigned, aligned bit field.  */
00320 #define DBG_S_C_UBITU              0x22   /* Unsigned, unaligned bit field.  */
00321 #define DBG_S_C_SBITA              0x29   /* Signed, aligned bit field.  */
00322 #define DBG_S_C_SBITU              0x2a   /* Signed, unaligned bit field.  */
00323 #define DBG_S_C_CSTRING            0x2e   /* Asciz ('\0' terminated) string.  */
00324 #define DBG_S_C_WCHAR              0x38   /* Wchar_t.  */
00325 /*  These are descriptor class codes.  */
00326 #define DSC_K_CLASS_S              0x01   /* Static (fixed length).  */
00327 #define DSC_K_CLASS_D              0x02   /* Dynamic string (not via malloc!).  */
00328 #define DSC_K_CLASS_A              0x04   /* Array.  */
00329 #define DSC_K_CLASS_UBS            0x0d   /* Unaligned bit string.  */
00330 /*  These are the codes that are used to generate the definitions of struct
00331     union and enum records.  */
00332 #define DBG_S_C_ENUM_ITEM          0xa4
00333 #define DBG_S_C_ENUM_START         0xa5
00334 #define DBG_S_C_ENUM_END           0xa6
00335 #define DBG_S_C_STRUCT_ITEM        DST_K_VFLAGS_BITOFFS /* 0xff */
00336 #define DBG_S_C_STRUCT_START              0xab
00337 #define DBG_S_C_STRUCT_END         0xac
00338 #define DST_K_TYPSPEC                     0xaf          /* Type specification.  */
00339 /* These codes are used in the generation of the symbol definition records.  */
00340 #define DST_K_VFLAGS_NOVAL         0x80   /* Struct definition only.  */
00341 #define DST_K_VFLAGS_DSC           0xfa   /* Descriptor used.  */
00342 #define DST_K_VFLAGS_TVS           0xfb   /* Trailing value specified.  */
00343 #define DST_K_VS_FOLLOWS           0xfd   /* Value spec follows.  */
00344 #define DST_K_VFLAGS_BITOFFS              0xff   /* Value contains bit offset.  */
00345 #define DST_K_VALKIND_LITERAL      0
00346 #define DST_K_VALKIND_ADDR  1
00347 #define DST_K_VALKIND_DESC  2
00348 #define DST_K_VALKIND_REG   3
00349 #define DST_K_REG_VAX_AP    0x0c   /* R12.  */
00350 #define DST_K_REG_VAX_FP    0x0d   /* R13.  */
00351 #define DST_K_REG_VAX_SP    0x0e   /* R14.  */
00352 #define DST_V_VALKIND              0      /* Offset of valkind field.  */
00353 #define DST_V_INDIRECT             2      /* Offset to indirect bit.  */
00354 #define DST_V_DISP          3      /* Offset to displacement bit.  */
00355 #define DST_V_REGNUM        4      /* Offset to register number.  */
00356 #define DST_M_INDIRECT             (1<<DST_V_INDIRECT)
00357 #define DST_M_DISP          (1<<DST_V_DISP)
00358 #define DBG_C_FUNCTION_PARAM       /* 0xc9 */    \
00359        (DST_K_VALKIND_ADDR|DST_M_DISP|(DST_K_REG_VAX_AP<<DST_V_REGNUM))
00360 #define DBG_C_LOCAL_SYM            /* 0xd9 */    \
00361        (DST_K_VALKIND_ADDR|DST_M_DISP|(DST_K_REG_VAX_FP<<DST_V_REGNUM))
00362 /* Kinds of value specifications.   */
00363 #define DST_K_VS_ALLOC_SPLIT       3      /* Split lifetime.  */
00364 /* Kinds of type specifications.  */
00365 #define DST_K_TS_ATOM              0x01   /* Atomic type specification.  */
00366 #define DST_K_TS_DSC        0x02   /* Descriptor type spec.  */
00367 #define DST_K_TS_IND        0x03   /* Indirect type specification.  */
00368 #define DST_K_TS_TPTR              0x04   /* Typed pointer type spec.  */
00369 #define DST_K_TS_PTR        0x05   /* Pointer type spec.  */
00370 #define DST_K_TS_ARRAY             0x07   /* Array type spec.  */
00371 #define DST_K_TS_NOV_LENG   0x0e   /* Novel length type spec.  */
00372 /* These are the codes that are used in the suffix records to determine the
00373    actual data type.  */
00374 #define DBG_S_C_BASIC                     DST_K_TS_ATOM
00375 #define DBG_S_C_BASIC_ARRAY        DST_K_TS_DSC
00376 #define DBG_S_C_STRUCT                    DST_K_TS_IND
00377 #define DBG_S_C_POINTER                   DST_K_TS_TPTR
00378 #define DBG_S_C_VOID               DST_K_TS_PTR
00379 #define DBG_S_C_COMPLEX_ARRAY             DST_K_TS_ARRAY
00380 
00381 /* VMS Module header record (EMH) definitions.  */
00382 
00383 #define MHD_S_C_MHD 0
00384 #define MHD_S_C_LNM 1
00385 #define MHD_S_C_SRC 2
00386 #define MHD_S_C_TTL 3
00387 #define MHD_S_C_CPR 4
00388 #define MHD_S_C_MTC 5
00389 #define MHD_S_C_GTX 6
00390 #define MHD_S_C_MAXHDRTYP 6
00391 
00392 #define EMH_S_C_MHD 0              /* Main header record.             */
00393 #define EMH_S_C_LNM 1              /* Language name and version.      */
00394 #define EMH_S_C_SRC 2              /* Source file specification.      */
00395 #define EMH_S_C_TTL 3              /* Title text of module.    */
00396 #define EMH_S_C_CPR 4              /* Copyright notice.        */
00397 #define EMH_S_C_MTC 5              /* Maintenance status.             */
00398 #define EMH_S_C_GTX 6              /* General text.            */
00399 #define EMH_S_C_MAXHDRTYP 6 /* Maximum allowable type.  */
00400 
00401 /* vms.c.  */
00402 
00403 extern asymbol *_bfd_vms_make_empty_symbol (bfd *);
00404 
00405 /* vms-gsd.c.  */
00406 
00407 extern int _bfd_vms_slurp_gsd (bfd *, int);
00408 extern int _bfd_vms_write_gsd (bfd *, int);
00409 
00410 /* vms-mhd.c.  */
00411 
00412 extern int _bfd_vms_slurp_hdr (bfd *, int);
00413 extern int _bfd_vms_write_hdr (bfd *, int);
00414 extern int _bfd_vms_slurp_eom (bfd *, int);
00415 extern int _bfd_vms_write_eom (bfd *, int);
00416 
00417 /* vms-tir.c.  */
00418 
00419 extern int _bfd_vms_slurp_tir (bfd *, int);
00420 extern int _bfd_vms_slurp_dbg (bfd *, int);
00421 extern int _bfd_vms_slurp_tbt (bfd *, int);
00422 extern int _bfd_vms_slurp_lnk (bfd *, int);
00423                                     
00424 extern int _bfd_vms_write_tir (bfd *, int);
00425 extern int _bfd_vms_write_tbt (bfd *, int);
00426 extern int _bfd_vms_write_dbg (bfd *, int);
00427                                     
00428 /* The r_type field in a reloc is one of he following values.  */
00429 #define ALPHA_R_IGNORE             0       
00430 #define ALPHA_R_REFQUAD            1       
00431 #define ALPHA_R_BRADDR             2       
00432 #define ALPHA_R_HINT        3       
00433 #define ALPHA_R_SREL16             4       
00434 #define ALPHA_R_SREL32             5       
00435 #define ALPHA_R_SREL64             6       
00436 #define ALPHA_R_OP_PUSH            7       
00437 #define ALPHA_R_OP_STORE    8       
00438 #define ALPHA_R_OP_PSUB            9       
00439 #define ALPHA_R_OP_PRSHIFT  10      
00440 #define ALPHA_R_LINKAGE            11      
00441 #define ALPHA_R_REFLONG            12      
00442 #define ALPHA_R_CODEADDR    13      
00443                                     
00444 /* Object language definitions.  */        
00445                                     
00446 #define OBJ_S_C_HDR 0              /* VAX moule header record.        */
00447 #define OBJ_S_C_GSD 1              /* VAX glbal symbol definition record.    */
00448 #define OBJ_S_C_TIR 2              /* VAX tet information record.            */
00449 #define OBJ_S_C_EOM 3              /* VAX en of module record.        */
00450 #define OBJ_S_C_DBG 4              /* VAX Deugger information record. */
00451 #define OBJ_S_C_TBT 5              /* VAX Trceback information record.       */
00452 #define OBJ_S_C_LNK 6              /* VAX liker options record.              */
00453 #define OBJ_S_C_EOMW 7             /* VAX en of module word-psect record.    */
00454 #define OBJ_S_C_MAXRECTYP 7 /* VAX Lat assigned record type.   */
00455 #define EOBJ_S_C_EMH 8             /* EVAX mdule header record.              */
00456 #define EOBJ_S_C_EEOM 9            /* EVAX ed of module record.              */
00457 #define EOBJ_S_C_EGSD 10    /* EVAX gobal symbol definition record.*/
00458 #define EOBJ_S_C_ETIR 11    /* EVAX txt information record.    */
00459 #define EOBJ_S_C_EDBG 12    /* EVAX Dbugger information record.       */
00460 #define EOBJ_S_C_ETBT 13    /* EVAX Taceback information record.      */
00461 #define EOBJ_S_C_MAXRECTYP 13      /* EVAX Lst assigned record type.  */
00462 #define OBJ_S_K_SUBTYP 1            
00463 #define OBJ_S_C_SUBTYP 1            
00464 #define EOBJ_S_K_SUBTYP 4           
00465 #define EOBJ_S_C_SUBTYP 4           
00466 #define OBJ_S_C_MAXRECSIZ 2048     /* Maximu legal record size.           */
00467 #define EOBJ_S_C_MAXRECSIZ 8192 /* Maximu legal record size.           */
00468 #define OBJ_S_C_STRLVL 0    /* Structre level.                     */
00469 #define EOBJ_S_C_STRLVL 2   /* Structre level.                     */
00470 #define OBJ_S_C_SYMSIZ 31   /* Maximu symbol length.           */
00471 #define EOBJ_S_C_SYMSIZ 64  /* Maximu symbol length.           */
00472 #define EOBJ_S_C_SECSIZ 31  /* Maximu section name length.            */
00473 #define OBJ_S_C_STOREPLIM -1       /* Maximu repeat count on store commands.  */
00474 #define EOBJ_S_C_STOREPLIM -1      /* Maximu repeat count on store commands.  */
00475 #define OBJ_S_C_PSCALILIM 9 /* Maximu p-sect alignment.            */
00476 #define EOBJ_S_C_PSCALILIM 16      /* Maximu p-sect alignment.            */
00477                                     
00478 #define EVAX_OFFSET  256    /* Type ofset for EVAX codes in switch.  */
00479 /* Miscellaneous definitions.  */   
00480 
00481 #if __GNUC__                        
00482 typedef unsigned long long uquad;   
00483 #else                               
00484 typedef unsigned long uquad;               
00485 #endif                              
00486                                     
00487 #define MAX_OUTREC_SIZE 4096               
00488 #define MIN_OUTREC_LUFT 64          
00489                                     
00490 typedef struct _vms_section         
00491 {                                   
00492   unsigned char *contents;          
00493   bfd_vma offset;                   
00494   bfd_size_type size;                      
00495   struct _vms_section *next;               
00496 } vms_section;                             
00497                                     
00498 extern vms_section * _bfd_get_vms_section (bfd *, int);
00499                                     
00500 typedef struct _vms_reloc           
00501 {                                   
00502   struct _vms_reloc *next;          
00503   arelent *reloc;                   
00504   asection *section;                
00505 } vms_reloc;                        
00506                                     
00507 /* VMS module header.  */           
00508                                     
00509 struct hdr_struc                    
00510 {                                   
00511   int    hdr_b_strlvl;                     
00512   long   hdr_l_arch1;                      
00513   long   hdr_l_arch2;                      
00514   long   hdr_l_recsiz;                     
00515   char * hdr_t_name;                
00516   char * hdr_t_version;                    
00517   char * hdr_t_date;                
00518   char * hdr_c_lnm;                 
00519   char * hdr_c_src;                 
00520   char * hdr_c_ttl;                 
00521 };                                  
00522                                     
00523 /* VMS end of module.  */           
00524                                     
00525 struct eom_struc                    
00526 {                                   
00527   long          eom_l_total_lps;    
00528   unsigned char eom_b_comcod;              
00529   bfd_boolean   eom_has_transfer;   
00530   unsigned char eom_b_tfrflg;              
00531   long          eom_l_psindx;              
00532   long          eom_l_tfradr;              
00533 };                                  
00534                                     
00535 enum file_format_enum { FF_UNKNOWN, FF_FOREIGN, FF_NATIVE, FF_VAX };
00536                                     
00537 typedef struct vms_symbol_struct    
00538 {                                   
00539   struct bfd_hash_entry bfd_hash;   
00540   asymbol *symbol;                  
00541 } vms_symbol_entry;                 
00542                                     
00543 /* Stack value for push/pop commands.  */
00544                                     
00545 struct stack_struct                 
00546 {                                   
00547   uquad value;                             
00548   int psect;                        
00549 };                                  
00550 #define STACKSIZE 8192                     
00551                                     
00552 /* location stack definitions for CTL_DFLC, CTL_STLOC, and CTL_STKDL  */
00553                                     
00554 struct location_struct                     
00555 {                                   
00556   unsigned long value;                     
00557   int psect;                        
00558 };                                  
00559 #define LOCATION_SAVE_SIZE 32              
00560                                     
00561 #define VMS_SECTION_COUNT 1024             
00562                                     
00563 struct vms_private_data_struct             
00564 {                                   
00565   bfd_boolean is_vax;                             
00566   bfd_boolean fixup_done;          /* Flag to indicate if all
00567                                       section pointers and PRIV(sections)
00568                                       are set up correctly.  */
00569   unsigned char *vms_buf;          /* Buffer to record.  */
00570   int buf_size;                           /* Max size of buffer.  */
00571   unsigned char *vms_rec;          /* Actual record ptr.  */
00572   int rec_length;                  /* Remaining record length.  */
00573   int rec_size;                           /* Actual record size.  */
00574   int rec_type;                           /* Actual record type.  */
00575   enum file_format_enum file_format;       
00576                                     
00577   struct hdr_struc hdr_data;              /* Data from HDR/EMH record.  */
00578   struct eom_struc eom_data;              /* Data from EOM/EEOM record.  */
00579   unsigned int section_count;             /* # of sections in following array.  */
00580   asection **sections;                    /* Array of GSD/EGSD sections.  */
00581   int gsd_sym_count;               /* # of GSD/EGSD symbols.  */
00582   asymbol **symbols;               /* Vector of GSD/EGSD symbols.  */
00583   struct proc_value *procedure;            
00584                                     
00585   struct stack_struct *stack;              
00586   int stackptr;                            
00587                                     
00588   vms_section *vms_section_table[VMS_SECTION_COUNT];
00589                                     
00590   struct bfd_hash_table *vms_symbol_table;
00591   struct bfd_symbol **symcache;            
00592   int symnum;                       
00593                                     
00594   struct location_struct *location_stack;
00595                                     
00596   asection *image_section;         /* Section for image_ptr.  */
00597   unsigned char *image_ptr;        /* A pointer to section->contents.  */
00598                                     
00599   unsigned char pdsc[8];           /* Procedure descriptor.  */
00600                                     
00601   /* Output routine storage.  */    
00602   unsigned char *output_buf;              /* Output data.  */
00603   int push_level;                   
00604   int pushed_size;                  
00605   int length_pos;                   
00606   int output_size;                  
00607   int output_alignment;                    
00608                                     
00609   /* Linkage index counter          
00610      used by conditional store commands (TIR_S_C_STC_).   */
00611   int vms_linkage_index;            
00612                                     
00613   /* see tc-alpha.c of gas for a descripton.  */
00614   int flag_hash_long_names; /* -+, hash instead of truncate.  */
00615   int flag_show_after_trunc;       /* -H, shw hashing/truncation.  */
00616 };                                  
00617                                     
00618 #define PRIV(name)   ((struct vms_private_data_struct *) abfd->tdata.any)->name
00619                                     
00620 #define SECTION_NAME_TEMPLATE "__SEC__%d"
00621                                     
00622 #if VMS_DEBUG                       
00623 extern void _bfd_vms_debug (int, char *, ...) ATTRIBUTE_PRINTF_2;
00624 extern void _bfd_hexdump   (int, unsigned char *, int, int);
00625                                     
00626 #define vms_debug _bfd_vms_debug    
00627 #endif                              
00628                                     
00629 extern struct bfd_hash_entry * _bfd_vms_hash_newfunc (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
00630 extern void        _bfd_vms_get_header_values (bfd *, unsigned char *, int *, int *);
00631 extern int         _bfd_vms_get_record  (bfd *abf);
00632 extern int         _bfd_vms_next_record (bfd *abf);
00633 extern char *      _bfd_vms_save_sized_string (unsigned char *, int);
00634 extern char *      _bfd_vms_save_counted_string (unsigned char *);
00635 extern void        _bfd_vms_push (bfd *, uquad, int);
00636 extern uquad       _bfd_vms_pop (bfd *, int *);
00637 extern bfd_boolean _bfd_save_vms_section (bfd *, asection *, const void *, file_ptr, bfd_size_type);
00638 extern void        _bfd_vms_output_begin (bfd *, int, int);
00639 extern void        _bfd_vms_output_alignment (bfd *, int);
00640 extern void        _bfd_vms_output_push (bfd *);
00641 extern void        _bfd_vms_output_pop (bfd *);
00642 extern void        _bfd_vms_output_flush (bfd *);
00643 extern void        _bfd_vms_output_end (bfd *);
00644 extern int         _bfd_vms_output_check (bfd *, int);
00645 extern void        _bfd_vms_output_byte (bfd *, unsigned);
00646 extern void        _bfd_vms_output_short (bfd *, unsigned);
00647 extern void        _bfd_vms_output_long (bfd *, unsigned long);
00648 extern void        _bfd_vms_output_quad (bfd *, uquad);
00649 extern void        _bfd_vms_output_counted (bfd *, char *);
00650 extern void        _bfd_vms_output_dump (bfd *, unsigned char *, int);
00651 extern void        _bfd_vms_output_fill (bfd *, int, int);
00652 extern char *      _bfd_vms_length_hash_symbol (bfd *, const char *, int);
00653 extern vms_symbol_entry * _bfd_vms_enter_symbol (bfd *, char *);
00654 
00655 #endif /* VMS_H */