mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-01-18 14:04:24 +08:00
* expr.c (make_expr_symbol): Delete DOT_LABEL_PREFIX code
and instead simply use the string defined by FAKE_LABEL_NAME. (operand): Likewise. * read.c (s_stab_generic): Likewise.
This commit is contained in:
parent
6bc14195fb
commit
d4c8cbd8ef
51
gas/expr.c
51
gas/expr.c
@ -31,6 +31,8 @@
|
|||||||
|
|
||||||
#include "obstack.h"
|
#include "obstack.h"
|
||||||
|
|
||||||
|
static void floating_constant PARAMS ((expressionS * expressionP));
|
||||||
|
static void integer_constant PARAMS ((int radix, expressionS * expressionP));
|
||||||
static void clean_up_expression PARAMS ((expressionS * expressionP));
|
static void clean_up_expression PARAMS ((expressionS * expressionP));
|
||||||
static symbolS *make_expr_symbol PARAMS ((expressionS * expressionP));
|
static symbolS *make_expr_symbol PARAMS ((expressionS * expressionP));
|
||||||
|
|
||||||
@ -49,11 +51,8 @@ make_expr_symbol (expressionP)
|
|||||||
|
|
||||||
/* FIXME: This should be something which decode_local_label_name
|
/* FIXME: This should be something which decode_local_label_name
|
||||||
will handle. */
|
will handle. */
|
||||||
#ifdef DOT_LABEL_PREFIX
|
fake = FAKE_LABEL_NAME;
|
||||||
fake = ".L0\001";
|
|
||||||
#else
|
|
||||||
fake = "L0\001";
|
|
||||||
#endif
|
|
||||||
/* Putting constant symbols in absolute_section rather than
|
/* Putting constant symbols in absolute_section rather than
|
||||||
expr_section is convenient for the old a.out code, for which
|
expr_section is convenient for the old a.out code, for which
|
||||||
S_GET_SEGMENT does not always retrieve the value put in by
|
S_GET_SEGMENT does not always retrieve the value put in by
|
||||||
@ -89,7 +88,7 @@ FLONUM_TYPE generic_floating_point_number =
|
|||||||
/* If nonzero, we've been asked to assemble nan, +inf or -inf */
|
/* If nonzero, we've been asked to assemble nan, +inf or -inf */
|
||||||
int generic_floating_point_magic;
|
int generic_floating_point_magic;
|
||||||
|
|
||||||
void
|
static void
|
||||||
floating_constant (expressionP)
|
floating_constant (expressionP)
|
||||||
expressionS *expressionP;
|
expressionS *expressionP;
|
||||||
{
|
{
|
||||||
@ -118,7 +117,7 @@ floating_constant (expressionP)
|
|||||||
expressionP->X_add_number = -1;
|
expressionP->X_add_number = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
integer_constant (radix, expressionP)
|
integer_constant (radix, expressionP)
|
||||||
int radix;
|
int radix;
|
||||||
expressionS *expressionP;
|
expressionS *expressionP;
|
||||||
@ -230,10 +229,8 @@ integer_constant (radix, expressionP)
|
|||||||
}
|
}
|
||||||
/* again, c is char after number, */
|
/* again, c is char after number, */
|
||||||
/* input_line_pointer->after c. */
|
/* input_line_pointer->after c. */
|
||||||
know (sizeof (int) * 8 == 32);
|
|
||||||
know (LITTLENUM_NUMBER_OF_BITS == 16);
|
know (LITTLENUM_NUMBER_OF_BITS == 16);
|
||||||
/* hence the constant "2" in the next line. */
|
if (leader < generic_bignum + sizeof (valueT) / 2)
|
||||||
if (leader < generic_bignum + 2)
|
|
||||||
{ /* will fit into 32 bits. */
|
{ /* will fit into 32 bits. */
|
||||||
number =
|
number =
|
||||||
((generic_bignum[1] & LITTLENUM_MASK) << LITTLENUM_NUMBER_OF_BITS)
|
((generic_bignum[1] & LITTLENUM_MASK) << LITTLENUM_NUMBER_OF_BITS)
|
||||||
@ -331,15 +328,15 @@ integer_constant (radix, expressionP)
|
|||||||
then this is a fresh instantiation of that number, so create
|
then this is a fresh instantiation of that number, so create
|
||||||
it. */
|
it. */
|
||||||
|
|
||||||
if (dollar_label_defined (number))
|
if (dollar_label_defined ((long) number))
|
||||||
{
|
{
|
||||||
name = dollar_label_name (number, 0);
|
name = dollar_label_name ((long) number, 0);
|
||||||
symbolP = symbol_find (name);
|
symbolP = symbol_find (name);
|
||||||
know (symbolP != NULL);
|
know (symbolP != NULL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
name = dollar_label_name (number, 1);
|
name = dollar_label_name ((long) number, 1);
|
||||||
symbolP = symbol_find_or_make (name);
|
symbolP = symbol_find_or_make (name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -371,7 +368,7 @@ integer_constant (radix, expressionP)
|
|||||||
expressionP->X_add_number = number;
|
expressionP->X_add_number = number;
|
||||||
input_line_pointer--; /*->char following number. */
|
input_line_pointer--; /*->char following number. */
|
||||||
}
|
}
|
||||||
} /* integer_constant() */
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -394,6 +391,14 @@ operand (expressionP)
|
|||||||
char *name; /* points to name of symbol */
|
char *name; /* points to name of symbol */
|
||||||
segT segment;
|
segT segment;
|
||||||
|
|
||||||
|
/* All integers are regarded as unsigned unless they are negated.
|
||||||
|
This is because the only thing which cares whether a number is
|
||||||
|
unsigned is the code in emit_expr which extends constants into
|
||||||
|
bignums. It should only sign extend negative numbers, so that
|
||||||
|
something like ``.quad 0x80000000'' is not sign extended even
|
||||||
|
though it appears negative if valueT is 32 bits. */
|
||||||
|
expressionP->X_unsigned = 1;
|
||||||
|
|
||||||
/* digits, assume it is a bignum. */
|
/* digits, assume it is a bignum. */
|
||||||
|
|
||||||
SKIP_WHITESPACE (); /* leading whitespace is part of operand. */
|
SKIP_WHITESPACE (); /* leading whitespace is part of operand. */
|
||||||
@ -562,6 +567,7 @@ operand (expressionP)
|
|||||||
expressionP->X_add_number = - expressionP->X_add_number;
|
expressionP->X_add_number = - expressionP->X_add_number;
|
||||||
/* Notice: '-' may overflow: no warning is given. This is
|
/* Notice: '-' may overflow: no warning is given. This is
|
||||||
compatible with other people's assemblers. Sigh. */
|
compatible with other people's assemblers. Sigh. */
|
||||||
|
expressionP->X_unsigned = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
expressionP->X_add_number = ~ expressionP->X_add_number;
|
expressionP->X_add_number = ~ expressionP->X_add_number;
|
||||||
@ -589,11 +595,7 @@ operand (expressionP)
|
|||||||
|
|
||||||
/* JF: '.' is pseudo symbol with value of current location
|
/* JF: '.' is pseudo symbol with value of current location
|
||||||
in current segment. */
|
in current segment. */
|
||||||
#ifdef DOT_LABEL_PREFIX
|
fake = FAKE_LABEL_NAME;
|
||||||
fake = ".L0\001";
|
|
||||||
#else
|
|
||||||
fake = "L0\001";
|
|
||||||
#endif
|
|
||||||
symbolP = symbol_new (fake,
|
symbolP = symbol_new (fake,
|
||||||
now_seg,
|
now_seg,
|
||||||
(valueT) frag_now_fix (),
|
(valueT) frag_now_fix (),
|
||||||
@ -852,8 +854,8 @@ expr (rank, resultP)
|
|||||||
as_warn ("missing operand; zero assumed");
|
as_warn ("missing operand; zero assumed");
|
||||||
right.X_op = O_constant;
|
right.X_op = O_constant;
|
||||||
right.X_add_number = 0;
|
right.X_add_number = 0;
|
||||||
resultP->X_add_symbol = NULL;
|
right.X_add_symbol = NULL;
|
||||||
resultP->X_op_symbol = NULL;
|
right.X_op_symbol = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
know (*input_line_pointer != ' ');
|
know (*input_line_pointer != ' ');
|
||||||
@ -866,7 +868,11 @@ expr (rank, resultP)
|
|||||||
else if (! SEG_NORMAL (retval))
|
else if (! SEG_NORMAL (retval))
|
||||||
retval = rightseg;
|
retval = rightseg;
|
||||||
else if (SEG_NORMAL (rightseg)
|
else if (SEG_NORMAL (rightseg)
|
||||||
&& retval != rightseg)
|
&& retval != rightseg
|
||||||
|
#ifdef DIFF_EXPR_OK
|
||||||
|
&& op_left != O_subtract
|
||||||
|
#endif
|
||||||
|
)
|
||||||
as_bad ("operation combines symbols in different segments");
|
as_bad ("operation combines symbols in different segments");
|
||||||
|
|
||||||
c_right = *input_line_pointer;
|
c_right = *input_line_pointer;
|
||||||
@ -968,6 +974,7 @@ expr (rank, resultP)
|
|||||||
resultP->X_op_symbol = make_expr_symbol (&right);
|
resultP->X_op_symbol = make_expr_symbol (&right);
|
||||||
resultP->X_op = op_left;
|
resultP->X_op = op_left;
|
||||||
resultP->X_add_number = 0;
|
resultP->X_add_number = 0;
|
||||||
|
resultP->X_unsigned = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
op_left = op_right;
|
op_left = op_right;
|
||||||
|
100
gas/read.c
100
gas/read.c
@ -50,6 +50,15 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|||||||
|
|
||||||
#include "aout/stab_gnu.h"
|
#include "aout/stab_gnu.h"
|
||||||
|
|
||||||
|
/* Allow backends to override the names used for the stab sections. */
|
||||||
|
#ifndef STAB_SECTION_NAME
|
||||||
|
#define STAB_SECTION_NAME ".stab"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef STAB_STRING_SECTION_NAME
|
||||||
|
#define STAB_STRING_SECTION_NAME ".stabstr"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef TC_START_LABEL
|
#ifndef TC_START_LABEL
|
||||||
#define TC_START_LABEL(x,y) (x==':')
|
#define TC_START_LABEL(x,y) (x==':')
|
||||||
#endif
|
#endif
|
||||||
@ -449,6 +458,19 @@ read_a_source_file (name)
|
|||||||
|
|
||||||
pop = NULL;
|
pop = NULL;
|
||||||
|
|
||||||
|
#define IGNORE_OPCODE_CASE
|
||||||
|
#ifdef IGNORE_OPCODE_CASE
|
||||||
|
{
|
||||||
|
char *s2 = s;
|
||||||
|
while (*s2)
|
||||||
|
{
|
||||||
|
if (isupper (*s2))
|
||||||
|
*s2 = tolower (*s2);
|
||||||
|
s2++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef NO_PSEUDO_DOT
|
#ifdef NO_PSEUDO_DOT
|
||||||
/* The m88k uses pseudo-ops without a period. */
|
/* The m88k uses pseudo-ops without a period. */
|
||||||
pop = (pseudo_typeS *) hash_find (po_hash, s);
|
pop = (pseudo_typeS *) hash_find (po_hash, s);
|
||||||
@ -484,9 +506,7 @@ read_a_source_file (name)
|
|||||||
A well shaped space is sometimes all that separates
|
A well shaped space is sometimes all that separates
|
||||||
keyword from operands. */
|
keyword from operands. */
|
||||||
if (c == ' ' || c == '\t')
|
if (c == ' ' || c == '\t')
|
||||||
{
|
|
||||||
input_line_pointer++;
|
input_line_pointer++;
|
||||||
} /* Skip seperator after keyword. */
|
|
||||||
/*
|
/*
|
||||||
* Input_line is restored.
|
* Input_line is restored.
|
||||||
* Input_line_pointer->1st non-blank char
|
* Input_line_pointer->1st non-blank char
|
||||||
@ -498,9 +518,7 @@ read_a_source_file (name)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
(*pop->poc_handler) (pop->poc_val);
|
(*pop->poc_handler) (pop->poc_val);
|
||||||
} /* if we have one */
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
@ -524,23 +542,22 @@ read_a_source_file (name)
|
|||||||
|
|
||||||
*input_line_pointer++ = c;
|
*input_line_pointer++ = c;
|
||||||
|
|
||||||
/* We resume loop AFTER the end-of-line from this instruction */
|
/* We resume loop AFTER the end-of-line from
|
||||||
|
this instruction. */
|
||||||
} /* if (*s=='.') */
|
} /* if (*s=='.') */
|
||||||
|
|
||||||
} /* if c==':' */
|
} /* if c==':' */
|
||||||
continue;
|
continue;
|
||||||
} /* if (is_name_beginner(c) */
|
} /* if (is_name_beginner(c) */
|
||||||
|
|
||||||
|
|
||||||
|
/* Empty statement? */
|
||||||
if (is_end_of_line[(unsigned char) c])
|
if (is_end_of_line[(unsigned char) c])
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
} /* empty statement */
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(LOCAL_LABELS_DOLLAR) || defined(LOCAL_LABELS_FB)
|
#if defined(LOCAL_LABELS_DOLLAR) || defined(LOCAL_LABELS_FB)
|
||||||
if (isdigit (c))
|
if (isdigit (c))
|
||||||
{ /* local label ("4:") */
|
{
|
||||||
|
/* local label ("4:") */
|
||||||
char *backup = input_line_pointer;
|
char *backup = input_line_pointer;
|
||||||
|
|
||||||
HANDLE_CONDITIONAL_ASSEMBLY ();
|
HANDLE_CONDITIONAL_ASSEMBLY ();
|
||||||
@ -2274,8 +2291,9 @@ next_char_of_string ()
|
|||||||
case '9':
|
case '9':
|
||||||
{
|
{
|
||||||
long number;
|
long number;
|
||||||
|
int i;
|
||||||
|
|
||||||
for (number = 0; isdigit (c); c = *input_line_pointer++)
|
for (i = 0, number = 0; isdigit (c) && i < 3; c = *input_line_pointer++, i++)
|
||||||
{
|
{
|
||||||
number = number * 8 + c - '0';
|
number = number * 8 + c - '0';
|
||||||
}
|
}
|
||||||
@ -2284,6 +2302,28 @@ next_char_of_string ()
|
|||||||
--input_line_pointer;
|
--input_line_pointer;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'x':
|
||||||
|
case 'X':
|
||||||
|
{
|
||||||
|
long number;
|
||||||
|
|
||||||
|
number = 0;
|
||||||
|
c = *input_line_pointer++;
|
||||||
|
while (isxdigit (c))
|
||||||
|
{
|
||||||
|
if (isdigit (c))
|
||||||
|
number = number * 16 + c - '0';
|
||||||
|
else if (isupper (c))
|
||||||
|
number = number * 16 + c - 'A' + 10;
|
||||||
|
else
|
||||||
|
number = number * 16 + c - 'a' + 10;
|
||||||
|
c = *input_line_pointer++;
|
||||||
|
}
|
||||||
|
c = number & 0xff;
|
||||||
|
--input_line_pointer;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case '\n':
|
case '\n':
|
||||||
/* To be compatible with BSD 4.2 as: give the luser a linefeed!! */
|
/* To be compatible with BSD 4.2 as: give the luser a linefeed!! */
|
||||||
as_warn ("Unterminated string: Newline inserted.");
|
as_warn ("Unterminated string: Newline inserted.");
|
||||||
@ -2598,9 +2638,9 @@ s_ignore (arg)
|
|||||||
#ifdef SEPARATE_STAB_SECTIONS
|
#ifdef SEPARATE_STAB_SECTIONS
|
||||||
|
|
||||||
unsigned int
|
unsigned int
|
||||||
get_stab_string_offset (string, secname)
|
get_stab_string_offset (string, stabstr_secname)
|
||||||
const char *string;
|
const char *string;
|
||||||
const char *secname;
|
const char *stabstr_secname;
|
||||||
{
|
{
|
||||||
unsigned int length;
|
unsigned int length;
|
||||||
unsigned int retval;
|
unsigned int retval;
|
||||||
@ -2620,9 +2660,8 @@ get_stab_string_offset (string, secname)
|
|||||||
save_subseg = now_subseg;
|
save_subseg = now_subseg;
|
||||||
|
|
||||||
/* Create the stab string section. */
|
/* Create the stab string section. */
|
||||||
newsecname = xmalloc ((unsigned long) (strlen (secname) + 4));
|
newsecname = xmalloc ((unsigned long) (strlen (stabstr_secname) + 1));
|
||||||
strcpy (newsecname, secname);
|
strcpy (newsecname, stabstr_secname);
|
||||||
strcat (newsecname, "str");
|
|
||||||
|
|
||||||
seg = subseg_new (newsecname, 0);
|
seg = subseg_new (newsecname, 0);
|
||||||
|
|
||||||
@ -2659,9 +2698,10 @@ get_stab_string_offset (string, secname)
|
|||||||
kinds of stab sections. */
|
kinds of stab sections. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
s_stab_generic (what, secname)
|
s_stab_generic (what, stab_secname, stabstr_secname)
|
||||||
int what;
|
int what;
|
||||||
char *secname;
|
char *stab_secname;
|
||||||
|
char *stabstr_secname;
|
||||||
{
|
{
|
||||||
long longint;
|
long longint;
|
||||||
char *string;
|
char *string;
|
||||||
@ -2742,7 +2782,7 @@ s_stab_generic (what, secname)
|
|||||||
|
|
||||||
dot = frag_now_fix ();
|
dot = frag_now_fix ();
|
||||||
|
|
||||||
seg = subseg_new (secname, 0);
|
seg = subseg_new (stab_secname, 0);
|
||||||
|
|
||||||
if (! seg_info (seg)->hadone)
|
if (! seg_info (seg)->hadone)
|
||||||
{
|
{
|
||||||
@ -2755,7 +2795,7 @@ s_stab_generic (what, secname)
|
|||||||
seg_info (seg)->hadone = 1;
|
seg_info (seg)->hadone = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
stroff = get_stab_string_offset (string, secname);
|
stroff = get_stab_string_offset (string, stabstr_secname);
|
||||||
|
|
||||||
/* At least for now, stabs in a special stab section are always
|
/* At least for now, stabs in a special stab section are always
|
||||||
output as 12 byte blocks of information. */
|
output as 12 byte blocks of information. */
|
||||||
@ -2778,11 +2818,7 @@ s_stab_generic (what, secname)
|
|||||||
expressionS exp;
|
expressionS exp;
|
||||||
|
|
||||||
/* Arrange for a value representing the current location. */
|
/* Arrange for a value representing the current location. */
|
||||||
#ifdef DOT_LABEL_PREFIX
|
fake = FAKE_LABEL_NAME;
|
||||||
fake = ".L0\001";
|
|
||||||
#else
|
|
||||||
fake = "L0\001";
|
|
||||||
#endif
|
|
||||||
symbol = symbol_new (fake, saved_seg, dot, saved_frag);
|
symbol = symbol_new (fake, saved_seg, dot, saved_frag);
|
||||||
|
|
||||||
exp.X_op = O_symbol;
|
exp.X_op = O_symbol;
|
||||||
@ -2854,7 +2890,7 @@ void
|
|||||||
s_stab (what)
|
s_stab (what)
|
||||||
int what;
|
int what;
|
||||||
{
|
{
|
||||||
s_stab_generic (what, ".stab");
|
s_stab_generic (what, STAB_SECTION_NAME, STAB_STRING_SECTION_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* "Extended stabs", used in Solaris only now. */
|
/* "Extended stabs", used in Solaris only now. */
|
||||||
@ -2864,9 +2900,9 @@ s_xstab (what)
|
|||||||
int what;
|
int what;
|
||||||
{
|
{
|
||||||
int length;
|
int length;
|
||||||
char *secname;
|
char *stab_secname, *stabstr_secname;
|
||||||
|
|
||||||
secname = demand_copy_C_string (&length);
|
stab_secname = demand_copy_C_string (&length);
|
||||||
SKIP_WHITESPACE ();
|
SKIP_WHITESPACE ();
|
||||||
if (*input_line_pointer == ',')
|
if (*input_line_pointer == ',')
|
||||||
input_line_pointer++;
|
input_line_pointer++;
|
||||||
@ -2876,7 +2912,13 @@ s_xstab (what)
|
|||||||
ignore_rest_of_line ();
|
ignore_rest_of_line ();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
s_stab_generic (what, secname);
|
|
||||||
|
/* To get the name of the stab string section, simply .str to
|
||||||
|
the stab section name. */
|
||||||
|
stabstr_secname = alloca (strlen (stab_secname) + 4);
|
||||||
|
strcpy (stabstr_secname, stab_secname);
|
||||||
|
strcat (stabstr_secname, "str");
|
||||||
|
s_stab_generic (what, stab_secname, stabstr_secname);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef S_SET_DESC
|
#ifdef S_SET_DESC
|
||||||
|
Loading…
Reference in New Issue
Block a user