[1/8] gas: don't permit "repeat" expressions with .cfi_{escape,fde_data}

Message ID 8692b7be-ece3-4def-94ab-dbbe904fe137@suse.com
State New
Headers
Series gas: CFI directive and listing adjustments |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm fail Patch failed to apply
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 fail Patch failed to apply

Commit Message

Jan Beulich Feb. 26, 2025, 3:14 p.m. UTC
  Repeat counts greater than 1 will emit data directly into the current
(sub-)section. That's wrong with .cfi_*, which defer data emission until
much later: N-1 instances of the specified data would not end up in
.eh_frame (or whatever the section that CFI data was specified to go
into). Simply disallow "repeat" expressions in such cases.
---
The alternative of properly implementing support would likely be a
little more involved.
  

Patch

--- a/gas/read.c
+++ b/gas/read.c
@@ -4184,6 +4184,20 @@  static void
 parse_mri_cons (expressionS *exp, unsigned int nbytes);
 #endif
 
+/* This function is used by .cfi_* directive handling, and hence must not
+   invoke parse_repeat_cons().  */
+
+void
+do_parse_cons_expression (expressionS *exp,
+			  int nbytes ATTRIBUTE_UNUSED)
+{
+#ifdef TC_PARSE_CONS_EXPRESSION
+  (void) TC_PARSE_CONS_EXPRESSION (exp, nbytes);
+#else
+  expression (exp);
+#endif
+}
+
 #ifndef TC_PARSE_CONS_EXPRESSION
 #ifdef REPEAT_CONS_EXPRESSIONS
 #define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) \
@@ -4199,14 +4213,6 @@  parse_repeat_cons (expressionS *exp, uns
 #endif
 #endif
 
-void
-do_parse_cons_expression (expressionS *exp,
-			  int nbytes ATTRIBUTE_UNUSED)
-{
-  (void) TC_PARSE_CONS_EXPRESSION (exp, nbytes);
-}
-
-
 /* Worker to do .byte etc statements.
    Clobbers input_line_pointer and checks end-of-line.  */