From adbe951fc95943016325af08d677f18e8c177ac1 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Fri, 3 Mar 2023 13:56:36 +0000 Subject: Prevent the ASCII linker script directive from generating huge amounts of padding if the size expression is not a constant. PR 30193 * ldgram.y (ASCII): Fail if the size is not a constant. --- ld/ChangeLog | 5 +++++ ld/ldgram.y | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'ld') diff --git a/ld/ChangeLog b/ld/ChangeLog index 9f4ad7c..6a7bc06 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,8 @@ +2023-03-03 Nick Clifton + + PR 30193 + * ldgram.y (ASCII): Fail if the size is not a constant. + 2023-02-23 Fangrui Song * emultempl/riscvelf.em: Add option parsing. diff --git a/ld/ldgram.y b/ld/ldgram.y index faffeec..26e56fe 100644 --- a/ld/ldgram.y +++ b/ld/ldgram.y @@ -672,7 +672,10 @@ statement: { /* 'value' is a memory leak, do we care? */ etree_type *value = $3; - lang_add_string (value->value.value, $5); + if (value->type.node_code == INT) + lang_add_string (value->value.value, $5); + else + einfo (_("%X%P:%pS: ASCII expression must be an integer\n"), NULL); } | ASCIZ NAME { -- cgit v1.1