diff options
Diffstat (limited to 'gas')
-rw-r--r-- | gas/ChangeLog | 26 | ||||
-rw-r--r-- | gas/config/obj-vms.c | 87 | ||||
-rw-r--r-- | gas/config/obj-vms.h | 28 |
3 files changed, 78 insertions, 63 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index 0847b10..681ba54 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -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> * 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 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> * config/tc-sh.c (md_pseudo_table): Add "uses". diff --git a/gas/config/obj-vms.c b/gas/config/obj-vms.c index 72ae2e4..31a8c24 100644 --- a/gas/config/obj-vms.c +++ b/gas/config/obj-vms.c @@ -101,6 +101,15 @@ 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 * 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 VMS_typedef_parse PARAMS ((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 *)); static int VMS_Initialized_Data_Size PARAMS ((symbolS *,int)); @@ -410,7 +419,7 @@ static void vms_build_DST PARAMS ((unsigned)); * use with VMS. */ -char const_flag = IN_DEFAULT_SECTION; +unsigned char const_flag = IN_DEFAULT_SECTION; static void s_const (arg) @@ -3835,7 +3844,7 @@ static int VMS_Psect_Spec (Name, Size, Type, vsp) const char *Name; int Size; - const char *Type; + enum ps_type Type; struct VMS_Symbol *vsp; { char Local[32]; @@ -3844,45 +3853,31 @@ VMS_Psect_Spec (Name, Size, Type, vsp) /* * Generate the appropriate PSECT flags given the PSECT type */ - if (strcmp (Type, "COMMON") == 0) - { - /* - * Common block psects are: PIC,OVR,REL,GBL,SHR,RD,WRT - */ - 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_WRT); - } - else if (strcmp (Type, "CONST") == 0) - { - /* - * Common block psects are: PIC,OVR,REL,GBL,SHR,RD - */ - 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); - } - else if (strcmp (Type, "DATA") == 0) - { - /* - * The Data psects are PIC,REL,RD,WRT - */ - Psect_Attributes = - (GPS_S_M_PIC | GPS_S_M_REL | GPS_S_M_RD | GPS_S_M_WRT); - } - else if (strcmp (Type, "TEXT") == 0) - { - /* - * 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 + switch (Type) { - /* - * Error: Unknown psect type - */ - error ("Unknown VMS psect type"); + case ps_TEXT: + /* 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 + |GPS_S_M_RD); + break; + case ps_DATA: + /* 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; + 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 + |GPS_S_M_SHR|GPS_S_M_RD|GPS_S_M_WRT); + break; + 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 + |GPS_S_M_SHR|GPS_S_M_RD); + break; + default: + /* impossible */ + error ("Unknown VMS psect type (%ld)", (long) Type); + break; } /* * 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. */ Globalref = VMS_Psect_Spec (S_GET_NAME (sp), vsp->Size, - S_GET_OTHER (sp) ? "CONST" : "COMMON", + S_GET_OTHER (sp) ? ps_CONST : ps_COMMON, vsp); if (Globalref) Psect_Number--; @@ -5094,7 +5089,7 @@ global_symbol_directory (text_siz, data_siz) /* Make its psect. */ Globalref = VMS_Psect_Spec (S_GET_NAME (sp), vsp->Size, - S_GET_OTHER (sp) ? "CONST" : "COMMON", + S_GET_OTHER (sp) ? ps_CONST : ps_COMMON, vsp); if (Globalref) Psect_Number--; @@ -5605,14 +5600,14 @@ vms_write_object_file (text_siz, data_siz, bss_siz, text_frag_root, * Define the Text Psect */ 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 */ if (bss_siz > 0) { 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. @@ -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) { 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 * proper value of Data_Psect now that it's actually been defined. diff --git a/gas/config/obj-vms.h b/gas/config/obj-vms.h index 34aa4a2..88f7155 100644 --- a/gas/config/obj-vms.h +++ b/gas/config/obj-vms.h @@ -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 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 @@ -81,27 +81,21 @@ typedef struct 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 */ @@ -156,9 +150,9 @@ typedef struct nlist obj_symbol_type; /* Symbol table entry */ /* 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 */ @@ -179,9 +173,9 @@ typedef struct nlist obj_symbol_type; /* Symbol table entry */ /* 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 */ |