Allow symbol and label names to be enclosed in double quotes.

gas	PR gas/18581
	* expr.c (get_symbol_end): Rename to get_symbol_name.  Add a
	return parameter pointing to the start of the symbol.  Allow
	symbol names enclosed in double quotes.
	(restore_line_pointer): New function.  Replace the NUL character
	inserted into the input stream with the given character.  If the
	character was a double quote, advance the input pointer.
	* expr.h (get_symbol_end): Delete.
	(get_symbol_name): Add prototype.
	(restore_line_pointer): Prototype.
	* read.h (SKIP_WHITESPACE_AFTER_NAME): New macro.
	* doc/as.texinfo (Symbol Intro): Document that symbol names can
	now be enclosed in double quotes.
	* cond.c (s_ifdef): Replace get_symbol_end with get_symbol_name.
	Use restore_line_pointer to replace the NUL in the input stream.
	Use SKIP_WHITESPACE_AFTER_NAME to skip past the end of a symbol.
	Check for the use of double quoted symbol names.
	* expr.c: Likewise.
	* config/obj-aout.c: Likewise.
	* config/obj-coff-seh.c: Likewise.
	* config/obj-coff.c: Likewise.
	* config/obj-elf.c: Likewise.
	* config/obj-evax.c: Likewise.
	* config/obj-macho.c: Likewise.
	* config/obj-som.c: Likewise.
	* config/tc-alpha.c: Likewise.
	* config/tc-arc.c: Likewise.
	* config/tc-arm.c: Likewise.
	* config/tc-dlx.c: Likewise.
	* config/tc-h8300.c: Likewise.
	* config/tc-hppa.c: Likewise.
	* config/tc-i370.c: Likewise.
	* config/tc-i386-intel.c: Likewise.
	* config/tc-i386.c: Likewise.
	* config/tc-i960.c: Likewise.
	* config/tc-ia64.c: Likewise.
	* config/tc-iq2000.c: Likewise.
	* config/tc-m32r.c: Likewise.
	* config/tc-m68hc11.c: Likewise.
	* config/tc-m68k.c: Likewise.
	* config/tc-microblaze.c: Likewise.
	* config/tc-mips.c: Likewise.
	* config/tc-mmix.c: Likewise.
	* config/tc-mn10200.c: Likewise.
	* config/tc-mn10300.c: Likewise.
	* config/tc-nios2.c: Likewise.
	* config/tc-ppc.c: Likewise.
	* config/tc-s390.c: Likewise.
	* config/tc-score.c: Likewise.
	* config/tc-score7.c: Likewise.
	* config/tc-sparc.c: Likewise.
	* config/tc-tic4x.c: Likewise.
	* config/tc-tic54x.c: Likewise.
	* config/tc-tic6x.c: Likewise.
	* config/tc-tilegx.c: Likewise.
	* config/tc-tilepro.c: Likewise.
	* config/tc-v850.c: Likewise.
	* config/tc-xtensa.c: Likewise.
	* config/tc-z80.c: Likewise.
	* dw2gencfi.c: Likewise.
	* dwarf2dbgc.: Likewise.
	* ecoff.c: Likewise.
	* read.c: Likewise.
	* stabs.c: Likewise.

tests	PR gas/18581
	* gas/all/byte.d: Disable this test.  Quoted expressions
	are now allowed in .byte directives.
	* gas/all/quoted-sym-names.s: New test.
	* gas/all/quoted-sym-names.d: Expected output.
	* gas/all/gas.exp: Run the new test.
This commit is contained in:
Nick Clifton 2015-08-21 16:42:14 +01:00
parent 40045d9181
commit d02603dc20
59 changed files with 900 additions and 911 deletions

View file

@ -1,3 +1,70 @@
2015-08-21 Nick Clifton <nickc@redhat.com>
PR gas/18581
* expr.c (get_symbol_end): Rename to get_symbol_name. Add a
return parameter pointing to the start of the symbol. Allow
symbol names enclosed in double quotes.
(restore_line_pointer): New function. Replace the NUL character
inserted into the input stream with the given character. If the
character was a double quote, advance the input pointer.
* expr.h (get_symbol_end): Delete.
(get_symbol_name): Add prototype.
(restore_line_pointer): Prototype.
* read.h (SKIP_WHITESPACE_AFTER_NAME): New macro.
* doc/as.texinfo (Symbol Intro): Document that symbol names can
now be enclosed in double quotes.
* cond.c (s_ifdef): Replace get_symbol_end with get_symbol_name.
Use restore_line_pointer to replace the NUL in the input stream.
Use SKIP_WHITESPACE_AFTER_NAME to skip past the end of a symbol.
Check for the use of double quoted symbol names.
* expr.c: Likewise.
* config/obj-aout.c: Likewise.
* config/obj-coff-seh.c: Likewise.
* config/obj-coff.c: Likewise.
* config/obj-elf.c: Likewise.
* config/obj-evax.c: Likewise.
* config/obj-macho.c: Likewise.
* config/obj-som.c: Likewise.
* config/tc-alpha.c: Likewise.
* config/tc-arc.c: Likewise.
* config/tc-arm.c: Likewise.
* config/tc-dlx.c: Likewise.
* config/tc-h8300.c: Likewise.
* config/tc-hppa.c: Likewise.
* config/tc-i370.c: Likewise.
* config/tc-i386-intel.c: Likewise.
* config/tc-i386.c: Likewise.
* config/tc-i960.c: Likewise.
* config/tc-ia64.c: Likewise.
* config/tc-iq2000.c: Likewise.
* config/tc-m32r.c: Likewise.
* config/tc-m68hc11.c: Likewise.
* config/tc-m68k.c: Likewise.
* config/tc-microblaze.c: Likewise.
* config/tc-mips.c: Likewise.
* config/tc-mmix.c: Likewise.
* config/tc-mn10200.c: Likewise.
* config/tc-mn10300.c: Likewise.
* config/tc-nios2.c: Likewise.
* config/tc-ppc.c: Likewise.
* config/tc-s390.c: Likewise.
* config/tc-score.c: Likewise.
* config/tc-score7.c: Likewise.
* config/tc-sparc.c: Likewise.
* config/tc-tic4x.c: Likewise.
* config/tc-tic54x.c: Likewise.
* config/tc-tic6x.c: Likewise.
* config/tc-tilegx.c: Likewise.
* config/tc-tilepro.c: Likewise.
* config/tc-v850.c: Likewise.
* config/tc-xtensa.c: Likewise.
* config/tc-z80.c: Likewise.
* dw2gencfi.c: Likewise.
* dwarf2dbgc.: Likewise.
* ecoff.c: Likewise.
* read.c: Likewise.
* stabs.c: Likewise.
2015-08-19 Jiong Wang <jiong.wang@arm.com> 2015-08-19 Jiong Wang <jiong.wang@arm.com>
* config/tc-aarch64.c (reloc_table): New relocation types support for * config/tc-aarch64.c (reloc_table): New relocation types support for

View file

@ -2,6 +2,10 @@
Changes in 2.26: Changes in 2.26:
* Symbol and label names can now be enclosed in double quotes (") which allows
them to contain characters that are not part of valid symbol names in high
level languages.
* Added the correctly spelled -march=armv6kz, for ARMv6KZ support. The * Added the correctly spelled -march=armv6kz, for ARMv6KZ support. The
previous spelling, -march=armv6zk, is still accepted. previous spelling, -march=armv6zk, is still accepted.

View file

@ -77,7 +77,7 @@ s_ifdef (int test_defined)
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
name = input_line_pointer; name = input_line_pointer;
if (!is_name_beginner (*name)) if (!is_name_beginner (*name) && *name != '"')
{ {
as_bad (_("invalid identifier for \".ifdef\"")); as_bad (_("invalid identifier for \".ifdef\""));
obstack_1grow (&cond_obstack, 0); obstack_1grow (&cond_obstack, 0);
@ -85,9 +85,9 @@ s_ifdef (int test_defined)
return; return;
} }
c = get_symbol_end (); c = get_symbol_name (& name);
symbolP = symbol_find (name); symbolP = symbol_find (name);
*input_line_pointer = c; (void) restore_line_pointer (c);
initialize_cframe (&cframe); initialize_cframe (&cframe);

View file

@ -152,10 +152,9 @@ obj_aout_weak (int ignore ATTRIBUTE_UNUSED)
do do
{ {
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
symbolP = symbol_find_or_make (name); symbolP = symbol_find_or_make (name);
*input_line_pointer = c; (void) restore_line_pointer (c);
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
S_SET_WEAK (symbolP); S_SET_WEAK (symbolP);
if (c == ',') if (c == ',')
@ -182,10 +181,9 @@ obj_aout_type (int ignore ATTRIBUTE_UNUSED)
int c; int c;
symbolS *sym; symbolS *sym;
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
sym = symbol_find_or_make (name); sym = symbol_find_or_make (name);
*input_line_pointer = c; (void) restore_line_pointer (c);
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
if (*input_line_pointer == ',') if (*input_line_pointer == ',')
{ {

View file

@ -329,8 +329,7 @@ obj_coff_seh_handler (int what ATTRIBUTE_UNUSED)
if (*input_line_pointer == '@') if (*input_line_pointer == '@')
{ {
symbol_name = input_line_pointer; name_end = get_symbol_name (&symbol_name);
name_end = get_symbol_end ();
seh_ctx_cur->handler.X_op = O_constant; seh_ctx_cur->handler.X_op = O_constant;
seh_ctx_cur->handler.X_add_number = 0; seh_ctx_cur->handler.X_add_number = 0;
@ -343,7 +342,7 @@ obj_coff_seh_handler (int what ATTRIBUTE_UNUSED)
else else
as_bad (_("unknown constant value '%s' for handler"), symbol_name); as_bad (_("unknown constant value '%s' for handler"), symbol_name);
*input_line_pointer = name_end; (void) restore_line_pointer (name_end);
} }
else else
expression (&seh_ctx_cur->handler); expression (&seh_ctx_cur->handler);
@ -359,8 +358,7 @@ obj_coff_seh_handler (int what ATTRIBUTE_UNUSED)
{ {
do do
{ {
symbol_name = input_line_pointer; name_end = get_symbol_name (&symbol_name);
name_end = get_symbol_end ();
if (strcasecmp (symbol_name, "@unwind") == 0) if (strcasecmp (symbol_name, "@unwind") == 0)
seh_ctx_cur->handler_flags |= UNW_FLAG_UHANDLER; seh_ctx_cur->handler_flags |= UNW_FLAG_UHANDLER;
@ -369,7 +367,7 @@ obj_coff_seh_handler (int what ATTRIBUTE_UNUSED)
else else
as_bad (_(".seh_handler constant '%s' unknown"), symbol_name); as_bad (_(".seh_handler constant '%s' unknown"), symbol_name);
*input_line_pointer = name_end; (void) restore_line_pointer (name_end);
} }
while (skip_whitespace_and_comma (0)); while (skip_whitespace_and_comma (0));
} }
@ -454,10 +452,9 @@ obj_coff_seh_proc (int what ATTRIBUTE_UNUSED)
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
symbol_name = input_line_pointer; name_end = get_symbol_name (&symbol_name);
name_end = get_symbol_end ();
seh_ctx_cur->func_name = xstrdup (symbol_name); seh_ctx_cur->func_name = xstrdup (symbol_name);
*input_line_pointer = name_end; (void) restore_line_pointer (name_end);
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
@ -549,14 +546,13 @@ seh_x64_read_reg (const char *directive, int kind)
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
if (*input_line_pointer == '%') if (*input_line_pointer == '%')
++input_line_pointer; ++input_line_pointer;
symbol_name = input_line_pointer; name_end = get_symbol_name (& symbol_name);
name_end = get_symbol_end ();
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)
if (! strcasecmp (regs[i], symbol_name)) if (! strcasecmp (regs[i], symbol_name))
break; break;
*input_line_pointer = name_end; (void) restore_line_pointer (name_end);
/* Error if register not found, or EAX used as a frame pointer. */ /* Error if register not found, or EAX used as a frame pointer. */
if (i == 16 || (kind == 0 && i == 0)) if (i == 16 || (kind == 0 && i == 0))

View file

@ -603,8 +603,7 @@ obj_coff_def (int what ATTRIBUTE_UNUSED)
SKIP_WHITESPACES (); SKIP_WHITESPACES ();
symbol_name = input_line_pointer; name_end = get_symbol_name (&symbol_name);
name_end = get_symbol_end ();
symbol_name_length = strlen (symbol_name); symbol_name_length = strlen (symbol_name);
symbol_name_copy = xmalloc (symbol_name_length + 1); symbol_name_copy = xmalloc (symbol_name_length + 1);
strcpy (symbol_name_copy, symbol_name); strcpy (symbol_name_copy, symbol_name);
@ -620,7 +619,7 @@ obj_coff_def (int what ATTRIBUTE_UNUSED)
if (S_IS_STRING (def_symbol_in_progress)) if (S_IS_STRING (def_symbol_in_progress))
SF_SET_STRING (def_symbol_in_progress); SF_SET_STRING (def_symbol_in_progress);
*input_line_pointer = name_end; (void) restore_line_pointer (name_end);
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
} }
@ -973,8 +972,7 @@ obj_coff_tag (int ignore ATTRIBUTE_UNUSED)
} }
S_SET_NUMBER_AUXILIARY (def_symbol_in_progress, 1); S_SET_NUMBER_AUXILIARY (def_symbol_in_progress, 1);
symbol_name = input_line_pointer; name_end = get_symbol_name (&symbol_name);
name_end = get_symbol_end ();
#ifdef tc_canonicalize_symbol_name #ifdef tc_canonicalize_symbol_name
symbol_name = tc_canonicalize_symbol_name (symbol_name); symbol_name = tc_canonicalize_symbol_name (symbol_name);
@ -988,8 +986,8 @@ obj_coff_tag (int ignore ATTRIBUTE_UNUSED)
as_warn (_("tag not found for .tag %s"), symbol_name); as_warn (_("tag not found for .tag %s"), symbol_name);
SF_SET_TAGGED (def_symbol_in_progress); SF_SET_TAGGED (def_symbol_in_progress);
*input_line_pointer = name_end;
(void) restore_line_pointer (name_end);
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
} }
@ -1024,8 +1022,8 @@ obj_coff_val (int ignore ATTRIBUTE_UNUSED)
if (is_name_beginner (*input_line_pointer)) if (is_name_beginner (*input_line_pointer))
{ {
char *symbol_name = input_line_pointer; char *symbol_name;
char name_end = get_symbol_end (); char name_end = get_symbol_name (&symbol_name);
#ifdef tc_canonicalize_symbol_name #ifdef tc_canonicalize_symbol_name
symbol_name = tc_canonicalize_symbol_name (symbol_name); symbol_name = tc_canonicalize_symbol_name (symbol_name);
@ -1059,7 +1057,7 @@ obj_coff_val (int ignore ATTRIBUTE_UNUSED)
} }
/* Otherwise, it is the name of a non debug symbol and its value /* Otherwise, it is the name of a non debug symbol and its value
will be calculated later. */ will be calculated later. */
*input_line_pointer = name_end; (void) restore_line_pointer (name_end);
} }
else else
{ {
@ -1170,8 +1168,7 @@ obj_coff_weak (int ignore ATTRIBUTE_UNUSED)
do do
{ {
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
if (*name == 0) if (*name == 0)
{ {
as_warn (_("badly formed .weak directive ignored")); as_warn (_("badly formed .weak directive ignored"));
@ -1181,7 +1178,7 @@ obj_coff_weak (int ignore ATTRIBUTE_UNUSED)
c = 0; c = 0;
symbolP = symbol_find_or_make (name); symbolP = symbol_find_or_make (name);
*input_line_pointer = c; *input_line_pointer = c;
SKIP_WHITESPACE (); SKIP_WHITESPACE_AFTER_NAME ();
S_SET_WEAK (symbolP); S_SET_WEAK (symbolP);
if (c == ',') if (c == ',')
@ -1564,15 +1561,11 @@ obj_coff_section (int ignore ATTRIBUTE_UNUSED)
return; return;
} }
section_name = input_line_pointer; c = get_symbol_name (&section_name);
c = get_symbol_end ();
name = xmalloc (input_line_pointer - section_name + 1); name = xmalloc (input_line_pointer - section_name + 1);
strcpy (name, section_name); strcpy (name, section_name);
*input_line_pointer = c; *input_line_pointer = c;
SKIP_WHITESPACE_AFTER_NAME ();
SKIP_WHITESPACE ();
exp = 0; exp = 0;
flags = SEC_NO_FLAGS; flags = SEC_NO_FLAGS;

View file

@ -406,11 +406,10 @@ get_sym_from_input_line_and_check (void)
char c; char c;
symbolS *sym; symbolS *sym;
name = input_line_pointer; c = get_symbol_name (& name);
c = get_symbol_end ();
sym = symbol_find_or_make (name); sym = symbol_find_or_make (name);
*input_line_pointer = c; *input_line_pointer = c;
SKIP_WHITESPACE (); SKIP_WHITESPACE_AFTER_NAME ();
/* There is no symbol name if input_line_pointer has not moved. */ /* There is no symbol name if input_line_pointer has not moved. */
if (name == input_line_pointer) if (name == input_line_pointer)
@ -1043,9 +1042,9 @@ obj_elf_section (int push)
} }
else if (c == '@' || c == '%') else if (c == '@' || c == '%')
{ {
beg = ++input_line_pointer; ++input_line_pointer;
c = get_symbol_end (); c = get_symbol_name (& beg);
*input_line_pointer = c; (void) restore_line_pointer (c);
type = obj_elf_section_type (beg, input_line_pointer - beg, TRUE); type = obj_elf_section_type (beg, input_line_pointer - beg, TRUE);
} }
else else
@ -1125,9 +1124,9 @@ obj_elf_section (int push)
ignore_rest_of_line (); ignore_rest_of_line ();
return; return;
} }
beg = ++input_line_pointer; ++input_line_pointer;
c = get_symbol_end (); c = get_symbol_name (& beg);
*input_line_pointer = c; (void) restore_line_pointer (c);
attr |= obj_elf_section_word (beg, input_line_pointer - beg, & type); attr |= obj_elf_section_word (beg, input_line_pointer - beg, & type);
@ -1319,19 +1318,18 @@ obj_elf_symver (int ignore ATTRIBUTE_UNUSED)
++input_line_pointer; ++input_line_pointer;
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
name = input_line_pointer;
/* Temporarily include '@' in symbol names. */ /* Temporarily include '@' in symbol names. */
old_lexat = lex_type[(unsigned char) '@']; old_lexat = lex_type[(unsigned char) '@'];
lex_type[(unsigned char) '@'] |= LEX_NAME; lex_type[(unsigned char) '@'] |= LEX_NAME;
c = get_symbol_end (); c = get_symbol_name (& name);
lex_type[(unsigned char) '@'] = old_lexat; lex_type[(unsigned char) '@'] = old_lexat;
if (symbol_get_obj (sym)->versioned_name == NULL) if (symbol_get_obj (sym)->versioned_name == NULL)
{ {
symbol_get_obj (sym)->versioned_name = xstrdup (name); symbol_get_obj (sym)->versioned_name = xstrdup (name);
*input_line_pointer = c; (void) restore_line_pointer (c);
if (strchr (symbol_get_obj (sym)->versioned_name, if (strchr (symbol_get_obj (sym)->versioned_name,
ELF_VER_CHR) == NULL) ELF_VER_CHR) == NULL)
@ -1354,7 +1352,7 @@ obj_elf_symver (int ignore ATTRIBUTE_UNUSED)
return; return;
} }
*input_line_pointer = c; (void) restore_line_pointer (c);
} }
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
@ -1374,8 +1372,7 @@ obj_elf_vtable_inherit (int ignore ATTRIBUTE_UNUSED)
if (*input_line_pointer == '#') if (*input_line_pointer == '#')
++input_line_pointer; ++input_line_pointer;
cname = input_line_pointer; c = get_symbol_name (& cname);
c = get_symbol_end ();
csym = symbol_find (cname); csym = symbol_find (cname);
/* GCFIXME: should check that we don't have two .vtable_inherits for /* GCFIXME: should check that we don't have two .vtable_inherits for
@ -1391,7 +1388,7 @@ obj_elf_vtable_inherit (int ignore ATTRIBUTE_UNUSED)
*input_line_pointer = c; *input_line_pointer = c;
SKIP_WHITESPACE (); SKIP_WHITESPACE_AFTER_NAME ();
if (*input_line_pointer != ',') if (*input_line_pointer != ',')
{ {
as_bad (_("expected comma after name in .vtable_inherit")); as_bad (_("expected comma after name in .vtable_inherit"));
@ -1414,10 +1411,9 @@ obj_elf_vtable_inherit (int ignore ATTRIBUTE_UNUSED)
} }
else else
{ {
pname = input_line_pointer; c = get_symbol_name (& pname);
c = get_symbol_end ();
psym = symbol_find_or_make (pname); psym = symbol_find_or_make (pname);
*input_line_pointer = c; restore_line_pointer (c);
} }
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
@ -1767,15 +1763,15 @@ obj_elf_version (int ignore ATTRIBUTE_UNUSED)
static void static void
obj_elf_size (int ignore ATTRIBUTE_UNUSED) obj_elf_size (int ignore ATTRIBUTE_UNUSED)
{ {
char *name = input_line_pointer; char *name;
char c = get_symbol_end (); char c = get_symbol_name (&name);
char *p; char *p;
expressionS exp; expressionS exp;
symbolS *sym; symbolS *sym;
p = input_line_pointer; p = input_line_pointer;
*p = c; *p = c;
SKIP_WHITESPACE (); SKIP_WHITESPACE_AFTER_NAME ();
if (*input_line_pointer != ',') if (*input_line_pointer != ',')
{ {
*p = 0; *p = 0;
@ -1847,7 +1843,7 @@ obj_elf_type_name (char *cp)
*input_line_pointer = '\0'; *input_line_pointer = '\0';
} }
else else
*cp = get_symbol_end (); *cp = get_symbol_name (&p);
return p; return p;
} }

View file

@ -60,10 +60,9 @@ s_evax_weak (int ignore ATTRIBUTE_UNUSED)
do do
{ {
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
symbolP = symbol_find_or_make (name); symbolP = symbol_find_or_make (name);
*input_line_pointer = c; (void) restore_line_pointer (c);
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
S_SET_WEAK (symbolP); S_SET_WEAK (symbolP);
if (c == ',') if (c == ',')

View file

@ -475,8 +475,7 @@ obj_mach_o_zerofill (int ignore ATTRIBUTE_UNUSED)
input_line_pointer++; /* Skip ',' */ input_line_pointer++; /* Skip ',' */
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
/* Just after name is now '\0'. */ /* Just after name is now '\0'. */
p = input_line_pointer; p = input_line_pointer;
*p = c; *p = c;
@ -488,7 +487,7 @@ obj_mach_o_zerofill (int ignore ATTRIBUTE_UNUSED)
goto done; goto done;
} }
SKIP_WHITESPACE (); SKIP_WHITESPACE_AFTER_NAME ();
if (*input_line_pointer == ',') if (*input_line_pointer == ',')
input_line_pointer++; input_line_pointer++;
@ -1133,12 +1132,11 @@ obj_mach_o_sym_qual (int ntype)
do do
{ {
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
symbolP = symbol_find_or_make (name); symbolP = symbol_find_or_make (name);
obj_mach_o_set_symbol_qualifier (symbolP, ntype); obj_mach_o_set_symbol_qualifier (symbolP, ntype);
*input_line_pointer = c; *input_line_pointer = c;
SKIP_WHITESPACE (); SKIP_WHITESPACE_AFTER_NAME ();
c = *input_line_pointer; c = *input_line_pointer;
if (c == ',') if (c == ',')
{ {
@ -1184,8 +1182,8 @@ obj_mach_o_indirect_symbol (int arg ATTRIBUTE_UNUSED)
case BFD_MACH_O_S_NON_LAZY_SYMBOL_POINTERS: case BFD_MACH_O_S_NON_LAZY_SYMBOL_POINTERS:
{ {
obj_mach_o_indirect_sym *isym; obj_mach_o_indirect_sym *isym;
char *name = input_line_pointer; char *name;
char c = get_symbol_end (); char c = get_symbol_name (&name);
symbolS *sym = symbol_find_or_make (name); symbolS *sym = symbol_find_or_make (name);
unsigned int elsize = unsigned int elsize =
bfd_mach_o_section_get_entry_size (stdoutput, sec); bfd_mach_o_section_get_entry_size (stdoutput, sec);
@ -1195,11 +1193,11 @@ obj_mach_o_indirect_symbol (int arg ATTRIBUTE_UNUSED)
as_bad (_("attempt to add an indirect_symbol to a stub or" as_bad (_("attempt to add an indirect_symbol to a stub or"
" reference section with a zero-sized element at %s"), " reference section with a zero-sized element at %s"),
name); name);
*input_line_pointer = c; (void) restore_line_pointer (c);
ignore_rest_of_line (); ignore_rest_of_line ();
return; return;
} }
*input_line_pointer = c; (void) restore_line_pointer (c);
/* The indirect symbols are validated after the symbol table is /* The indirect symbols are validated after the symbol table is
frozen, we must make sure that if a local symbol is used as an frozen, we must make sure that if a local symbol is used as an

View file

@ -302,11 +302,10 @@ obj_som_weak (int ignore ATTRIBUTE_UNUSED)
do do
{ {
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
symbolP = symbol_find_or_make (name); symbolP = symbol_find_or_make (name);
*input_line_pointer = c; *input_line_pointer = c;
SKIP_WHITESPACE (); SKIP_WHITESPACE_AFTER_NAME ();
S_SET_WEAK (symbolP); S_SET_WEAK (symbolP);
if (c == ',') if (c == ',')
{ {

View file

@ -921,8 +921,7 @@ tokenize_arguments (char *str,
++input_line_pointer; ++input_line_pointer;
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
p = input_line_pointer; c = get_symbol_name (&p);
c = get_symbol_end ();
/* Parse !relocation_type. */ /* Parse !relocation_type. */
len = input_line_pointer - p; len = input_line_pointer - p;
@ -943,7 +942,7 @@ tokenize_arguments (char *str,
} }
*input_line_pointer = c; *input_line_pointer = c;
SKIP_WHITESPACE (); SKIP_WHITESPACE_AFTER_NAME ();
if (*input_line_pointer != '!') if (*input_line_pointer != '!')
{ {
if (r->require_seq) if (r->require_seq)
@ -3494,14 +3493,13 @@ s_alpha_comm (int ignore ATTRIBUTE_UNUSED)
int log_align = 0; int log_align = 0;
#endif #endif
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
/* Just after name is now '\0'. */ /* Just after name is now '\0'. */
p = input_line_pointer; p = input_line_pointer;
*p = c; *p = c;
SKIP_WHITESPACE (); SKIP_WHITESPACE_AFTER_NAME ();
/* Alpha OSF/1 compiler doesn't provide the comma, gcc does. */ /* Alpha OSF/1 compiler doesn't provide the comma, gcc does. */
if (*input_line_pointer == ',') if (*input_line_pointer == ',')
@ -3714,15 +3712,15 @@ s_alpha_ent (int dummy ATTRIBUTE_UNUSED)
else else
{ {
char *name, name_end; char *name, name_end;
name = input_line_pointer;
name_end = get_symbol_end (); name_end = get_symbol_name (&name);
/* CFI_EMIT_eh_frame is the default. */ /* CFI_EMIT_eh_frame is the default. */
all_cfi_sections = CFI_EMIT_eh_frame; all_cfi_sections = CFI_EMIT_eh_frame;
if (! is_name_beginner (*name)) if (! is_name_beginner (*name))
{ {
as_warn (_(".ent directive has no name")); as_warn (_(".ent directive has no name"));
*input_line_pointer = name_end; (void) restore_line_pointer (name_end);
} }
else else
{ {
@ -3748,7 +3746,7 @@ s_alpha_ent (int dummy ATTRIBUTE_UNUSED)
/* The .ent directive is sometimes followed by a number. Not sure /* The .ent directive is sometimes followed by a number. Not sure
what it really means, but ignore it. */ what it really means, but ignore it. */
*input_line_pointer = name_end; *input_line_pointer = name_end;
SKIP_WHITESPACE (); SKIP_WHITESPACE_AFTER_NAME ();
if (*input_line_pointer == ',') if (*input_line_pointer == ',')
{ {
input_line_pointer++; input_line_pointer++;
@ -3769,13 +3767,12 @@ s_alpha_end (int dummy ATTRIBUTE_UNUSED)
else else
{ {
char *name, name_end; char *name, name_end;
name = input_line_pointer;
name_end = get_symbol_end (); name_end = get_symbol_name (&name);
if (! is_name_beginner (*name)) if (! is_name_beginner (*name))
{ {
as_warn (_(".end directive has no name")); as_warn (_(".end directive has no name"));
*input_line_pointer = name_end;
} }
else else
{ {
@ -3803,9 +3800,9 @@ s_alpha_end (int dummy ATTRIBUTE_UNUSED)
} }
cur_frame_data = NULL; cur_frame_data = NULL;
*input_line_pointer = name_end;
} }
(void) restore_line_pointer (name_end);
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
} }
} }
@ -4130,19 +4127,20 @@ s_alpha_usepv (int unused ATTRIBUTE_UNUSED)
symbolS *sym; symbolS *sym;
int other; int other;
name = input_line_pointer; name_end = get_symbol_name (&name);
name_end = get_symbol_end ();
if (! is_name_beginner (*name)) if (! is_name_beginner (*name))
{ {
as_bad (_(".usepv directive has no name")); as_bad (_(".usepv directive has no name"));
*input_line_pointer = name_end; (void) restore_line_pointer (name_end);
ignore_rest_of_line (); ignore_rest_of_line ();
return; return;
} }
sym = symbol_find_or_make (name); sym = symbol_find_or_make (name);
*input_line_pointer++ = name_end; name_end = restore_line_pointer (name_end);
if (! is_end_of_line[(unsigned char) name_end])
input_line_pointer++;
if (name_end != ',') if (name_end != ',')
{ {
@ -4152,8 +4150,8 @@ s_alpha_usepv (int unused ATTRIBUTE_UNUSED)
} }
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
which = input_line_pointer;
which_end = get_symbol_end (); which_end = get_symbol_name (&which);
if (strcmp (which, "no") == 0) if (strcmp (which, "no") == 0)
other = STO_ALPHA_NOPV; other = STO_ALPHA_NOPV;
@ -4165,7 +4163,7 @@ s_alpha_usepv (int unused ATTRIBUTE_UNUSED)
other = 0; other = 0;
} }
*input_line_pointer = which_end; (void) restore_line_pointer (which_end);
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
S_SET_OTHER (sym, other | (S_GET_OTHER (sym) & ~STO_ALPHA_STD_GPLOAD)); S_SET_OTHER (sym, other | (S_GET_OTHER (sym) & ~STO_ALPHA_STD_GPLOAD));
@ -4319,15 +4317,15 @@ s_alpha_section (int secid)
char c; char c;
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
beg = input_line_pointer; c = get_symbol_name (&beg);
c = get_symbol_end ();
*input_line_pointer = c; *input_line_pointer = c;
vms_flags |= s_alpha_section_word (beg, input_line_pointer - beg); vms_flags |= s_alpha_section_word (beg, input_line_pointer - beg);
SKIP_WHITESPACE (); SKIP_WHITESPACE_AFTER_NAME ();
} }
while (*input_line_pointer++ == ','); while (*input_line_pointer++ == ',');
--input_line_pointer; --input_line_pointer;
} }
@ -4411,13 +4409,12 @@ s_alpha_handler (int is_data)
else else
{ {
char *name, name_end; char *name, name_end;
name = input_line_pointer;
name_end = get_symbol_end (); name_end = get_symbol_name (&name);
if (! is_name_beginner (*name)) if (! is_name_beginner (*name))
{ {
as_warn (_(".handler directive has no name")); as_warn (_(".handler directive has no name"));
*input_line_pointer = name_end;
} }
else else
{ {
@ -4426,9 +4423,11 @@ s_alpha_handler (int is_data)
sym = symbol_find_or_make (name); sym = symbol_find_or_make (name);
symbol_get_bfdsym (sym)->flags |= BSF_FUNCTION; symbol_get_bfdsym (sym)->flags |= BSF_FUNCTION;
alpha_evax_proc->handler = sym; alpha_evax_proc->handler = sym;
*input_line_pointer = name_end;
} }
(void) restore_line_pointer (name_end);
} }
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
} }
@ -4547,8 +4546,7 @@ s_alpha_pdesc (int ignore ATTRIBUTE_UNUSED)
} }
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
name = input_line_pointer; name_end = get_symbol_name (&name);
name_end = get_symbol_end ();
if (strncmp (name, "stack", 5) == 0) if (strncmp (name, "stack", 5) == 0)
alpha_evax_proc->pdsckind = PDSC_S_K_KIND_FP_STACK; alpha_evax_proc->pdsckind = PDSC_S_K_KIND_FP_STACK;
@ -4561,12 +4559,13 @@ s_alpha_pdesc (int ignore ATTRIBUTE_UNUSED)
else else
{ {
(void) restore_line_pointer (name_end);
as_fatal (_("unknown procedure kind")); as_fatal (_("unknown procedure kind"));
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
return; return;
} }
*input_line_pointer = name_end; (void) restore_line_pointer (name_end);
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
#ifdef md_flush_pending_output #ifdef md_flush_pending_output
@ -4804,10 +4803,11 @@ s_alpha_fmask (int ignore ATTRIBUTE_UNUSED)
static void static void
s_alpha_end (int ignore ATTRIBUTE_UNUSED) s_alpha_end (int ignore ATTRIBUTE_UNUSED)
{ {
char *name;
char c; char c;
c = get_symbol_end (); c = get_symbol_name (&name);
*input_line_pointer = c; (void) restore_line_pointer (c);
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
alpha_evax_proc = NULL; alpha_evax_proc = NULL;
} }
@ -4938,12 +4938,11 @@ s_alpha_proc (int is_static ATTRIBUTE_UNUSED)
/* Takes ".proc name,nargs". */ /* Takes ".proc name,nargs". */
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
p = input_line_pointer; p = input_line_pointer;
symbolP = symbol_find_or_make (name); symbolP = symbol_find_or_make (name);
*p = c; *p = c;
SKIP_WHITESPACE (); SKIP_WHITESPACE_AFTER_NAME ();
if (*input_line_pointer != ',') if (*input_line_pointer != ',')
{ {
*p = 0; *p = 0;
@ -4973,9 +4972,8 @@ s_alpha_set (int x ATTRIBUTE_UNUSED)
int yesno = 1; int yesno = 1;
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
name = input_line_pointer;
ch = get_symbol_end ();
ch = get_symbol_name (&name);
s = name; s = name;
if (s[0] == 'n' && s[1] == 'o') if (s[0] == 'n' && s[1] == 'o')
{ {
@ -4995,7 +4993,7 @@ s_alpha_set (int x ATTRIBUTE_UNUSED)
else else
as_warn (_("Tried to .set unrecognized mode `%s'"), name); as_warn (_("Tried to .set unrecognized mode `%s'"), name);
*input_line_pointer = ch; (void) restore_line_pointer (ch);
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
} }
@ -5130,8 +5128,8 @@ s_alpha_arch (int ignored ATTRIBUTE_UNUSED)
const struct cpu_type *p; const struct cpu_type *p;
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
name = input_line_pointer;
ch = get_symbol_end (); ch = get_symbol_name (&name);
for (p = cpu_types; p->name; ++p) for (p = cpu_types; p->name; ++p)
if (strcmp (name, p->name) == 0) if (strcmp (name, p->name) == 0)
@ -5142,7 +5140,7 @@ s_alpha_arch (int ignored ATTRIBUTE_UNUSED)
as_warn (_("Unknown CPU identifier `%s'"), name); as_warn (_("Unknown CPU identifier `%s'"), name);
found: found:
*input_line_pointer = ch; (void) restore_line_pointer (ch);
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
} }
@ -6334,8 +6332,8 @@ tc_get_register (int frame ATTRIBUTE_UNUSED)
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
if (*input_line_pointer == '$') if (*input_line_pointer == '$')
{ {
char *s = input_line_pointer; char *s;
char c = get_symbol_end (); char c = get_symbol_name (&s);
symbolS *sym = md_undefined_symbol (s); symbolS *sym = md_undefined_symbol (s);
*strchr (s, '\0') = c; *strchr (s, '\0') = c;

View file

@ -410,8 +410,7 @@ arc_extoper (int opertype)
segT old_sec; segT old_sec;
int old_subsec; int old_subsec;
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
name = xstrdup (name); name = xstrdup (name);
p = name; p = name;
@ -423,7 +422,7 @@ arc_extoper (int opertype)
/* just after name is now '\0' */ /* just after name is now '\0' */
p = input_line_pointer; p = input_line_pointer;
*p = c; (void) restore_line_pointer (c);
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
if (*input_line_pointer != ',') if (*input_line_pointer != ',')
@ -653,15 +652,14 @@ arc_extinst (int ignore ATTRIBUTE_UNUSED)
segT old_sec; segT old_sec;
int old_subsec; int old_subsec;
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
name = xstrdup (name); name = xstrdup (name);
strcpy (syntax, name); strcpy (syntax, name);
name_len = strlen (name); name_len = strlen (name);
/* just after name is now '\0' */ /* just after name is now '\0' */
p = input_line_pointer; p = input_line_pointer;
*p = c; (void) restore_line_pointer (c);
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
@ -849,11 +847,10 @@ arc_common (int localScope)
int align, size; int align, size;
symbolS *symbolP; symbolS *symbolP;
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
/* just after name is now '\0' */ /* just after name is now '\0' */
p = input_line_pointer; p = input_line_pointer;
*p = c; (void) restore_line_pointer (c);
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
if (*input_line_pointer != ',') if (*input_line_pointer != ',')
@ -959,10 +956,9 @@ arc_option (int ignore ATTRIBUTE_UNUSED)
char c; char c;
char *cpu; char *cpu;
cpu = input_line_pointer; c = get_symbol_name (&cpu);
c = get_symbol_end ();
mach = arc_get_mach (cpu); mach = arc_get_mach (cpu);
*input_line_pointer = c; (void) restore_line_pointer (c);
/* If an instruction has already been seen, it's too late. */ /* If an instruction has already been seen, it's too late. */
if (cpu_tables_init_p) if (cpu_tables_init_p)

View file

@ -2868,10 +2868,9 @@ s_thumb_set (int equiv)
/* Especial apologies for the random logic: /* Especial apologies for the random logic:
This just grew, and could be parsed much more simply! This just grew, and could be parsed much more simply!
Dean - in haste. */ Dean - in haste. */
name = input_line_pointer; delim = get_symbol_name (& name);
delim = get_symbol_end ();
end_name = input_line_pointer; end_name = input_line_pointer;
*end_name = delim; (void) restore_line_pointer (delim);
if (*input_line_pointer != ',') if (*input_line_pointer != ',')
{ {
@ -2951,8 +2950,7 @@ s_syntax (int unused ATTRIBUTE_UNUSED)
{ {
char *name, delim; char *name, delim;
name = input_line_pointer; delim = get_symbol_name (& name);
delim = get_symbol_end ();
if (!strcasecmp (name, "unified")) if (!strcasecmp (name, "unified"))
unified_syntax = TRUE; unified_syntax = TRUE;
@ -2963,7 +2961,7 @@ s_syntax (int unused ATTRIBUTE_UNUSED)
as_bad (_("unrecognized syntax mode \"%s\""), name); as_bad (_("unrecognized syntax mode \"%s\""), name);
return; return;
} }
*input_line_pointer = delim; (void) restore_line_pointer (delim);
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
} }
@ -3880,9 +3878,10 @@ s_arm_unwind_personality (int ignored ATTRIBUTE_UNUSED)
if (unwind.personality_routine || unwind.personality_index != -1) if (unwind.personality_routine || unwind.personality_index != -1)
as_bad (_("duplicate .personality directive")); as_bad (_("duplicate .personality directive"));
name = input_line_pointer; c = get_symbol_name (& name);
c = get_symbol_end ();
p = input_line_pointer; p = input_line_pointer;
if (c == '"')
++ input_line_pointer;
unwind.personality_routine = symbol_find_or_make (name); unwind.personality_routine = symbol_find_or_make (name);
*p = c; *p = c;
demand_empty_rest_of_line (); demand_empty_rest_of_line ();

View file

@ -230,11 +230,10 @@ s_proc (int end_p)
return; return;
} }
name = input_line_pointer; delim1 = get_symbol_name (&name);
delim1 = get_symbol_end ();
name = xstrdup (name); name = xstrdup (name);
*input_line_pointer = delim1; *input_line_pointer = delim1;
SKIP_WHITESPACE (); SKIP_WHITESPACE_AFTER_NAME ();
if (*input_line_pointer != ',') if (*input_line_pointer != ',')
{ {
@ -257,10 +256,9 @@ s_proc (int end_p)
{ {
++input_line_pointer; ++input_line_pointer;
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
label = input_line_pointer; delim2 = get_symbol_name (&label);
delim2 = get_symbol_end ();
label = xstrdup (label); label = xstrdup (label);
*input_line_pointer = delim2; (void) restore_line_pointer (delim2);
} }
current_name = name; current_name = name;

View file

@ -384,7 +384,7 @@ parse_reg (char *src, op_type *mode, unsigned int *reg, int direction)
char *end; char *end;
int len; int len;
/* Cribbed from get_symbol_end. */ /* Cribbed from get_symbol_name. */
if (!is_name_beginner (*src) || *src == '\001') if (!is_name_beginner (*src) || *src == '\001')
return 0; return 0;
end = src + 1; end = src + 1;

View file

@ -5894,33 +5894,28 @@ pa_try (int begin ATTRIBUTE_UNUSED)
static void static void
pa_call_args (struct call_desc *call_desc) pa_call_args (struct call_desc *call_desc)
{ {
char *name, c, *p; char *name, c;
unsigned int temp, arg_reloc; unsigned int temp, arg_reloc;
while (!is_end_of_statement ()) while (!is_end_of_statement ())
{ {
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
/* Process a source argument. */ /* Process a source argument. */
if ((strncasecmp (name, "argw", 4) == 0)) if ((strncasecmp (name, "argw", 4) == 0))
{ {
temp = atoi (name + 4); temp = atoi (name + 4);
p = input_line_pointer; (void) restore_line_pointer (c);
*p = c;
input_line_pointer++; input_line_pointer++;
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
arg_reloc = pa_build_arg_reloc (name); arg_reloc = pa_build_arg_reloc (name);
call_desc->arg_reloc |= pa_align_arg_reloc (temp, arg_reloc); call_desc->arg_reloc |= pa_align_arg_reloc (temp, arg_reloc);
} }
/* Process a return value. */ /* Process a return value. */
else if ((strncasecmp (name, "rtnval", 6) == 0)) else if ((strncasecmp (name, "rtnval", 6) == 0))
{ {
p = input_line_pointer; (void) restore_line_pointer (c);
*p = c;
input_line_pointer++; input_line_pointer++;
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
arg_reloc = pa_build_arg_reloc (name); arg_reloc = pa_build_arg_reloc (name);
call_desc->arg_reloc |= (arg_reloc & 0x3); call_desc->arg_reloc |= (arg_reloc & 0x3);
} }
@ -5928,8 +5923,8 @@ pa_call_args (struct call_desc *call_desc)
{ {
as_bad (_("Invalid .CALL argument: %s"), name); as_bad (_("Invalid .CALL argument: %s"), name);
} }
p = input_line_pointer;
*p = c; (void) restore_line_pointer (c);
if (!is_end_of_statement ()) if (!is_end_of_statement ())
input_line_pointer++; input_line_pointer++;
} }
@ -6064,7 +6059,7 @@ pa_build_unwind_subspace (struct call_info *call_info)
static void static void
pa_callinfo (int unused ATTRIBUTE_UNUSED) pa_callinfo (int unused ATTRIBUTE_UNUSED)
{ {
char *name, c, *p; char *name, c;
int temp; int temp;
#ifdef OBJ_SOM #ifdef OBJ_SOM
@ -6083,13 +6078,11 @@ pa_callinfo (int unused ATTRIBUTE_UNUSED)
/* Iterate over the .CALLINFO arguments. */ /* Iterate over the .CALLINFO arguments. */
while (!is_end_of_statement ()) while (!is_end_of_statement ())
{ {
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
/* Frame size specification. */ /* Frame size specification. */
if ((strncasecmp (name, "frame", 5) == 0)) if ((strncasecmp (name, "frame", 5) == 0))
{ {
p = input_line_pointer; (void) restore_line_pointer (c);
*p = c;
input_line_pointer++; input_line_pointer++;
temp = get_absolute_expression (); temp = get_absolute_expression ();
if ((temp & 0x3) != 0) if ((temp & 0x3) != 0)
@ -6100,13 +6093,11 @@ pa_callinfo (int unused ATTRIBUTE_UNUSED)
/* callinfo is in bytes and unwind_desc is in 8 byte units. */ /* callinfo is in bytes and unwind_desc is in 8 byte units. */
last_call_info->ci_unwind.descriptor.frame_size = temp / 8; last_call_info->ci_unwind.descriptor.frame_size = temp / 8;
} }
/* Entry register (GR, GR and SR) specifications. */ /* Entry register (GR, GR and SR) specifications. */
else if ((strncasecmp (name, "entry_gr", 8) == 0)) else if ((strncasecmp (name, "entry_gr", 8) == 0))
{ {
p = input_line_pointer; (void) restore_line_pointer (c);
*p = c;
input_line_pointer++; input_line_pointer++;
temp = get_absolute_expression (); temp = get_absolute_expression ();
/* The HP assembler accepts 19 as the high bound for ENTRY_GR /* The HP assembler accepts 19 as the high bound for ENTRY_GR
@ -6118,8 +6109,7 @@ pa_callinfo (int unused ATTRIBUTE_UNUSED)
} }
else if ((strncasecmp (name, "entry_fr", 8) == 0)) else if ((strncasecmp (name, "entry_fr", 8) == 0))
{ {
p = input_line_pointer; (void) restore_line_pointer (c);
*p = c;
input_line_pointer++; input_line_pointer++;
temp = get_absolute_expression (); temp = get_absolute_expression ();
/* Similarly the HP assembler takes 31 as the high bound even /* Similarly the HP assembler takes 31 as the high bound even
@ -6130,53 +6120,46 @@ pa_callinfo (int unused ATTRIBUTE_UNUSED)
} }
else if ((strncasecmp (name, "entry_sr", 8) == 0)) else if ((strncasecmp (name, "entry_sr", 8) == 0))
{ {
p = input_line_pointer; (void) restore_line_pointer (c);
*p = c;
input_line_pointer++; input_line_pointer++;
temp = get_absolute_expression (); temp = get_absolute_expression ();
if (temp != 3) if (temp != 3)
as_bad (_("Value for ENTRY_SR must be 3\n")); as_bad (_("Value for ENTRY_SR must be 3\n"));
} }
/* Note whether or not this function performs any calls. */ /* Note whether or not this function performs any calls. */
else if ((strncasecmp (name, "calls", 5) == 0) || else if ((strncasecmp (name, "calls", 5) == 0)
(strncasecmp (name, "caller", 6) == 0)) || (strncasecmp (name, "caller", 6) == 0))
{ {
p = input_line_pointer; (void) restore_line_pointer (c);
*p = c;
} }
else if ((strncasecmp (name, "no_calls", 8) == 0)) else if ((strncasecmp (name, "no_calls", 8) == 0))
{ {
p = input_line_pointer; (void) restore_line_pointer (c);
*p = c;
} }
/* Should RP be saved into the stack. */ /* Should RP be saved into the stack. */
else if ((strncasecmp (name, "save_rp", 7) == 0)) else if ((strncasecmp (name, "save_rp", 7) == 0))
{ {
p = input_line_pointer; (void) restore_line_pointer (c);
*p = c;
last_call_info->ci_unwind.descriptor.save_rp = 1; last_call_info->ci_unwind.descriptor.save_rp = 1;
} }
/* Likewise for SP. */ /* Likewise for SP. */
else if ((strncasecmp (name, "save_sp", 7) == 0)) else if ((strncasecmp (name, "save_sp", 7) == 0))
{ {
p = input_line_pointer; (void) restore_line_pointer (c);
*p = c;
last_call_info->ci_unwind.descriptor.save_sp = 1; last_call_info->ci_unwind.descriptor.save_sp = 1;
} }
/* Is this an unwindable procedure. If so mark it so /* Is this an unwindable procedure. If so mark it so
in the unwind descriptor. */ in the unwind descriptor. */
else if ((strncasecmp (name, "no_unwind", 9) == 0)) else if ((strncasecmp (name, "no_unwind", 9) == 0))
{ {
p = input_line_pointer; (void) restore_line_pointer (c);
*p = c;
last_call_info->ci_unwind.descriptor.cannot_unwind = 1; last_call_info->ci_unwind.descriptor.cannot_unwind = 1;
} }
/* Is this an interrupt routine. If so mark it in the /* Is this an interrupt routine. If so mark it in the
unwind descriptor. */ unwind descriptor. */
else if ((strncasecmp (name, "hpux_int", 7) == 0)) else if ((strncasecmp (name, "hpux_int", 7) == 0))
{ {
p = input_line_pointer; (void) restore_line_pointer (c);
*p = c;
last_call_info->ci_unwind.descriptor.hpux_interrupt_marker = 1; last_call_info->ci_unwind.descriptor.hpux_interrupt_marker = 1;
} }
/* Is this a millicode routine. "millicode" isn't in my /* Is this a millicode routine. "millicode" isn't in my
@ -6185,15 +6168,15 @@ pa_callinfo (int unused ATTRIBUTE_UNUSED)
to drop the information, so we'll accept it too. */ to drop the information, so we'll accept it too. */
else if ((strncasecmp (name, "millicode", 9) == 0)) else if ((strncasecmp (name, "millicode", 9) == 0))
{ {
p = input_line_pointer; (void) restore_line_pointer (c);
*p = c;
last_call_info->ci_unwind.descriptor.millicode = 1; last_call_info->ci_unwind.descriptor.millicode = 1;
} }
else else
{ {
as_bad (_("Invalid .CALLINFO argument: %s"), name); as_bad (_("Invalid .CALLINFO argument: %s"), name);
*input_line_pointer = c; (void) restore_line_pointer (c);
} }
if (!is_end_of_statement ()) if (!is_end_of_statement ())
input_line_pointer++; input_line_pointer++;
} }
@ -6554,7 +6537,7 @@ pa_exit (int unused ATTRIBUTE_UNUSED)
static void static void
pa_type_args (symbolS *symbolP, int is_export) pa_type_args (symbolS *symbolP, int is_export)
{ {
char *name, c, *p; char *name, c;
unsigned int temp, arg_reloc; unsigned int temp, arg_reloc;
pa_symbol_type type = SYMBOL_TYPE_UNKNOWN; pa_symbol_type type = SYMBOL_TYPE_UNKNOWN;
asymbol *bfdsym = symbol_get_bfdsym (symbolP); asymbol *bfdsym = symbol_get_bfdsym (symbolP);
@ -6651,60 +6634,56 @@ pa_type_args (symbolS *symbolP, int is_export)
{ {
if (*input_line_pointer == ',') if (*input_line_pointer == ',')
input_line_pointer++; input_line_pointer++;
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
/* Argument sources. */ /* Argument sources. */
if ((strncasecmp (name, "argw", 4) == 0)) if ((strncasecmp (name, "argw", 4) == 0))
{ {
p = input_line_pointer; (void) restore_line_pointer (c);
*p = c;
input_line_pointer++; input_line_pointer++;
temp = atoi (name + 4); temp = atoi (name + 4);
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
arg_reloc = pa_align_arg_reloc (temp, pa_build_arg_reloc (name)); arg_reloc = pa_align_arg_reloc (temp, pa_build_arg_reloc (name));
#if defined (OBJ_SOM) || defined (ELF_ARG_RELOC) #if defined (OBJ_SOM) || defined (ELF_ARG_RELOC)
symbol_arg_reloc_info (symbolP) |= arg_reloc; symbol_arg_reloc_info (symbolP) |= arg_reloc;
#else #else
(void) arg_reloc; (void) arg_reloc;
#endif #endif
*input_line_pointer = c; (void) restore_line_pointer (c);
} }
/* The return value. */ /* The return value. */
else if ((strncasecmp (name, "rtnval", 6)) == 0) else if ((strncasecmp (name, "rtnval", 6)) == 0)
{ {
p = input_line_pointer; (void) restore_line_pointer (c);
*p = c;
input_line_pointer++; input_line_pointer++;
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
arg_reloc = pa_build_arg_reloc (name); arg_reloc = pa_build_arg_reloc (name);
#if defined (OBJ_SOM) || defined (ELF_ARG_RELOC) #if defined (OBJ_SOM) || defined (ELF_ARG_RELOC)
symbol_arg_reloc_info (symbolP) |= arg_reloc; symbol_arg_reloc_info (symbolP) |= arg_reloc;
#else #else
(void) arg_reloc; (void) arg_reloc;
#endif #endif
*input_line_pointer = c; (void) restore_line_pointer (c);
} }
/* Privilege level. */ /* Privilege level. */
else if ((strncasecmp (name, "priv_lev", 8)) == 0) else if ((strncasecmp (name, "priv_lev", 8)) == 0)
{ {
p = input_line_pointer; char *priv;
*p = c;
(void) restore_line_pointer (c);
input_line_pointer++; input_line_pointer++;
temp = atoi (input_line_pointer); temp = atoi (input_line_pointer);
#ifdef OBJ_SOM #ifdef OBJ_SOM
((obj_symbol_type *) bfdsym)->tc_data.ap.hppa_priv_level = temp; ((obj_symbol_type *) bfdsym)->tc_data.ap.hppa_priv_level = temp;
#endif #endif
c = get_symbol_end (); c = get_symbol_name (&priv);
*input_line_pointer = c; (void) restore_line_pointer (c);
} }
else else
{ {
as_bad (_("Undefined .EXPORT/.IMPORT argument (ignored): %s"), name); as_bad (_("Undefined .EXPORT/.IMPORT argument (ignored): %s"), name);
p = input_line_pointer; (void) restore_line_pointer (c);
*p = c;
} }
if (!is_end_of_statement ()) if (!is_end_of_statement ())
input_line_pointer++; input_line_pointer++;
} }
@ -6717,17 +6696,15 @@ pa_type_args (symbolS *symbolP, int is_export)
static void static void
pa_export (int unused ATTRIBUTE_UNUSED) pa_export (int unused ATTRIBUTE_UNUSED)
{ {
char *name, c, *p; char *name, c;
symbolS *symbol; symbolS *symbol;
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
/* Make sure the given symbol exists. */ /* Make sure the given symbol exists. */
if ((symbol = symbol_find_or_make (name)) == NULL) if ((symbol = symbol_find_or_make (name)) == NULL)
{ {
as_bad (_("Cannot define export symbol: %s\n"), name); as_bad (_("Cannot define export symbol: %s\n"), name);
p = input_line_pointer; restore_line_pointer (c);
*p = c;
input_line_pointer++; input_line_pointer++;
} }
else else
@ -6739,8 +6716,7 @@ pa_export (int unused ATTRIBUTE_UNUSED)
set BSF_GLOBAL when we get back. */ set BSF_GLOBAL when we get back. */
S_SET_EXTERNAL (symbol); S_SET_EXTERNAL (symbol);
symbol_get_bfdsym (symbol)->flags |= BSF_GLOBAL; symbol_get_bfdsym (symbol)->flags |= BSF_GLOBAL;
p = input_line_pointer; (void) restore_line_pointer (c);
*p = c;
if (!is_end_of_statement ()) if (!is_end_of_statement ())
{ {
input_line_pointer++; input_line_pointer++;
@ -6758,11 +6734,10 @@ pa_export (int unused ATTRIBUTE_UNUSED)
static void static void
pa_import (int unused ATTRIBUTE_UNUSED) pa_import (int unused ATTRIBUTE_UNUSED)
{ {
char *name, c, *p; char *name, c;
symbolS *symbol; symbolS *symbol;
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
symbol = symbol_find (name); symbol = symbol_find (name);
/* Ugh. We might be importing a symbol defined earlier in the file, /* Ugh. We might be importing a symbol defined earlier in the file,
@ -6771,8 +6746,7 @@ pa_import (int unused ATTRIBUTE_UNUSED)
if (symbol == NULL || !S_IS_DEFINED (symbol)) if (symbol == NULL || !S_IS_DEFINED (symbol))
{ {
symbol = symbol_find_or_make (name); symbol = symbol_find_or_make (name);
p = input_line_pointer; (void) restore_line_pointer (c);
*p = c;
if (!is_end_of_statement ()) if (!is_end_of_statement ())
{ {
@ -6809,16 +6783,14 @@ pa_import (int unused ATTRIBUTE_UNUSED)
static void static void
pa_label (int unused ATTRIBUTE_UNUSED) pa_label (int unused ATTRIBUTE_UNUSED)
{ {
char *name, c, *p; char *name, c;
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
if (strlen (name) > 0) if (strlen (name) > 0)
{ {
colon (name); colon (name);
p = input_line_pointer; (void) restore_line_pointer (c);
*p = c;
} }
else else
{ {
@ -6907,24 +6879,21 @@ pa_origin (int unused ATTRIBUTE_UNUSED)
static void static void
pa_param (int unused ATTRIBUTE_UNUSED) pa_param (int unused ATTRIBUTE_UNUSED)
{ {
char *name, c, *p; char *name, c;
symbolS *symbol; symbolS *symbol;
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
if ((symbol = symbol_find_or_make (name)) == NULL) if ((symbol = symbol_find_or_make (name)) == NULL)
{ {
as_bad (_("Cannot define static symbol: %s\n"), name); as_bad (_("Cannot define static symbol: %s\n"), name);
p = input_line_pointer; (void) restore_line_pointer (c);
*p = c;
input_line_pointer++; input_line_pointer++;
} }
else else
{ {
S_CLEAR_EXTERNAL (symbol); S_CLEAR_EXTERNAL (symbol);
p = input_line_pointer; (void) restore_line_pointer (c);
*p = c;
if (!is_end_of_statement ()) if (!is_end_of_statement ())
{ {
input_line_pointer++; input_line_pointer++;
@ -7161,39 +7130,38 @@ pa_parse_space_stmt (char *space_name, int create_flag)
while (!is_end_of_statement ()) while (!is_end_of_statement ())
{ {
input_line_pointer++; input_line_pointer++;
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
if ((strncasecmp (name, "spnum", 5) == 0)) if ((strncasecmp (name, "spnum", 5) == 0))
{ {
*input_line_pointer = c; (void) restore_line_pointer (c);
input_line_pointer++; input_line_pointer++;
spnum = get_absolute_expression (); spnum = get_absolute_expression ();
} }
else if ((strncasecmp (name, "sort", 4) == 0)) else if ((strncasecmp (name, "sort", 4) == 0))
{ {
*input_line_pointer = c; (void) restore_line_pointer (c);
input_line_pointer++; input_line_pointer++;
sort = get_absolute_expression (); sort = get_absolute_expression ();
} }
else if ((strncasecmp (name, "unloadable", 10) == 0)) else if ((strncasecmp (name, "unloadable", 10) == 0))
{ {
*input_line_pointer = c; (void) restore_line_pointer (c);
loadable = FALSE; loadable = FALSE;
} }
else if ((strncasecmp (name, "notdefined", 10) == 0)) else if ((strncasecmp (name, "notdefined", 10) == 0))
{ {
*input_line_pointer = c; (void) restore_line_pointer (c);
defined = FALSE; defined = FALSE;
} }
else if ((strncasecmp (name, "private", 7) == 0)) else if ((strncasecmp (name, "private", 7) == 0))
{ {
*input_line_pointer = c; (void) restore_line_pointer (c);
private = TRUE; private = TRUE;
} }
else else
{ {
as_bad (_("Invalid .SPACE argument")); as_bad (_("Invalid .SPACE argument"));
*input_line_pointer = c; (void) restore_line_pointer (c);
if (!is_end_of_statement ()) if (!is_end_of_statement ())
input_line_pointer++; input_line_pointer++;
} }
@ -7331,11 +7299,10 @@ pa_space (int unused ATTRIBUTE_UNUSED)
/* Not a number, attempt to create a new space. */ /* Not a number, attempt to create a new space. */
print_errors = 1; print_errors = 1;
input_line_pointer = save_s; input_line_pointer = save_s;
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
space_name = xmalloc (strlen (name) + 1); space_name = xmalloc (strlen (name) + 1);
strcpy (space_name, name); strcpy (space_name, name);
*input_line_pointer = c; (void) restore_line_pointer (c);
sd_chain = pa_parse_space_stmt (space_name, 1); sd_chain = pa_parse_space_stmt (space_name, 1);
current_space = sd_chain; current_space = sd_chain;
@ -7357,8 +7324,7 @@ pa_spnum (int unused ATTRIBUTE_UNUSED)
char *p; char *p;
sd_chain_struct *space; sd_chain_struct *space;
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
space = is_defined_space (name); space = is_defined_space (name);
if (space) if (space)
{ {
@ -7368,7 +7334,7 @@ pa_spnum (int unused ATTRIBUTE_UNUSED)
else else
as_warn (_("Undefined space: '%s' Assuming space number = 0."), name); as_warn (_("Undefined space: '%s' Assuming space number = 0."), name);
*input_line_pointer = c; (void) restore_line_pointer (c);
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
} }
@ -7398,11 +7364,10 @@ pa_subspace (int create_new)
} }
else else
{ {
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
ss_name = xmalloc (strlen (name) + 1); ss_name = xmalloc (strlen (name) + 1);
strcpy (ss_name, name); strcpy (ss_name, name);
*input_line_pointer = c; (void) restore_line_pointer (c);
/* Load default values. */ /* Load default values. */
sort = 0; sort = 0;
@ -7466,17 +7431,16 @@ pa_subspace (int create_new)
input_line_pointer++; input_line_pointer++;
while (!is_end_of_statement ()) while (!is_end_of_statement ())
{ {
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
if ((strncasecmp (name, "quad", 4) == 0)) if ((strncasecmp (name, "quad", 4) == 0))
{ {
*input_line_pointer = c; (void) restore_line_pointer (c);
input_line_pointer++; input_line_pointer++;
quadrant = get_absolute_expression (); quadrant = get_absolute_expression ();
} }
else if ((strncasecmp (name, "align", 5) == 0)) else if ((strncasecmp (name, "align", 5) == 0))
{ {
*input_line_pointer = c; (void) restore_line_pointer (c);
input_line_pointer++; input_line_pointer++;
alignment = get_absolute_expression (); alignment = get_absolute_expression ();
if (exact_log2 (alignment) == -1) if (exact_log2 (alignment) == -1)
@ -7487,50 +7451,51 @@ pa_subspace (int create_new)
} }
else if ((strncasecmp (name, "access", 6) == 0)) else if ((strncasecmp (name, "access", 6) == 0))
{ {
*input_line_pointer = c; (void) restore_line_pointer (c);
input_line_pointer++; input_line_pointer++;
access_ctr = get_absolute_expression (); access_ctr = get_absolute_expression ();
} }
else if ((strncasecmp (name, "sort", 4) == 0)) else if ((strncasecmp (name, "sort", 4) == 0))
{ {
*input_line_pointer = c; (void) restore_line_pointer (c);
input_line_pointer++; input_line_pointer++;
sort = get_absolute_expression (); sort = get_absolute_expression ();
} }
else if ((strncasecmp (name, "code_only", 9) == 0)) else if ((strncasecmp (name, "code_only", 9) == 0))
{ {
*input_line_pointer = c; (void) restore_line_pointer (c);
code_only = 1; code_only = 1;
} }
else if ((strncasecmp (name, "unloadable", 10) == 0)) else if ((strncasecmp (name, "unloadable", 10) == 0))
{ {
*input_line_pointer = c; (void) restore_line_pointer (c);
loadable = 0; loadable = 0;
} }
else if ((strncasecmp (name, "comdat", 6) == 0)) else if ((strncasecmp (name, "comdat", 6) == 0))
{ {
*input_line_pointer = c; (void) restore_line_pointer (c);
comdat = 1; comdat = 1;
} }
else if ((strncasecmp (name, "common", 6) == 0)) else if ((strncasecmp (name, "common", 6) == 0))
{ {
*input_line_pointer = c; (void) restore_line_pointer (c);
common = 1; common = 1;
} }
else if ((strncasecmp (name, "dup_comm", 8) == 0)) else if ((strncasecmp (name, "dup_comm", 8) == 0))
{ {
*input_line_pointer = c; (void) restore_line_pointer (c);
dup_common = 1; dup_common = 1;
} }
else if ((strncasecmp (name, "zero", 4) == 0)) else if ((strncasecmp (name, "zero", 4) == 0))
{ {
*input_line_pointer = c; (void) restore_line_pointer (c);
zero = 1; zero = 1;
} }
else if ((strncasecmp (name, "first", 5) == 0)) else if ((strncasecmp (name, "first", 5) == 0))
as_bad (_("FIRST not supported as a .SUBSPACE argument")); as_bad (_("FIRST not supported as a .SUBSPACE argument"));
else else
as_bad (_("Invalid .SUBSPACE argument")); as_bad (_("Invalid .SUBSPACE argument"));
if (!is_end_of_statement ()) if (!is_end_of_statement ())
input_line_pointer++; input_line_pointer++;
} }

View file

@ -269,11 +269,11 @@ register_name (expressionS *expressionP)
reg_number = get_single_number (); reg_number = get_single_number ();
else else
{ {
c = get_symbol_end (); c = get_symbol_name (&name);
reg_number = reg_name_search (pre_defined_registers, REG_NAME_CNT, name); reg_number = reg_name_search (pre_defined_registers, REG_NAME_CNT, name);
/* Put back the delimiting char. */ /* Put back the delimiting char. */
*input_line_pointer = c; (void) restore_line_pointer (c);
} }
/* If numeric, make sure its not out of bounds. */ /* If numeric, make sure its not out of bounds. */
@ -1033,12 +1033,11 @@ i370_elf_lcomm (int unused ATTRIBUTE_UNUSED)
char *pfrag; char *pfrag;
int align2; int align2;
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
/* Just after name is now '\0'. */ /* Just after name is now '\0'. */
p = input_line_pointer; p = input_line_pointer;
*p = c; (void) restore_line_pointer (c);
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
if (*input_line_pointer != ',') if (*input_line_pointer != ',')
{ {

View file

@ -168,13 +168,18 @@ operatorT i386_operator (const char *name, unsigned int operands, char *pc)
for (j = 0; i386_types[j].name; ++j) for (j = 0; i386_types[j].name; ++j)
if (strcasecmp (i386_types[j].name, name) == 0) if (strcasecmp (i386_types[j].name, name) == 0)
break; break;
if (i386_types[j].name && *pc == ' ') if (i386_types[j].name && *pc == ' ')
{ {
char *pname = ++input_line_pointer; char *pname;
char c = get_symbol_end (); char c;
++input_line_pointer;
c = get_symbol_name (&pname);
if (strcasecmp (pname, "ptr") == 0) if (strcasecmp (pname, "ptr") == 0)
{ {
/* FIXME: What if c == '"' ? */
pname[-1] = *pc; pname[-1] = *pc;
*pc = c; *pc = c;
if (intel_syntax > 0 || operands != 1) if (intel_syntax > 0 || operands != 1)
@ -182,7 +187,7 @@ operatorT i386_operator (const char *name, unsigned int operands, char *pc)
return i386_types[j].op; return i386_types[j].op;
} }
*input_line_pointer = c; (void) restore_line_pointer (c);
input_line_pointer = pname - 1; input_line_pointer = pname - 1;
} }

View file

@ -2198,8 +2198,8 @@ set_intel_syntax (int syntax_flag)
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
if (!is_end_of_line[(unsigned char) *input_line_pointer]) if (!is_end_of_line[(unsigned char) *input_line_pointer])
{ {
char *string = input_line_pointer; char *string;
int e = get_symbol_end (); int e = get_symbol_name (&string);
if (strcmp (string, "prefix") == 0) if (strcmp (string, "prefix") == 0)
ask_naked_reg = 1; ask_naked_reg = 1;
@ -2207,7 +2207,7 @@ set_intel_syntax (int syntax_flag)
ask_naked_reg = -1; ask_naked_reg = -1;
else else
as_bad (_("bad argument to syntax directive.")); as_bad (_("bad argument to syntax directive."));
*input_line_pointer = e; (void) restore_line_pointer (e);
} }
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
@ -2259,8 +2259,8 @@ set_check (int what)
if (!is_end_of_line[(unsigned char) *input_line_pointer]) if (!is_end_of_line[(unsigned char) *input_line_pointer])
{ {
char *string = input_line_pointer; char *string;
int e = get_symbol_end (); int e = get_symbol_name (&string);
if (strcmp (string, "none") == 0) if (strcmp (string, "none") == 0)
*kind = check_none; *kind = check_none;
@ -2270,7 +2270,7 @@ set_check (int what)
*kind = check_error; *kind = check_error;
else else
as_bad (_("bad argument to %s_check directive."), str); as_bad (_("bad argument to %s_check directive."), str);
*input_line_pointer = e; (void) restore_line_pointer (e);
} }
else else
as_bad (_("missing argument for %s_check directive"), str); as_bad (_("missing argument for %s_check directive"), str);
@ -2324,8 +2324,8 @@ set_cpu_arch (int dummy ATTRIBUTE_UNUSED)
if (!is_end_of_line[(unsigned char) *input_line_pointer]) if (!is_end_of_line[(unsigned char) *input_line_pointer])
{ {
char *string = input_line_pointer; char *string;
int e = get_symbol_end (); int e = get_symbol_name (&string);
unsigned int j; unsigned int j;
i386_cpu_flags flags; i386_cpu_flags flags;
@ -2385,7 +2385,7 @@ set_cpu_arch (int dummy ATTRIBUTE_UNUSED)
cpu_arch_flags = flags; cpu_arch_flags = flags;
cpu_arch_isa_flags = flags; cpu_arch_isa_flags = flags;
} }
*input_line_pointer = e; (void) restore_line_pointer (e);
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
return; return;
} }
@ -2402,8 +2402,11 @@ set_cpu_arch (int dummy ATTRIBUTE_UNUSED)
if (*input_line_pointer == ',' if (*input_line_pointer == ','
&& !is_end_of_line[(unsigned char) input_line_pointer[1]]) && !is_end_of_line[(unsigned char) input_line_pointer[1]])
{ {
char *string = ++input_line_pointer; char *string;
int e = get_symbol_end (); char e;
++input_line_pointer;
e = get_symbol_name (&string);
if (strcmp (string, "nojumps") == 0) if (strcmp (string, "nojumps") == 0)
no_cond_jump_promotion = 1; no_cond_jump_promotion = 1;
@ -2412,7 +2415,7 @@ set_cpu_arch (int dummy ATTRIBUTE_UNUSED)
else else
as_bad (_("no such architecture modifier: `%s'"), string); as_bad (_("no such architecture modifier: `%s'"), string);
*input_line_pointer = e; (void) restore_line_pointer (e);
} }
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
@ -3967,14 +3970,14 @@ parse_operands (char *l, const char *mnemonic)
/* Skip optional white space before operand. */ /* Skip optional white space before operand. */
if (is_space_char (*l)) if (is_space_char (*l))
++l; ++l;
if (!is_operand_char (*l) && *l != END_OF_INSN) if (!is_operand_char (*l) && *l != END_OF_INSN && *l != '"')
{ {
as_bad (_("invalid character %s before operand %d"), as_bad (_("invalid character %s before operand %d"),
output_invalid (*l), output_invalid (*l),
i.operands + 1); i.operands + 1);
return NULL; return NULL;
} }
token_start = l; /* after white space */ token_start = l; /* After white space. */
paren_not_balanced = 0; paren_not_balanced = 0;
while (paren_not_balanced || *l != ',') while (paren_not_balanced || *l != ',')
{ {
@ -3993,7 +3996,7 @@ parse_operands (char *l, const char *mnemonic)
else else
break; /* we are done */ break; /* we are done */
} }
else if (!is_operand_char (*l) && !is_space_char (*l)) else if (!is_operand_char (*l) && !is_space_char (*l) && *l != '"')
{ {
as_bad (_("invalid character %s in operand %d"), as_bad (_("invalid character %s in operand %d"),
output_invalid (*l), output_invalid (*l),
@ -8637,6 +8640,7 @@ i386_att_operand (char *operand_string)
} }
else if (is_digit_char (*op_string) else if (is_digit_char (*op_string)
|| is_identifier_char (*op_string) || is_identifier_char (*op_string)
|| *op_string == '"'
|| *op_string == '(') || *op_string == '(')
{ {
/* This is a memory reference of some sort. */ /* This is a memory reference of some sort. */
@ -9471,7 +9475,7 @@ parse_register (char *reg_string, char **end_op)
symbolS *symbolP; symbolS *symbolP;
input_line_pointer = reg_string; input_line_pointer = reg_string;
c = get_symbol_end (); c = get_symbol_name (&reg_string);
symbolP = symbol_find (reg_string); symbolP = symbol_find (reg_string);
if (symbolP && S_GET_SEGMENT (symbolP) == reg_section) if (symbolP && S_GET_SEGMENT (symbolP) == reg_section)
{ {

View file

@ -2335,8 +2335,7 @@ s_endian (int ignore ATTRIBUTE_UNUSED)
char *name; char *name;
char c; char c;
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
if (strcasecmp (name, "little") == 0) if (strcasecmp (name, "little") == 0)
; ;
else if (strcasecmp (name, "big") == 0) else if (strcasecmp (name, "big") == 0)
@ -2344,7 +2343,7 @@ s_endian (int ignore ATTRIBUTE_UNUSED)
else else
as_warn (_("ignoring unrecognized .endian type `%s'"), name); as_warn (_("ignoring unrecognized .endian type `%s'"), name);
*input_line_pointer = c; (void) restore_line_pointer (c);
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
} }

View file

@ -1084,19 +1084,18 @@ obj_elf_vms_common (int ignore ATTRIBUTE_UNUSED)
return; return;
} }
sym_name = input_line_pointer; c = get_symbol_name (&sym_name);
c = get_symbol_end ();
if (input_line_pointer == sym_name) if (input_line_pointer == sym_name)
{ {
*input_line_pointer = c; (void) restore_line_pointer (c);
as_bad (_("expected symbol name")); as_bad (_("expected symbol name"));
ignore_rest_of_line (); ignore_rest_of_line ();
return; return;
} }
symbolP = symbol_find_or_make (sym_name); symbolP = symbol_find_or_make (sym_name);
*input_line_pointer = c; (void) restore_line_pointer (c);
if ((S_IS_DEFINED (symbolP) || symbol_equated_p (symbolP)) if ((S_IS_DEFINED (symbolP) || symbol_equated_p (symbolP))
&& !S_IS_COMMON (symbolP)) && !S_IS_COMMON (symbolP))
@ -3167,12 +3166,11 @@ dot_radix (int dummy ATTRIBUTE_UNUSED)
if (is_it_end_of_statement ()) if (is_it_end_of_statement ())
return; return;
radix = input_line_pointer; ch = get_symbol_name (&radix);
ch = get_symbol_end ();
ia64_canonicalize_symbol_name (radix); ia64_canonicalize_symbol_name (radix);
if (strcasecmp (radix, "C")) if (strcasecmp (radix, "C"))
as_bad (_("Radix `%s' unsupported or invalid"), radix); as_bad (_("Radix `%s' unsupported or invalid"), radix);
*input_line_pointer = ch; (void) restore_line_pointer (ch);
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
} }
@ -3279,11 +3277,12 @@ add_unwind_entry (unw_rec_list *ptr, int sep)
if (sep == ',') if (sep == ',')
{ {
char *name;
/* Parse a tag permitted for the current directive. */ /* Parse a tag permitted for the current directive. */
int ch; int ch;
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
ch = get_symbol_end (); ch = get_symbol_name (&name);
/* FIXME: For now, just issue a warning that this isn't implemented. */ /* FIXME: For now, just issue a warning that this isn't implemented. */
{ {
static int warned; static int warned;
@ -3294,7 +3293,7 @@ add_unwind_entry (unw_rec_list *ptr, int sep)
as_warn (_("Tags on unwind pseudo-ops aren't supported, yet")); as_warn (_("Tags on unwind pseudo-ops aren't supported, yet"));
} }
} }
*input_line_pointer = ch; (void) restore_line_pointer (ch);
} }
if (sep != NOT_A_CHAR) if (sep != NOT_A_CHAR)
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
@ -4232,16 +4231,16 @@ static void
dot_personality (int dummy ATTRIBUTE_UNUSED) dot_personality (int dummy ATTRIBUTE_UNUSED)
{ {
char *name, *p, c; char *name, *p, c;
if (!in_procedure ("personality")) if (!in_procedure ("personality"))
return; return;
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
p = input_line_pointer; p = input_line_pointer;
unwind.personality_routine = symbol_find_or_make (name); unwind.personality_routine = symbol_find_or_make (name);
unwind.force_unwind_entry = 1; unwind.force_unwind_entry = 1;
*p = c; *p = c;
SKIP_WHITESPACE (); SKIP_WHITESPACE_AFTER_NAME ();
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
} }
@ -4271,8 +4270,7 @@ dot_proc (int dummy ATTRIBUTE_UNUSED)
while (1) while (1)
{ {
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
p = input_line_pointer; p = input_line_pointer;
if (!*name) if (!*name)
as_bad (_("Empty argument of .proc")); as_bad (_("Empty argument of .proc"));
@ -4295,7 +4293,7 @@ dot_proc (int dummy ATTRIBUTE_UNUSED)
symbol_get_bfdsym (sym)->flags |= BSF_FUNCTION; symbol_get_bfdsym (sym)->flags |= BSF_FUNCTION;
} }
*p = c; *p = c;
SKIP_WHITESPACE (); SKIP_WHITESPACE_AFTER_NAME ();
if (*input_line_pointer != ',') if (*input_line_pointer != ',')
break; break;
++input_line_pointer; ++input_line_pointer;
@ -4529,8 +4527,7 @@ dot_endp (int dummy ATTRIBUTE_UNUSED)
char *name, *p, c; char *name, *p, c;
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
p = input_line_pointer; p = input_line_pointer;
if (!*name) if (!*name)
(md.unwind_check == unwind_check_warning (md.unwind_check == unwind_check_warning
@ -4552,7 +4549,7 @@ dot_endp (int dummy ATTRIBUTE_UNUSED)
as_warn (_("`%s' was not specified with previous .proc"), name); as_warn (_("`%s' was not specified with previous .proc"), name);
} }
*p = c; *p = c;
SKIP_WHITESPACE (); SKIP_WHITESPACE_AFTER_NAME ();
if (*input_line_pointer != ',') if (*input_line_pointer != ',')
break; break;
++input_line_pointer; ++input_line_pointer;
@ -4638,12 +4635,11 @@ dot_rot (int type)
drpp = &md.dynreg[type]; drpp = &md.dynreg[type];
while (1) while (1)
{ {
start = input_line_pointer; ch = get_symbol_name (&start);
ch = get_symbol_end ();
len = strlen (ia64_canonicalize_symbol_name (start)); len = strlen (ia64_canonicalize_symbol_name (start));
*input_line_pointer = ch; *input_line_pointer = ch;
SKIP_WHITESPACE (); SKIP_WHITESPACE_AFTER_NAME ();
if (*input_line_pointer != '[') if (*input_line_pointer != '[')
{ {
as_bad (_("Expected '['")); as_bad (_("Expected '['"));
@ -4769,8 +4765,7 @@ dot_psr (int dummy ATTRIBUTE_UNUSED)
while (1) while (1)
{ {
option = input_line_pointer; ch = get_symbol_name (&option);
ch = get_symbol_end ();
if (strcmp (option, "lsb") == 0) if (strcmp (option, "lsb") == 0)
md.flags &= ~EF_IA_64_BE; md.flags &= ~EF_IA_64_BE;
else if (strcmp (option, "msb") == 0) else if (strcmp (option, "msb") == 0)
@ -4783,7 +4778,7 @@ dot_psr (int dummy ATTRIBUTE_UNUSED)
as_bad (_("Unknown psr option `%s'"), option); as_bad (_("Unknown psr option `%s'"), option);
*input_line_pointer = ch; *input_line_pointer = ch;
SKIP_WHITESPACE (); SKIP_WHITESPACE_AFTER_NAME ();
if (*input_line_pointer != ',') if (*input_line_pointer != ',')
break; break;
@ -4806,26 +4801,12 @@ cross_section (int ref, void (*builder) (int), int ua)
char *start, *end; char *start, *end;
int saved_auto_align; int saved_auto_align;
unsigned int section_count; unsigned int section_count;
char *name;
char c;
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
start = input_line_pointer; start = input_line_pointer;
if (*start == '"') c = get_symbol_name (&name);
{
int len;
char *name;
name = demand_copy_C_string (&len);
obstack_free(&notes, name);
if (!name)
{
ignore_rest_of_line ();
return;
}
}
else
{
char c = get_symbol_end ();
if (input_line_pointer == start) if (input_line_pointer == start)
{ {
as_bad (_("Missing section name")); as_bad (_("Missing section name"));
@ -4833,9 +4814,8 @@ cross_section (int ref, void (*builder) (int), int ua)
return; return;
} }
* input_line_pointer = c; * input_line_pointer = c;
} SKIP_WHITESPACE_AFTER_NAME ();
end = input_line_pointer; end = input_line_pointer;
SKIP_WHITESPACE ();
if (*input_line_pointer != ',') if (*input_line_pointer != ',')
{ {
as_bad (_("Comma expected after section name")); as_bad (_("Comma expected after section name"));
@ -5068,8 +5048,11 @@ dot_pred_rel (int type)
} }
else if (*input_line_pointer == '@') else if (*input_line_pointer == '@')
{ {
char *form = ++input_line_pointer; char *form;
char c = get_symbol_end(); char c;
++input_line_pointer;
c = get_symbol_name (&form);
if (strcmp (form, "mutex") == 0) if (strcmp (form, "mutex") == 0)
type = 'm'; type = 'm';
@ -5077,7 +5060,7 @@ dot_pred_rel (int type)
type = 'c'; type = 'c';
else if (strcmp (form, "imply") == 0) else if (strcmp (form, "imply") == 0)
type = 'i'; type = 'i';
*input_line_pointer = c; (void) restore_line_pointer (c);
} }
else else
{ {
@ -5215,8 +5198,7 @@ dot_entry (int dummy ATTRIBUTE_UNUSED)
do do
{ {
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
symbolP = symbol_find_or_make (name); symbolP = symbol_find_or_make (name);
err = hash_insert (md.entry_hash, S_GET_NAME (symbolP), (void *) symbolP); err = hash_insert (md.entry_hash, S_GET_NAME (symbolP), (void *) symbolP);
@ -5225,7 +5207,7 @@ dot_entry (int dummy ATTRIBUTE_UNUSED)
name, err); name, err);
*input_line_pointer = c; *input_line_pointer = c;
SKIP_WHITESPACE (); SKIP_WHITESPACE_AFTER_NAME ();
c = *input_line_pointer; c = *input_line_pointer;
if (c == ',') if (c == ',')
{ {
@ -7748,8 +7730,7 @@ ia64_unrecognized_line (int ch)
recognize labels. */ recognize labels. */
if (is_name_beginner (*input_line_pointer)) if (is_name_beginner (*input_line_pointer))
{ {
s = input_line_pointer; c = get_symbol_name (&s);
c = get_symbol_end ();
} }
else if (LOCAL_LABELS_FB else if (LOCAL_LABELS_FB
&& ISDIGIT (*input_line_pointer)) && ISDIGIT (*input_line_pointer))
@ -10720,12 +10701,11 @@ md_assemble (char *str)
/* extract the opcode (mnemonic): */ /* extract the opcode (mnemonic): */
mnemonic = input_line_pointer; ch = get_symbol_name (&mnemonic);
ch = get_symbol_end ();
pdesc = (struct pseudo_opcode *) hash_find (md.pseudo_hash, mnemonic); pdesc = (struct pseudo_opcode *) hash_find (md.pseudo_hash, mnemonic);
if (pdesc) if (pdesc)
{ {
*input_line_pointer = ch; (void) restore_line_pointer (ch);
(*pdesc->handler) (pdesc->arg); (*pdesc->handler) (pdesc->arg);
goto done; goto done;
} }
@ -10733,7 +10713,7 @@ md_assemble (char *str)
/* Find the instruction descriptor matching the arguments. */ /* Find the instruction descriptor matching the arguments. */
idesc = ia64_find_opcode (mnemonic); idesc = ia64_find_opcode (mnemonic);
*input_line_pointer = ch; (void) restore_line_pointer (ch);
if (!idesc) if (!idesc)
{ {
as_bad (_("Unknown opcode `%s'"), mnemonic); as_bad (_("Unknown opcode `%s'"), mnemonic);
@ -11805,8 +11785,7 @@ dot_alias (int section)
struct hash_control *ahash, *nhash; struct hash_control *ahash, *nhash;
const char *kind; const char *kind;
name = input_line_pointer; delim = get_symbol_name (&name);
delim = get_symbol_end ();
end_name = input_line_pointer; end_name = input_line_pointer;
*end_name = delim; *end_name = delim;
@ -11817,7 +11796,7 @@ dot_alias (int section)
return; return;
} }
SKIP_WHITESPACE (); SKIP_WHITESPACE_AFTER_NAME ();
if (*input_line_pointer != ',') if (*input_line_pointer != ',')
{ {

View file

@ -796,10 +796,9 @@ get_symbol (void)
char *name; char *name;
symbolS *p; symbolS *p;
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
p = (symbolS *) symbol_find_or_make (name); p = (symbolS *) symbol_find_or_make (name);
*input_line_pointer = c; (void) restore_line_pointer (c);
return p; return p;
} }

View file

@ -567,13 +567,10 @@ debug_sym (int ignore ATTRIBUTE_UNUSED)
{ {
char *name; char *name;
char delim; char delim;
char *end_name;
symbolS *symbolP; symbolS *symbolP;
sym_linkS *lnk; sym_linkS *lnk;
name = input_line_pointer; delim = get_symbol_name (&name);
delim = get_symbol_end ();
end_name = input_line_pointer;
if ((symbolP = symbol_find (name)) == NULL if ((symbolP = symbol_find (name)) == NULL
&& (symbolP = md_undefined_symbol (name)) == NULL) && (symbolP = md_undefined_symbol (name)) == NULL)
@ -595,7 +592,7 @@ debug_sym (int ignore ATTRIBUTE_UNUSED)
symbol_get_obj (symbolP)->local = 1; symbol_get_obj (symbolP)->local = 1;
} }
*end_name = delim; (void) restore_line_pointer (delim);
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
} }
@ -1480,13 +1477,12 @@ m32r_scomm (int ignore ATTRIBUTE_UNUSED)
offsetT align; offsetT align;
int align2; int align2;
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
/* Just after name is now '\0'. */ /* Just after name is now '\0'. */
p = input_line_pointer; p = input_line_pointer;
*p = c; *p = c;
SKIP_WHITESPACE (); SKIP_WHITESPACE_AFTER_NAME ();
if (*input_line_pointer != ',') if (*input_line_pointer != ',')
{ {
as_bad (_("Expected comma after symbol-name: rest of line ignored.")); as_bad (_("Expected comma after symbol-name: rest of line ignored."));

View file

@ -3760,10 +3760,9 @@ s_m68hc11_mark_symbol (int mark)
do do
{ {
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
symbolP = symbol_find_or_make (name); symbolP = symbol_find_or_make (name);
*input_line_pointer = c; (void) restore_line_pointer (c);
SKIP_WHITESPACE (); SKIP_WHITESPACE ();

View file

@ -5703,7 +5703,7 @@ mri_chip (void)
int i; int i;
s = input_line_pointer; s = input_line_pointer;
/* We can't use get_symbol_end since the processor names are not proper /* We can't use get_symbol_name since the processor names are not proper
symbols. */ symbols. */
while (is_part_of_name (c = *input_line_pointer++)) while (is_part_of_name (c = *input_line_pointer++))
; ;
@ -5731,7 +5731,7 @@ mri_chip (void)
{ {
++input_line_pointer; ++input_line_pointer;
s = input_line_pointer; s = input_line_pointer;
/* We can't use get_symbol_end since the processor names are not /* We can't use get_symbol_name since the processor names are not
proper symbols. */ proper symbols. */
while (is_part_of_name (c = *input_line_pointer++)) while (is_part_of_name (c = *input_line_pointer++))
; ;
@ -5896,8 +5896,7 @@ s_opt (int ignore ATTRIBUTE_UNUSED)
t = 0; t = 0;
} }
s = input_line_pointer; c = get_symbol_name (&s);
c = get_symbol_end ();
for (i = 0, o = opt_table; i < OPTCOUNT; i++, o++) for (i = 0, o = opt_table; i < OPTCOUNT; i++, o++)
{ {
@ -5907,14 +5906,14 @@ s_opt (int ignore ATTRIBUTE_UNUSED)
{ {
/* Restore input_line_pointer now in case the option /* Restore input_line_pointer now in case the option
takes arguments. */ takes arguments. */
*input_line_pointer = c; (void) restore_line_pointer (c);
(*o->pfn) (o->arg, t); (*o->pfn) (o->arg, t);
} }
else if (o->pvar != NULL) else if (o->pvar != NULL)
{ {
if (! t && o->arg == o->notarg) if (! t && o->arg == o->notarg)
as_bad (_("option `%s' may not be negated"), s); as_bad (_("option `%s' may not be negated"), s);
*input_line_pointer = c; restore_line_pointer (c);
*o->pvar = t ? o->arg : o->notarg; *o->pvar = t ? o->arg : o->notarg;
} }
else else
@ -5925,7 +5924,7 @@ s_opt (int ignore ATTRIBUTE_UNUSED)
if (i >= OPTCOUNT) if (i >= OPTCOUNT)
{ {
as_bad (_("option `%s' not recognized"), s); as_bad (_("option `%s' not recognized"), s);
*input_line_pointer = c; restore_line_pointer (c);
} }
} }
while (*input_line_pointer++ == ','); while (*input_line_pointer++ == ',');

View file

@ -179,12 +179,11 @@ microblaze_s_lcomm (int xxx ATTRIBUTE_UNUSED)
segT current_seg = now_seg; segT current_seg = now_seg;
subsegT current_subseg = now_subseg; subsegT current_subseg = now_subseg;
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
/* Just after name is now '\0'. */ /* Just after name is now '\0'. */
p = input_line_pointer; p = input_line_pointer;
*p = c; (void) restore_line_pointer (c);
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
if (*input_line_pointer != ',') if (*input_line_pointer != ',')
{ {
@ -315,7 +314,8 @@ microblaze_s_bss (int localvar)
static void static void
microblaze_s_func (int end_p ATTRIBUTE_UNUSED) microblaze_s_func (int end_p ATTRIBUTE_UNUSED)
{ {
*input_line_pointer = get_symbol_end (); char *name;
restore_line_pointer (get_symbol_name (&name));
s_func (1); s_func (1);
} }
@ -329,11 +329,10 @@ microblaze_s_weakext (int ignore ATTRIBUTE_UNUSED)
symbolS *symbolP; symbolS *symbolP;
expressionS exp; expressionS exp;
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
symbolP = symbol_find_or_make (name); symbolP = symbol_find_or_make (name);
S_SET_WEAK (symbolP); S_SET_WEAK (symbolP);
*input_line_pointer = c; (void) restore_line_pointer (c);
SKIP_WHITESPACE (); SKIP_WHITESPACE ();

View file

@ -15134,10 +15134,9 @@ get_symbol (void)
char *name; char *name;
symbolS *p; symbolS *p;
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
p = (symbolS *) symbol_find_or_make (name); p = (symbolS *) symbol_find_or_make (name);
*input_line_pointer = c; (void) restore_line_pointer (c);
return p; return p;
} }
@ -15280,28 +15279,34 @@ s_change_sec (int sec)
void void
s_change_section (int ignore ATTRIBUTE_UNUSED) s_change_section (int ignore ATTRIBUTE_UNUSED)
{ {
char *saved_ilp;
char *section_name; char *section_name;
char c; char c, endc;
char next_c = 0; char next_c = 0;
int section_type; int section_type;
int section_flag; int section_flag;
int section_entry_size; int section_entry_size;
int section_alignment; int section_alignment;
section_name = input_line_pointer; saved_ilp = input_line_pointer;
c = get_symbol_end (); endc = get_symbol_name (&section_name);
c = (endc == '"' ? input_line_pointer[1] : endc);
if (c) if (c)
next_c = *(input_line_pointer + 1); next_c = input_line_pointer [(endc == '"' ? 2 : 1)];
/* Do we have .section Name<,"flags">? */ /* Do we have .section Name<,"flags">? */
if (c != ',' || (c == ',' && next_c == '"')) if (c != ',' || (c == ',' && next_c == '"'))
{ {
/* just after name is now '\0'. */ /* Just after name is now '\0'. */
*input_line_pointer = c; (void) restore_line_pointer (endc);
input_line_pointer = section_name; input_line_pointer = saved_ilp;
obj_elf_section (ignore); obj_elf_section (ignore);
return; return;
} }
section_name = xstrdup (section_name);
c = restore_line_pointer (endc);
input_line_pointer++; input_line_pointer++;
/* Do we have .section Name<,type><,flag><,entry_size><,alignment> */ /* Do we have .section Name<,type><,flag><,entry_size><,alignment> */
@ -15309,23 +15314,25 @@ s_change_section (int ignore ATTRIBUTE_UNUSED)
section_type = get_absolute_expression (); section_type = get_absolute_expression ();
else else
section_type = 0; section_type = 0;
if (*input_line_pointer++ == ',') if (*input_line_pointer++ == ',')
section_flag = get_absolute_expression (); section_flag = get_absolute_expression ();
else else
section_flag = 0; section_flag = 0;
if (*input_line_pointer++ == ',') if (*input_line_pointer++ == ',')
section_entry_size = get_absolute_expression (); section_entry_size = get_absolute_expression ();
else else
section_entry_size = 0; section_entry_size = 0;
if (*input_line_pointer++ == ',') if (*input_line_pointer++ == ',')
section_alignment = get_absolute_expression (); section_alignment = get_absolute_expression ();
else else
section_alignment = 0; section_alignment = 0;
/* FIXME: really ignore? */ /* FIXME: really ignore? */
(void) section_alignment; (void) section_alignment;
section_name = xstrdup (section_name);
/* When using the generic form of .section (as implemented by obj-elf.c), /* When using the generic form of .section (as implemented by obj-elf.c),
there's no way to set the section type to SHT_MIPS_DWARF. Users have there's no way to set the section type to SHT_MIPS_DWARF. Users have
traditionally had to fall back on the more common @progbits instead. traditionally had to fall back on the more common @progbits instead.
@ -15404,13 +15411,12 @@ s_mips_globl (int x ATTRIBUTE_UNUSED)
do do
{ {
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
symbolP = symbol_find_or_make (name); symbolP = symbol_find_or_make (name);
S_SET_EXTERNAL (symbolP); S_SET_EXTERNAL (symbolP);
*input_line_pointer = c; *input_line_pointer = c;
SKIP_WHITESPACE (); SKIP_WHITESPACE_AFTER_NAME ();
/* On Irix 5, every global symbol that is not explicitly labelled as /* On Irix 5, every global symbol that is not explicitly labelled as
being a function is apparently labelled as being an object. */ being a function is apparently labelled as being an object. */
@ -15422,12 +15428,11 @@ s_mips_globl (int x ATTRIBUTE_UNUSED)
char *secname; char *secname;
asection *sec; asection *sec;
secname = input_line_pointer; c = get_symbol_name (&secname);
c = get_symbol_end ();
sec = bfd_get_section_by_name (stdoutput, secname); sec = bfd_get_section_by_name (stdoutput, secname);
if (sec == NULL) if (sec == NULL)
as_bad (_("%s: no such section"), secname); as_bad (_("%s: no such section"), secname);
*input_line_pointer = c; (void) restore_line_pointer (c);
if (sec != NULL && (sec->flags & SEC_CODE) != 0) if (sec != NULL && (sec->flags & SEC_CODE) != 0)
flag = BSF_FUNCTION; flag = BSF_FUNCTION;
@ -15455,8 +15460,7 @@ s_option (int x ATTRIBUTE_UNUSED)
char *opt; char *opt;
char c; char c;
opt = input_line_pointer; c = get_symbol_name (&opt);
c = get_symbol_end ();
if (*opt == 'O') if (*opt == 'O')
{ {
@ -15488,7 +15492,7 @@ s_option (int x ATTRIBUTE_UNUSED)
else else
as_warn (_("unrecognized option \"%s\""), opt); as_warn (_("unrecognized option \"%s\""), opt);
*input_line_pointer = c; (void) restore_line_pointer (c);
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
} }
@ -16425,13 +16429,12 @@ s_mips_weakext (int ignore ATTRIBUTE_UNUSED)
symbolS *symbolP; symbolS *symbolP;
expressionS exp; expressionS exp;
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
symbolP = symbol_find_or_make (name); symbolP = symbol_find_or_make (name);
S_SET_WEAK (symbolP); S_SET_WEAK (symbolP);
*input_line_pointer = c; *input_line_pointer = c;
SKIP_WHITESPACE (); SKIP_WHITESPACE_AFTER_NAME ();
if (! is_end_of_line[(unsigned char) *input_line_pointer]) if (! is_end_of_line[(unsigned char) *input_line_pointer])
{ {

View file

@ -587,8 +587,10 @@ get_putget_operands (struct mmix_opcode *insn, char *operands,
p++; p++;
sregp = p; sregp = p;
input_line_pointer = sregp; input_line_pointer = sregp;
c = get_symbol_end (); c = get_symbol_name (&sregp);
sregend = input_line_pointer; sregend = input_line_pointer;
if (c == '"')
++ input_line_pointer;
} }
} }
else else
@ -596,10 +598,10 @@ get_putget_operands (struct mmix_opcode *insn, char *operands,
expp_sreg = &exp[0]; expp_sreg = &exp[0];
expp_reg = &exp[1]; expp_reg = &exp[1];
sregp = p; c = get_symbol_name (&sregp);
c = get_symbol_end (); sregend = input_line_pointer;
sregend = p = input_line_pointer; restore_line_pointer (c);
*p = c; p = input_line_pointer;
/* Skip whitespace */ /* Skip whitespace */
while (*p == ' ' || *p == '\t') while (*p == ' ' || *p == '\t')
@ -1939,9 +1941,7 @@ s_prefix (int unused ATTRIBUTE_UNUSED)
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
p = input_line_pointer; c = get_symbol_name (&p);
c = get_symbol_end ();
/* Reseting prefix? */ /* Reseting prefix? */
if (*p == ':' && p[1] == 0) if (*p == ':' && p[1] == 0)
@ -1961,7 +1961,7 @@ s_prefix (int unused ATTRIBUTE_UNUSED)
mmix_current_prefix = p; mmix_current_prefix = p;
} }
*input_line_pointer = c; (void) restore_line_pointer (c);
mmix_handle_rest_of_empty_line (); mmix_handle_rest_of_empty_line ();
} }
@ -2057,13 +2057,15 @@ s_greg (int unused ATTRIBUTE_UNUSED)
{ {
char *p; char *p;
char c; char c;
p = input_line_pointer;
/* This will skip over what can be a symbol and zero out the next /* This will skip over what can be a symbol and zero out the next
character, which we assume is a ',' or other meaningful delimiter. character, which we assume is a ',' or other meaningful delimiter.
What comes after that is the initializer expression for the What comes after that is the initializer expression for the
register. */ register. */
c = get_symbol_end (); c = get_symbol_name (&p);
if (c == '"')
c = * ++ input_line_pointer;
if (! is_end_of_line[(unsigned char) c]) if (! is_end_of_line[(unsigned char) c])
input_line_pointer++; input_line_pointer++;

View file

@ -181,13 +181,12 @@ data_register_name (expressionS *expressionP)
char c; char c;
/* Find the spelling of the operand. */ /* Find the spelling of the operand. */
start = name = input_line_pointer; start = input_line_pointer;
c = get_symbol_name (&name);
c = get_symbol_end ();
reg_number = reg_name_search (data_registers, DATA_REG_NAME_CNT, name); reg_number = reg_name_search (data_registers, DATA_REG_NAME_CNT, name);
/* Put back the delimiting char. */ /* Put back the delimiting char. */
*input_line_pointer = c; (void) restore_line_pointer (c);
/* Look to see if it's in the register table. */ /* Look to see if it's in the register table. */
if (reg_number >= 0) if (reg_number >= 0)
@ -226,13 +225,12 @@ address_register_name (expressionS *expressionP)
char c; char c;
/* Find the spelling of the operand. */ /* Find the spelling of the operand. */
start = name = input_line_pointer; start = input_line_pointer;
c = get_symbol_name (&name);
c = get_symbol_end ();
reg_number = reg_name_search (address_registers, ADDRESS_REG_NAME_CNT, name); reg_number = reg_name_search (address_registers, ADDRESS_REG_NAME_CNT, name);
/* Put back the delimiting char. */ /* Put back the delimiting char. */
*input_line_pointer = c; (void) restore_line_pointer (c);
/* Look to see if it's in the register table. */ /* Look to see if it's in the register table. */
if (reg_number >= 0) if (reg_number >= 0)
@ -271,13 +269,12 @@ other_register_name (expressionS *expressionP)
char c; char c;
/* Find the spelling of the operand. */ /* Find the spelling of the operand. */
start = name = input_line_pointer; start = input_line_pointer;
c = get_symbol_name (&name);
c = get_symbol_end ();
reg_number = reg_name_search (other_registers, OTHER_REG_NAME_CNT, name); reg_number = reg_name_search (other_registers, OTHER_REG_NAME_CNT, name);
/* Put back the delimiting char. */ /* Put back the delimiting char. */
*input_line_pointer = c; (void) restore_line_pointer (c);
/* Look to see if it's in the register table. */ /* Look to see if it's in the register table. */
if (reg_number >= 0) if (reg_number >= 0)
@ -980,32 +977,31 @@ md_assemble (char *str)
} }
else if (operand->flags & MN10200_OPERAND_PSW) else if (operand->flags & MN10200_OPERAND_PSW)
{ {
char *start = input_line_pointer; char *start;
char c = get_symbol_end (); char c = get_symbol_name (&start);
if (strcmp (start, "psw") != 0) if (strcmp (start, "psw") != 0)
{ {
*input_line_pointer = c; (void) restore_line_pointer (c);
input_line_pointer = hold; input_line_pointer = hold;
str = hold; str = hold;
goto error; goto error;
} }
*input_line_pointer = c; (void) restore_line_pointer (c);
goto keep_going; goto keep_going;
} }
else if (operand->flags & MN10200_OPERAND_MDR) else if (operand->flags & MN10200_OPERAND_MDR)
{ {
char *start = input_line_pointer; char *start;
char c = get_symbol_end (); char c = get_symbol_name (&start);
(void) restore_line_pointer (c);
if (strcmp (start, "mdr") != 0) if (strcmp (start, "mdr") != 0)
{ {
*input_line_pointer = c;
input_line_pointer = hold; input_line_pointer = hold;
str = hold; str = hold;
goto error; goto error;
} }
*input_line_pointer = c;
goto keep_going; goto keep_going;
} }
else if (data_register_name (&ex)) else if (data_register_name (&ex))
@ -1337,4 +1333,3 @@ keep_going:
} }
} }
} }

View file

@ -337,13 +337,13 @@ get_register_name (expressionS * expressionP,
char c; char c;
/* Find the spelling of the operand. */ /* Find the spelling of the operand. */
start = name = input_line_pointer; start = input_line_pointer;
c = get_symbol_end (); c = get_symbol_name (&name);
reg_number = reg_name_search (table, table_length, name); reg_number = reg_name_search (table, table_length, name);
/* Put back the delimiting char. */ /* Put back the delimiting char. */
*input_line_pointer = c; (void) restore_line_pointer (c);
/* Look to see if it's in the register table. */ /* Look to see if it's in the register table. */
if (reg_number >= 0) if (reg_number >= 0)
@ -409,13 +409,13 @@ other_register_name (expressionS *expressionP)
char c; char c;
/* Find the spelling of the operand. */ /* Find the spelling of the operand. */
start = name = input_line_pointer; start = input_line_pointer;
c = get_symbol_end (); c = get_symbol_name (&name);
reg_number = reg_name_search (other_registers, ARRAY_SIZE (other_registers), name); reg_number = reg_name_search (other_registers, ARRAY_SIZE (other_registers), name);
/* Put back the delimiting char. */ /* Put back the delimiting char. */
*input_line_pointer = c; (void) restore_line_pointer (c);
/* Look to see if it's in the register table. */ /* Look to see if it's in the register table. */
if (reg_number == 0 if (reg_number == 0
@ -1346,17 +1346,17 @@ md_assemble (char *str)
} }
else if (operand->flags & MN10300_OPERAND_SP) else if (operand->flags & MN10300_OPERAND_SP)
{ {
char *start = input_line_pointer; char *start;
char c = get_symbol_end (); char c = get_symbol_name (&start);
if (strcasecmp (start, "sp") != 0) if (strcasecmp (start, "sp") != 0)
{ {
*input_line_pointer = c; (void) restore_line_pointer (c);
input_line_pointer = hold; input_line_pointer = hold;
str = hold; str = hold;
goto error; goto error;
} }
*input_line_pointer = c; (void) restore_line_pointer (c);
goto keep_going; goto keep_going;
} }
else if (operand->flags & MN10300_OPERAND_RREG) else if (operand->flags & MN10300_OPERAND_RREG)
@ -1397,92 +1397,94 @@ md_assemble (char *str)
} }
else if (operand->flags & MN10300_OPERAND_FPCR) else if (operand->flags & MN10300_OPERAND_FPCR)
{ {
char *start = input_line_pointer; char *start;
char c = get_symbol_end (); char c = get_symbol_name (&start);
if (strcasecmp (start, "fpcr") != 0) if (strcasecmp (start, "fpcr") != 0)
{ {
*input_line_pointer = c; (void) restore_line_pointer (c);
input_line_pointer = hold; input_line_pointer = hold;
str = hold; str = hold;
goto error; goto error;
} }
*input_line_pointer = c; (void) restore_line_pointer (c);
goto keep_going; goto keep_going;
} }
else if (operand->flags & MN10300_OPERAND_USP) else if (operand->flags & MN10300_OPERAND_USP)
{ {
char *start = input_line_pointer; char *start;
char c = get_symbol_end (); char c = get_symbol_name (&start);
if (strcasecmp (start, "usp") != 0) if (strcasecmp (start, "usp") != 0)
{ {
(void) restore_line_pointer (c);
*input_line_pointer = c; *input_line_pointer = c;
input_line_pointer = hold; input_line_pointer = hold;
str = hold; str = hold;
goto error; goto error;
} }
(void) restore_line_pointer (c);
*input_line_pointer = c; *input_line_pointer = c;
goto keep_going; goto keep_going;
} }
else if (operand->flags & MN10300_OPERAND_SSP) else if (operand->flags & MN10300_OPERAND_SSP)
{ {
char *start = input_line_pointer; char *start;
char c = get_symbol_end (); char c = get_symbol_name (&start);
if (strcasecmp (start, "ssp") != 0) if (strcasecmp (start, "ssp") != 0)
{ {
*input_line_pointer = c; (void) restore_line_pointer (c);
input_line_pointer = hold; input_line_pointer = hold;
str = hold; str = hold;
goto error; goto error;
} }
*input_line_pointer = c; (void) restore_line_pointer (c);
goto keep_going; goto keep_going;
} }
else if (operand->flags & MN10300_OPERAND_MSP) else if (operand->flags & MN10300_OPERAND_MSP)
{ {
char *start = input_line_pointer; char *start;
char c = get_symbol_end (); char c = get_symbol_name (&start);
if (strcasecmp (start, "msp") != 0) if (strcasecmp (start, "msp") != 0)
{ {
*input_line_pointer = c; (void) restore_line_pointer (c);
input_line_pointer = hold; input_line_pointer = hold;
str = hold; str = hold;
goto error; goto error;
} }
*input_line_pointer = c; (void) restore_line_pointer (c);
goto keep_going; goto keep_going;
} }
else if (operand->flags & MN10300_OPERAND_PC) else if (operand->flags & MN10300_OPERAND_PC)
{ {
char *start = input_line_pointer; char *start;
char c = get_symbol_end (); char c = get_symbol_name (&start);
if (strcasecmp (start, "pc") != 0) if (strcasecmp (start, "pc") != 0)
{ {
*input_line_pointer = c; (void) restore_line_pointer (c);
input_line_pointer = hold; input_line_pointer = hold;
str = hold; str = hold;
goto error; goto error;
} }
*input_line_pointer = c; (void) restore_line_pointer (c);
goto keep_going; goto keep_going;
} }
else if (operand->flags & MN10300_OPERAND_EPSW) else if (operand->flags & MN10300_OPERAND_EPSW)
{ {
char *start = input_line_pointer; char *start;
char c = get_symbol_end (); char c = get_symbol_name (&start);
if (strcasecmp (start, "epsw") != 0) if (strcasecmp (start, "epsw") != 0)
{ {
*input_line_pointer = c; (void) restore_line_pointer (c);
input_line_pointer = hold; input_line_pointer = hold;
str = hold; str = hold;
goto error; goto error;
} }
*input_line_pointer = c; (void) restore_line_pointer (c);
goto keep_going; goto keep_going;
} }
else if (operand->flags & MN10300_OPERAND_PLUS) else if (operand->flags & MN10300_OPERAND_PLUS)
@ -1498,32 +1500,32 @@ md_assemble (char *str)
} }
else if (operand->flags & MN10300_OPERAND_PSW) else if (operand->flags & MN10300_OPERAND_PSW)
{ {
char *start = input_line_pointer; char *start;
char c = get_symbol_end (); char c = get_symbol_name (&start);
if (strcasecmp (start, "psw") != 0) if (strcasecmp (start, "psw") != 0)
{ {
*input_line_pointer = c; (void) restore_line_pointer (c);
input_line_pointer = hold; input_line_pointer = hold;
str = hold; str = hold;
goto error; goto error;
} }
*input_line_pointer = c; (void) restore_line_pointer (c);
goto keep_going; goto keep_going;
} }
else if (operand->flags & MN10300_OPERAND_MDR) else if (operand->flags & MN10300_OPERAND_MDR)
{ {
char *start = input_line_pointer; char *start;
char c = get_symbol_end (); char c = get_symbol_name (&start);
if (strcasecmp (start, "mdr") != 0) if (strcasecmp (start, "mdr") != 0)
{ {
*input_line_pointer = c; (void) restore_line_pointer (c);
input_line_pointer = hold; input_line_pointer = hold;
str = hold; str = hold;
goto error; goto error;
} }
*input_line_pointer = c; (void) restore_line_pointer (c);
goto keep_going; goto keep_going;
} }
else if (operand->flags & MN10300_OPERAND_REG_LIST) else if (operand->flags & MN10300_OPERAND_REG_LIST)
@ -1554,57 +1556,56 @@ md_assemble (char *str)
if (*input_line_pointer == ',') if (*input_line_pointer == ',')
input_line_pointer++; input_line_pointer++;
start = input_line_pointer; c = get_symbol_name (&start);
c = get_symbol_end ();
if (strcasecmp (start, "d2") == 0) if (strcasecmp (start, "d2") == 0)
{ {
value |= 0x80; value |= 0x80;
*input_line_pointer = c; (void) restore_line_pointer (c);
} }
else if (strcasecmp (start, "d3") == 0) else if (strcasecmp (start, "d3") == 0)
{ {
value |= 0x40; value |= 0x40;
*input_line_pointer = c; (void) restore_line_pointer (c);
} }
else if (strcasecmp (start, "a2") == 0) else if (strcasecmp (start, "a2") == 0)
{ {
value |= 0x20; value |= 0x20;
*input_line_pointer = c; (void) restore_line_pointer (c);
} }
else if (strcasecmp (start, "a3") == 0) else if (strcasecmp (start, "a3") == 0)
{ {
value |= 0x10; value |= 0x10;
*input_line_pointer = c; (void) restore_line_pointer (c);
} }
else if (strcasecmp (start, "other") == 0) else if (strcasecmp (start, "other") == 0)
{ {
value |= 0x08; value |= 0x08;
*input_line_pointer = c; (void) restore_line_pointer (c);
} }
else if (HAVE_AM33 else if (HAVE_AM33
&& strcasecmp (start, "exreg0") == 0) && strcasecmp (start, "exreg0") == 0)
{ {
value |= 0x04; value |= 0x04;
*input_line_pointer = c; (void) restore_line_pointer (c);
} }
else if (HAVE_AM33 else if (HAVE_AM33
&& strcasecmp (start, "exreg1") == 0) && strcasecmp (start, "exreg1") == 0)
{ {
value |= 0x02; value |= 0x02;
*input_line_pointer = c; (void) restore_line_pointer (c);
} }
else if (HAVE_AM33 else if (HAVE_AM33
&& strcasecmp (start, "exother") == 0) && strcasecmp (start, "exother") == 0)
{ {
value |= 0x01; value |= 0x01;
*input_line_pointer = c; (void) restore_line_pointer (c);
} }
else if (HAVE_AM33 else if (HAVE_AM33
&& strcasecmp (start, "all") == 0) && strcasecmp (start, "all") == 0)
{ {
value |= 0xff; value |= 0xff;
*input_line_pointer = c; (void) restore_line_pointer (c);
} }
else else
{ {

View file

@ -566,10 +566,11 @@ s_nios2_sdata (int ignore ATTRIBUTE_UNUSED)
static void static void
s_nios2_set (int equiv) s_nios2_set (int equiv)
{ {
char *directive = input_line_pointer; char *directive;
char delim = get_symbol_end (); char delim = get_symbol_name (&directive);
char *endline = input_line_pointer; char *endline = input_line_pointer;
*endline = delim;
(void) restore_line_pointer (delim);
/* We only want to handle ".set XXX" if the /* We only want to handle ".set XXX" if the
user has tried ".set XXX, YYY" they are not user has tried ".set XXX, YYY" they are not

View file

@ -860,7 +860,7 @@ register_name (expressionS *expressionP)
else if (!reg_names_p || !ISALPHA (name[0])) else if (!reg_names_p || !ISALPHA (name[0]))
return FALSE; return FALSE;
c = get_symbol_end (); c = get_symbol_name (&name);
reg_number = reg_name_search (pre_defined_registers, REG_NAME_CNT, name); reg_number = reg_name_search (pre_defined_registers, REG_NAME_CNT, name);
/* Put back the delimiting char. */ /* Put back the delimiting char. */
@ -2142,13 +2142,12 @@ ppc_elf_lcomm (int xxx ATTRIBUTE_UNUSED)
char *pfrag; char *pfrag;
int align2; int align2;
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
/* just after name is now '\0'. */ /* Just after name is now '\0'. */
p = input_line_pointer; p = input_line_pointer;
*p = c; *p = c;
SKIP_WHITESPACE (); SKIP_WHITESPACE_AFTER_NAME ();
if (*input_line_pointer != ',') if (*input_line_pointer != ',')
{ {
as_bad (_("expected comma after symbol-name: rest of line ignored.")); as_bad (_("expected comma after symbol-name: rest of line ignored."));
@ -2238,8 +2237,8 @@ ppc_elf_lcomm (int xxx ATTRIBUTE_UNUSED)
static void static void
ppc_elf_localentry (int ignore ATTRIBUTE_UNUSED) ppc_elf_localentry (int ignore ATTRIBUTE_UNUSED)
{ {
char *name = input_line_pointer; char *name;
char c = get_symbol_end (); char c = get_symbol_name (&name);
char *p; char *p;
expressionS exp; expressionS exp;
symbolS *sym; symbolS *sym;
@ -2248,7 +2247,7 @@ ppc_elf_localentry (int ignore ATTRIBUTE_UNUSED)
p = input_line_pointer; p = input_line_pointer;
*p = c; *p = c;
SKIP_WHITESPACE (); SKIP_WHITESPACE_AFTER_NAME ();
if (*input_line_pointer != ',') if (*input_line_pointer != ',')
{ {
*p = 0; *p = 0;
@ -2491,8 +2490,7 @@ parse_toc_entry (enum toc_size_qualifier *toc_kind)
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
/* Find the spelling of the operand. */ /* Find the spelling of the operand. */
toc_spec = input_line_pointer; c = get_symbol_name (&toc_spec);
c = get_symbol_end ();
if (strcmp (toc_spec, "toc") == 0) if (strcmp (toc_spec, "toc") == 0)
{ {
@ -2521,7 +2519,7 @@ parse_toc_entry (enum toc_size_qualifier *toc_kind)
/* Now find the ']'. */ /* Now find the ']'. */
*input_line_pointer = c; *input_line_pointer = c;
SKIP_WHITESPACE (); /* leading whitespace could be there. */ SKIP_WHITESPACE_AFTER_NAME (); /* leading whitespace could be there. */
c = *input_line_pointer++; /* input_line_pointer->past char in c. */ c = *input_line_pointer++; /* input_line_pointer->past char in c. */
if (c != ']') if (c != ']')
@ -3630,10 +3628,9 @@ ppc_comm (int lcomm)
symbolS *sym; symbolS *sym;
char *pfrag; char *pfrag;
name = input_line_pointer; endc = get_symbol_name (&name);
endc = get_symbol_end ();
end_name = input_line_pointer; end_name = input_line_pointer;
*end_name = endc; (void) restore_line_pointer (endc);
if (*input_line_pointer != ',') if (*input_line_pointer != ',')
{ {
@ -3684,12 +3681,11 @@ ppc_comm (int lcomm)
} }
++input_line_pointer; ++input_line_pointer;
lcomm_name = input_line_pointer; lcomm_endc = get_symbol_name (&lcomm_name);
lcomm_endc = get_symbol_end ();
lcomm_sym = symbol_find_or_make (lcomm_name); lcomm_sym = symbol_find_or_make (lcomm_name);
*input_line_pointer = lcomm_endc; (void) restore_line_pointer (lcomm_endc);
/* The fourth argument to .lcomm is the alignment. */ /* The fourth argument to .lcomm is the alignment. */
if (*input_line_pointer != ',') if (*input_line_pointer != ',')
@ -3792,12 +3788,11 @@ ppc_csect (int ignore ATTRIBUTE_UNUSED)
symbolS *sym; symbolS *sym;
offsetT align; offsetT align;
name = input_line_pointer; endc = get_symbol_name (&name);
endc = get_symbol_end ();
sym = symbol_find_or_make (name); sym = symbol_find_or_make (name);
*input_line_pointer = endc; (void) restore_line_pointer (endc);
if (S_GET_NAME (sym)[0] == '\0') if (S_GET_NAME (sym)[0] == '\0')
{ {
@ -3965,15 +3960,14 @@ ppc_dwsect (int ignore ATTRIBUTE_UNUSED)
/* Parse opt-label. */ /* Parse opt-label. */
if (*input_line_pointer == ',') if (*input_line_pointer == ',')
{ {
const char *label; char *label;
char c; char c;
++input_line_pointer; ++input_line_pointer;
label = input_line_pointer; c = get_symbol_name (&label);
c = get_symbol_end ();
opt_label = symbol_find_or_make (label); opt_label = symbol_find_or_make (label);
*input_line_pointer = c; (void) restore_line_pointer (c);
} }
else else
opt_label = NULL; opt_label = NULL;
@ -4103,8 +4097,7 @@ ppc_named_section (int ignore ATTRIBUTE_UNUSED)
char c; char c;
symbolS *sym; symbolS *sym;
user_name = input_line_pointer; c = get_symbol_name (&user_name);
c = get_symbol_end ();
if (strcmp (user_name, ".text") == 0) if (strcmp (user_name, ".text") == 0)
real_name = ".text[PR]"; real_name = ".text[PR]";
@ -4113,12 +4106,12 @@ ppc_named_section (int ignore ATTRIBUTE_UNUSED)
else else
{ {
as_bad (_("the XCOFF file format does not support arbitrary sections")); as_bad (_("the XCOFF file format does not support arbitrary sections"));
*input_line_pointer = c; (void) restore_line_pointer (c);
ignore_rest_of_line (); ignore_rest_of_line ();
return; return;
} }
*input_line_pointer = c; (void) restore_line_pointer (c);
sym = symbol_find_or_make (real_name); sym = symbol_find_or_make (real_name);
@ -4135,12 +4128,11 @@ ppc_extern (int ignore ATTRIBUTE_UNUSED)
char *name; char *name;
char endc; char endc;
name = input_line_pointer; endc = get_symbol_name (&name);
endc = get_symbol_end ();
(void) symbol_find_or_make (name); (void) symbol_find_or_make (name);
*input_line_pointer = endc; (void) restore_line_pointer (endc);
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
} }
@ -4154,12 +4146,11 @@ ppc_lglobl (int ignore ATTRIBUTE_UNUSED)
char endc; char endc;
symbolS *sym; symbolS *sym;
name = input_line_pointer; endc = get_symbol_name (&name);
endc = get_symbol_end ();
sym = symbol_find_or_make (name); sym = symbol_find_or_make (name);
*input_line_pointer = endc; (void) restore_line_pointer (endc);
symbol_get_tc (sym)->output = 1; symbol_get_tc (sym)->output = 1;
@ -4192,14 +4183,13 @@ ppc_ref (int ignore ATTRIBUTE_UNUSED)
do do
{ {
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
fix_at_start (symbol_get_frag (ppc_current_csect), 0, fix_at_start (symbol_get_frag (ppc_current_csect), 0,
symbol_find_or_make (name), 0, FALSE, BFD_RELOC_NONE); symbol_find_or_make (name), 0, FALSE, BFD_RELOC_NONE);
*input_line_pointer = c; *input_line_pointer = c;
SKIP_WHITESPACE (); SKIP_WHITESPACE_AFTER_NAME ();
c = *input_line_pointer; c = *input_line_pointer;
if (c == ',') if (c == ',')
{ {
@ -4229,12 +4219,11 @@ ppc_rename (int ignore ATTRIBUTE_UNUSED)
symbolS *sym; symbolS *sym;
int len; int len;
name = input_line_pointer; endc = get_symbol_name (&name);
endc = get_symbol_end ();
sym = symbol_find_or_make (name); sym = symbol_find_or_make (name);
*input_line_pointer = endc; (void) restore_line_pointer (endc);
if (*input_line_pointer != ',') if (*input_line_pointer != ',')
{ {
@ -4393,8 +4382,7 @@ ppc_function (int ignore ATTRIBUTE_UNUSED)
symbolS *ext_sym; symbolS *ext_sym;
symbolS *lab_sym; symbolS *lab_sym;
name = input_line_pointer; endc = get_symbol_name (&name);
endc = get_symbol_end ();
/* Ignore any [PR] suffix. */ /* Ignore any [PR] suffix. */
name = ppc_canonicalize_symbol_name (name); name = ppc_canonicalize_symbol_name (name);
@ -4405,7 +4393,7 @@ ppc_function (int ignore ATTRIBUTE_UNUSED)
ext_sym = symbol_find_or_make (name); ext_sym = symbol_find_or_make (name);
*input_line_pointer = endc; (void) restore_line_pointer (endc);
if (*input_line_pointer != ',') if (*input_line_pointer != ',')
{ {
@ -4415,12 +4403,11 @@ ppc_function (int ignore ATTRIBUTE_UNUSED)
} }
++input_line_pointer; ++input_line_pointer;
name = input_line_pointer; endc = get_symbol_name (&name);
endc = get_symbol_end ();
lab_sym = symbol_find_or_make (name); lab_sym = symbol_find_or_make (name);
*input_line_pointer = endc; (void) restore_line_pointer (endc);
if (ext_sym != lab_sym) if (ext_sym != lab_sym)
{ {
@ -4599,12 +4586,11 @@ ppc_bs (int ignore ATTRIBUTE_UNUSED)
if (ppc_current_block != NULL) if (ppc_current_block != NULL)
as_bad (_("nested .bs blocks")); as_bad (_("nested .bs blocks"));
name = input_line_pointer; endc = get_symbol_name (&name);
endc = get_symbol_end ();
csect = symbol_find_or_make (name); csect = symbol_find_or_make (name);
*input_line_pointer = endc; (void) restore_line_pointer (endc);
sym = symbol_make (".bs"); sym = symbol_make (".bs");
S_SET_SEGMENT (sym, now_seg); S_SET_SEGMENT (sym, now_seg);
@ -4881,12 +4867,11 @@ ppc_tc (int ignore ATTRIBUTE_UNUSED)
return; return;
} }
name = input_line_pointer; endc = get_symbol_name (&name);
endc = get_symbol_end ();
sym = symbol_find_or_make (name); sym = symbol_find_or_make (name);
*input_line_pointer = endc; (void) restore_line_pointer (endc);
if (S_IS_DEFINED (sym)) if (S_IS_DEFINED (sym))
{ {
@ -4952,6 +4937,7 @@ ppc_tc (int ignore ATTRIBUTE_UNUSED)
static void static void
ppc_machine (int ignore ATTRIBUTE_UNUSED) ppc_machine (int ignore ATTRIBUTE_UNUSED)
{ {
char c;
char *cpu_string; char *cpu_string;
#define MAX_HISTORY 100 #define MAX_HISTORY 100
static ppc_cpu_t *cpu_history; static ppc_cpu_t *cpu_history;
@ -4959,19 +4945,9 @@ ppc_machine (int ignore ATTRIBUTE_UNUSED)
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
if (*input_line_pointer == '"') c = get_symbol_name (&cpu_string);
{
int len;
cpu_string = demand_copy_C_string (&len);
}
else
{
char c;
cpu_string = input_line_pointer;
c = get_symbol_end ();
cpu_string = xstrdup (cpu_string); cpu_string = xstrdup (cpu_string);
*input_line_pointer = c; (void) restore_line_pointer (c);
}
if (cpu_string != NULL) if (cpu_string != NULL)
{ {
@ -5210,8 +5186,7 @@ ppc_znop (int ignore ATTRIBUTE_UNUSED)
char *name; char *name;
/* Strip out the symbol name. */ /* Strip out the symbol name. */
symbol_name = input_line_pointer; c = get_symbol_name (&symbol_name);
c = get_symbol_end ();
name = xmalloc (input_line_pointer - symbol_name + 1); name = xmalloc (input_line_pointer - symbol_name + 1);
strcpy (name, symbol_name); strcpy (name, symbol_name);
@ -5220,7 +5195,7 @@ ppc_znop (int ignore ATTRIBUTE_UNUSED)
*input_line_pointer = c; *input_line_pointer = c;
SKIP_WHITESPACE (); SKIP_WHITESPACE_AFTER_NAME ();
/* Look up the opcode in the hash table. */ /* Look up the opcode in the hash table. */
opcode = (const struct powerpc_opcode *) hash_find (ppc_hash, "nop"); opcode = (const struct powerpc_opcode *) hash_find (ppc_hash, "nop");
@ -5256,13 +5231,12 @@ ppc_pe_comm (int lcomm)
symbolS *symbolP; symbolS *symbolP;
offsetT align; offsetT align;
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
/* just after name is now '\0'. */ /* just after name is now '\0'. */
p = input_line_pointer; p = input_line_pointer;
*p = c; *p = c;
SKIP_WHITESPACE (); SKIP_WHITESPACE_AFTER_NAME ();
if (*input_line_pointer != ',') if (*input_line_pointer != ',')
{ {
as_bad (_("expected comma after symbol-name: rest of line ignored.")); as_bad (_("expected comma after symbol-name: rest of line ignored."));
@ -5387,15 +5361,14 @@ ppc_pe_section (int ignore ATTRIBUTE_UNUSED)
segT sec; segT sec;
int align; int align;
section_name = input_line_pointer; c = get_symbol_name (&section_name);
c = get_symbol_end ();
name = xmalloc (input_line_pointer - section_name + 1); name = xmalloc (input_line_pointer - section_name + 1);
strcpy (name, section_name); strcpy (name, section_name);
*input_line_pointer = c; *input_line_pointer = c;
SKIP_WHITESPACE (); SKIP_WHITESPACE_AFTER_NAME ();
exp = 0; exp = 0;
flags = SEC_NO_FLAGS; flags = SEC_NO_FLAGS;
@ -5543,12 +5516,11 @@ ppc_pe_function (int ignore ATTRIBUTE_UNUSED)
char endc; char endc;
symbolS *ext_sym; symbolS *ext_sym;
name = input_line_pointer; endc = get_symbol_name (&name);
endc = get_symbol_end ();
ext_sym = symbol_find_or_make (name); ext_sym = symbol_find_or_make (name);
*input_line_pointer = endc; (void) restore_line_pointer (endc);
S_SET_DATA_TYPE (ext_sym, DT_FCN << N_BTSHFT); S_SET_DATA_TYPE (ext_sym, DT_FCN << N_BTSHFT);
SF_SET_FUNCTION (ext_sym); SF_SET_FUNCTION (ext_sym);

View file

@ -168,11 +168,11 @@ register_name (expressionS *expressionP)
else else
return FALSE; return FALSE;
c = get_symbol_end (); c = get_symbol_name (&name);
reg_number = reg_name_search (name); reg_number = reg_name_search (name);
/* Put back the delimiting char. */ /* Put back the delimiting char. */
*input_line_pointer = c; (void) restore_line_pointer (c);
/* Look to see if it's in the register table. */ /* Look to see if it's in the register table. */
if (reg_number >= 0) if (reg_number >= 0)
@ -1793,10 +1793,9 @@ s390_machine (int ignore ATTRIBUTE_UNUSED)
else else
{ {
char c; char c;
cpu_string = input_line_pointer; c = get_symbol_name (&cpu_string);
c = get_symbol_end ();
cpu_string = xstrdup (cpu_string); cpu_string = xstrdup (cpu_string);
*input_line_pointer = c; (void) restore_line_pointer (c);
} }
if (cpu_string != NULL) if (cpu_string != NULL)
@ -1848,18 +1847,12 @@ s390_machinemode (int ignore ATTRIBUTE_UNUSED)
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
if (*input_line_pointer == '"')
{
int len;
mode_string = demand_copy_C_string (&len);
}
else
{ {
char c; char c;
mode_string = input_line_pointer;
c = get_symbol_end (); c = get_symbol_name (&mode_string);
mode_string = xstrdup (mode_string); mode_string = xstrdup (mode_string);
*input_line_pointer = c; (void) restore_line_pointer (c);
} }
if (mode_string != NULL) if (mode_string != NULL)

View file

@ -5619,10 +5619,9 @@ s3_get_symbol (void)
char *name; char *name;
symbolS *p; symbolS *p;
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
p = (symbolS *) symbol_find_or_make (name); p = (symbolS *) symbol_find_or_make (name);
*input_line_pointer = c; (void) restore_line_pointer (c);
return p; return p;
} }
@ -6095,10 +6094,9 @@ s3_s_score_lcomm (int bytes_p)
segT bss_seg = bss_section; segT bss_seg = bss_section;
int needs_align = 0; int needs_align = 0;
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
p = input_line_pointer; p = input_line_pointer;
*p = c; (void) restore_line_pointer (c);
if (name == p) if (name == p)
{ {

View file

@ -5471,10 +5471,9 @@ s7_get_symbol (void)
char *name; char *name;
symbolS *p; symbolS *p;
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
p = (symbolS *) symbol_find_or_make (name); p = (symbolS *) symbol_find_or_make (name);
*input_line_pointer = c; (void) restore_line_pointer (c);
return p; return p;
} }
@ -5954,8 +5953,7 @@ s7_s_score_lcomm (int bytes_p)
segT bss_seg = bss_section; segT bss_seg = bss_section;
int needs_align = 0; int needs_align = 0;
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
p = input_line_pointer; p = input_line_pointer;
*p = c; *p = c;
@ -5966,7 +5964,7 @@ s7_s_score_lcomm (int bytes_p)
return; return;
} }
SKIP_WHITESPACE (); SKIP_WHITESPACE_AFTER_NAME ();
/* Accept an optional comma after the name. The comma used to be /* Accept an optional comma after the name. The comma used to be
required, but Irix 5 cc does not generate it. */ required, but Irix 5 cc does not generate it. */

View file

@ -3975,11 +3975,10 @@ s_reserve (int ignore ATTRIBUTE_UNUSED)
int temp; int temp;
symbolS *symbolP; symbolS *symbolP;
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
p = input_line_pointer; p = input_line_pointer;
*p = c; *p = c;
SKIP_WHITESPACE (); SKIP_WHITESPACE_AFTER_NAME ();
if (*input_line_pointer != ',') if (*input_line_pointer != ',')
{ {
@ -4117,12 +4116,11 @@ s_common (int ignore ATTRIBUTE_UNUSED)
offsetT temp, size; offsetT temp, size;
symbolS *symbolP; symbolS *symbolP;
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
/* Just after name is now '\0'. */ /* Just after name is now '\0'. */
p = input_line_pointer; p = input_line_pointer;
*p = c; *p = c;
SKIP_WHITESPACE (); SKIP_WHITESPACE_AFTER_NAME ();
if (*input_line_pointer != ',') if (*input_line_pointer != ',')
{ {
as_bad (_("Expected comma after symbol-name")); as_bad (_("Expected comma after symbol-name"));
@ -4388,7 +4386,7 @@ s_register (int ignore ATTRIBUTE_UNUSED)
char c; char c;
int reg; int reg;
int flags; int flags;
const char *regname; char *regname;
if (input_line_pointer[0] != '%' if (input_line_pointer[0] != '%'
|| input_line_pointer[1] != 'g' || input_line_pointer[1] != 'g'
@ -4402,8 +4400,7 @@ s_register (int ignore ATTRIBUTE_UNUSED)
if (*input_line_pointer == '#') if (*input_line_pointer == '#')
{ {
++input_line_pointer; ++input_line_pointer;
regname = input_line_pointer; c = get_symbol_name (&regname);
c = get_symbol_end ();
if (strcmp (regname, "scratch") && strcmp (regname, "ignore")) if (strcmp (regname, "scratch") && strcmp (regname, "ignore"))
as_bad (_("register syntax is .register %%g[2367],{#scratch|symbolname|#ignore}")); as_bad (_("register syntax is .register %%g[2367],{#scratch|symbolname|#ignore}"));
if (regname[0] == 'i') if (regname[0] == 'i')
@ -4413,9 +4410,9 @@ s_register (int ignore ATTRIBUTE_UNUSED)
} }
else else
{ {
regname = input_line_pointer; c = get_symbol_name (&regname);
c = get_symbol_end ();
} }
if (sparc_arch_size == 64) if (sparc_arch_size == 64)
{ {
if (globals[reg]) if (globals[reg])
@ -4462,7 +4459,7 @@ s_register (int ignore ATTRIBUTE_UNUSED)
} }
} }
*input_line_pointer = c; (void) restore_line_pointer (c);
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
} }

View file

@ -727,8 +727,7 @@ tic4x_asg (int x ATTRIBUTE_UNUSED)
return; return;
} }
*input_line_pointer++ = '\0'; *input_line_pointer++ = '\0';
name = input_line_pointer; c = get_symbol_name (&name); /* Get terminator. */
c = get_symbol_end (); /* Get terminator. */
tmp = xmalloc (strlen (str) + 1); tmp = xmalloc (strlen (str) + 1);
strcpy (tmp, str); strcpy (tmp, str);
str = tmp; str = tmp;
@ -739,7 +738,7 @@ tic4x_asg (int x ATTRIBUTE_UNUSED)
hash_replace (tic4x_asg_hash, name, (void *) str); hash_replace (tic4x_asg_hash, name, (void *) str);
else else
hash_insert (tic4x_asg_hash, name, (void *) str); hash_insert (tic4x_asg_hash, name, (void *) str);
*input_line_pointer = c; (void) restore_line_pointer (c);
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
} }
@ -759,8 +758,9 @@ tic4x_bss (int x ATTRIBUTE_UNUSED)
current_subseg = now_subseg; /* Save current subseg. */ current_subseg = now_subseg; /* Save current subseg. */
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
name = input_line_pointer; c = get_symbol_name (&name); /* Get terminator. */
c = get_symbol_end (); /* Get terminator. */ if (c == '"')
c = * ++ input_line_pointer;
if (c != ',') if (c != ',')
{ {
as_bad (_(".bss size argument missing\n")); as_bad (_(".bss size argument missing\n"));
@ -807,11 +807,10 @@ tic4x_globl (int ignore ATTRIBUTE_UNUSED)
do do
{ {
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
symbolP = symbol_find_or_make (name); symbolP = symbol_find_or_make (name);
*input_line_pointer = c; *input_line_pointer = c;
SKIP_WHITESPACE (); SKIP_WHITESPACE_AFTER_NAME ();
S_SET_STORAGE_CLASS (symbolP, C_EXT); S_SET_STORAGE_CLASS (symbolP, C_EXT);
S_SET_EXTERNAL (symbolP); S_SET_EXTERNAL (symbolP);
if (c == ',') if (c == ',')
@ -939,10 +938,9 @@ tic4x_eval (int x ATTRIBUTE_UNUSED)
as_bad (_("Symbol missing\n")); as_bad (_("Symbol missing\n"));
return; return;
} }
name = input_line_pointer; c = get_symbol_name (&name); /* Get terminator. */
c = get_symbol_end (); /* Get terminator. */
tic4x_insert_sym (name, value); tic4x_insert_sym (name, value);
*input_line_pointer++ = c; (void) restore_line_pointer (c);
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
} }
@ -967,8 +965,9 @@ tic4x_sect (int x ATTRIBUTE_UNUSED)
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
if (*input_line_pointer == '"') if (*input_line_pointer == '"')
input_line_pointer++; input_line_pointer++;
section_name = input_line_pointer; c = get_symbol_name (&section_name); /* Get terminator. */
c = get_symbol_end (); /* Get terminator. */ if (c == '"')
c = * ++ input_line_pointer;
input_line_pointer++; /* Skip null symbol terminator. */ input_line_pointer++; /* Skip null symbol terminator. */
name = xmalloc (input_line_pointer - section_name + 1); name = xmalloc (input_line_pointer - section_name + 1);
strcpy (name, section_name); strcpy (name, section_name);
@ -980,13 +979,16 @@ tic4x_sect (int x ATTRIBUTE_UNUSED)
Volker Kuhlmann <v.kuhlmann@elec.canterbury.ac.nz>. */ Volker Kuhlmann <v.kuhlmann@elec.canterbury.ac.nz>. */
if (c == ':') if (c == ':')
{ {
c = get_symbol_end (); /* Get terminator. */ char *subname;
c = get_symbol_name (&subname); /* Get terminator. */
if (c == '"')
c = * ++ input_line_pointer;
input_line_pointer++; /* Skip null symbol terminator. */ input_line_pointer++; /* Skip null symbol terminator. */
as_warn (_(".sect: subsection name ignored")); as_warn (_(".sect: subsection name ignored"));
} }
/* We might still have a '"' to discard, but the character after a /* We might still have a '"' to discard, but the character after a
symbol name will be overwritten with a \0 by get_symbol_end() symbol name will be overwritten with a \0 by get_symbol_name()
[VK]. */ [VK]. */
if (c == ',') if (c == ',')
@ -1014,7 +1016,7 @@ tic4x_sect (int x ATTRIBUTE_UNUSED)
bfd_errmsg (bfd_get_error ())); bfd_errmsg (bfd_get_error ()));
} }
/* If the last character overwritten by get_symbol_end() was an /* If the last character overwritten by get_symbol_name() was an
end-of-line, we must restore it or the end of the line will not be end-of-line, we must restore it or the end of the line will not be
recognised and scanning extends into the next line, stopping with recognised and scanning extends into the next line, stopping with
an error (blame Volker Kuhlmann <v.kuhlmann@elec.canterbury.ac.nz> an error (blame Volker Kuhlmann <v.kuhlmann@elec.canterbury.ac.nz>
@ -1037,8 +1039,9 @@ tic4x_set (int x ATTRIBUTE_UNUSED)
char c; char c;
char *name; char *name;
name = input_line_pointer; c = get_symbol_name (&name); /* Get terminator. */
c = get_symbol_end (); /* Get terminator. */ if (c == '"')
c = * ++ input_line_pointer;
if (c != ',') if (c != ',')
{ {
as_bad (_(".set syntax invalid\n")); as_bad (_(".set syntax invalid\n"));
@ -1073,8 +1076,9 @@ tic4x_usect (int x ATTRIBUTE_UNUSED)
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
if (*input_line_pointer == '"') if (*input_line_pointer == '"')
input_line_pointer++; input_line_pointer++;
section_name = input_line_pointer; c = get_symbol_name (&section_name); /* Get terminator. */
c = get_symbol_end (); /* Get terminator. */ if (c == '"')
c = * ++ input_line_pointer;
input_line_pointer++; /* Skip null symbol terminator. */ input_line_pointer++; /* Skip null symbol terminator. */
name = xmalloc (input_line_pointer - section_name + 1); name = xmalloc (input_line_pointer - section_name + 1);
strcpy (name, section_name); strcpy (name, section_name);
@ -1513,17 +1517,16 @@ tic4x_operand_parse (char *s, tic4x_operand_t *operand)
input_line_pointer = s; input_line_pointer = s;
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
str = input_line_pointer; c = get_symbol_name (&str); /* Get terminator. */
c = get_symbol_end (); /* Get terminator. */
new_pointer = input_line_pointer; new_pointer = input_line_pointer;
if (strlen (str) && (entry = hash_find (tic4x_asg_hash, str)) != NULL) if (strlen (str) && (entry = hash_find (tic4x_asg_hash, str)) != NULL)
{ {
*input_line_pointer = c; (void) restore_line_pointer (c);
input_line_pointer = (char *) entry; input_line_pointer = (char *) entry;
} }
else else
{ {
*input_line_pointer = c; (void) restore_line_pointer (c);
input_line_pointer = str; input_line_pointer = str;
} }

View file

@ -351,8 +351,8 @@ tic54x_asg (int x ATTRIBUTE_UNUSED)
return; return;
} }
name = ++input_line_pointer; ++input_line_pointer;
c = get_symbol_end (); /* Get terminator. */ c = get_symbol_name (&name); /* Get terminator. */
if (!ISALPHA (*name)) if (!ISALPHA (*name))
{ {
as_bad (_("symbols assigned with .asg must begin with a letter")); as_bad (_("symbols assigned with .asg must begin with a letter"));
@ -367,7 +367,7 @@ tic54x_asg (int x ATTRIBUTE_UNUSED)
strcpy (tmp, name); strcpy (tmp, name);
name = tmp; name = tmp;
subsym_create_or_replace (name, str); subsym_create_or_replace (name, str);
*input_line_pointer = c; (void) restore_line_pointer (c);
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
} }
@ -411,11 +411,10 @@ tic54x_eval (int x ATTRIBUTE_UNUSED)
ignore_rest_of_line (); ignore_rest_of_line ();
return; return;
} }
name = input_line_pointer; c = get_symbol_name (&name); /* Get terminator. */
c = get_symbol_end (); /* Get terminator. */
tmp = xmalloc (strlen (name) + 1); tmp = xmalloc (strlen (name) + 1);
name = strcpy (tmp, name); name = strcpy (tmp, name);
*input_line_pointer = c; (void) restore_line_pointer (c);
if (!ISALPHA (*name)) if (!ISALPHA (*name))
{ {
@ -471,8 +470,9 @@ tic54x_bss (int x ATTRIBUTE_UNUSED)
current_seg = now_seg; /* Save current seg. */ current_seg = now_seg; /* Save current seg. */
current_subseg = now_subseg; /* Save current subseg. */ current_subseg = now_subseg; /* Save current subseg. */
name = input_line_pointer; c = get_symbol_name (&name); /* Get terminator. */
c = get_symbol_end (); /* Get terminator. */ if (c == '"')
c = * ++ input_line_pointer;
if (c != ',') if (c != ',')
{ {
as_bad (_(".bss size argument missing\n")); as_bad (_(".bss size argument missing\n"));
@ -782,8 +782,8 @@ tic54x_endstruct (int is_union)
static void static void
tic54x_tag (int ignore ATTRIBUTE_UNUSED) tic54x_tag (int ignore ATTRIBUTE_UNUSED)
{ {
char *name = input_line_pointer; char *name;
int c = get_symbol_end (); int c = get_symbol_name (&name);
struct stag *stag = (struct stag *) hash_find (stag_hash, name); struct stag *stag = (struct stag *) hash_find (stag_hash, name);
if (!stag) if (!stag)
@ -829,7 +829,7 @@ tic54x_tag (int ignore ATTRIBUTE_UNUSED)
if (current_stag != NULL && !current_stag->is_union) if (current_stag != NULL && !current_stag->is_union)
abs_section_offset += stag->size; abs_section_offset += stag->size;
*input_line_pointer = c; (void) restore_line_pointer (c);
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
line_label = NULL; line_label = NULL;
} }
@ -1109,11 +1109,10 @@ tic54x_global (int type)
do do
{ {
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
symbolP = symbol_find_or_make (name); symbolP = symbol_find_or_make (name);
c = restore_line_pointer (c);
*input_line_pointer = c;
S_SET_STORAGE_CLASS (symbolP, C_EXT); S_SET_STORAGE_CLASS (symbolP, C_EXT);
if (c == ',') if (c == ',')
{ {
@ -1184,13 +1183,14 @@ tic54x_sect (int arg)
else else
{ {
int c; int c;
name = input_line_pointer;
c = get_symbol_end (); c = get_symbol_name (&name);
len = strlen(name); len = strlen(name);
name = strcpy (xmalloc (len + 10), name); name = strcpy (xmalloc (len + 10), name);
*input_line_pointer = c; (void) restore_line_pointer (c);
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
} }
/* Make sure all named initialized sections flagged properly. If we /* Make sure all named initialized sections flagged properly. If we
encounter instructions, we'll flag it with SEC_CODE as well. */ encounter instructions, we'll flag it with SEC_CODE as well. */
strcat (name, ",\"w\"\n"); strcat (name, ",\"w\"\n");
@ -1366,17 +1366,14 @@ tic54x_usect (int x ATTRIBUTE_UNUSED)
current_seg = now_seg; /* Save current seg. */ current_seg = now_seg; /* Save current seg. */
current_subseg = now_subseg; /* Save current subseg. */ current_subseg = now_subseg; /* Save current subseg. */
if (*input_line_pointer == '"') c = get_symbol_name (&section_name); /* Get terminator. */
input_line_pointer++;
section_name = input_line_pointer;
c = get_symbol_end (); /* Get terminator. */
input_line_pointer++; /* Skip null symbol terminator. */
name = xmalloc (input_line_pointer - section_name + 1); name = xmalloc (input_line_pointer - section_name + 1);
strcpy (name, section_name); strcpy (name, section_name);
c = restore_line_pointer (c);
if (*input_line_pointer == ',') if (c == ',')
++input_line_pointer; ++input_line_pointer;
else if (c != ',') else
{ {
as_bad (_("Missing size argument")); as_bad (_("Missing size argument"));
ignore_rest_of_line (); ignore_rest_of_line ();
@ -2008,17 +2005,17 @@ tic54x_message (int type)
static void static void
tic54x_label (int ignored ATTRIBUTE_UNUSED) tic54x_label (int ignored ATTRIBUTE_UNUSED)
{ {
char *name = input_line_pointer; char *name;
symbolS *symbolP; symbolS *symbolP;
int c; int c;
ILLEGAL_WITHIN_STRUCT (); ILLEGAL_WITHIN_STRUCT ();
c = get_symbol_end (); c = get_symbol_name (&name);
symbolP = colon (name); symbolP = colon (name);
S_SET_STORAGE_CLASS (symbolP, C_STATLAB); S_SET_STORAGE_CLASS (symbolP, C_STATLAB);
*input_line_pointer = c; (void) restore_line_pointer (c);
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
} }
@ -2141,12 +2138,12 @@ tic54x_sblock (int ignore ATTRIBUTE_UNUSED)
} }
else else
{ {
char *section_name = input_line_pointer; char *section_name;
c = get_symbol_end (); c = get_symbol_name (&section_name);
name = xmalloc (strlen (section_name) + 1); name = xmalloc (strlen (section_name) + 1);
strcpy (name, section_name); strcpy (name, section_name);
*input_line_pointer = c; (void) restore_line_pointer (c);
} }
seg = bfd_get_section_by_name (stdoutput, name); seg = bfd_get_section_by_name (stdoutput, name);
@ -2256,12 +2253,11 @@ tic54x_var (int ignore ATTRIBUTE_UNUSED)
ignore_rest_of_line (); ignore_rest_of_line ();
return; return;
} }
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
/* .var symbols start out with a null string. */ /* .var symbols start out with a null string. */
name = strcpy (xmalloc (strlen (name) + 1), name); name = strcpy (xmalloc (strlen (name) + 1), name);
hash_insert (subsym_hash[macro_level], name, empty); hash_insert (subsym_hash[macro_level], name, empty);
*input_line_pointer = c; c = restore_line_pointer (c);
if (c == ',') if (c == ',')
{ {
++input_line_pointer; ++input_line_pointer;
@ -4500,8 +4496,8 @@ subsym_substitute (char *line, int forced)
if (forced) if (forced)
++ptr; ++ptr;
name = input_line_pointer = ptr; input_line_pointer = ptr;
c = get_symbol_end (); c = get_symbol_name (&name);
/* '?' is not normally part of a symbol, but it IS part of a local /* '?' is not normally part of a symbol, but it IS part of a local
label. */ label. */
if (c == '?') if (c == '?')
@ -4846,7 +4842,7 @@ md_assemble (char *line)
int c; int c;
input_line_pointer = line; input_line_pointer = line;
c = get_symbol_end (); c = get_symbol_name (&line);
if (cpu == VNONE) if (cpu == VNONE)
cpu = V542; cpu = V542;

View file

@ -471,17 +471,15 @@ s_tic6x_personalityindex (int ignored ATTRIBUTE_UNUSED)
static void static void
s_tic6x_personality (int ignored ATTRIBUTE_UNUSED) s_tic6x_personality (int ignored ATTRIBUTE_UNUSED)
{ {
char *name, *p, c; char *name, c;
tic6x_unwind_info *unwind = tic6x_get_unwind (); tic6x_unwind_info *unwind = tic6x_get_unwind ();
if (unwind->personality_routine || unwind->personality_index != -1) if (unwind->personality_routine || unwind->personality_index != -1)
as_bad (_("duplicate .personality directive")); as_bad (_("duplicate .personality directive"));
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
p = input_line_pointer;
unwind->personality_routine = symbol_find_or_make (name); unwind->personality_routine = symbol_find_or_make (name);
*p = c; (void) restore_line_pointer (c);
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
} }
@ -570,12 +568,11 @@ s_tic6x_scomm (int ignore ATTRIBUTE_UNUSED)
offsetT align; offsetT align;
int align2; int align2;
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
/* Just after name is now '\0'. */ /* Just after name is now '\0'. */
p = input_line_pointer; p = input_line_pointer;
*p = c; (void) restore_line_pointer (c);
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
if (*input_line_pointer != ',') if (*input_line_pointer != ',')
{ {

View file

@ -1085,33 +1085,32 @@ tilegx_parse_name (char *name, expressionS *e, char *nextcharP)
static void static void
parse_reg_expression (expressionS* expression) parse_reg_expression (expressionS* expression)
{ {
char *regname;
char terminating_char;
void *pval;
int regno_and_flags;
int regno;
/* Zero everything to make sure we don't miss any flags. */ /* Zero everything to make sure we don't miss any flags. */
memset (expression, 0, sizeof *expression); memset (expression, 0, sizeof *expression);
char* regname = input_line_pointer; terminating_char = get_symbol_name (&regname);
char terminating_char = get_symbol_end ();
void* pval = hash_find (main_reg_hash, regname);
pval = hash_find (main_reg_hash, regname);
if (pval == NULL) if (pval == NULL)
{
as_bad (_("Expected register, got '%s'."), regname); as_bad (_("Expected register, got '%s'."), regname);
}
int regno_and_flags = (int)(size_t)pval; regno_and_flags = (int)(size_t)pval;
int regno = EXTRACT_REGNO(regno_and_flags); regno = EXTRACT_REGNO(regno_and_flags);
if ((regno_and_flags & NONCANONICAL_REG_NAME_FLAG) if ((regno_and_flags & NONCANONICAL_REG_NAME_FLAG)
&& require_canonical_reg_names) && require_canonical_reg_names)
{
as_warn (_("Found use of non-canonical register name %s; " as_warn (_("Found use of non-canonical register name %s; "
"use %s instead."), "use %s instead."),
regname, regname, tilegx_register_names[regno]);
tilegx_register_names[regno]);
}
/* Restore the old character following the register name. */ /* Restore the old character following the register name. */
*input_line_pointer = terminating_char; (void) restore_line_pointer (terminating_char);
/* Fill in the expression fields to indicate it's a register. */ /* Fill in the expression fields to indicate it's a register. */
expression->X_op = O_register; expression->X_op = O_register;

View file

@ -980,8 +980,7 @@ parse_reg_expression (expressionS* expression)
/* Zero everything to make sure we don't miss any flags. */ /* Zero everything to make sure we don't miss any flags. */
memset (expression, 0, sizeof *expression); memset (expression, 0, sizeof *expression);
char* regname = input_line_pointer; char terminating_char = get_symbol_name (&regname);
char terminating_char = get_symbol_end ();
void* pval = hash_find (main_reg_hash, regname); void* pval = hash_find (main_reg_hash, regname);
@ -998,7 +997,7 @@ parse_reg_expression (expressionS* expression)
regname, tilepro_register_names[regno]); regname, tilepro_register_names[regno]);
/* Restore the old character following the register name. */ /* Restore the old character following the register name. */
*input_line_pointer = terminating_char; (void) restore_line_pointer (terminating_char);
/* Fill in the expression fields to indicate it's a register. */ /* Fill in the expression fields to indicate it's a register. */
expression->X_op = O_register; expression->X_op = O_register;

View file

@ -270,8 +270,7 @@ v850_comm (int area)
symbolS *symbolP; symbolS *symbolP;
int have_align; int have_align;
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
/* Just after name is now '\0'. */ /* Just after name is now '\0'. */
p = input_line_pointer; p = input_line_pointer;
@ -1005,15 +1004,14 @@ register_name (expressionS *expressionP)
char c; char c;
/* Find the spelling of the operand. */ /* Find the spelling of the operand. */
start = name = input_line_pointer; start = input_line_pointer;
c = get_symbol_name (&name);
c = get_symbol_end ();
reg_number = reg_name_search (pre_defined_registers, REG_NAME_CNT, reg_number = reg_name_search (pre_defined_registers, REG_NAME_CNT,
name, FALSE); name, FALSE);
/* Put back the delimiting char. */ /* Put back the delimiting char. */
*input_line_pointer = c; (void) restore_line_pointer (c);
expressionP->X_add_symbol = NULL; expressionP->X_add_symbol = NULL;
expressionP->X_op_symbol = NULL; expressionP->X_op_symbol = NULL;
@ -1057,14 +1055,13 @@ system_register_name (expressionS *expressionP,
char c; char c;
/* Find the spelling of the operand. */ /* Find the spelling of the operand. */
start = name = input_line_pointer; start = input_line_pointer;
c = get_symbol_name (&name);
c = get_symbol_end ();
reg_number = reg_name_search (system_registers, SYSREG_NAME_CNT, name, reg_number = reg_name_search (system_registers, SYSREG_NAME_CNT, name,
accept_numbers); accept_numbers);
/* Put back the delimiting char. */ /* Put back the delimiting char. */
*input_line_pointer = c; (void) restore_line_pointer (c);
if (reg_number < 0 if (reg_number < 0
&& accept_numbers) && accept_numbers)
@ -1118,13 +1115,12 @@ cc_name (expressionS *expressionP,
char c; char c;
/* Find the spelling of the operand. */ /* Find the spelling of the operand. */
start = name = input_line_pointer; start = input_line_pointer;
c = get_symbol_name (&name);
c = get_symbol_end ();
reg_number = reg_name_search (cc_names, CC_NAME_CNT, name, accept_numbers); reg_number = reg_name_search (cc_names, CC_NAME_CNT, name, accept_numbers);
/* Put back the delimiting char. */ /* Put back the delimiting char. */
*input_line_pointer = c; (void) restore_line_pointer (c);
if (reg_number < 0 if (reg_number < 0
&& accept_numbers) && accept_numbers)
@ -1169,13 +1165,12 @@ float_cc_name (expressionS *expressionP,
char c; char c;
/* Find the spelling of the operand. */ /* Find the spelling of the operand. */
start = name = input_line_pointer; start = input_line_pointer;
c = get_symbol_name (&name);
c = get_symbol_end ();
reg_number = reg_name_search (float_cc_names, FLOAT_CC_NAME_CNT, name, accept_numbers); reg_number = reg_name_search (float_cc_names, FLOAT_CC_NAME_CNT, name, accept_numbers);
/* Put back the delimiting char. */ /* Put back the delimiting char. */
*input_line_pointer = c; (void) restore_line_pointer (c);
if (reg_number < 0 if (reg_number < 0
&& accept_numbers) && accept_numbers)
@ -1220,13 +1215,12 @@ cacheop_name (expressionS * expressionP,
char c; char c;
/* Find the spelling of the operand. */ /* Find the spelling of the operand. */
start = name = input_line_pointer; start = input_line_pointer;
c = get_symbol_name (&name);
c = get_symbol_end ();
reg_number = reg_name_search (cacheop_names, CACHEOP_NAME_CNT, name, accept_numbers); reg_number = reg_name_search (cacheop_names, CACHEOP_NAME_CNT, name, accept_numbers);
/* Put back the delimiting char. */ /* Put back the delimiting char. */
*input_line_pointer = c; (void) restore_line_pointer (c);
if (reg_number < 0 if (reg_number < 0
&& accept_numbers) && accept_numbers)
@ -1269,13 +1263,12 @@ prefop_name (expressionS * expressionP,
char c; char c;
/* Find the spelling of the operand. */ /* Find the spelling of the operand. */
start = name = input_line_pointer; start = input_line_pointer;
c = get_symbol_name (&name);
c = get_symbol_end ();
reg_number = reg_name_search (prefop_names, PREFOP_NAME_CNT, name, accept_numbers); reg_number = reg_name_search (prefop_names, PREFOP_NAME_CNT, name, accept_numbers);
/* Put back the delimiting char. */ /* Put back the delimiting char. */
*input_line_pointer = c; (void) restore_line_pointer (c);
if (reg_number < 0 if (reg_number < 0
&& accept_numbers) && accept_numbers)
@ -1317,15 +1310,14 @@ vector_register_name (expressionS *expressionP)
char c; char c;
/* Find the spelling of the operand. */ /* Find the spelling of the operand. */
start = name = input_line_pointer; start = input_line_pointer;
c = get_symbol_name (&name);
c = get_symbol_end ();
reg_number = reg_name_search (vector_registers, VREG_NAME_CNT, reg_number = reg_name_search (vector_registers, VREG_NAME_CNT,
name, FALSE); name, FALSE);
/* Put back the delimiting char. */ /* Put back the delimiting char. */
*input_line_pointer = c; (void) restore_line_pointer (c);
expressionP->X_add_symbol = NULL; expressionP->X_add_symbol = NULL;
expressionP->X_op_symbol = NULL; expressionP->X_op_symbol = NULL;
@ -2792,18 +2784,19 @@ md_assemble (char *str)
else if ((operand->flags & V850_OPERAND_EP) != 0) else if ((operand->flags & V850_OPERAND_EP) != 0)
{ {
char *start = input_line_pointer; char *start = input_line_pointer;
char c = get_symbol_end (); char *name;
char c = get_symbol_name (&name);
if (strcmp (start, "ep") != 0 && strcmp (start, "r30") != 0) if (strcmp (name, "ep") != 0 && strcmp (name, "r30") != 0)
{ {
/* Put things back the way we found them. */ /* Put things back the way we found them. */
*input_line_pointer = c; (void) restore_line_pointer (c);
input_line_pointer = start; input_line_pointer = start;
errmsg = _("expected EP register"); errmsg = _("expected EP register");
goto error; goto error;
} }
*input_line_pointer = c; (void) restore_line_pointer (c);
str = input_line_pointer; str = input_line_pointer;
input_line_pointer = hold; input_line_pointer = hold;
@ -2850,6 +2843,7 @@ md_assemble (char *str)
else if ((register_name (&ex) else if ((register_name (&ex)
&& (operand->flags & V850_OPERAND_REG) == 0)) && (operand->flags & V850_OPERAND_REG) == 0))
{ {
char *name;
char c; char c;
int exists = 0; int exists = 0;
@ -2862,12 +2856,12 @@ md_assemble (char *str)
input_line_pointer = str; input_line_pointer = str;
c = get_symbol_end (); c = get_symbol_name (&name);
if (symbol_find (str) != NULL) if (symbol_find (name) != NULL)
exists = 1; exists = 1;
*input_line_pointer = c; (void) restore_line_pointer (c);
input_line_pointer = str; input_line_pointer = str;
expression (&ex); expression (&ex);

View file

@ -1548,11 +1548,11 @@ xtensa_literal_pseudo (int ignored ATTRIBUTE_UNUSED)
frag_align (2, 0, 0); frag_align (2, 0, 0);
record_alignment (now_seg, 2); record_alignment (now_seg, 2);
c = get_symbol_end (); c = get_symbol_name (&base_name);
/* Just after name is now '\0'. */ /* Just after name is now '\0'. */
p = input_line_pointer; p = input_line_pointer;
*p = c; *p = c;
SKIP_WHITESPACE (); SKIP_WHITESPACE_AFTER_NAME ();
if (*input_line_pointer != ',' && *input_line_pointer != ':') if (*input_line_pointer != ',' && *input_line_pointer != ':')
{ {
@ -1562,11 +1562,11 @@ xtensa_literal_pseudo (int ignored ATTRIBUTE_UNUSED)
xtensa_restore_emit_state (&state); xtensa_restore_emit_state (&state);
return; return;
} }
*p = 0; *p = 0;
colon (base_name); colon (base_name);
*p = c; *p = c;
input_line_pointer++; /* skip ',' or ':' */ input_line_pointer++; /* skip ',' or ':' */
xtensa_elf_cons (4); xtensa_elf_cons (4);

View file

@ -332,6 +332,7 @@ z80_start_line_hook (void)
/* Check for <label>[:] [.](EQU|DEFL) <value>. */ /* Check for <label>[:] [.](EQU|DEFL) <value>. */
if (is_name_beginner (*input_line_pointer)) if (is_name_beginner (*input_line_pointer))
{ {
char *name;
char c, *rest, *line_start; char c, *rest, *line_start;
int len; int len;
@ -339,7 +340,7 @@ z80_start_line_hook (void)
if (ignore_input ()) if (ignore_input ())
return 0; return 0;
c = get_symbol_end (); c = get_symbol_name (&name);
rest = input_line_pointer + 1; rest = input_line_pointer + 1;
if (*rest == ':') if (*rest == ':')
@ -364,13 +365,13 @@ z80_start_line_hook (void)
} }
input_line_pointer = rest + len - 1; input_line_pointer = rest + len - 1;
/* Allow redefining with "DEFL" (len == 4), but not with "EQU". */ /* Allow redefining with "DEFL" (len == 4), but not with "EQU". */
equals (line_start, len == 4); equals (name, len == 4);
return 1; return 1;
} }
else else
{ {
/* Restore line and pointer. */ /* Restore line and pointer. */
*input_line_pointer = c; (void) restore_line_pointer (c);
input_line_pointer = line_start; input_line_pointer = line_start;
} }
} }

View file

@ -2740,10 +2740,15 @@ On most machines, you can also use @code{$} in symbol names; exceptions
are noted in @ref{Machine Dependencies}. are noted in @ref{Machine Dependencies}.
@end ifset @end ifset
No symbol may begin with a digit. Case is significant. No symbol may begin with a digit. Case is significant.
There is no length limit: all characters are significant. Multibyte characters There is no length limit; all characters are significant. Multibyte characters
are supported. Symbols are delimited by characters not in that set, or by the are supported. Symbols are delimited by characters not in that set, or by the
beginning of a file (since the source program must end with a newline, the end beginning of a file (since the source program must end with a newline, the end
of a file is not a possible symbol delimiter). @xref{Symbols}. of a file is not a possible symbol delimiter). @xref{Symbols}.
Symbol names may also be enclosed in double quote @code{"} characters. In such
cases any characters are allowed, except for the NUL character. If a double
quote character is to be included in the symbol name it must be preceeded by a
backslash @code{\} character.
@cindex length of symbols @cindex length of symbols
@node Statements @node Statements

View file

@ -754,13 +754,12 @@ tc_parse_to_dw2regnum (expressionS *exp)
{ {
char *name, c; char *name, c;
name = input_line_pointer; c = get_symbol_name (& name);
c = get_symbol_end ();
exp->X_op = O_constant; exp->X_op = O_constant;
exp->X_add_number = tc_regname_to_dw2regnum (name); exp->X_add_number = tc_regname_to_dw2regnum (name);
*input_line_pointer = c; restore_line_pointer (c);
} }
else else
# endif # endif
@ -1197,13 +1196,14 @@ dot_cfi_sections (int ignored ATTRIBUTE_UNUSED)
int sections = 0; int sections = 0;
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
if (is_name_beginner (*input_line_pointer)) if (is_name_beginner (*input_line_pointer) || *input_line_pointer == '"')
while (1) while (1)
{ {
char * saved_ilp;
char *name, c; char *name, c;
name = input_line_pointer; saved_ilp = input_line_pointer;
c = get_symbol_end (); c = get_symbol_name (& name);
if (strncmp (name, ".eh_frame", sizeof ".eh_frame") == 0 if (strncmp (name, ".eh_frame", sizeof ".eh_frame") == 0
&& name[9] != '_') && name[9] != '_')
@ -1224,23 +1224,23 @@ dot_cfi_sections (int ignored ATTRIBUTE_UNUSED)
else else
{ {
*input_line_pointer = c; *input_line_pointer = c;
input_line_pointer = name; input_line_pointer = saved_ilp;
break; break;
} }
*input_line_pointer = c; *input_line_pointer = c;
SKIP_WHITESPACE (); SKIP_WHITESPACE_AFTER_NAME ();
if (*input_line_pointer == ',') if (*input_line_pointer == ',')
{ {
name = input_line_pointer++; name = input_line_pointer++;
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
if (!is_name_beginner (*input_line_pointer)) if (!is_name_beginner (*input_line_pointer) && *input_line_pointer != '"')
{ {
input_line_pointer = name; input_line_pointer = name;
break; break;
} }
} }
else if (is_name_beginner (*input_line_pointer)) else if (is_name_beginner (*input_line_pointer) || *input_line_pointer == '"')
break; break;
} }
@ -1266,20 +1266,20 @@ dot_cfi_startproc (int ignored ATTRIBUTE_UNUSED)
cfi_new_fde (symbol_temp_new_now ()); cfi_new_fde (symbol_temp_new_now ());
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
if (is_name_beginner (*input_line_pointer)) if (is_name_beginner (*input_line_pointer) || *input_line_pointer == '"')
{ {
char * saved_ilp = input_line_pointer;
char *name, c; char *name, c;
name = input_line_pointer; c = get_symbol_name (& name);
c = get_symbol_end ();
if (strcmp (name, "simple") == 0) if (strcmp (name, "simple") == 0)
{ {
simple = 1; simple = 1;
*input_line_pointer = c; restore_line_pointer (c);
} }
else else
input_line_pointer = name; input_line_pointer = saved_ilp;
} }
demand_empty_rest_of_line (); demand_empty_rest_of_line ();

View file

@ -670,8 +670,7 @@ dwarf2_directive_loc (int dummy ATTRIBUTE_UNUSED)
char *p, c; char *p, c;
offsetT value; offsetT value;
p = input_line_pointer; c = get_symbol_name (& p);
c = get_symbol_end ();
if (strcmp (p, "basic_block") == 0) if (strcmp (p, "basic_block") == 0)
{ {
@ -690,7 +689,7 @@ dwarf2_directive_loc (int dummy ATTRIBUTE_UNUSED)
} }
else if (strcmp (p, "is_stmt") == 0) else if (strcmp (p, "is_stmt") == 0)
{ {
*input_line_pointer = c; (void) restore_line_pointer (c);
value = get_absolute_expression (); value = get_absolute_expression ();
if (value == 0) if (value == 0)
current.flags &= ~DWARF2_FLAG_IS_STMT; current.flags &= ~DWARF2_FLAG_IS_STMT;
@ -704,7 +703,7 @@ dwarf2_directive_loc (int dummy ATTRIBUTE_UNUSED)
} }
else if (strcmp (p, "isa") == 0) else if (strcmp (p, "isa") == 0)
{ {
*input_line_pointer = c; (void) restore_line_pointer (c);
value = get_absolute_expression (); value = get_absolute_expression ();
if (value >= 0) if (value >= 0)
current.isa = value; current.isa = value;
@ -716,7 +715,7 @@ dwarf2_directive_loc (int dummy ATTRIBUTE_UNUSED)
} }
else if (strcmp (p, "discriminator") == 0) else if (strcmp (p, "discriminator") == 0)
{ {
*input_line_pointer = c; (void) restore_line_pointer (c);
value = get_absolute_expression (); value = get_absolute_expression ();
if (value >= 0) if (value >= 0)
current.discriminator = value; current.discriminator = value;
@ -729,11 +728,11 @@ dwarf2_directive_loc (int dummy ATTRIBUTE_UNUSED)
else else
{ {
as_bad (_("unknown .loc sub-directive `%s'"), p); as_bad (_("unknown .loc sub-directive `%s'"), p);
*input_line_pointer = c; (void) restore_line_pointer (c);
return; return;
} }
SKIP_WHITESPACE (); SKIP_WHITESPACE_AFTER_NAME ();
} }
demand_empty_rest_of_line (); demand_empty_rest_of_line ();

View file

@ -2434,14 +2434,13 @@ ecoff_directive_begin (int ignore ATTRIBUTE_UNUSED)
return; return;
} }
name = input_line_pointer; name_end = get_symbol_name (&name);
name_end = get_symbol_end ();
(void) add_ecoff_symbol ((const char *) NULL, st_Block, sc_Text, (void) add_ecoff_symbol ((const char *) NULL, st_Block, sc_Text,
symbol_find_or_make (name), symbol_find_or_make (name),
(bfd_vma) 0, (symint_t) 0, (symint_t) 0); (bfd_vma) 0, (symint_t) 0, (symint_t) 0);
*input_line_pointer = name_end; (void) restore_line_pointer (name_end);
/* The line number follows, but we don't use it. */ /* The line number follows, but we don't use it. */
(void) get_absolute_expression (); (void) get_absolute_expression ();
@ -2472,8 +2471,7 @@ ecoff_directive_bend (int ignore ATTRIBUTE_UNUSED)
return; return;
} }
name = input_line_pointer; name_end = get_symbol_name (&name);
name_end = get_symbol_end ();
/* The value is the distance between the .bend directive and the /* The value is the distance between the .bend directive and the
corresponding symbol. We fill in the offset when we write out corresponding symbol. We fill in the offset when we write out
@ -2485,7 +2483,7 @@ ecoff_directive_bend (int ignore ATTRIBUTE_UNUSED)
(void) add_ecoff_symbol ((const char *) NULL, st_End, sc_Text, endsym, (void) add_ecoff_symbol ((const char *) NULL, st_End, sc_Text, endsym,
(bfd_vma) 0, (symint_t) 0, (symint_t) 0); (bfd_vma) 0, (symint_t) 0, (symint_t) 0);
*input_line_pointer = name_end; restore_line_pointer (name_end);
/* The line number follows, but we don't use it. */ /* The line number follows, but we don't use it. */
(void) get_absolute_expression (); (void) get_absolute_expression ();
@ -2519,8 +2517,7 @@ ecoff_directive_def (int ignore ATTRIBUTE_UNUSED)
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
name = input_line_pointer; name_end = get_symbol_name (&name);
name_end = get_symbol_end ();
if (coff_sym_name != (char *) NULL) if (coff_sym_name != (char *) NULL)
as_warn (_(".def pseudo-op used inside of .def/.endef; ignored")); as_warn (_(".def pseudo-op used inside of .def/.endef; ignored"));
@ -2544,7 +2541,7 @@ ecoff_directive_def (int ignore ATTRIBUTE_UNUSED)
coff_sym_addend = 0; coff_sym_addend = 0;
} }
*input_line_pointer = name_end; restore_line_pointer (name_end);
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
} }
@ -2757,12 +2754,11 @@ ecoff_directive_tag (int ignore ATTRIBUTE_UNUSED)
return; return;
} }
name = input_line_pointer; name_end = get_symbol_name (&name);
name_end = get_symbol_end ();
coff_tag = xstrdup (name); coff_tag = xstrdup (name);
*input_line_pointer = name_end; (void) restore_line_pointer (name_end);
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
} }
@ -3004,13 +3000,12 @@ ecoff_directive_end (int ignore ATTRIBUTE_UNUSED)
return; return;
} }
name = input_line_pointer; name_end = get_symbol_name (&name);
name_end = get_symbol_end ();
if (name == input_line_pointer) if (name == input_line_pointer)
{ {
as_warn (_(".end directive has no name")); as_warn (_(".end directive has no name"));
*input_line_pointer = name_end; (void) restore_line_pointer (name_end);
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
return; return;
} }
@ -3031,7 +3026,7 @@ ecoff_directive_end (int ignore ATTRIBUTE_UNUSED)
cur_proc_ptr = (proc_t *) NULL; cur_proc_ptr = (proc_t *) NULL;
*input_line_pointer = name_end; (void) restore_line_pointer (name_end);
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
} }
@ -3053,20 +3048,19 @@ ecoff_directive_ent (int ignore ATTRIBUTE_UNUSED)
return; return;
} }
name = input_line_pointer; name_end = get_symbol_name (&name);
name_end = get_symbol_end ();
if (name == input_line_pointer) if (name == input_line_pointer)
{ {
as_warn (_(".ent directive has no name")); as_warn (_(".ent directive has no name"));
*input_line_pointer = name_end; (void) restore_line_pointer (name_end);
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
return; return;
} }
add_procedure (name); add_procedure (name);
*input_line_pointer = name_end; (void) restore_line_pointer (name_end);
/* The .ent directive is sometimes followed by a number. I'm not /* The .ent directive is sometimes followed by a number. I'm not
really sure what the number means. I don't see any way to store really sure what the number means. I don't see any way to store
@ -3095,10 +3089,9 @@ ecoff_directive_extern (int ignore ATTRIBUTE_UNUSED)
symbolS *symbolp; symbolS *symbolp;
valueT size; valueT size;
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
symbolp = symbol_find_or_make (name); symbolp = symbol_find_or_make (name);
*input_line_pointer = c; (void) restore_line_pointer (c);
S_SET_EXTERNAL (symbolp); S_SET_EXTERNAL (symbolp);
@ -3348,10 +3341,9 @@ ecoff_directive_weakext (int ignore ATTRIBUTE_UNUSED)
symbolS *symbolP; symbolS *symbolP;
expressionS exp; expressionS exp;
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
symbolP = symbol_find_or_make (name); symbolP = symbol_find_or_make (name);
*input_line_pointer = c; (void) restore_line_pointer (c);
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
@ -3489,11 +3481,9 @@ ecoff_stab (segT sec ATTRIBUTE_UNUSED,
return; return;
} }
name = input_line_pointer; name_end = get_symbol_name (&name);
name_end = get_symbol_end ();
sym = symbol_find_or_make (name); sym = symbol_find_or_make (name);
*input_line_pointer = name_end; (void) restore_line_pointer (name_end);
value = 0; value = 0;
addend = 0; addend = 0;

View file

@ -1142,8 +1142,7 @@ operand (expressionS *expressionP, enum expr_mode mode)
++input_line_pointer; ++input_line_pointer;
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
name = input_line_pointer; c = get_symbol_name (& name);
c = get_symbol_end ();
buf = (char *) xmalloc (strlen (name) + 10); buf = (char *) xmalloc (strlen (name) + 10);
if (start) if (start)
@ -1158,7 +1157,7 @@ operand (expressionS *expressionP, enum expr_mode mode)
expressionP->X_add_number = 0; expressionP->X_add_number = 0;
*input_line_pointer = c; *input_line_pointer = c;
SKIP_WHITESPACE (); SKIP_WHITESPACE_AFTER_NAME ();
if (*input_line_pointer != ')') if (*input_line_pointer != ')')
as_bad (_("syntax error in .startof. or .sizeof.")); as_bad (_("syntax error in .startof. or .sizeof."));
else else
@ -1214,13 +1213,13 @@ operand (expressionS *expressionP, enum expr_mode mode)
#if defined(md_need_index_operator) || defined(TC_M68K) #if defined(md_need_index_operator) || defined(TC_M68K)
de_fault: de_fault:
#endif #endif
if (is_name_beginner (c)) /* Here if did not begin with a digit. */ if (is_name_beginner (c) || c == '"') /* Here if did not begin with a digit. */
{ {
/* Identifier begins here. /* Identifier begins here.
This is kludged for speed, so code is repeated. */ This is kludged for speed, so code is repeated. */
isname: isname:
name = --input_line_pointer; -- input_line_pointer;
c = get_symbol_end (); c = get_symbol_name (&name);
#ifdef md_operator #ifdef md_operator
{ {
@ -1229,15 +1228,15 @@ operand (expressionS *expressionP, enum expr_mode mode)
switch (op) switch (op)
{ {
case O_uminus: case O_uminus:
*input_line_pointer = c; restore_line_pointer (c);
c = '-'; c = '-';
goto unary; goto unary;
case O_bit_not: case O_bit_not:
*input_line_pointer = c; restore_line_pointer (c);
c = '~'; c = '~';
goto unary; goto unary;
case O_logical_not: case O_logical_not:
*input_line_pointer = c; restore_line_pointer (c);
c = '!'; c = '!';
goto unary; goto unary;
case O_illegal: case O_illegal:
@ -1246,9 +1245,10 @@ operand (expressionS *expressionP, enum expr_mode mode)
default: default:
break; break;
} }
if (op != O_absent && op != O_illegal) if (op != O_absent && op != O_illegal)
{ {
*input_line_pointer = c; restore_line_pointer (c);
expr (9, expressionP, mode); expr (9, expressionP, mode);
expressionP->X_add_symbol = make_expr_symbol (expressionP); expressionP->X_add_symbol = make_expr_symbol (expressionP);
expressionP->X_op_symbol = NULL; expressionP->X_op_symbol = NULL;
@ -1266,7 +1266,7 @@ operand (expressionS *expressionP, enum expr_mode mode)
entering it in the symbol table. */ entering it in the symbol table. */
if (md_parse_name (name, expressionP, mode, &c)) if (md_parse_name (name, expressionP, mode, &c))
{ {
*input_line_pointer = c; restore_line_pointer (c);
break; break;
} }
#endif #endif
@ -1286,10 +1286,9 @@ operand (expressionS *expressionP, enum expr_mode mode)
|| name[1] == 'T'); || name[1] == 'T');
*input_line_pointer = c; *input_line_pointer = c;
SKIP_WHITESPACE (); SKIP_WHITESPACE_AFTER_NAME ();
name = input_line_pointer; c = get_symbol_name (& name);
c = get_symbol_end ();
buf = (char *) xmalloc (strlen (name) + 10); buf = (char *) xmalloc (strlen (name) + 10);
if (start) if (start)
@ -1304,8 +1303,7 @@ operand (expressionS *expressionP, enum expr_mode mode)
expressionP->X_add_number = 0; expressionP->X_add_number = 0;
*input_line_pointer = c; *input_line_pointer = c;
SKIP_WHITESPACE (); SKIP_WHITESPACE_AFTER_NAME ();
break; break;
} }
#endif #endif
@ -1333,7 +1331,8 @@ operand (expressionS *expressionP, enum expr_mode mode)
expressionP->X_add_symbol = symbolP; expressionP->X_add_symbol = symbolP;
expressionP->X_add_number = 0; expressionP->X_add_number = 0;
} }
*input_line_pointer = c;
restore_line_pointer (c);
} }
else else
{ {
@ -1589,8 +1588,8 @@ operatorf (int *num_chars)
#ifdef md_operator #ifdef md_operator
if (is_name_beginner (c)) if (is_name_beginner (c))
{ {
char *name = input_line_pointer; char *name;
char ec = get_symbol_end (); char ec = get_symbol_name (& name);
ret = md_operator (name, 2, &ec); ret = md_operator (name, 2, &ec);
switch (ret) switch (ret)
@ -2318,19 +2317,22 @@ resolve_expression (expressionS *expressionP)
expr.c is just a branch office read.c anyway, and putting it expr.c is just a branch office read.c anyway, and putting it
here lessens the crowd at read.c. here lessens the crowd at read.c.
Assume input_line_pointer is at start of symbol name. Assume input_line_pointer is at start of symbol name, or the
start of a double quote enclosed symbol name.
Advance input_line_pointer past symbol name. Advance input_line_pointer past symbol name.
Turn that character into a '\0', returning its former value. Turn that character into a '\0', returning its former value,
which may be the closing double quote.
This allows a string compare (RMS wants symbol names to be strings) This allows a string compare (RMS wants symbol names to be strings)
of the symbol name. of the symbol name.
There will always be a char following symbol name, because all good There will always be a char following symbol name, because all good
lines end in end-of-line. */ lines end in end-of-line. */
char char
get_symbol_end (void) get_symbol_name (char ** ilp_return)
{ {
char c; char c;
* ilp_return = input_line_pointer;
/* We accept \001 in a name in case this is being called with a /* We accept \001 in a name in case this is being called with a
constructed string. */ constructed string. */
if (is_name_beginner (c = *input_line_pointer++) || c == '\001') if (is_name_beginner (c = *input_line_pointer++) || c == '\001')
@ -2341,8 +2343,36 @@ get_symbol_end (void)
if (is_name_ender (c)) if (is_name_ender (c))
c = *input_line_pointer++; c = *input_line_pointer++;
} }
else if (c == '"')
{
bfd_boolean backslash_seen;
* ilp_return = input_line_pointer;
do
{
backslash_seen = c == '\\';
c = * input_line_pointer ++;
}
while (c != 0 && (c != '"' || backslash_seen));
if (c == 0)
as_warn (_("missing closing '\"'"));
}
*--input_line_pointer = 0; *--input_line_pointer = 0;
return (c); return c;
}
/* Replace the NUL character pointed to by input_line_pointer
with C. If C is \" then advance past it. Return the character
now pointed to by input_line_pointer. */
char
restore_line_pointer (char c)
{
* input_line_pointer = c;
if (c == '"')
c = * ++ input_line_pointer;
return c;
} }
unsigned int unsigned int

View file

@ -170,7 +170,8 @@ extern LITTLENUM_TYPE generic_bignum[];
typedef char operator_rankT; typedef char operator_rankT;
extern char get_symbol_end (void); extern char get_symbol_name (char **);
extern char restore_line_pointer (char);
extern void expr_begin (void); extern void expr_begin (void);
extern void expr_set_precedence (void); extern void expr_set_precedence (void);
extern void expr_set_rank (operatorT, operator_rankT); extern void expr_set_rank (operatorT, operator_rankT);

View file

@ -741,7 +741,8 @@ single instruction is %u bytes long but .bundle_align_mode limit is %u"),
void void
read_a_source_file (char *name) read_a_source_file (char *name)
{ {
char c; char nul_char;
char next_char;
char *s; /* String of symbol, '\0' appended. */ char *s; /* String of symbol, '\0' appended. */
int temp; int temp;
pseudo_typeS *pop; pseudo_typeS *pop;
@ -828,16 +829,18 @@ read_a_source_file (char *name)
if (LABELS_WITHOUT_COLONS || flag_m68k_mri) if (LABELS_WITHOUT_COLONS || flag_m68k_mri)
{ {
next_char = * input_line_pointer;
/* Text at the start of a line must be a label, we /* Text at the start of a line must be a label, we
run down and stick a colon in. */ run down and stick a colon in. */
if (is_name_beginner (*input_line_pointer)) if (is_name_beginner (next_char) || next_char == '"')
{ {
char *line_start = input_line_pointer; char *line_start;
int mri_line_macro; int mri_line_macro;
HANDLE_CONDITIONAL_ASSEMBLY (0); HANDLE_CONDITIONAL_ASSEMBLY (0);
c = get_symbol_end (); nul_char = get_symbol_name (& line_start);
next_char = (nul_char == '"' ? input_line_pointer[1] : nul_char);
/* In MRI mode, the EQU and MACRO pseudoops must /* In MRI mode, the EQU and MACRO pseudoops must
be handled specially. */ be handled specially. */
@ -871,7 +874,7 @@ read_a_source_file (char *name)
symbol in the symbol table. */ symbol in the symbol table. */
if (!mri_line_macro if (!mri_line_macro
#ifdef TC_START_LABEL_WITHOUT_COLON #ifdef TC_START_LABEL_WITHOUT_COLON
&& TC_START_LABEL_WITHOUT_COLON(c, && TC_START_LABEL_WITHOUT_COLON (next_char,
input_line_pointer) input_line_pointer)
#endif #endif
) )
@ -882,8 +885,8 @@ read_a_source_file (char *name)
(valueT) 0, (valueT) 0,
&zero_address_frag); &zero_address_frag);
*input_line_pointer = c; next_char = restore_line_pointer (nul_char);
if (c == ':') if (next_char == ':')
input_line_pointer++; input_line_pointer++;
} }
} }
@ -898,30 +901,32 @@ read_a_source_file (char *name)
Each test is independent of all other tests at the (top) Each test is independent of all other tests at the (top)
level. */ level. */
do do
c = *input_line_pointer++; nul_char = next_char = *input_line_pointer++;
while (c == '\t' || c == ' ' || c == '\f'); while (next_char == '\t' || next_char == ' ' || next_char == '\f');
/* C is the 1st significant character. /* C is the 1st significant character.
Input_line_pointer points after that character. */ Input_line_pointer points after that character. */
if (is_name_beginner (c)) if (is_name_beginner (next_char) || next_char == '"')
{ {
char *rest;
/* Want user-defined label or pseudo/opcode. */ /* Want user-defined label or pseudo/opcode. */
HANDLE_CONDITIONAL_ASSEMBLY (1); HANDLE_CONDITIONAL_ASSEMBLY (1);
s = --input_line_pointer; --input_line_pointer;
c = get_symbol_end (); /* name's delimiter. */ nul_char = get_symbol_name (& s); /* name's delimiter. */
next_char = (nul_char == '"' ? input_line_pointer[1] : nul_char);
rest = input_line_pointer + (nul_char == '"' ? 2 : 1);
/* C is character after symbol. /* NEXT_CHAR is character after symbol.
That character's place in the input line is now '\0'. The end of symbol in the input line is now '\0'.
S points to the beginning of the symbol. S points to the beginning of the symbol.
[In case of pseudo-op, s->'.'.] [In case of pseudo-op, s->'.'.]
Input_line_pointer->'\0' where c was. */ Input_line_pointer->'\0' where NUL_CHAR was. */
if (TC_START_LABEL (c, s, input_line_pointer)) if (TC_START_LABEL (next_char, s, input_line_pointer))
{ {
if (flag_m68k_mri) if (flag_m68k_mri)
{ {
char *rest = input_line_pointer + 1;
/* In MRI mode, \tsym: set 0 is permitted. */ /* In MRI mode, \tsym: set 0 is permitted. */
if (*rest == ':') if (*rest == ':')
++rest; ++rest;
@ -940,27 +945,27 @@ read_a_source_file (char *name)
} }
line_label = colon (s); /* User-defined label. */ line_label = colon (s); /* User-defined label. */
/* Put ':' back for error messages' sake. */ restore_line_pointer (nul_char);
*input_line_pointer++ = ':'; ++ input_line_pointer;
#ifdef tc_check_label #ifdef tc_check_label
tc_check_label (line_label); tc_check_label (line_label);
#endif #endif
/* Input_line_pointer->after ':'. */ /* Input_line_pointer->after ':'. */
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
} }
else if ((c == '=' && input_line_pointer[1] == '=') else if ((next_char == '=' && *rest == '=')
|| ((c == ' ' || c == '\t') || ((next_char == ' ' || next_char == '\t')
&& input_line_pointer[1] == '=' && rest[0] == '='
&& input_line_pointer[2] == '=')) && rest[1] == '='))
{ {
equals (s, -1); equals (s, -1);
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
} }
else if ((c == '=' else if ((next_char == '='
|| ((c == ' ' || c == '\t') || ((next_char == ' ' || next_char == '\t')
&& input_line_pointer[1] == '=')) && *rest == '='))
#ifdef TC_EQUAL_IN_INSN #ifdef TC_EQUAL_IN_INSN
&& !TC_EQUAL_IN_INSN (c, s) && !TC_EQUAL_IN_INSN (next_char, s)
#endif #endif
) )
{ {
@ -1000,7 +1005,7 @@ read_a_source_file (char *name)
{ {
/* PSEUDO - OP. /* PSEUDO - OP.
WARNING: c has next char, which may be end-of-line. WARNING: next_char may be end-of-line.
We lookup the pseudo-op table with s+1 because we We lookup the pseudo-op table with s+1 because we
already know that the pseudo-op begins with a '.'. */ already know that the pseudo-op begins with a '.'. */
@ -1045,25 +1050,25 @@ read_a_source_file (char *name)
{ {
char *end = input_line_pointer; char *end = input_line_pointer;
*input_line_pointer = c; (void) restore_line_pointer (nul_char);
s_ignore (0); s_ignore (0);
c = *--input_line_pointer; nul_char = next_char = *--input_line_pointer;
*input_line_pointer = '\0'; *input_line_pointer = '\0';
if (! macro_defined || ! try_macro (c, s)) if (! macro_defined || ! try_macro (next_char, s))
{ {
*end = '\0'; *end = '\0';
as_bad (_("unknown pseudo-op: `%s'"), s); as_bad (_("unknown pseudo-op: `%s'"), s);
*input_line_pointer++ = c; *input_line_pointer++ = nul_char;
} }
continue; continue;
} }
/* Put it back for error messages etc. */ /* Put it back for error messages etc. */
*input_line_pointer = c; next_char = restore_line_pointer (nul_char);
/* The following skip of whitespace is compulsory. /* The following skip of whitespace is compulsory.
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 (next_char == ' ' || next_char == '\t')
input_line_pointer++; input_line_pointer++;
/* Input_line is restored. /* Input_line is restored.
@ -1077,16 +1082,16 @@ read_a_source_file (char *name)
} }
else else
{ {
/* WARNING: c has char, which may be end-of-line. */ /* WARNING: next_char may be end-of-line. */
/* Also: input_line_pointer->`\0` where c was. */ /* Also: input_line_pointer->`\0` where nul_char was. */
*input_line_pointer = c; (void) restore_line_pointer (nul_char);
input_line_pointer = _find_end_of_line (input_line_pointer, flag_m68k_mri, 1, 0); input_line_pointer = _find_end_of_line (input_line_pointer, flag_m68k_mri, 1, 0);
c = *input_line_pointer; next_char = nul_char = *input_line_pointer;
*input_line_pointer = '\0'; *input_line_pointer = '\0';
generate_lineno_debug (); generate_lineno_debug ();
if (macro_defined && try_macro (c, s)) if (macro_defined && try_macro (next_char, s))
continue; continue;
if (mri_pending_align) if (mri_pending_align)
@ -1102,7 +1107,7 @@ read_a_source_file (char *name)
assemble_one (s); /* Assemble 1 instruction. */ assemble_one (s); /* Assemble 1 instruction. */
*input_line_pointer++ = c; *input_line_pointer++ = nul_char;
/* We resume loop AFTER the end-of-line from /* We resume loop AFTER the end-of-line from
this instruction. */ this instruction. */
@ -1112,17 +1117,20 @@ read_a_source_file (char *name)
} }
/* Empty statement? */ /* Empty statement? */
if (is_end_of_line[(unsigned char) c]) if (is_end_of_line[(unsigned char) next_char])
continue; continue;
if ((LOCAL_LABELS_DOLLAR || LOCAL_LABELS_FB) && ISDIGIT (c)) if ((LOCAL_LABELS_DOLLAR || LOCAL_LABELS_FB) && ISDIGIT (next_char))
{ {
/* local label ("4:") */ /* local label ("4:") */
char *backup = input_line_pointer; char *backup = input_line_pointer;
HANDLE_CONDITIONAL_ASSEMBLY (1); HANDLE_CONDITIONAL_ASSEMBLY (1);
temp = c - '0'; temp = next_char - '0';
if (nul_char == '"')
++ input_line_pointer;
/* Read the whole number. */ /* Read the whole number. */
while (ISDIGIT (*input_line_pointer)) while (ISDIGIT (*input_line_pointer))
@ -1156,9 +1164,9 @@ read_a_source_file (char *name)
} }
input_line_pointer = backup; input_line_pointer = backup;
} /* local label ("4:") */ }
if (c && strchr (line_comment_chars, c)) if (next_char && strchr (line_comment_chars, next_char))
{ /* Its a comment. Better say APP or NO_APP. */ { /* Its a comment. Better say APP or NO_APP. */
sb sbuf; sb sbuf;
char *ends; char *ends;
@ -1270,7 +1278,7 @@ read_a_source_file (char *name)
HANDLE_CONDITIONAL_ASSEMBLY (1); HANDLE_CONDITIONAL_ASSEMBLY (1);
#ifdef tc_unrecognized_line #ifdef tc_unrecognized_line
if (tc_unrecognized_line (c)) if (tc_unrecognized_line (next_char))
continue; continue;
#endif #endif
input_line_pointer--; input_line_pointer--;
@ -1800,7 +1808,7 @@ s_mri_common (int small ATTRIBUTE_UNUSED)
name = input_line_pointer; name = input_line_pointer;
if (!ISDIGIT (*name)) if (!ISDIGIT (*name))
c = get_symbol_end (); c = get_symbol_name (& name);
else else
{ {
do do
@ -1823,7 +1831,7 @@ s_mri_common (int small ATTRIBUTE_UNUSED)
} }
sym = symbol_find_or_make (name); sym = symbol_find_or_make (name);
*input_line_pointer = c; c = restore_line_pointer (c);
if (alc != NULL) if (alc != NULL)
free (alc); free (alc);
@ -2343,8 +2351,7 @@ s_linkonce (int ignore ATTRIBUTE_UNUSED)
char *s; char *s;
char c; char c;
s = input_line_pointer; c = get_symbol_name (& s);
c = get_symbol_end ();
if (strcasecmp (s, "discard") == 0) if (strcasecmp (s, "discard") == 0)
type = LINKONCE_DISCARD; type = LINKONCE_DISCARD;
else if (strcasecmp (s, "one_only") == 0) else if (strcasecmp (s, "one_only") == 0)
@ -2356,7 +2363,7 @@ s_linkonce (int ignore ATTRIBUTE_UNUSED)
else else
as_warn (_("unrecognized .linkonce type `%s'"), s); as_warn (_("unrecognized .linkonce type `%s'"), s);
*input_line_pointer = c; (void) restore_line_pointer (c);
} }
#ifdef obj_handle_link_once #ifdef obj_handle_link_once
@ -2850,7 +2857,7 @@ s_mri_sect (char *type ATTRIBUTE_UNUSED)
name = input_line_pointer; name = input_line_pointer;
if (!ISDIGIT (*name)) if (!ISDIGIT (*name))
c = get_symbol_end (); c = get_symbol_name (& name);
else else
{ {
do do
@ -2865,11 +2872,11 @@ s_mri_sect (char *type ATTRIBUTE_UNUSED)
name = xstrdup (name); name = xstrdup (name);
*input_line_pointer = c; c = restore_line_pointer (c);
seg = subseg_new (name, 0); seg = subseg_new (name, 0);
if (*input_line_pointer == ',') if (c == ',')
{ {
int align; int align;
@ -2924,16 +2931,15 @@ s_mri_sect (char *type ATTRIBUTE_UNUSED)
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
name = input_line_pointer; c = get_symbol_name (& name);
c = get_symbol_end ();
name = xstrdup (name); name = xstrdup (name);
*input_line_pointer = c; c = restore_line_pointer (c);
seg = subseg_new (name, 0); seg = subseg_new (name, 0);
if (*input_line_pointer != ',') if (c != ',')
*type = 'C'; *type = 'C';
else else
{ {
@ -2941,8 +2947,7 @@ s_mri_sect (char *type ATTRIBUTE_UNUSED)
++input_line_pointer; ++input_line_pointer;
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
sectype = input_line_pointer; c = get_symbol_name (& sectype);
c = get_symbol_end ();
if (*sectype == '\0') if (*sectype == '\0')
*type = 'C'; *type = 'C';
else if (strcasecmp (sectype, "text") == 0) else if (strcasecmp (sectype, "text") == 0)
@ -2953,7 +2958,7 @@ s_mri_sect (char *type ATTRIBUTE_UNUSED)
*type = 'R'; *type = 'R';
else else
as_warn (_("unrecognized section type `%s'"), sectype); as_warn (_("unrecognized section type `%s'"), sectype);
*input_line_pointer = c; (void) restore_line_pointer (c);
} }
if (*input_line_pointer == ',') if (*input_line_pointer == ',')
@ -2962,8 +2967,7 @@ s_mri_sect (char *type ATTRIBUTE_UNUSED)
++input_line_pointer; ++input_line_pointer;
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
seccmd = input_line_pointer; c = get_symbol_name (& seccmd);
c = get_symbol_end ();
if (strcasecmp (seccmd, "absolute") == 0) if (strcasecmp (seccmd, "absolute") == 0)
{ {
as_bad (_("absolute sections are not supported")); as_bad (_("absolute sections are not supported"));
@ -2975,14 +2979,14 @@ s_mri_sect (char *type ATTRIBUTE_UNUSED)
{ {
int align; int align;
*input_line_pointer = c; (void) restore_line_pointer (c);
align = get_absolute_expression (); align = get_absolute_expression ();
record_alignment (seg, align); record_alignment (seg, align);
} }
else else
{ {
as_warn (_("unrecognized section command `%s'"), seccmd); as_warn (_("unrecognized section command `%s'"), seccmd);
*input_line_pointer = c; (void) restore_line_pointer (c);
} }
} }
@ -3028,11 +3032,10 @@ s_purgem (int ignore ATTRIBUTE_UNUSED)
char c; char c;
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
name = input_line_pointer; c = get_symbol_name (& name);
c = get_symbol_end ();
delete_macro (name); delete_macro (name);
*input_line_pointer = c; *input_line_pointer = c;
SKIP_WHITESPACE (); SKIP_WHITESPACE_AFTER_NAME ();
} }
while (*input_line_pointer++ == ','); while (*input_line_pointer++ == ',');
@ -3937,12 +3940,14 @@ cons_worker (int nbytes, /* 1=.byte, 2=.word, 4=.long. */
else else
#endif #endif
{ {
#if 0
if (*input_line_pointer == '"') if (*input_line_pointer == '"')
{ {
as_bad (_("unexpected `\"' in expression")); as_bad (_("unexpected `\"' in expression"));
ignore_rest_of_line (); ignore_rest_of_line ();
return; return;
} }
#endif
ret = TC_PARSE_CONS_EXPRESSION (&exp, (unsigned int) nbytes); ret = TC_PARSE_CONS_EXPRESSION (&exp, (unsigned int) nbytes);
} }
@ -4046,8 +4051,7 @@ s_reloc (int ignore ATTRIBUTE_UNUSED)
++input_line_pointer; ++input_line_pointer;
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
r_name = input_line_pointer; c = get_symbol_name (& r_name);
c = get_symbol_end ();
if (strncasecmp (r_name, "BFD_RELOC_", 10) == 0) if (strncasecmp (r_name, "BFD_RELOC_", 10) == 0)
{ {
unsigned int i; unsigned int i;
@ -4070,7 +4074,7 @@ s_reloc (int ignore ATTRIBUTE_UNUSED)
} }
exp.X_op = O_absent; exp.X_op = O_absent;
SKIP_WHITESPACE (); SKIP_WHITESPACE_AFTER_NAME ();
if (*input_line_pointer == ',') if (*input_line_pointer == ',')
{ {
++input_line_pointer; ++input_line_pointer;
@ -5957,11 +5961,10 @@ do_s_func (int end_p, const char *default_prefix)
return; return;
} }
name = input_line_pointer; delim1 = get_symbol_name (& name);
delim1 = get_symbol_end ();
name = xstrdup (name); name = xstrdup (name);
*input_line_pointer = delim1; *input_line_pointer = delim1;
SKIP_WHITESPACE (); SKIP_WHITESPACE_AFTER_NAME ();
if (*input_line_pointer != ',') if (*input_line_pointer != ',')
{ {
if (default_prefix) if (default_prefix)
@ -5987,10 +5990,9 @@ do_s_func (int end_p, const char *default_prefix)
{ {
++input_line_pointer; ++input_line_pointer;
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
label = input_line_pointer; delim2 = get_symbol_name (& label);
delim2 = get_symbol_end ();
label = xstrdup (label); label = xstrdup (label);
*input_line_pointer = delim2; restore_line_pointer (delim2);
} }
if (debug_type == DEBUG_STABS) if (debug_type == DEBUG_STABS)

View file

@ -33,6 +33,16 @@ extern char *input_line_pointer; /* -> char we are parsing now. */
#define SKIP_WHITESPACE() know(*input_line_pointer != ' ' ) #define SKIP_WHITESPACE() know(*input_line_pointer != ' ' )
#endif #endif
#define SKIP_WHITESPACE_AFTER_NAME() \
do \
{ \
if (* input_line_pointer == '"') \
++ input_line_pointer; \
if (* input_line_pointer == ' ') \
++ input_line_pointer; \
} \
while (0)
#define LEX_NAME (1) /* may continue a name */ #define LEX_NAME (1) /* may continue a name */
#define LEX_BEGIN_NAME (2) /* may begin a name */ #define LEX_BEGIN_NAME (2) /* may begin a name */
#define LEX_END_NAME (4) /* ends a name */ #define LEX_END_NAME (4) /* ends a name */

View file

@ -457,11 +457,10 @@ s_desc (ignore)
symbolS *symbolP; symbolS *symbolP;
int temp; int temp;
name = input_line_pointer; c = get_symbol_name (&name);
c = get_symbol_end ();
p = input_line_pointer; p = input_line_pointer;
*p = c; *p = c;
SKIP_WHITESPACE (); SKIP_WHITESPACE_AFTER_NAME ();
if (*input_line_pointer != ',') if (*input_line_pointer != ',')
{ {
*p = 0; *p = 0;

View file

@ -1,3 +1,12 @@
2015-08-21 Nick Clifton <nickc@redhat.com>
PR gas/18581
* gas/all/byte.d: Disable this test. Quoted expressions
are now allowed in .byte directives.
* gas/all/quoted-sym-names.s: New test.
* gas/all/quoted-sym-names.d: Expected output.
* gas/all/gas.exp: Run the new test.
2015-08-21 Alexander Fomin <alexander.fomin@intel.com> 2015-08-21 Alexander Fomin <alexander.fomin@intel.com>
PR binutils/18257 PR binutils/18257

View file

@ -1,5 +1,4 @@
#name: bad byte directive #name: bad byte directive
#error-output: byte.l #error-output: byte.l
# The RX target allows quoted ASCII strings inside .byte directives # Quoted expressions are now allowed in .byte (and similar) expressions.
# for compatibily with the Renesas assembler. #skip: *-*-*
#skip: rx-*-*

View file

@ -434,6 +434,8 @@ if [is_elf_format] {
run_dump_test none run_dump_test none
} }
run_dump_test quoted-sym-names
load_lib gas-dg.exp load_lib gas-dg.exp
dg-init dg-init
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/err-*.s $srcdir/$subdir/warn-*.s]] "" "" dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/err-*.s $srcdir/$subdir/warn-*.s]] "" ""

View file

@ -0,0 +1,6 @@
#nm: --extern-only
#name: quoted symbol names
#...
0+00 T test-a

View file

@ -0,0 +1,4 @@
.text
.globl "test-a"
"test-a":
.word 0

View file

@ -23,7 +23,7 @@ Section Headers:
\[ 7\] \.symtab SYMTAB 0000000000000000 .* \[ 7\] \.symtab SYMTAB 0000000000000000 .*
00000000000000c0 0000000000000018 8 8 8 00000000000000c0 0000000000000018 8 8 8
\[ 8\] \.strtab STRTAB 0000000000000000 .* \[ 8\] \.strtab STRTAB 0000000000000000 .*
000000000000000c 0000000000000000 0 0 1 000000000000000[7c] 0000000000000000 0 0 1
Key to Flags: Key to Flags:
#... #...