/* VMS object file format
- Copyright (C) 1989, 1990, 1991, 1994 Free Software Foundation, Inc.
+ Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000
+ 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)
* 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 : 2)
+#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
#define IN_DEFAULT_SECTION 0x80
-/* Compiler-generated label "__vax_g_doubles" is used to augment .stabs. */
-
-#define tc_frob_label(X) vms_check_for_special_label(X)
-extern void vms_check_for_special_label();
-
-/* These are defined in obj-vms.c. */
+/* These are defined in obj-vms.c. */
extern const short seg_N_TYPE[];
extern const segT N_TYPE_seg[];
};
#define N_BADMAG(x) (0)
-#define N_TXTOFF(x) ( sizeof(struct exec) )
+#define N_TXTOFF(x) ( sizeof (struct exec) )
#define N_DATOFF(x) ( N_TXTOFF(x) + (x).a_text )
#define N_TROFF(x) ( N_DATOFF(x) + (x).a_data )
#define N_DROFF(x) ( N_TROFF(x) + (x).a_trsize )
typedef struct
{
struct exec header; /* a.out header */
- long string_table_size; /* names + '\0' + sizeof(int) */
+ 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 */
/* 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 */
#define S_IS_DEBUG(s) ((s)->sy_symbol.n_type & N_STAB)
/* True if a symbol is local symbol name */
/* A symbol name whose name begin with ^A is a gas internal pseudo symbol
- nameless symbols come from .stab directives. */
+ 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' || \
+ (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)
/* Accessors */
/* 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 */
/* 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 */
/* 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_GET_TEXT_SIZE(h) ((h)->header.a_text)
#define H_SET_STRING_SIZE(h,v) ((h)->string_table_size = (v))
#define H_SET_SYMBOL_TABLE_SIZE(h,v) ((h)->header.a_syms = (v) * \
- sizeof(struct nlist))
+ sizeof (struct nlist))
-/* line numbering stuff. */
+/* line numbering stuff. */
#define OBJ_EMIT_LINENO(a, b, c) {;}
#define obj_symbol_new_hook(s) {;}
+/* 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 PARAMS ((char *where, struct fix *fixP, relax_addressT segment_address));
+struct frag;
+
+/* obj-vms routines visible to the rest of gas. */
-extern int vms_resolve_symbol_redef ();
+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)
-/* 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. */
+/* 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 *));
+
+/* 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
#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_POINTER DST_K_TS_TPTR
#define DBG_S_C_VOID DST_K_TS_PTR
#define DBG_S_C_COMPLEX_ARRAY DST_K_TS_ARRAY
-/* end of obj-vms.h */
+
+#endif /* WANT_VMS_OBJ_DEFS */