summaryrefslogtreecommitdiff
path: root/ld/ldlex.h
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2021-08-13 11:50:16 +0930
committerAlan Modra <amodra@gmail.com>2021-08-13 12:32:53 +0930
commitaf29a8abcf50ff9cb465a136c68b06bfc2ca7b75 (patch)
tree3178a2b395ebf1861809037b3bcc6e4b26113347 /ld/ldlex.h
parent41ee6d14fd3faf486036cdb9042e432664abfe48 (diff)
downloadbinutils-gdb-af29a8abcf50ff9cb465a136c68b06bfc2ca7b75.tar.gz
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/ldlex.h')
-rw-r--r--ld/ldlex.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/ld/ldlex.h b/ld/ldlex.h
index 9707d57caf8..04ee0e40dc1 100644
--- a/ld/ldlex.h
+++ b/ld/ldlex.h
@@ -191,7 +191,7 @@ extern void ldlex_mri_script (void);
extern void ldlex_version_script (void);
extern void ldlex_version_file (void);
extern void ldlex_expression (void);
-extern void ldlex_both (void);
+extern void ldlex_wild (void);
extern void ldlex_popstate (void);
extern void ldlex_backup (void);
extern const char* ldlex_filename (void);