/* VMS object file format
- Copyright (C) 1989, 1990, 1991 Free Software Foundation, Inc.
+ Copyright (C) 1989, 90, 91, 92, 93, 94, 95, 96, 97, 1999
+ Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
the GNU General Public License for more details.
-You should have received a copy of the GNU General Public
-License along with GAS; see the file COPYING. If not, write
-to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+You should have received a copy of the GNU General Public License
+along with GAS; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
/* Tag to validate a.out object file format processing */
#define OBJ_VMS 1
#include "targ-cpu.h"
+#define LONGWORD_ALIGNMENT 2
+
+/* This macro controls subsection alignment within a section.
+ *
+ * Under VAX/VMS, the linker (and PSECT specifications)
+ * take care of correctly aligning the segments.
+ * Doing the alignment here (on initialized data) can
+ * mess up the calculation of global data PSECT sizes.
+ */
+#define SUB_SEGMENT_ALIGN(SEG) \
+ (((SEG) == data_section) ? 0 : LONGWORD_ALIGNMENT)
+
/* This flag is used to remember whether we are in the const or the
data section. By and large they are identical, but we set a no-write
bit for psects in the const section. */
-extern char const_flag;
+extern unsigned char const_flag;
+/* This is overloaded onto const_flag, for convenience. It's used to flag
+ dummy labels like "gcc2_compiled." which occur before the first .text
+ or .data section directive. */
+
+#define IN_DEFAULT_SECTION 0x80
/* These are defined in obj-vms.c. */
extern const short seg_N_TYPE[];
extern const segT N_TYPE_seg[];
+#undef NO_RELOC
enum reloc_type
{
NO_RELOC, RELOC_32
struct exec header; /* a.out header */
long string_table_size; /* names + '\0' + sizeof(int) */
}
-
object_headers;
/* A single entry in the symbol table
+ * (this started as a clone of bout.h's nlist, but much was unneeded).
*/
struct nlist
{
- union
- {
- char *n_name;
- struct nlist *n_next;
- long n_strx; /* Index into string table */
- }
- n_un;
+ char *n_name;
unsigned char n_type; /* See below */
- char n_other; /* Used in i80960 support -- see below */
- short n_desc;
- unsigned long n_value;
+ unsigned char n_other; /* used for const_flag and "default section" */
+ unsigned : 16; /* padding for alignment */
+ int n_desc; /* source line number for N_SLINE stabs */
};
-/* Legal values of n_type
+/* Legal values of n_type (see aout/stab.def for the majority of the codes).
*/
#define N_UNDF 0 /* Undefined symbol */
#define N_ABS 2 /* Absolute symbol */
#define N_STAB 0340 /* Mask for all bits used for SDB entries */
-#define N_GSYM 0x20 /* global symbol: name,,0,type,0 */
-#define N_FNAME 0x22 /* procedure name (f77 kludge): name,,0 */
-#define N_FUN 0x24 /* procedure: name,,0,linenumber,address */
-#define N_STSYM 0x26 /* static symbol: name,,0,type,address */
-#define N_LCSYM 0x28 /* .lcomm symbol: name,,0,type,address */
-#define N_RSYM 0x40 /* register sym: name,,0,type,register */
-#define N_SLINE 0x44 /* src line: 0,,0,linenumber,address */
-#define N_CATCH 0x54 /* */
-#define N_SSYM 0x60 /* structure elt: name,,0,type,struct_offset */
-#define N_SO 0x64 /* source file name: name,,0,0,address */
-#define N_LSYM 0x80 /* local sym: name,,0,type,offset */
-#define N_SOL 0x84 /* #included file name: name,,0,0,address */
-#define N_PSYM 0xa0 /* parameter: name,,0,type,offset */
-#define N_ENTRY 0xa4 /* alternate entry: name,linenumber,address */
-#define N_LBRAC 0xc0 /* left bracket: 0,,0,nesting level,address */
-#define N_RBRAC 0xe0 /* right bracket: 0,,0,nesting level,address */
-#define N_BCOMM 0xe2 /* begin common: name,, */
-#define N_ECOMM 0xe4 /* end common: name,, */
-#define N_ECOML 0xe8 /* end common (local name): ,,address */
-#define N_LENG 0xfe /* second stab entry with length information */
+#include "aout/stab_gnu.h"
/* SYMBOL TABLE */
/* Symbol table entry data type */
/* Symbol table macros and constants */
+#define OBJ_SYMFIELD_TYPE struct VMS_Symbol *
+
/*
* Macros to extract information from a symbol table entry.
* This syntaxic indirection allows independence regarding a.out or coff.
/* True if symbol has been defined, ie is in N_{TEXT,DATA,BSS,ABS} or N_EXT */
#define S_IS_DEFINED(s) (S_GET_TYPE(s) != N_UNDF)
+#define S_IS_COMMON(s) (S_GET_TYPE(s) == N_UNDF && S_GET_VALUE(s) != 0)
+
#define S_IS_REGISTER(s) ((s)->sy_symbol.n_type == N_REGISTER)
/* True if a debug special symbol entry */
nameless symbols come from .stab directives. */
#define S_IS_LOCAL(s) (S_GET_NAME(s) && \
!S_IS_DEBUG(s) && \
- (S_GET_NAME(s)[0] == '\001' || \
- (S_LOCAL_NAME(s) && !flagseen['L'])))
+ (strchr(S_GET_NAME(s), '\001') != 0 || \
+ strchr(S_GET_NAME(s), '\002') != 0 || \
+ (S_LOCAL_NAME(s) && !flag_keep_locals)))
/* True if a symbol is not defined in this file */
#define S_IS_EXTERN(s) ((s)->sy_symbol.n_type & N_EXT)
/* True if the symbol has been generated because of a .stabd directive */
#define S_IS_STABD(s) (S_GET_NAME(s) == (char *)0)
/* Accessors */
-/* The value of the symbol */
-#define S_GET_VALUE(s) (((s)->sy_symbol.n_value))
/* The name of the symbol */
-#define S_GET_NAME(s) ((s)->sy_symbol.n_un.n_name)
+#define S_GET_NAME(s) ((s)->sy_symbol.n_name)
/* The pointer to the string table */
-#define S_GET_OFFSET(s) ((s)->sy_symbol.n_un.n_strx)
+#define S_GET_OFFSET(s) ((s)->sy_name_offset)
/* The raw type of the symbol */
#define S_GET_RAW_TYPE(s) ((s)->sy_symbol.n_type)
/* The type of the symbol */
#define S_GET_DESC(s) ((s)->sy_symbol.n_desc)
/* Modifiers */
-/* Set the value of the symbol */
-#define S_SET_VALUE(s,v) ((s)->sy_symbol.n_value = (unsigned long) (v))
/* Assume that a symbol cannot be simultaneously in more than on segment */
/* set segment */
#define S_SET_SEGMENT(s,seg) ((s)->sy_symbol.n_type &= ~N_TYPE,(s)->sy_symbol.n_type|=SEGMENT_TO_SYMBOL_TYPE(seg))
/* The symbol is not external */
#define S_CLEAR_EXTERNAL(s) ((s)->sy_symbol.n_type &= ~N_EXT)
/* Set the name of the symbol */
-#define S_SET_NAME(s,v) ((s)->sy_symbol.n_un.n_name = (v))
+#define S_SET_NAME(s,v) ((s)->sy_symbol.n_name = (v))
/* Set the offset in the string table */
-#define S_SET_OFFSET(s,v) ((s)->sy_symbol.n_un.n_strx = (v))
+#define S_SET_OFFSET(s,v) ((s)->sy_name_offset = (v))
/* Set the n_other expression value */
#define S_SET_OTHER(s,v) ((s)->sy_symbol.n_other = (v))
/* Set the n_desc expression value */
#define S_SET_DESC(s,v) ((s)->sy_symbol.n_desc = (v))
+/* Set the n_type expression value */
+#define S_SET_TYPE(s,v) ((s)->sy_symbol.n_type = (v))
/* File header macro and type definition */
#define H_SET_SYMBOL_TABLE_SIZE(h,v) ((h)->header.a_syms = (v) * \
sizeof(struct nlist))
-/*
- * Current means for getting the name of a segment.
- * This will change for infinite-segments support (e.g. COFF).
- */
-#define segment_name(seg) ( seg_name[(int)(seg)] )
-extern char *const seg_name[];
-
-
/* line numbering stuff. */
#define OBJ_EMIT_LINENO(a, b, c) {;}
#define obj_symbol_new_hook(s) {;}
-#ifdef __STDC__
+/* Force structure tags into scope so that their use in prototypes
+ will never be their first occurance. */
struct fix;
-void tc_aout_fix_to_chars (char *where, struct fix *fixP, relax_addressT segment_address);
-#else
-void tc_aout_fix_to_chars ();
-#endif /* __STDC__ */
+struct frag;
+
+/* obj-vms routines visible to the rest of gas. */
+
+extern void tc_aout_fix_to_chars PARAMS ((char *,struct fix *,relax_addressT));
+
+extern int vms_resolve_symbol_redef PARAMS ((symbolS *));
+#define RESOLVE_SYMBOL_REDEFINITION(X) vms_resolve_symbol_redef(X)
+
+/* Compiler-generated label "__vax_g_doubles" is used to augment .stabs. */
+extern void vms_check_for_special_label PARAMS ((symbolS *));
+#define obj_frob_label(X) vms_check_for_special_label(X)
+
+extern void vms_check_for_main PARAMS ((void));
+
+extern void vms_write_object_file PARAMS ((unsigned,unsigned,unsigned,
+ struct frag *,struct frag *));
-/* The rest of this file contains definitions for constants used within the actual
- VMS object file. We do not use a $ in the symbols (as per usual VMS
- convention) since System V gags on it. */
+/* VMS executables are nothing like a.out, but the VMS port of gcc uses
+ a.out format stabs which obj-vms.c then translates. */
+
+#define AOUT_STABS
+
+\f
+#ifdef WANT_VMS_OBJ_DEFS
+
+/* The rest of this file contains definitions for constants used within
+ the actual VMS object file. We do not use a $ in the symbols (as per
+ usual VMS convention) since System V gags on it. */
#define OBJ_S_C_HDR 0
#define OBJ_S_C_HDR_MHD 0
#define GSY_S_M_DEF 2
#define GSY_S_M_UNI 4
#define GSY_S_M_REL 8
+
+#define LSY_S_M_DEF 2
+#define LSY_S_M_REL 8
+
+#define ENV_S_M_DEF 1
+#define ENV_S_M_NESTED 2
\f
#define GPS_S_M_PIC 1
#define GPS_S_M_LIB 2
* machine-readable version seems
* to be available.
*/
-#define DST_S_C_C 7 /* Language == "C" */
+#define DST_S_C_C 7 /* Language == "C" */
+#define DST_S_C_CXX 15 /* Language == "C++" */
#define DST_S_C_VERSION 153
#define DST_S_C_SOURCE 155 /* Source file */
#define DST_S_C_PROLOG 162
#define DST_S_C_SET_LINUM_L 20 /* Set Line # */
#define DST_S_C_TERM_L 21 /* End of lines */
/* these are used with DST_S_C_SOURCE */
-#define DST_S_C_SRC_FORMFEED 16 /* ^L counts */
-#define DST_S_C_SRC_DECLFILE 1 /* Declare file */
-#define DST_S_C_SRC_SETFILE 2 /* Set file */
-#define DST_S_C_SRC_SETREC_L 3 /* Set record */
-#define DST_S_C_SRC_DEFLINES_W 10 /* # of line */
+#define DST_S_C_SRC_DECLFILE 1 /* Declare source file */
+#define DST_S_C_SRC_SETFILE 2 /* Set source file */
+#define DST_S_C_SRC_SETREC_L 3 /* Set record, longword value */
+#define DST_S_C_SRC_SETREC_W 4 /* Set record, word value */
+#define DST_S_C_SRC_DEFLINES_W 10 /* # of line, word counter */
+#define DST_S_C_SRC_DEFLINES_B 11 /* # of line, byte counter */
+#define DST_S_C_SRC_FORMFEED 16 /* ^L counts as a record */
/* the following are the codes for the various data types. Anything not on
* the list is included under 'advanced_type'
*/
#define DBG_S_C_UCHAR 0x02
#define DBG_S_C_USINT 0x03
#define DBG_S_C_ULINT 0x04
+#define DBG_S_C_UQUAD 0x05
#define DBG_S_C_SCHAR 0x06
#define DBG_S_C_SSINT 0x07
#define DBG_S_C_SLINT 0x08
+#define DBG_S_C_SQUAD 0x09
#define DBG_S_C_REAL4 0x0a
-#define DBG_S_C_REAL8 0x0b
+#define DBG_S_C_REAL8 0x0b /* D_float double */
+#define DBG_S_C_COMPLX4 0x0c /* 2xF_float complex float */
+#define DBG_S_C_COMPLX8 0x0d /* 2xD_float complex double */
+#define DBG_S_C_REAL8_G 0x1b /* G_float double */
+#define DBG_S_C_COMPLX8_G 0x1d /* 2xG_float complex double */
#define DBG_S_C_FUNCTION_ADDR 0x17
#define DBG_S_C_ADVANCED_TYPE 0xa3
+/* Some of these are just for future reference. [pr]
+ */
+#define DBG_S_C_UBITA 0x01 /* unsigned, aligned bit field */
+#define DBG_S_C_UBITU 0x22 /* unsigned, unaligned bit field */
+#define DBG_S_C_SBITA 0x29 /* signed, aligned bit field */
+#define DBG_S_C_SBITU 0x2a /* signed, unaligned bit field */
+#define DBG_S_C_CSTRING 0x2e /* asciz ('\0' terminated) string */
+#define DBG_S_C_WCHAR 0x38 /* wchar_t */
+/* These are descriptor class codes.
+ */
+#define DSC_K_CLASS_S 0x01 /* static (fixed length) */
+#define DSC_K_CLASS_D 0x02 /* dynamic string (not via malloc!) */
+#define DSC_K_CLASS_A 0x04 /* array */
+#define DSC_K_CLASS_UBS 0x0d /* unaligned bit string */
/* These are the codes that are used to generate the definitions of struct
* union and enum records
*/
-#define DBG_S_C_ENUM_ITEM 0xa4
+#define DBG_S_C_ENUM_ITEM 0xa4
#define DBG_S_C_ENUM_START 0xa5
-#define DBG_S_C_ENUM_END 0xa6
+#define DBG_S_C_ENUM_END 0xa6
+#define DBG_S_C_STRUCT_ITEM DST_K_VFLAGS_BITOFFS /* 0xff */
#define DBG_S_C_STRUCT_START 0xab
-#define DBG_S_C_STRUCT_ITEM 0xff
#define DBG_S_C_STRUCT_END 0xac
-/* These are the codes that are used in the suffix records to determine the
- * actual data type
- */
-#define DBG_S_C_BASIC 0x01
-#define DBG_S_C_BASIC_ARRAY 0x02
-#define DBG_S_C_STRUCT 0x03
-#define DBG_S_C_POINTER 0x04
-#define DBG_S_C_VOID 0x05
-#define DBG_S_C_COMPLEX_ARRAY 0x07
+#define DST_K_TYPSPEC 0xaf /* type specification */
/* These codes are used in the generation of the symbol definition records
*/
-#define DBG_S_C_FUNCTION_PARAMETER 0xc9
-#define DBG_S_C_LOCAL_SYM 0xd9
-/*
- * Local Variables:
- * comment-column: 0
- * fill-column: 131
- * End:
+#define DST_K_VFLAGS_NOVAL 0x80 /* struct definition only */
+#define DST_K_VFLAGS_DSC 0xfa /* descriptor used */
+#define DST_K_VFLAGS_TVS 0xfb /* trailing value specified */
+#define DST_K_VS_FOLLOWS 0xfd /* value spec follows */
+#define DST_K_VFLAGS_BITOFFS 0xff /* value contains bit offset */
+#define DST_K_VALKIND_LITERAL 0
+#define DST_K_VALKIND_ADDR 1
+#define DST_K_VALKIND_DESC 2
+#define DST_K_VALKIND_REG 3
+#define DST_K_REG_VAX_AP 0x0c /* R12 */
+#define DST_K_REG_VAX_FP 0x0d /* R13 */
+#define DST_K_REG_VAX_SP 0x0e /* R14 */
+#define DST_V_VALKIND 0 /* offset of valkind field */
+#define DST_V_INDIRECT 2 /* offset to indirect bit */
+#define DST_V_DISP 3 /* offset to displacement bit */
+#define DST_V_REGNUM 4 /* offset to register number */
+#define DST_M_INDIRECT (1<<DST_V_INDIRECT)
+#define DST_M_DISP (1<<DST_V_DISP)
+#define DBG_C_FUNCTION_PARAM /* 0xc9 */ \
+ (DST_K_VALKIND_ADDR|DST_M_DISP|(DST_K_REG_VAX_AP<<DST_V_REGNUM))
+#define DBG_C_LOCAL_SYM /* 0xd9 */ \
+ (DST_K_VALKIND_ADDR|DST_M_DISP|(DST_K_REG_VAX_FP<<DST_V_REGNUM))
+/* Kinds of value specifications
+ */
+#define DST_K_VS_ALLOC_SPLIT 3 /* split lifetime */
+/* Kinds of type specifications
+ */
+#define DST_K_TS_ATOM 0x01 /* atomic type specification */
+#define DST_K_TS_DSC 0x02 /* descriptor type spec */
+#define DST_K_TS_IND 0x03 /* indirect type specification */
+#define DST_K_TS_TPTR 0x04 /* typed pointer type spec */
+#define DST_K_TS_PTR 0x05 /* pointer type spec */
+#define DST_K_TS_ARRAY 0x07 /* array type spec */
+#define DST_K_TS_NOV_LENG 0x0e /* novel length type spec */
+/* These are the codes that are used in the suffix records to determine the
+ * actual data type
*/
+#define DBG_S_C_BASIC DST_K_TS_ATOM
+#define DBG_S_C_BASIC_ARRAY DST_K_TS_DSC
+#define DBG_S_C_STRUCT DST_K_TS_IND
+#define DBG_S_C_POINTER DST_K_TS_TPTR
+#define DBG_S_C_VOID DST_K_TS_PTR
+#define DBG_S_C_COMPLEX_ARRAY DST_K_TS_ARRAY
+
+#endif /* WANT_VMS_OBJ_DEFS */
/* end of obj-vms.h */