Browse Source

* app.c (do_scrub_chars): In MRI mode, silently end quoted strings

at newline characters.  In MRI mode, always keep spaces in the
	operands field.  In MRI mode, treat a line comment character as a
	regular comment character following a space.
	* cond.c (ignore_input): Use strncasecmp rather than strncmp when
	looking for special pseudo-ops.
	* read.c (cons_worker): In MRI mode, the expressions stop at the
	first unquoted space.
	(equals): Likewise.
gdb-4_18-branch
Ian Lance Taylor 31 years ago
parent
commit
86038ada17
  1. 25
      gas/ChangeLog
  2. 1166
      gas/app.c
  3. 50
      gas/cond.c
  4. 172
      gas/read.c

25
gas/ChangeLog

@ -1,3 +1,28 @@
Wed Sep 6 21:13:06 1995 Ian Lance Taylor <ian@cygnus.com>
* app.c (do_scrub_chars): In MRI mode, silently end quoted strings
at newline characters. In MRI mode, always keep spaces in the
operands field. In MRI mode, treat a line comment character as a
regular comment character following a space.
* cond.c (ignore_input): Use strncasecmp rather than strncmp when
looking for special pseudo-ops.
* read.c (cons_worker): In MRI mode, the expressions stop at the
first unquoted space.
(equals): Likewise.
start-sanitize-sh3e
Wed Sep 6 15:03:53 1995 Jim Wilson <wilson@chestnut.cygnus.com>
* config/tc-sh.c (get_operands): Read third arg if it exists.
Otherwise, clear it.
(get_specific, case F_FR0): Add.
end-sanitize-sh3e
Wed Sep 6 15:03:53 1995 Jim Wilson <wilson@chestnut.cygnus.com>
* config/tc-sh.c (get_specific): Delete arg_to_test.
(md_assemble): Increase operand array from 2 to 3.
Tue Sep 5 16:47:36 1995 Stan Shebs <shebs@andros.cygnus.com> Tue Sep 5 16:47:36 1995 Stan Shebs <shebs@andros.cygnus.com>
* config/tc-mips.c: Remove CYGNUS LOCAL comments. * config/tc-mips.c: Remove CYGNUS LOCAL comments.

1166
gas/app.c

File diff suppressed because it is too large

50
gas/cond.c

@ -61,19 +61,23 @@ s_ifdef (arg)
{ {
as_bad ("invalid identifier for \".ifdef\""); as_bad ("invalid identifier for \".ifdef\"");
obstack_1grow (&cond_obstack, 0); obstack_1grow (&cond_obstack, 0);
ignore_rest_of_line ();
} }
else else
{ {
get_symbol_end (); char c;
++input_line_pointer;
c = get_symbol_end ();
symbolP = symbol_find (name); symbolP = symbol_find (name);
*input_line_pointer = c;
initialize_cframe (&cframe); initialize_cframe (&cframe);
cframe.ignoring = cframe.dead_tree || !((symbolP != 0) ^ arg); cframe.ignoring = cframe.dead_tree || !((symbolP != 0) ^ arg);
current_cframe = (struct conditional_frame *) obstack_copy (&cond_obstack, &cframe, sizeof (cframe)); current_cframe = ((struct conditional_frame *)
obstack_copy (&cond_obstack, &cframe,
sizeof (cframe)));
demand_empty_rest_of_line ();
} /* if a valid identifyer name */ } /* if a valid identifyer name */
return;
} /* s_ifdef() */ } /* s_ifdef() */
void void
@ -85,10 +89,19 @@ s_if (arg)
int t; int t;
SKIP_WHITESPACE (); /* Leading whitespace is part of operand. */ SKIP_WHITESPACE (); /* Leading whitespace is part of operand. */
expression (&operand);
if (operand.X_op != O_constant) if (current_cframe != NULL && current_cframe->ignoring)
as_bad ("non-constant expression in \".if\" statement"); {
operand.X_add_number = 0;
while (! is_end_of_line[(unsigned char) *input_line_pointer])
++input_line_pointer;
}
else
{
expression (&operand);
if (operand.X_op != O_constant)
as_bad ("non-constant expression in \".if\" statement");
}
switch ((operatorT) arg) switch ((operatorT) arg)
{ {
@ -108,7 +121,8 @@ s_if (arg)
cframe.ignoring = cframe.dead_tree || ! t; cframe.ignoring = cframe.dead_tree || ! t;
current_cframe = ((struct conditional_frame *) current_cframe = ((struct conditional_frame *)
obstack_copy (&cond_obstack, &cframe, sizeof (cframe))); obstack_copy (&cond_obstack, &cframe, sizeof (cframe)));
return;
demand_empty_rest_of_line ();
} /* s_if() */ } /* s_if() */
/* Get a string for the MRI IFC or IFNC pseudo-ops. */ /* Get a string for the MRI IFC or IFNC pseudo-ops. */
@ -268,14 +282,16 @@ ignore_input ()
} }
/* We cannot ignore certain pseudo ops. */ /* We cannot ignore certain pseudo ops. */
if ((s[0] == 'i' if (((s[0] == 'i'
&& (!strncmp (s, "if", 2) || s[0] == 'I')
|| !strncmp (s, "ifdef", 5) && (!strncasecmp (s, "if", 2)
|| !strncmp (s, "ifndef", 6))) || !strncasecmp (s, "ifdef", 5)
|| (s[0] == 'e' || !strncasecmp (s, "ifndef", 6)))
&& (!strncmp (s, "else", 4) || ((s[0] == 'e'
|| !strncmp (s, "endif", 5) || s[0] == 'E')
|| !strncmp (s, "endc", 4)))) && (!strncasecmp (s, "else", 4)
|| !strncasecmp (s, "endif", 5)
|| !strncasecmp (s, "endc", 4))))
return 0; return 0;
return (current_cframe != NULL) && (current_cframe->ignoring); return (current_cframe != NULL) && (current_cframe->ignoring);

172
gas/read.c

@ -191,6 +191,7 @@ symbolS *mri_common_symbol;
may be needed. */ may be needed. */
static int mri_pending_align; static int mri_pending_align;
static int scrub_from_string PARAMS ((char **));
static void do_align PARAMS ((int, char *)); static void do_align PARAMS ((int, char *));
static int hex_float PARAMS ((int, char *)); static int hex_float PARAMS ((int, char *));
static void do_org PARAMS ((segT, expressionS *, int)); static void do_org PARAMS ((segT, expressionS *, int));
@ -330,6 +331,7 @@ static const pseudo_typeS potable[] =
/* print */ /* print */
{"quad", cons, 8}, {"quad", cons, 8},
{"rept", s_rept, 0}, {"rept", s_rept, 0},
{"rva", s_rva, 4},
{"sbttl", listing_title, 1}, /* Subtitle of listing */ {"sbttl", listing_title, 1}, /* Subtitle of listing */
/* scl */ /* scl */
/* sect */ /* sect */
@ -425,6 +427,24 @@ pobegin ()
} }
/* This function is used when scrubbing the characters between #APP
and #NO_APP. */
static char *scrub_string;
static char *scrub_string_end;
static int
scrub_from_string (from)
char **from;
{
int size;
*from = scrub_string;
size = scrub_string_end - scrub_string;
scrub_string = scrub_string_end;
return size;
}
/* read_a_source_file() /* read_a_source_file()
* *
* We read the file, putting things into a web that * We read the file, putting things into a web that
@ -810,7 +830,6 @@ read_a_source_file (name)
char *new_tmp; char *new_tmp;
unsigned int new_length; unsigned int new_length;
char *tmp_buf = 0; char *tmp_buf = 0;
extern char *scrub_string, *scrub_last_string;
bump_line_counters (); bump_line_counters ();
s = input_line_pointer; s = input_line_pointer;
@ -862,26 +881,30 @@ read_a_source_file (name)
{ {
input_line_pointer = ends + 8; input_line_pointer = ends + 8;
} }
new_buf = xmalloc (100);
new_length = 100;
new_tmp = new_buf;
scrub_string = s; scrub_string = s;
scrub_last_string = ends; scrub_string_end = ends;
new_length = ends - s;
new_buf = (char *) xmalloc (new_length);
new_tmp = new_buf;
for (;;) for (;;)
{ {
int ch; int space;
int size;
ch = do_scrub_next_char (scrub_from_string, scrub_to_string); space = (new_buf + new_length) - new_tmp;
if (ch == EOF) size = do_scrub_chars (scrub_from_string, new_tmp, space);
break;
*new_tmp++ = ch; if (size < space)
if (new_tmp == new_buf + new_length)
{ {
new_buf = xrealloc (new_buf, new_length + 100); new_tmp += size;
new_tmp = new_buf + new_length; break;
new_length += 100;
} }
new_buf = xrealloc (new_buf, new_length + 100);
new_tmp = new_buf + new_length;
new_length += 100;
} }
if (tmp_buf) if (tmp_buf)
@ -908,6 +931,7 @@ read_a_source_file (name)
if (old_buffer) if (old_buffer)
{ {
free (buffer);
bump_line_counters (); bump_line_counters ();
if (old_input != 0) if (old_input != 0)
{ {
@ -1224,11 +1248,11 @@ s_data (ignore)
} }
/* Handle the .appfile pseudo-op. This is automatically generated by /* Handle the .appfile pseudo-op. This is automatically generated by
do_scrub_next_char when a preprocessor # line comment is seen with do_scrub_chars when a preprocessor # line comment is seen with a
a file name. This default definition may be overridden by the file name. This default definition may be overridden by the object
object or CPU specific pseudo-ops. This function is also the or CPU specific pseudo-ops. This function is also the default
default definition for .file; the APPFILE argument is 1 for definition for .file; the APPFILE argument is 1 for .appfile, 0 for
.appfile, 0 for .file. */ .file. */
void void
s_app_file (appfile) s_app_file (appfile)
@ -1256,9 +1280,9 @@ s_app_file (appfile)
} }
/* Handle the .appline pseudo-op. This is automatically generated by /* Handle the .appline pseudo-op. This is automatically generated by
do_scrub_next_char when a preprocessor # line comment is seen. do_scrub_chars when a preprocessor # line comment is seen. This
This default definition may be overridden by the object or CPU default definition may be overridden by the object or CPU specific
specific pseudo-ops. */ pseudo-ops. */
void void
s_app_line (ignore) s_app_line (ignore)
@ -2362,12 +2386,14 @@ parse_repeat_cons PARAMS ((expressionS *exp, unsigned int nbytes));
/* worker to do .byte etc statements */ /* worker to do .byte etc statements */
/* clobbers input_line_pointer, checks */ /* clobbers input_line_pointer, checks */
/* end-of-line. */ /* end-of-line. */
void static void
cons (nbytes) cons_worker (nbytes, rva)
register int nbytes; /* 1=.byte, 2=.word, 4=.long */ register int nbytes; /* 1=.byte, 2=.word, 4=.long */
int rva;
{ {
int c; int c;
expressionS exp; expressionS exp;
char *stop = NULL;
#ifdef md_flush_pending_output #ifdef md_flush_pending_output
md_flush_pending_output (); md_flush_pending_output ();
@ -2379,17 +2405,54 @@ cons (nbytes)
return; return;
} }
/* In MRI mode, the operands end at the first unquoted space. */
if (flag_mri)
{
char *s;
int inquote = 0;
for (s = input_line_pointer;
((! is_end_of_line[(unsigned char) *s] && *s != ' ' && *s != '\t')
|| inquote);
s++)
{
if (*s == '\'')
inquote = ! inquote;
}
stop = s;
}
c = 0; c = 0;
do do
{ {
if (rva)
{
/* If this is an .rva pseudoop then stick
an extra reloc in for this word. */
int reloc;
char *p = frag_more (0);
exp.X_op = O_absent;
#ifdef BFD_ASSEMBLER
reloc = BFD_RELOC_RVA;
#elif defined(TC_RVA_RELOC)
reloc = TC_RVA_RELOC;
#else
abort();
#endif
fix_new_exp (frag_now, p - frag_now->fr_literal,
nbytes, &exp, 0, reloc);
}
if (flag_mri) if (flag_mri)
parse_mri_cons (&exp, (unsigned int) nbytes); parse_mri_cons (&exp, (unsigned int) nbytes);
else else
TC_PARSE_CONS_EXPRESSION (&exp, (unsigned int) nbytes); TC_PARSE_CONS_EXPRESSION (&exp, (unsigned int) nbytes);
emit_expr (&exp, (unsigned int) nbytes); emit_expr (&exp, (unsigned int) nbytes);
++c; ++c;
} }
while (*input_line_pointer++ == ','); while (*input_line_pointer++ == ','
&& (! flag_mri || input_line_pointer < stop));
/* In MRI mode, after an odd number of bytes, we must align to an /* In MRI mode, after an odd number of bytes, we must align to an
even word boundary, unless the next instruction is a dc.b, ds.b even word boundary, unless the next instruction is a dc.b, ds.b
@ -2398,9 +2461,33 @@ cons (nbytes)
mri_pending_align = 1; mri_pending_align = 1;
input_line_pointer--; /* Put terminator back into stream. */ input_line_pointer--; /* Put terminator back into stream. */
if (flag_mri)
{
input_line_pointer = stop;
while (! is_end_of_line[(unsigned char) *input_line_pointer])
++input_line_pointer;
}
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
} }
void
cons (size)
int size;
{
cons_worker (size, 0);
}
void
s_rva (size)
int size;
{
cons_worker (size, 1);
}
/* Put the contents of expression EXP into the object file using /* Put the contents of expression EXP into the object file using
NBYTES bytes. If need_pass_2 is 1, this does nothing. */ NBYTES bytes. If need_pass_2 is 1, this does nothing. */
@ -2625,8 +2712,8 @@ emit_expr (exp, nbytes)
fix_new_exp (frag_now, p - frag_now->fr_literal, (int) nbytes, exp, 0, fix_new_exp (frag_now, p - frag_now->fr_literal, (int) nbytes, exp, 0,
/* @@ Should look at CPU word size. */ /* @@ Should look at CPU word size. */
nbytes == 2 ? BFD_RELOC_16 nbytes == 2 ? BFD_RELOC_16
: nbytes == 8 ? BFD_RELOC_64 : nbytes == 8 ? BFD_RELOC_64
: BFD_RELOC_32); : BFD_RELOC_32);
#endif #endif
#else #else
#ifdef TC_CONS_FIX_NEW #ifdef TC_CONS_FIX_NEW
@ -3435,6 +3522,8 @@ equals (sym_name)
char *sym_name; char *sym_name;
{ {
register symbolS *symbolP; /* symbol we are working with */ register symbolS *symbolP; /* symbol we are working with */
char *stop;
int stopc;
input_line_pointer++; input_line_pointer++;
if (*input_line_pointer == '=') if (*input_line_pointer == '=')
@ -3443,6 +3532,25 @@ equals (sym_name)
while (*input_line_pointer == ' ' || *input_line_pointer == '\t') while (*input_line_pointer == ' ' || *input_line_pointer == '\t')
input_line_pointer++; input_line_pointer++;
/* In MRI mode, the operands end at the first unquoted space. */
if (flag_mri)
{
char *s;
int inquote = 0;
for (s = input_line_pointer;
((! is_end_of_line[(unsigned char) *s] && *s != ' ' && *s != '\t')
|| inquote);
s++)
{
if (*s == '\'')
inquote = ! inquote;
}
stop = s;
stopc = *stop;
*stop = '\0';
}
if (sym_name[0] == '.' && sym_name[1] == '\0') if (sym_name[0] == '.' && sym_name[1] == '\0')
{ {
/* Turn '. = mumble' into a .org mumble */ /* Turn '. = mumble' into a .org mumble */
@ -3458,6 +3566,14 @@ equals (sym_name)
symbolP = symbol_find_or_make (sym_name); symbolP = symbol_find_or_make (sym_name);
pseudo_set (symbolP); pseudo_set (symbolP);
} }
if (flag_mri)
{
input_line_pointer = stop;
*stop = stopc;
while (! is_end_of_line[(unsigned char) *input_line_pointer])
++input_line_pointer;
}
} /* equals() */ } /* equals() */
/* .include -- include a file at this point. */ /* .include -- include a file at this point. */

Loading…
Cancel
Save