diff options
author | Alan Modra <amodra@gmail.com> | 2021-08-13 11:50:16 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2021-08-13 12:32:53 +0930 |
commit | af29a8abcf50ff9cb465a136c68b06bfc2ca7b75 (patch) | |
tree | 3178a2b395ebf1861809037b3bcc6e4b26113347 /ld/ldfile.c | |
parent | 41ee6d14fd3faf486036cdb9042e432664abfe48 (diff) | |
download | gdb-af29a8abcf50ff9cb465a136c68b06bfc2ca7b75.zip gdb-af29a8abcf50ff9cb465a136c68b06bfc2ca7b75.tar.gz gdb-af29a8abcf50ff9cb465a136c68b06bfc2ca7b75.tar.bz2 |
PR28217, Syntax error when memory region contains a hyphen
The saga of commit 40726f16a8d7 continues. This attacks the problem
of switching between SCRIPT and EXPRESSION state lexing by removing
the need to do so for phdrs like ":text". Instead {WILDCHAR}*
matching, the reason why ":text" lexed as one token, is restricted to
within the braces of a section or overlay statement. The new WILD
lexer state is switched at the non-optional brace tokens, so
ldlex_backup is no longer needed. I've also removed the BOTH state,
which doesn't seem to be needed any more. Besides rules involving
error reporting, there was just one place where SCRIPT appeared
without BOTH, the {WILDCHAR}* rule, three where BOTH appears without
SCRIPT for tokens that only need EXPRESSION state, and two where BOTH
appears alongside INPUT_LIST. (Since I'm editing the wild and
filename rules, removing BOTH and adding WILD can also be seen as
renaming the old BOTH state to SCRIPT and renaming the old SCRIPT
state to WILD with a reduced scope.)
As a followup, I'll look at removing EXPRESSION state from some lexer
rules that no longer need it due to this cleanup.
PR 28217
* ldgram.y (exp <ORIGIN, LENGTH>): Use paren_script_name.
(section): Parse within braces of section in wild mode, and
after brace back in script mode. Remove ldlex_backup call.
Similarly for OVERLAY.
(overlay_section): Similarly.
(script_file): Replace ldlex_both with ldlex_script.
* ldlex.h (ldlex_wild): Declare.
(ldlex_both): Delete.
* ldlex.l (BOTH): Delete. Remove state from all rules.
(WILD): New state. Enable many tokens in this state.
Enable filename match in SCRIPT mode. Enable WILDCHAR match
in WILD state, disable in SCRIPT mode.
(ldlex_wild): New function.
* ldfile.c (ldfile_try_open_bfd): Replace ldlex_both call with
ldlex_script.
Diffstat (limited to 'ld/ldfile.c')
-rw-r--r-- | ld/ldfile.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/ld/ldfile.c b/ld/ldfile.c index 43b1116..22271fd 100644 --- a/ld/ldfile.c +++ b/ld/ldfile.c @@ -193,7 +193,7 @@ ldfile_try_open_bfd (const char *attempt, ldfile_assumed_script = true; parser_input = input_selected; - ldlex_both (); + ldlex_script (); token = INPUT_SCRIPT; while (token != 0) { |