aboutsummaryrefslogtreecommitdiff
path: root/GnuLdLexer.g4
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2016-07-17 16:03:47 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2016-07-17 16:03:47 +0200
commit0f57cc9750282ce0284fe69b06f161dea2bfc8cb (patch)
tree50afd51fec2d05752cc49441ae47c40aa831cf84 /GnuLdLexer.g4
parentc5e53ec8da9b11e351893742096f76e2bceb5730 (diff)
downloadelfinfo-0f57cc9750282ce0284fe69b06f161dea2bfc8cb.tar.gz
elfinfo-0f57cc9750282ce0284fe69b06f161dea2bfc8cb.tar.bz2
elfinfo-0f57cc9750282ce0284fe69b06f161dea2bfc8cb.tar.xz
elfinfo-0f57cc9750282ce0284fe69b06f161dea2bfc8cb.zip
parser/lexer:
o Support special '/DISCARD/' as NAME. o Add 'SORT' as a token. It is equivalent with SORT_BY_NAME. The new rule sort_by_name coverts both. Ld: o Don't die on unknown sections, they can be referenced before declared. Doesn't matter for this app anyway.
Diffstat (limited to 'GnuLdLexer.g4')
-rw-r--r--GnuLdLexer.g43
1 files changed, 2 insertions, 1 deletions
diff --git a/GnuLdLexer.g4 b/GnuLdLexer.g4
index 16c4a9e..eb6090f 100644
--- a/GnuLdLexer.g4
+++ b/GnuLdLexer.g4
@@ -131,6 +131,7 @@ SIZEOF_HEADERS : 'SIZEOF_HEADERS';
SIZEOF : 'SIZEOF';
SORT_BY_ALIGNMENT : 'SORT_BY_ALIGNMENT';
SORT_BY_INIT_PRIORITY : 'SORT_BY_INIT_PRIORITY';
+SORT : 'SORT';
SORT_BY_NAME : 'SORT_BY_NAME';
SORT_NONE : 'SORT_NONE';
SPECIAL : 'SPECIAL';
@@ -159,7 +160,7 @@ QUOTE : '"' -> skip, pushMode(STRING);
// | NAME # namePlain;
//NAME : [\._a-zA-Z][\._a-zA-Z0-9]*;
-NAME : [*\._a-zA-Z][*\.\/_a-zA-Z0-9]*;
+NAME : [*\._a-zA-Z][*\.\/_a-zA-Z0-9]* | '/DISCARD/';
// TODO: ld supports some really fancy expressions here, like "0101010b", "ffH", "ffx", "$Aa" etc
//INT : '0x' [0-9a-fA-F]+