more vms changes

This commit is contained in:
Ken Raeburn 1995-07-28 00:45:53 +00:00
parent 373fa578ae
commit 5700b874e4
3 changed files with 78 additions and 63 deletions

View file

@ -1,3 +1,19 @@
Thu Jul 27 16:14:56 1995 Pat Rankin <rankin@eql.caltech.edu>
* config/obj-vms.c (enum ps_type {ps_TEXT,ps_DATA,ps_COMMON,
ps_CONST}): New constants.
(VMS_Psect_Spec): Use them instead of literal strings.
(vms_write_object_file, global_symbol_directory): Adjust callers.
Wed Jul 26 18:31:35 1995 Pat Rankin <rankin@eql.caltech.edu>
* config/obj-vms.c (const_flag): Change from char to unsigned char.
* config/obj-vms.h (const_flag): Ditto.
(struct nlist): Replace union n_un and n_un.{n_name,n_next,n_strx}
fields with just n_name; delete field n_value; change n_other from
char to unsigned char and n_desc from short to int; insert explicit
padding for alignment.
Mon Jul 24 20:06:17 1995 Ken Raeburn <raeburn@cygnus.com> Mon Jul 24 20:06:17 1995 Ken Raeburn <raeburn@cygnus.com>
* subsegs.h (struct seg_info_trash): Make bitfield types valid. * subsegs.h (struct seg_info_trash): Make bitfield types valid.
@ -6,6 +22,16 @@ Mon Jul 24 20:06:17 1995 Ken Raeburn <raeburn@cygnus.com>
be declared register since its address is taken for be declared register since its address is taken for
MD_APPLY_FIX3. MD_APPLY_FIX3.
Fri Jul 21 15:28:18 1995 Pat Rankin <rankin@eql.caltech.edu>
Split huge vms_write_object_file routine into managable pieces.
* config/obj-vms.c (vms_fixup_text_section, synthesize_data_segment,
vms_fixup_data_section, global_symbol_directory, local_symbols_DST,
vms_build_DST): New routines.
(vms_write_object_file): Call them.
(struct vms_obj_state): New file scope variable used by the above.
Mon Jul 24 14:10:24 1995 Ian Lance Taylor <ian@cygnus.com> Mon Jul 24 14:10:24 1995 Ian Lance Taylor <ian@cygnus.com>
* config/tc-sh.c (md_pseudo_table): Add "uses". * config/tc-sh.c (md_pseudo_table): Add "uses".

View file

@ -100,6 +100,15 @@ struct input_file
static struct input_file *file_root = (struct input_file *) NULL; static struct input_file *file_root = (struct input_file *) NULL;
/*
* Styles of PSECTS (program sections) that we generate; just shorthand
* to avoid lists of section attributes. Used by VMS_Psect_Spec().
*/
enum ps_type
{
ps_TEXT, ps_DATA, ps_COMMON, ps_CONST
};
/* /*
* This enum is used to keep track of the various types of variables that * This enum is used to keep track of the various types of variables that
* may be present. * may be present.
@ -342,7 +351,7 @@ static int forward_reference PARAMS ((char *));
static int final_forward_reference PARAMS ((struct VMS_DBG_Symbol *)); static int final_forward_reference PARAMS ((struct VMS_DBG_Symbol *));
static int VMS_typedef_parse PARAMS ((char *)); static int VMS_typedef_parse PARAMS ((char *));
static int hash_string PARAMS ((const char *)); static int hash_string PARAMS ((const char *));
static int VMS_Psect_Spec PARAMS ((const char *,int,const char *, static int VMS_Psect_Spec PARAMS ((const char *,int,enum ps_type,
struct VMS_Symbol *)); struct VMS_Symbol *));
static int VMS_Initialized_Data_Size PARAMS ((symbolS *,int)); static int VMS_Initialized_Data_Size PARAMS ((symbolS *,int));
@ -410,7 +419,7 @@ static void vms_build_DST PARAMS ((unsigned));
* use with VMS. * use with VMS.
*/ */
char const_flag = IN_DEFAULT_SECTION; unsigned char const_flag = IN_DEFAULT_SECTION;
static void static void
s_const (arg) s_const (arg)
@ -3835,7 +3844,7 @@ static int
VMS_Psect_Spec (Name, Size, Type, vsp) VMS_Psect_Spec (Name, Size, Type, vsp)
const char *Name; const char *Name;
int Size; int Size;
const char *Type; enum ps_type Type;
struct VMS_Symbol *vsp; struct VMS_Symbol *vsp;
{ {
char Local[32]; char Local[32];
@ -3844,45 +3853,31 @@ VMS_Psect_Spec (Name, Size, Type, vsp)
/* /*
* Generate the appropriate PSECT flags given the PSECT type * Generate the appropriate PSECT flags given the PSECT type
*/ */
if (strcmp (Type, "COMMON") == 0) switch (Type)
{ {
/* case ps_TEXT:
* Common block psects are: PIC,OVR,REL,GBL,SHR,RD,WRT /* Text psects are PIC,noOVR,REL,noGBL,SHR,EXE,RD,noWRT. */
*/ Psect_Attributes = (GPS_S_M_PIC|GPS_S_M_REL|GPS_S_M_SHR|GPS_S_M_EXE
Psect_Attributes = (GPS_S_M_PIC | GPS_S_M_OVR | GPS_S_M_REL | GPS_S_M_GBL | |GPS_S_M_RD);
GPS_S_M_SHR | GPS_S_M_RD | GPS_S_M_WRT); break;
} case ps_DATA:
else if (strcmp (Type, "CONST") == 0) /* Data psects are PIC,noOVR,REL,noGBL,noSHR,noEXE,RD,WRT. */
{ Psect_Attributes = (GPS_S_M_PIC|GPS_S_M_REL|GPS_S_M_RD|GPS_S_M_WRT);
/* break;
* Common block psects are: PIC,OVR,REL,GBL,SHR,RD case ps_COMMON:
*/ /* Common block psects are: PIC,OVR,REL,GBL,SHR,noEXE,RD,WRT. */
Psect_Attributes = (GPS_S_M_PIC | GPS_S_M_OVR | GPS_S_M_REL | GPS_S_M_GBL | Psect_Attributes = (GPS_S_M_PIC|GPS_S_M_OVR|GPS_S_M_REL|GPS_S_M_GBL
GPS_S_M_SHR | GPS_S_M_RD); |GPS_S_M_SHR|GPS_S_M_RD|GPS_S_M_WRT);
} break;
else if (strcmp (Type, "DATA") == 0) case ps_CONST:
{ /* Const data psects are: PIC,OVR,REL,GBL,SHR,noEXE,RD,noWRT. */
/* Psect_Attributes = (GPS_S_M_PIC|GPS_S_M_OVR|GPS_S_M_REL|GPS_S_M_GBL
* The Data psects are PIC,REL,RD,WRT |GPS_S_M_SHR|GPS_S_M_RD);
*/ break;
Psect_Attributes = default:
(GPS_S_M_PIC | GPS_S_M_REL | GPS_S_M_RD | GPS_S_M_WRT); /* impossible */
} error ("Unknown VMS psect type (%ld)", (long) Type);
else if (strcmp (Type, "TEXT") == 0) break;
{
/*
* The Text psects are PIC,REL,SHR,EXE,RD
*/
Psect_Attributes =
(GPS_S_M_PIC | GPS_S_M_REL | GPS_S_M_SHR |
GPS_S_M_EXE | GPS_S_M_RD);
}
else
{
/*
* Error: Unknown psect type
*/
error ("Unknown VMS psect type");
} }
/* /*
* Modify the psect attributes according to any attribute string * Modify the psect attributes according to any attribute string
@ -5051,7 +5046,7 @@ global_symbol_directory (text_siz, data_siz)
/* Make the psect for this data. */ /* Make the psect for this data. */
Globalref = VMS_Psect_Spec (S_GET_NAME (sp), Globalref = VMS_Psect_Spec (S_GET_NAME (sp),
vsp->Size, vsp->Size,
S_GET_OTHER (sp) ? "CONST" : "COMMON", S_GET_OTHER (sp) ? ps_CONST : ps_COMMON,
vsp); vsp);
if (Globalref) if (Globalref)
Psect_Number--; Psect_Number--;
@ -5094,7 +5089,7 @@ global_symbol_directory (text_siz, data_siz)
/* Make its psect. */ /* Make its psect. */
Globalref = VMS_Psect_Spec (S_GET_NAME (sp), Globalref = VMS_Psect_Spec (S_GET_NAME (sp),
vsp->Size, vsp->Size,
S_GET_OTHER (sp) ? "CONST" : "COMMON", S_GET_OTHER (sp) ? ps_CONST : ps_COMMON,
vsp); vsp);
if (Globalref) if (Globalref)
Psect_Number--; Psect_Number--;
@ -5605,14 +5600,14 @@ vms_write_object_file (text_siz, data_siz, bss_siz, text_frag_root,
* Define the Text Psect * Define the Text Psect
*/ */
Text_Psect = Psect_Number++; Text_Psect = Psect_Number++;
VMS_Psect_Spec ("$code", text_siz, "TEXT", 0); VMS_Psect_Spec ("$code", text_siz, ps_TEXT, 0);
/* /*
* Define the BSS Psect * Define the BSS Psect
*/ */
if (bss_siz > 0) if (bss_siz > 0)
{ {
Bss_Psect = Psect_Number++; Bss_Psect = Psect_Number++;
VMS_Psect_Spec ("$uninitialized_data", bss_siz, "DATA", 0); VMS_Psect_Spec ("$uninitialized_data", bss_siz, ps_DATA, 0);
} }
/* /*
* Define symbols to the linker. * Define symbols to the linker.
@ -5624,7 +5619,7 @@ vms_write_object_file (text_siz, data_siz, bss_siz, text_frag_root,
if (data_siz > 0 && Local_Initd_Data_Size > 0) if (data_siz > 0 && Local_Initd_Data_Size > 0)
{ {
Data_Psect = Psect_Number++; Data_Psect = Psect_Number++;
VMS_Psect_Spec ("$data", Local_Initd_Data_Size, "DATA", 0); VMS_Psect_Spec ("$data", Local_Initd_Data_Size, ps_DATA, 0);
/* /*
* Local initialized data (N_DATA) symbols need to be updated to the * Local initialized data (N_DATA) symbols need to be updated to the
* proper value of Data_Psect now that it's actually been defined. * proper value of Data_Psect now that it's actually been defined.

View file

@ -35,7 +35,7 @@ to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1
data section. By and large they are identical, but we set a no-write data section. By and large they are identical, but we set a no-write
bit for psects in the const section. */ 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 /* This is overloaded onto const_flag, for convenience. It's used to flag
dummy labels like "gcc2_compiled." which occur before the first .text dummy labels like "gcc2_compiled." which occur before the first .text
@ -81,27 +81,21 @@ typedef struct
struct exec header; /* a.out header */ struct exec header; /* a.out header */
long string_table_size; /* names + '\0' + sizeof(int) */ long string_table_size; /* names + '\0' + sizeof(int) */
} }
object_headers; object_headers;
/* A single entry in the symbol table /* A single entry in the symbol table
* (this started as a clone of bout.h's nlist, but much was unneeded).
*/ */
struct nlist struct nlist
{ {
union char *n_name;
{
char *n_name;
struct nlist *n_next;
long n_strx; /* Index into string table */
}
n_un;
unsigned char n_type; /* See below */ unsigned char n_type; /* See below */
char n_other; /* Used in i80960 support -- see below */ unsigned char n_other; /* used for const_flag and "default section" */
short n_desc; unsigned : 16; /* padding for alignment */
unsigned long n_value; 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_UNDF 0 /* Undefined symbol */
#define N_ABS 2 /* Absolute symbol */ #define N_ABS 2 /* Absolute symbol */
@ -156,9 +150,9 @@ typedef struct nlist obj_symbol_type; /* Symbol table entry */
/* Accessors */ /* Accessors */
/* The name of the symbol */ /* 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 */ /* 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 */ /* The raw type of the symbol */
#define S_GET_RAW_TYPE(s) ((s)->sy_symbol.n_type) #define S_GET_RAW_TYPE(s) ((s)->sy_symbol.n_type)
/* The type of the symbol */ /* The type of the symbol */
@ -179,9 +173,9 @@ typedef struct nlist obj_symbol_type; /* Symbol table entry */
/* The symbol is not external */ /* The symbol is not external */
#define S_CLEAR_EXTERNAL(s) ((s)->sy_symbol.n_type &= ~N_EXT) #define S_CLEAR_EXTERNAL(s) ((s)->sy_symbol.n_type &= ~N_EXT)
/* Set the name of the symbol */ /* 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 */ /* 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 */ /* Set the n_other expression value */
#define S_SET_OTHER(s,v) ((s)->sy_symbol.n_other = (v)) #define S_SET_OTHER(s,v) ((s)->sy_symbol.n_other = (v))
/* Set the n_desc expression value */ /* Set the n_desc expression value */