mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-25 04:49:54 +08:00
vms fixes from pat rankin
This commit is contained in:
@ -240,14 +240,6 @@ static int total_len; /* used to calculate the total length of variable
|
|||||||
section. */
|
section. */
|
||||||
static int gave_compiler_message = 0;
|
static int gave_compiler_message = 0;
|
||||||
|
|
||||||
/* A pointer to the current routine that we are working on. */
|
|
||||||
|
|
||||||
static symbolS *Current_Routine;
|
|
||||||
|
|
||||||
/* The psect number for $code a.k.a. the text section. */
|
|
||||||
|
|
||||||
static int Text_Psect;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Global data (Object records limited to 512 bytes by VAX-11 "C" runtime)
|
* Global data (Object records limited to 512 bytes by VAX-11 "C" runtime)
|
||||||
@ -338,7 +330,7 @@ const segT N_TYPE_seg[N_TYPE + 2] =
|
|||||||
|
|
||||||
static struct input_file *find_file PARAMS ((symbolS *));
|
static struct input_file *find_file PARAMS ((symbolS *));
|
||||||
static struct VMS_DBG_Symbol *find_symbol PARAMS ((int));
|
static struct VMS_DBG_Symbol *find_symbol PARAMS ((int));
|
||||||
static symbolS *Define_Routine PARAMS ((symbolS *,int));
|
static symbolS *Define_Routine PARAMS ((symbolS *,int,symbolS *,int));
|
||||||
|
|
||||||
static char *cvt_integer PARAMS ((char *,int *));
|
static char *cvt_integer PARAMS ((char *,int *));
|
||||||
static char *fix_name PARAMS ((char *));
|
static char *fix_name PARAMS ((char *));
|
||||||
@ -372,7 +364,7 @@ static void VMS_TBT_Module_End PARAMS ((void));
|
|||||||
static void VMS_TBT_Routine_Begin PARAMS ((symbolS *,int));
|
static void VMS_TBT_Routine_Begin PARAMS ((symbolS *,int));
|
||||||
static void VMS_TBT_Routine_End PARAMS ((int,symbolS *));
|
static void VMS_TBT_Routine_End PARAMS ((int,symbolS *));
|
||||||
static void VMS_TBT_Block_Begin PARAMS ((symbolS *,int,char *));
|
static void VMS_TBT_Block_Begin PARAMS ((symbolS *,int,char *));
|
||||||
static void VMS_TBT_Block_End PARAMS ((int));
|
static void VMS_TBT_Block_End PARAMS ((valueT));
|
||||||
static void VMS_TBT_Line_PC_Correlation PARAMS ((int,int,int,int));
|
static void VMS_TBT_Line_PC_Correlation PARAMS ((int,int,int,int));
|
||||||
static void VMS_TBT_Source_Lines PARAMS ((int,int,int));
|
static void VMS_TBT_Source_Lines PARAMS ((int,int,int));
|
||||||
static void fpush PARAMS ((int,int));
|
static void fpush PARAMS ((int,int));
|
||||||
@ -390,8 +382,7 @@ static void VMS_LCSYM_Parse PARAMS ((symbolS *,int));
|
|||||||
static void VMS_STSYM_Parse PARAMS ((symbolS *,int));
|
static void VMS_STSYM_Parse PARAMS ((symbolS *,int));
|
||||||
static void VMS_RSYM_Parse PARAMS ((symbolS *,symbolS *,int));
|
static void VMS_RSYM_Parse PARAMS ((symbolS *,symbolS *,int));
|
||||||
static void VMS_LSYM_Parse PARAMS ((void));
|
static void VMS_LSYM_Parse PARAMS ((void));
|
||||||
static void Define_Local_Symbols PARAMS ((symbolS *,symbolS *));
|
static void Define_Local_Symbols PARAMS ((symbolS *,symbolS *,symbolS *,int));
|
||||||
static void VMS_DBG_Define_Routine PARAMS ((symbolS *,symbolS *,int));
|
|
||||||
static void Write_VMS_MHD_Records PARAMS ((void));
|
static void Write_VMS_MHD_Records PARAMS ((void));
|
||||||
static void Write_VMS_EOM_Record PARAMS ((int,int));
|
static void Write_VMS_EOM_Record PARAMS ((int,int));
|
||||||
static void VMS_Case_Hack_Symbol PARAMS ((const char *,char *));
|
static void VMS_Case_Hack_Symbol PARAMS ((const char *,char *));
|
||||||
@ -1178,7 +1169,7 @@ VMS_TBT_Block_Begin (symbolP, Psect, Name)
|
|||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
VMS_TBT_Block_End (Size)
|
VMS_TBT_Block_End (Size)
|
||||||
int Size;
|
valueT Size;
|
||||||
{
|
{
|
||||||
char Local[16];
|
char Local[16];
|
||||||
|
|
||||||
@ -3110,38 +3101,41 @@ VMS_LSYM_Parse ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
Define_Local_Symbols (s1, s2)
|
Define_Local_Symbols (s0P, s2P, Current_Routine, Text_Psect)
|
||||||
symbolS *s1, *s2;
|
symbolS *s0P, *s2P;
|
||||||
|
symbolS *Current_Routine;
|
||||||
|
int Text_Psect;
|
||||||
{
|
{
|
||||||
symbolS *symbolP1;
|
symbolS *s1P; /* each symbol from s0P .. s2P (exclusive) */
|
||||||
for (symbolP1 = symbol_next (s1); symbolP1 != s2; symbolP1 = symbol_next (symbolP1))
|
|
||||||
|
for (s1P = symbol_next (s0P); s1P != s2P; s1P = symbol_next (s1P))
|
||||||
{
|
{
|
||||||
if (symbolP1 == (symbolS *) NULL)
|
if (!s1P)
|
||||||
return;
|
break; /* and return */
|
||||||
if (S_GET_RAW_TYPE (symbolP1) == N_FUN)
|
if (S_GET_RAW_TYPE (s1P) == N_FUN)
|
||||||
{
|
{
|
||||||
char * pnt=(char*) strchr (S_GET_NAME (symbolP1), ':') + 1;
|
char *pnt = (char *) strchr (S_GET_NAME (s1P), ':') + 1;
|
||||||
if (*pnt == 'F' || *pnt == 'f') break;
|
if (*pnt == 'F' || *pnt == 'f') break;
|
||||||
}
|
}
|
||||||
|
if (!S_IS_DEBUG (s1P))
|
||||||
|
continue;
|
||||||
/*
|
/*
|
||||||
* Deal with STAB symbols
|
* Dispatch on STAB type
|
||||||
*/
|
*/
|
||||||
if (S_IS_DEBUG (symbolP1))
|
switch (S_GET_RAW_TYPE (s1P))
|
||||||
{
|
{
|
||||||
/*
|
default:
|
||||||
* Dispatch on STAB type
|
continue; /* not left or right brace */
|
||||||
*/
|
|
||||||
switch (S_GET_RAW_TYPE (symbolP1))
|
case N_LSYM:
|
||||||
{
|
case N_PSYM:
|
||||||
case N_LSYM:
|
VMS_local_stab_Parse (s1P);
|
||||||
case N_PSYM:
|
break;
|
||||||
VMS_local_stab_Parse (symbolP1);
|
|
||||||
break;
|
case N_RSYM:
|
||||||
case N_RSYM:
|
VMS_RSYM_Parse (s1P, Current_Routine, Text_Psect);
|
||||||
VMS_RSYM_Parse (symbolP1, Current_Routine, Text_Psect);
|
break;
|
||||||
break;
|
} /*switch*/
|
||||||
} /*switch*/
|
|
||||||
} /* if */
|
|
||||||
} /* for */
|
} /* for */
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3153,69 +3147,57 @@ Define_Local_Symbols (s1, s2)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static symbolS *
|
static symbolS *
|
||||||
Define_Routine (symbolP, Level)
|
Define_Routine (s0P, Level, Current_Routine, Text_Psect)
|
||||||
symbolS *symbolP;
|
symbolS *s0P;
|
||||||
int Level;
|
int Level;
|
||||||
|
symbolS *Current_Routine;
|
||||||
|
int Text_Psect;
|
||||||
{
|
{
|
||||||
symbolS *sstart;
|
symbolS *s1P;
|
||||||
symbolS *symbolP1;
|
valueT Offset;
|
||||||
char str[10];
|
|
||||||
int rcount = 0;
|
int rcount = 0;
|
||||||
int Offset;
|
|
||||||
sstart = symbolP;
|
for (s1P = symbol_next (s0P); s1P != 0; s1P = symbol_next (s1P))
|
||||||
for (symbolP1 = symbol_next (symbolP); symbolP1; symbolP1 = symbol_next (symbolP1))
|
|
||||||
{
|
{
|
||||||
if (S_GET_RAW_TYPE (symbolP1) == N_FUN)
|
if (S_GET_RAW_TYPE (s1P) == N_FUN)
|
||||||
{
|
{
|
||||||
char * pnt=(char*) strchr (S_GET_NAME (symbolP1), ':') + 1;
|
char *pnt = (char *) strchr (S_GET_NAME (s1P), ':') + 1;
|
||||||
if (*pnt == 'F' || *pnt == 'f') break;
|
if (*pnt == 'F' || *pnt == 'f') break;
|
||||||
}
|
}
|
||||||
|
if (!S_IS_DEBUG (s1P))
|
||||||
|
continue;
|
||||||
/*
|
/*
|
||||||
* Deal with STAB symbols
|
* Dispatch on STAB type
|
||||||
*/
|
*/
|
||||||
if (S_IS_DEBUG (symbolP1))
|
switch (S_GET_RAW_TYPE (s1P))
|
||||||
{
|
{
|
||||||
/*
|
default:
|
||||||
* Dispatch on STAB type
|
continue; /* not left or right brace */
|
||||||
*/
|
|
||||||
switch (S_GET_RAW_TYPE (symbolP1))
|
|
||||||
{
|
|
||||||
case N_LBRAC:
|
|
||||||
if (Level != 0)
|
|
||||||
{
|
|
||||||
sprintf (str, "$%d", rcount++);
|
|
||||||
VMS_TBT_Block_Begin (symbolP1, Text_Psect, str);
|
|
||||||
}
|
|
||||||
Offset = S_GET_VALUE (symbolP1);
|
|
||||||
Define_Local_Symbols (sstart, symbolP1);
|
|
||||||
symbolP1 =
|
|
||||||
Define_Routine (symbolP1, Level + 1);
|
|
||||||
if (Level != 0)
|
|
||||||
VMS_TBT_Block_End (S_GET_VALUE (symbolP1) -
|
|
||||||
Offset);
|
|
||||||
sstart = symbolP1;
|
|
||||||
break;
|
|
||||||
case N_RBRAC:
|
|
||||||
return symbolP1;
|
|
||||||
} /*switch*/
|
|
||||||
} /* if */
|
|
||||||
} /* for */
|
|
||||||
/* we end up here if there were no brackets in this function. Define
|
|
||||||
everything */
|
|
||||||
Define_Local_Symbols (sstart, (symbolS *) 0);
|
|
||||||
return symbolP1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
case N_LBRAC:
|
||||||
VMS_DBG_Define_Routine (symbolP, Curr_Routine, Txt_Psect)
|
if (Level != 0)
|
||||||
symbolS *symbolP;
|
{
|
||||||
symbolS *Curr_Routine;
|
char str[10];
|
||||||
int Txt_Psect;
|
sprintf (str, "$%d", rcount++);
|
||||||
{
|
VMS_TBT_Block_Begin (s1P, Text_Psect, str);
|
||||||
Current_Routine = Curr_Routine;
|
}
|
||||||
Text_Psect = Txt_Psect;
|
Offset = S_GET_VALUE (s1P); /* side-effect: fully resolve symbol */
|
||||||
Define_Routine (symbolP, 0);
|
Define_Local_Symbols (s0P, s1P, Current_Routine, Text_Psect);
|
||||||
|
s1P = Define_Routine (s1P, Level + 1, Current_Routine, Text_Psect);
|
||||||
|
if (Level != 0)
|
||||||
|
VMS_TBT_Block_End (S_GET_VALUE (s1P) - Offset);
|
||||||
|
s0P = s1P;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case N_RBRAC:
|
||||||
|
return s1P;
|
||||||
|
} /*switch*/
|
||||||
|
} /* for */
|
||||||
|
|
||||||
|
/* We end up here if there were no brackets in this function.
|
||||||
|
Define everything. */
|
||||||
|
Define_Local_Symbols (s0P, (symbolS *)0, Current_Routine, Text_Psect);
|
||||||
|
return s1P;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3389,26 +3371,14 @@ Write_VMS_EOM_Record (Psect, Offset)
|
|||||||
* Text_Psect==0)
|
* Text_Psect==0)
|
||||||
*/
|
*/
|
||||||
Set_VMS_Object_File_Record (OBJ_S_C_EOM);
|
Set_VMS_Object_File_Record (OBJ_S_C_EOM);
|
||||||
/*
|
PUT_CHAR (OBJ_S_C_EOM); /* Record type. */
|
||||||
* Store record Type
|
PUT_CHAR (0); /* Error severity level (we ignore it). */
|
||||||
*/
|
|
||||||
PUT_CHAR (OBJ_S_C_EOM);
|
|
||||||
/*
|
|
||||||
* Store the error severity (0)
|
|
||||||
*/
|
|
||||||
PUT_CHAR (0);
|
|
||||||
/*
|
/*
|
||||||
* Store the entry point, if it exists
|
* Store the entry point, if it exists
|
||||||
*/
|
*/
|
||||||
if (Psect >= 0)
|
if (Psect >= 0)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
* Store the entry point Psect
|
|
||||||
*/
|
|
||||||
PUT_CHAR (Psect);
|
PUT_CHAR (Psect);
|
||||||
/*
|
|
||||||
* Store the entry point Psect offset
|
|
||||||
*/
|
|
||||||
PUT_LONG (Offset);
|
PUT_LONG (Offset);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -4054,6 +4024,7 @@ VMS_Initialized_Data_Size (sp, End_Of_Data)
|
|||||||
return Next_Symbol ? (next_val - sp_val) : (End_Of_Data - sp_val);
|
return Next_Symbol ? (next_val - sp_val) : (End_Of_Data - sp_val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check symbol names for the Psect hack with a globalvalue, and then
|
* Check symbol names for the Psect hack with a globalvalue, and then
|
||||||
* generate globalvalues for those that have it.
|
* generate globalvalues for those that have it.
|
||||||
@ -4511,6 +4482,7 @@ VMS_Fix_Indirect_Reference (Text_Psect, Offset, fragP, text_frag_root)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the procedure "main()" exists we have to add the instruction
|
* If the procedure "main()" exists we have to add the instruction
|
||||||
* "jsb c$main_args" at the beginning to be compatible with VAX-11 "C".
|
* "jsb c$main_args" at the beginning to be compatible with VAX-11 "C".
|
||||||
@ -5198,7 +5170,7 @@ vms_write_object_file (text_siz, data_siz, bss_siz, text_frag_root,
|
|||||||
*/
|
*/
|
||||||
if (fixP->fx_subsy && fixP->fx_addsy)
|
if (fixP->fx_subsy && fixP->fx_addsy)
|
||||||
{
|
{
|
||||||
int i;
|
offsetT dif;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* They need to be in the same segment
|
* They need to be in the same segment
|
||||||
@ -5222,7 +5194,8 @@ vms_write_object_file (text_siz, data_siz, bss_siz, text_frag_root,
|
|||||||
* Subtract their values to get the
|
* Subtract their values to get the
|
||||||
* difference.
|
* difference.
|
||||||
*/
|
*/
|
||||||
i = S_GET_VALUE (fixP->fx_addsy) - S_GET_VALUE (fixP->fx_subsy);
|
dif = S_GET_VALUE (fixP->fx_addsy) - S_GET_VALUE (fixP->fx_subsy);
|
||||||
|
md_number_to_chars (Local, (valueT) dif, fixP->fx_size);
|
||||||
/*
|
/*
|
||||||
* Now generate the fixup object records
|
* Now generate the fixup object records
|
||||||
* Set the psect and store the data
|
* Set the psect and store the data
|
||||||
@ -5230,7 +5203,7 @@ vms_write_object_file (text_siz, data_siz, bss_siz, text_frag_root,
|
|||||||
VMS_Set_Psect (Text_Psect,
|
VMS_Set_Psect (Text_Psect,
|
||||||
fixP->fx_where + fixP->fx_frag->fr_address,
|
fixP->fx_where + fixP->fx_frag->fr_address,
|
||||||
OBJ_S_C_TIR);
|
OBJ_S_C_TIR);
|
||||||
VMS_Store_Immediate_Data (&i,
|
VMS_Store_Immediate_Data (Local,
|
||||||
fixP->fx_size,
|
fixP->fx_size,
|
||||||
OBJ_S_C_TIR);
|
OBJ_S_C_TIR);
|
||||||
/*
|
/*
|
||||||
@ -5348,7 +5321,7 @@ vms_write_object_file (text_siz, data_siz, bss_siz, text_frag_root,
|
|||||||
*/
|
*/
|
||||||
if (fixP->fx_subsy && fixP->fx_addsy)
|
if (fixP->fx_subsy && fixP->fx_addsy)
|
||||||
{
|
{
|
||||||
int i;
|
offsetT dif;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* They need to be in the same segment
|
* They need to be in the same segment
|
||||||
@ -5372,8 +5345,9 @@ vms_write_object_file (text_siz, data_siz, bss_siz, text_frag_root,
|
|||||||
* Subtract their values to get the
|
* Subtract their values to get the
|
||||||
* difference.
|
* difference.
|
||||||
*/
|
*/
|
||||||
i = S_GET_VALUE (fixP->fx_addsy) -
|
dif = S_GET_VALUE (fixP->fx_addsy) -
|
||||||
S_GET_VALUE (fixP->fx_subsy);
|
S_GET_VALUE (fixP->fx_subsy);
|
||||||
|
md_number_to_chars (Local, (valueT) dif, fixP->fx_size);
|
||||||
/*
|
/*
|
||||||
* Now generate the fixup object records
|
* Now generate the fixup object records
|
||||||
* Set the psect and store the data
|
* Set the psect and store the data
|
||||||
@ -5384,7 +5358,7 @@ vms_write_object_file (text_siz, data_siz, bss_siz, text_frag_root,
|
|||||||
S_GET_VALUE (vsp->Symbol) +
|
S_GET_VALUE (vsp->Symbol) +
|
||||||
vsp->Psect_Offset,
|
vsp->Psect_Offset,
|
||||||
OBJ_S_C_TIR);
|
OBJ_S_C_TIR);
|
||||||
VMS_Store_Immediate_Data (&i,
|
VMS_Store_Immediate_Data (Local,
|
||||||
fixP->fx_size,
|
fixP->fx_size,
|
||||||
OBJ_S_C_TIR);
|
OBJ_S_C_TIR);
|
||||||
/*
|
/*
|
||||||
@ -5607,8 +5581,8 @@ vms_write_object_file (text_siz, data_siz, bss_siz, text_frag_root,
|
|||||||
if ((*(--pnt) == '\0') && (*(--pnt1) == ':'))
|
if ((*(--pnt) == '\0') && (*(--pnt1) == ':'))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (symbolP1 != (symbolS *) NULL)
|
if (symbolP1)
|
||||||
VMS_DBG_Define_Routine (symbolP1, Current_Routine, Text_Psect);
|
Define_Routine (symbolP1, 0, Current_Routine, Text_Psect);
|
||||||
} /* local symbol block */
|
} /* local symbol block */
|
||||||
/*
|
/*
|
||||||
* Done
|
* Done
|
||||||
|
Reference in New Issue
Block a user