[binutils-gdb] gas/CFI: fix .cfi_escape parsing when equates are in use
Jan Beulich
jbeulich@sourceware.org
Mon Dec 22 10:09:25 GMT 2025
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8c8ec38a99f276fc26d35c3caef8e02d8b292e73
commit 8c8ec38a99f276fc26d35c3caef8e02d8b292e73
Author: Jan Beulich <jbeulich@suse.com>
Date: Mon Dec 22 11:06:13 2025 +0100
gas/CFI: fix .cfi_escape parsing when equates are in use
The restoring of the line pointer needs to happen in more cases.
While there also adjust a slightly misleading comment.
Reviewed-by: Jens Remus <jremus@linux.ibm.com>
Diff:
---
gas/dw2gencfi.c | 9 ++++-----
gas/testsuite/gas/cfi/listing.l | 3 ++-
gas/testsuite/gas/cfi/listing.s | 3 ++-
3 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/gas/dw2gencfi.c b/gas/dw2gencfi.c
index 44124807416..5b1cdfba6af 100644
--- a/gas/dw2gencfi.c
+++ b/gas/dw2gencfi.c
@@ -996,11 +996,10 @@ dot_cfi_escape (int ignored ATTRIBUTE_UNUSED)
if (is_whitespace (c))
c = *++input_line_pointer;
if (c != '(')
- {
- input_line_pointer = ilp_save;
- e->type = CFI_ESC_byte;
- }
+ e->type = CFI_ESC_byte;
}
+ if (e->type == CFI_ESC_byte)
+ input_line_pointer = ilp_save;
if (e->type == CFI_ESC_sleb128 || e->type == CFI_ESC_uleb128)
{
@@ -1010,7 +1009,7 @@ dot_cfi_escape (int ignored ATTRIBUTE_UNUSED)
}
else
{
- /* We may still be at the opening parenthesis. Leave it to expression()
+ /* We may still be at an opening parenthesis. Leave it to expression()
to parse it and find the matching closing one. */
e->reloc = do_parse_cons_expression (&e->exp, e->type);
}
diff --git a/gas/testsuite/gas/cfi/listing.l b/gas/testsuite/gas/cfi/listing.l
index 3290fb664a2..b3645e91e2d 100644
--- a/gas/testsuite/gas/cfi/listing.l
+++ b/gas/testsuite/gas/cfi/listing.l
@@ -24,7 +24,8 @@
[ ]*[0-9]*[ ]+(4[048]00 ?0000|0000 ?004[048]) *
[ ]*[0-9]*[ ]+[0-9a-f]{4} .*[ ]\.nop
[ ]*[0-9]*[ ]+/\* DW_CFA_register reg127, reg129. \*/
-[ ]*[0-9]*[ ]+[0-9a-f]{4} 4.09 ?7F81[ ]+\.cfi_escape 0x09, uleb128\(127\), uleb128\(129\)
+[ ]*[0-9]*[ ]+\.equiv DW_CFA_register, 0x09
+[ ]*[0-9]*[ ]+[0-9a-f]{4} 4.09 ?7F81[ ]+\.cfi_escape DW_CFA_register, uleb128\(127\), uleb128\(129\)
[ ]*[0-9]*[ ]+01
[ ]*[0-9]*[ ]+/\* DW_CFA_val_expression reg250, ... \*/
[ ]*[0-9]*[ ]+[0-9a-f]{4} 16FA ?01[ ]+\.cfi_escape 0x16, uleb128\(250\)
diff --git a/gas/testsuite/gas/cfi/listing.s b/gas/testsuite/gas/cfi/listing.s
index 6794f8a5db1..d54d648355e 100644
--- a/gas/testsuite/gas/cfi/listing.s
+++ b/gas/testsuite/gas/cfi/listing.s
@@ -20,7 +20,8 @@ func2:
.cfi_startproc
.nop
/* DW_CFA_register reg127, reg129. */
- .cfi_escape 0x09, uleb128(127), uleb128(129)
+ .equiv DW_CFA_register, 0x09
+ .cfi_escape DW_CFA_register, uleb128(127), uleb128(129)
/* DW_CFA_val_expression reg250, ... */
.cfi_escape 0x16, uleb128(250)
/* ... <len>. */
More information about the Binutils-cvs
mailing list