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 --git a/gas/dw2gencfi.c b/gas/dw2gencfi.c index 4412480..5b1cdfb 100644 --- a/gas/dw2gencfi.c +++ b/gas/dw2gencfi.c
@@ -996,11 +996,10 @@ 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 @@ } 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 3290fb6..b3645e9 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 6794f8a..d54d648 100644 --- a/gas/testsuite/gas/cfi/listing.s +++ b/gas/testsuite/gas/cfi/listing.s
@@ -20,7 +20,8 @@ .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>. */