[2/4] ldgram.y: Add 'ASCIZ <string>' command

Message ID 20230210174404.3763-3-binutils@emagii.com
State Accepted
Headers
Series [1/4] ldlex.l: Add ASCIZ token |

Checks

Context Check Description
snail/binutils-gdb-check success Github commit url

Commit Message

Ulf Samuelsson Feb. 10, 2023, 5:44 p.m. UTC
  From: Ulf Samuelsson <ulf@emagii.com>

Signed-off-by: Ulf Samuelsson <ulf@emagii.com>
---
 ld/ldgram.y | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
  

Patch

diff --git a/ld/ldgram.y b/ld/ldgram.y
index fa5f01fef1d..67e75d43067 100644
--- a/ld/ldgram.y
+++ b/ld/ldgram.y
@@ -125,7 +125,7 @@  static int error_index;
 %right UNARY
 %token END
 %left <token> '('
-%token <token> ALIGN_K BLOCK BIND QUAD SQUAD LONG SHORT BYTE
+%token <token> ALIGN_K BLOCK BIND QUAD SQUAD LONG SHORT BYTE ASCIZ
 %token SECTIONS PHDRS INSERT_K AFTER BEFORE
 %token DATA_SEGMENT_ALIGN DATA_SEGMENT_RELRO_END DATA_SEGMENT_END
 %token SORT_BY_NAME SORT_BY_ALIGNMENT SORT_NONE
@@ -668,7 +668,10 @@  statement:
 		{
 		  lang_add_data ((int) $1, $3);
 		}
-
+	| ASCIZ NAME
+		{
+		  lang_add_stringz($2);
+		}
 	| FILL '(' fill_exp ')'
 		{
 		  lang_add_fill ($3);