Prevent the ASCII linker script directive from generating huge amounts of padding...
authorNick Clifton <nickc@redhat.com>
Fri, 3 Mar 2023 13:56:36 +0000 (13:56 +0000)
committerNick Clifton <nickc@redhat.com>
Fri, 3 Mar 2023 13:56:36 +0000 (13:56 +0000)
 PR 30193 * ldgram.y (ASCII): Fail if the size is not a constant.

ld/ChangeLog
ld/ldgram.y

index 9f4ad7cbf2533a06cc6e4c768a730129c03cefdb..6a7bc06c70c666a4a43b5ed3e30a77d681ed5dda 100644 (file)
@@ -1,3 +1,8 @@
+2023-03-03  Nick Clifton  <nickc@redhat.com>
+
+       PR 30193
+       * ldgram.y (ASCII): Fail if the size is not a constant.
+
 2023-02-23  Fangrui Song  <i@maskray.me>
 
        * emultempl/riscvelf.em: Add option parsing.
index faffeec94b8a79363d67781d9f3284588b30b7c4..26e56fe15660088c5d9e2bd52d0c1f973684ec76 100644 (file)
@@ -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
                {