mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-26 05:47:26 +08:00
gas: generalize comment character escaping recognition
PR gas/4572 Generalize what ab1fadc6b2f0 ("PR22714, Assembler preprocessor loses track of \@") did to always honor escaped comment chars. Use this then to support escaped /, %, and * operators on x86, when / is a comment char (to match the Sun assembler's behavior).
This commit is contained in:
@ -1,3 +1,13 @@
|
|||||||
|
2020-07-20 Jan Beulich <jbeulich@suse.com>
|
||||||
|
|
||||||
|
PR gas/4572
|
||||||
|
* app.c (last_char): Drop TC_ARM conditional around it.
|
||||||
|
(struct app_save): Drop TC_ARM conditional around last_char.
|
||||||
|
(app_push, app_pop): Drop TC_ARM conditional from last_char
|
||||||
|
accesses.
|
||||||
|
(do_scrub_chars): Likewise. Drop TC_ARM conditional from
|
||||||
|
backslash-precedes-comment-character check.
|
||||||
|
|
||||||
2020-07-20 Jan Beulich <jbeulich@suse.com>
|
2020-07-20 Jan Beulich <jbeulich@suse.com>
|
||||||
|
|
||||||
* config/tc-i386.c (frag_opcode_byte): New.
|
* config/tc-i386.c (frag_opcode_byte): New.
|
||||||
|
21
gas/app.c
21
gas/app.c
@ -55,9 +55,8 @@ static const char mri_pseudo[] = ".mri 0";
|
|||||||
static const char symver_pseudo[] = ".symver";
|
static const char symver_pseudo[] = ".symver";
|
||||||
static const char * symver_state;
|
static const char * symver_state;
|
||||||
#endif
|
#endif
|
||||||
#ifdef TC_ARM
|
|
||||||
static char last_char;
|
static char last_char;
|
||||||
#endif
|
|
||||||
|
|
||||||
static char lex[256];
|
static char lex[256];
|
||||||
static const char symbol_chars[] =
|
static const char symbol_chars[] =
|
||||||
@ -244,9 +243,7 @@ struct app_save
|
|||||||
#if defined TC_ARM && defined OBJ_ELF
|
#if defined TC_ARM && defined OBJ_ELF
|
||||||
const char * symver_state;
|
const char * symver_state;
|
||||||
#endif
|
#endif
|
||||||
#ifdef TC_ARM
|
|
||||||
char last_char;
|
char last_char;
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
char *
|
char *
|
||||||
@ -276,9 +273,7 @@ app_push (void)
|
|||||||
#if defined TC_ARM && defined OBJ_ELF
|
#if defined TC_ARM && defined OBJ_ELF
|
||||||
saved->symver_state = symver_state;
|
saved->symver_state = symver_state;
|
||||||
#endif
|
#endif
|
||||||
#ifdef TC_ARM
|
|
||||||
saved->last_char = last_char;
|
saved->last_char = last_char;
|
||||||
#endif
|
|
||||||
|
|
||||||
/* do_scrub_begin() is not useful, just wastes time. */
|
/* do_scrub_begin() is not useful, just wastes time. */
|
||||||
|
|
||||||
@ -318,9 +313,7 @@ app_pop (char *arg)
|
|||||||
#if defined TC_ARM && defined OBJ_ELF
|
#if defined TC_ARM && defined OBJ_ELF
|
||||||
symver_state = saved->symver_state;
|
symver_state = saved->symver_state;
|
||||||
#endif
|
#endif
|
||||||
#ifdef TC_ARM
|
|
||||||
last_char = saved->last_char;
|
last_char = saved->last_char;
|
||||||
#endif
|
|
||||||
|
|
||||||
free (arg);
|
free (arg);
|
||||||
}
|
}
|
||||||
@ -1289,13 +1282,11 @@ do_scrub_chars (size_t (*get) (char *, size_t), char *tostart, size_t tolen)
|
|||||||
goto de_fault;
|
goto de_fault;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef TC_ARM
|
/* Care is needed not to damage occurrences of \<comment-char>
|
||||||
/* For the ARM, care is needed not to damage occurrences of \@
|
by stripping the <comment-char> onwards. Yuck. */
|
||||||
by stripping the @ onwards. Yuck. */
|
|
||||||
if ((to > tostart ? to[-1] : last_char) == '\\')
|
if ((to > tostart ? to[-1] : last_char) == '\\')
|
||||||
/* Do not treat the @ as a start-of-comment. */
|
/* Do not treat the <comment-char> as a start-of-comment. */
|
||||||
goto de_fault;
|
goto de_fault;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef WARN_COMMENTS
|
#ifdef WARN_COMMENTS
|
||||||
if (!found_comment)
|
if (!found_comment)
|
||||||
@ -1472,10 +1463,8 @@ do_scrub_chars (size_t (*get) (char *, size_t), char *tostart, size_t tolen)
|
|||||||
|
|
||||||
fromeof:
|
fromeof:
|
||||||
/* We have reached the end of the input. */
|
/* We have reached the end of the input. */
|
||||||
#ifdef TC_ARM
|
|
||||||
if (to > tostart)
|
if (to > tostart)
|
||||||
last_char = to[-1];
|
last_char = to[-1];
|
||||||
#endif
|
|
||||||
return to - tostart;
|
return to - tostart;
|
||||||
|
|
||||||
tofull:
|
tofull:
|
||||||
@ -1489,9 +1478,7 @@ do_scrub_chars (size_t (*get) (char *, size_t), char *tostart, size_t tolen)
|
|||||||
else
|
else
|
||||||
saved_input = NULL;
|
saved_input = NULL;
|
||||||
|
|
||||||
#ifdef TC_ARM
|
|
||||||
if (to > tostart)
|
if (to > tostart)
|
||||||
last_char = to[-1];
|
last_char = to[-1];
|
||||||
#endif
|
|
||||||
return to - tostart;
|
return to - tostart;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user