[v2,2/7] ldgram.y: Add ASCII parsing
Checks
Context |
Check |
Description |
linaro-tcwg-bot/tcwg_binutils_build--master-arm |
fail
|
Build failed
|
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 |
fail
|
Build failed
|
Commit Message
From: Ulf Samuelsson <ulf@emagii.com>
Signed-off-by: Ulf Samuelsson <ulf@emagii.com>
---
ld/ldgram.y | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
@@ -128,7 +128,7 @@ static void yyerror (const char *);
%right UNARY
%token END
%left <token> '('
-%token <token> ALIGN_K BLOCK BIND QUAD SQUAD LONG SHORT BYTE ASCIZ
+%token <token> ALIGN_K BLOCK BIND QUAD SQUAD LONG SHORT BYTE ASCII ASCIZ
%token SECTIONS PHDRS INSERT_K AFTER BEFORE LINKER_VERSION
%token DATA_SEGMENT_ALIGN DATA_SEGMENT_RELRO_END DATA_SEGMENT_END
%token SORT_BY_NAME SORT_BY_ALIGNMENT SORT_NONE
@@ -703,9 +703,18 @@ statement:
{
lang_add_data ((int) $1, $3);
}
+ | ASCII mustbe_exp ',' NAME
+ {
+ /* 'value' is a memory leak, do we care? */
+ etree_type *value = $2;
+ if (value->type.node_code == INT)
+ lang_add_string (value->value.value, $4);
+ else
+ einfo (_("%X%P:%pS: ASCII expression must be an integer\n"), NULL);
+ }
| ASCIZ NAME
{
- lang_add_string ($2);
+ lang_add_string (0, $2);
}
| FILL '(' fill_exp ')'
{