#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 symbolS *make_expr_symbol PARAMS ((expressionS * expressionP));
/* FIXME: This should be something which decode_local_label_name
will handle. */
-#ifdef DOT_LABEL_PREFIX
- fake = ".L0\001";
-#else
- fake = "L0\001";
-#endif
+ fake = FAKE_LABEL_NAME;
+
/* Putting constant symbols in absolute_section rather than
expr_section is convenient for the old a.out code, for which
S_GET_SEGMENT does not always retrieve the value put in by
/* If nonzero, we've been asked to assemble nan, +inf or -inf */
int generic_floating_point_magic;
\f
-void
+static void
floating_constant (expressionP)
expressionS *expressionP;
{
expressionP->X_add_number = -1;
}
-void
+static void
integer_constant (radix, expressionP)
int radix;
expressionS *expressionP;
}
/* again, c is char after number, */
/* input_line_pointer->after c. */
- know (sizeof (int) * 8 == 32);
know (LITTLENUM_NUMBER_OF_BITS == 16);
- /* hence the constant "2" in the next line. */
- if (leader < generic_bignum + 2)
+ if (leader < generic_bignum + sizeof (valueT) / 2)
{ /* will fit into 32 bits. */
number =
((generic_bignum[1] & LITTLENUM_MASK) << LITTLENUM_NUMBER_OF_BITS)
then this is a fresh instantiation of that number, so create
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);
know (symbolP != NULL);
}
else
{
- name = dollar_label_name (number, 1);
+ name = dollar_label_name ((long) number, 1);
symbolP = symbol_find_or_make (name);
}
expressionP->X_add_number = number;
input_line_pointer--; /*->char following number. */
}
-} /* integer_constant() */
+}
/*
char *name; /* points to name of symbol */
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. */
SKIP_WHITESPACE (); /* leading whitespace is part of operand. */
expressionP->X_add_number = - expressionP->X_add_number;
/* Notice: '-' may overflow: no warning is given. This is
compatible with other people's assemblers. Sigh. */
+ expressionP->X_unsigned = 0;
}
else
expressionP->X_add_number = ~ expressionP->X_add_number;
/* JF: '.' is pseudo symbol with value of current location
in current segment. */
-#ifdef DOT_LABEL_PREFIX
- fake = ".L0\001";
-#else
- fake = "L0\001";
-#endif
+ fake = FAKE_LABEL_NAME;
symbolP = symbol_new (fake,
now_seg,
(valueT) frag_now_fix (),
as_warn ("missing operand; zero assumed");
right.X_op = O_constant;
right.X_add_number = 0;
- resultP->X_add_symbol = NULL;
- resultP->X_op_symbol = NULL;
+ right.X_add_symbol = NULL;
+ right.X_op_symbol = NULL;
}
know (*input_line_pointer != ' ');
else if (! SEG_NORMAL (retval))
retval = 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");
c_right = *input_line_pointer;
resultP->X_op_symbol = make_expr_symbol (&right);
resultP->X_op = op_left;
resultP->X_add_number = 0;
+ resultP->X_unsigned = 1;
}
op_left = op_right;
#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
#define TC_START_LABEL(x,y) (x==':')
#endif
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
/* The m88k uses pseudo-ops without a period. */
pop = (pseudo_typeS *) hash_find (po_hash, s);
A well shaped space is sometimes all that separates
keyword from operands. */
if (c == ' ' || c == '\t')
- {
- input_line_pointer++;
- } /* Skip seperator after keyword. */
+ input_line_pointer++;
/*
* Input_line is restored.
* Input_line_pointer->1st non-blank char
break;
}
else
- {
- (*pop->poc_handler) (pop->poc_val);
- } /* if we have one */
+ (*pop->poc_handler) (pop->poc_val);
}
else
#endif
*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 c==':' */
continue;
} /* if (is_name_beginner(c) */
+ /* Empty statement? */
if (is_end_of_line[(unsigned char) c])
- {
- continue;
- } /* empty statement */
-
+ continue;
#if defined(LOCAL_LABELS_DOLLAR) || defined(LOCAL_LABELS_FB)
if (isdigit (c))
- { /* local label ("4:") */
+ {
+ /* local label ("4:") */
char *backup = input_line_pointer;
HANDLE_CONDITIONAL_ASSEMBLY ();
case '9':
{
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';
}
--input_line_pointer;
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':
/* To be compatible with BSD 4.2 as: give the luser a linefeed!! */
as_warn ("Unterminated string: Newline inserted.");
#ifdef SEPARATE_STAB_SECTIONS
unsigned int
-get_stab_string_offset (string, secname)
+get_stab_string_offset (string, stabstr_secname)
const char *string;
- const char *secname;
+ const char *stabstr_secname;
{
unsigned int length;
unsigned int retval;
save_subseg = now_subseg;
/* Create the stab string section. */
- newsecname = xmalloc ((unsigned long) (strlen (secname) + 4));
- strcpy (newsecname, secname);
- strcat (newsecname, "str");
+ newsecname = xmalloc ((unsigned long) (strlen (stabstr_secname) + 1));
+ strcpy (newsecname, stabstr_secname);
seg = subseg_new (newsecname, 0);
kinds of stab sections. */
static void
-s_stab_generic (what, secname)
+s_stab_generic (what, stab_secname, stabstr_secname)
int what;
- char *secname;
+ char *stab_secname;
+ char *stabstr_secname;
{
long longint;
char *string;
dot = frag_now_fix ();
- seg = subseg_new (secname, 0);
+ seg = subseg_new (stab_secname, 0);
if (! seg_info (seg)->hadone)
{
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
output as 12 byte blocks of information. */
expressionS exp;
/* Arrange for a value representing the current location. */
-#ifdef DOT_LABEL_PREFIX
- fake = ".L0\001";
-#else
- fake = "L0\001";
-#endif
+ fake = FAKE_LABEL_NAME;
symbol = symbol_new (fake, saved_seg, dot, saved_frag);
exp.X_op = O_symbol;
s_stab (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. */
int what;
{
int length;
- char *secname;
+ char *stab_secname, *stabstr_secname;
- secname = demand_copy_C_string (&length);
+ stab_secname = demand_copy_C_string (&length);
SKIP_WHITESPACE ();
if (*input_line_pointer == ',')
input_line_pointer++;
ignore_rest_of_line ();
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