public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] gas: sframe: warn when skipping SFrame FDE generation
@ 2024-01-10 23:11 Indu Bhagat
  2024-01-12  8:35 ` Indu Bhagat
  0 siblings, 1 reply; 2+ messages in thread
From: Indu Bhagat @ 2024-01-10 23:11 UTC (permalink / raw)
  To: binutils; +Cc: Indu Bhagat

Fix PR gas/31213.

gas/
	PR gas/31213
        * gen-sframe.c (sframe_do_cfi_insn): Add new warning.

gas/testsuite/
	* gas/cfi-sframe/common-empty-1.d: Test the new warning as well.
	* gas/cfi-sframe/common-empty-2.d: Likewise.
---
 gas/gen-sframe.c                              | 34 ++++++++++++-------
 gas/testsuite/gas/cfi-sframe/common-empty-1.d |  1 +
 gas/testsuite/gas/cfi-sframe/common-empty-2.d |  1 +
 3 files changed, 23 insertions(+), 13 deletions(-)

diff --git a/gas/gen-sframe.c b/gas/gen-sframe.c
index 3c212f3a882..75781fc8ccb 100644
--- a/gas/gen-sframe.c
+++ b/gas/gen-sframe.c
@@ -1247,25 +1247,33 @@ sframe_do_cfi_insn (struct sframe_xlate_ctx *xlate_ctx,
     case DW_CFA_GNU_window_save:
       err = sframe_xlate_do_gnu_window_save (xlate_ctx, cfi_insn);
       break;
+    /* Other CFI opcodes are not processed at this time.
+       These do not impact the coverage of the basic stack tracing
+       information as conveyed in the SFrame format.
+	- DW_CFA_register,
+	- etc.  */
+    case DW_CFA_register:
+      if (cfi_insn->u.rr.reg1 == SFRAME_CFA_SP_REG
+#ifdef SFRAME_FRE_RA_TRACKING
+	  || cfi_insn->u.rr.reg1 == SFRAME_CFA_RA_REG
+#endif
+	  || cfi_insn->u.rr.reg1 == SFRAME_CFA_FP_REG)
+	err = SFRAME_XLATE_ERR_NOTREPRESENTED;
+      break;
     case DW_CFA_undefined:
     case DW_CFA_same_value:
       break;
     default:
-      {
-	/* Other CFI opcodes are not processed at this time.
-	   These do not impact the coverage of the basic stack tracing
-	   information as conveyed in the SFrame format.
-	    - DW_CFA_register,
-	    - ...
-
-	   Following skipped operations do, however, impact the asynchronicity:
-	     - CFI_escape  */
-
-	err = SFRAME_XLATE_ERR_NOTREPRESENTED;
-	// printf (_("SFrame Unsupported or unknown Dwarf CFI number: %#x\n"), op);
-      }
+      /* Following skipped operations do, however, impact the asynchronicity:
+	  - CFI_escape.  */
+      err = SFRAME_XLATE_ERR_NOTREPRESENTED;
     }
 
+  /* An error here will cause no SFrame FDE later.  Warn the user because this
+     will affect the overall coverage and hence, asynchronicity.  */
+  if (err)
+    as_warn (_("skipping SFrame FDE due to DWARF CFI op %#x"), op);
+
   return err;
 }
 
diff --git a/gas/testsuite/gas/cfi-sframe/common-empty-1.d b/gas/testsuite/gas/cfi-sframe/common-empty-1.d
index 141922517f0..b133b15b051 100644
--- a/gas/testsuite/gas/cfi-sframe/common-empty-1.d
+++ b/gas/testsuite/gas/cfi-sframe/common-empty-1.d
@@ -1,4 +1,5 @@
 #as: --gsframe
+#warning: skipping SFrame FDE due to DWARF CFI op 0xa
 #objdump: --sframe=.sframe
 #name: Uninteresting cfi directives generate an empty SFrame section
 #...
diff --git a/gas/testsuite/gas/cfi-sframe/common-empty-2.d b/gas/testsuite/gas/cfi-sframe/common-empty-2.d
index ab8de0b8afa..c5bc8594f1b 100644
--- a/gas/testsuite/gas/cfi-sframe/common-empty-2.d
+++ b/gas/testsuite/gas/cfi-sframe/common-empty-2.d
@@ -1,4 +1,5 @@
 #as: --gsframe
+#warning: skipping SFrame FDE due to DWARF CFI op 0xe
 #objdump: --sframe=.sframe
 #name: SFrame supports only FP/SP based CFA
 #...
-- 
2.41.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] gas: sframe: warn when skipping SFrame FDE generation
  2024-01-10 23:11 [PATCH] gas: sframe: warn when skipping SFrame FDE generation Indu Bhagat
@ 2024-01-12  8:35 ` Indu Bhagat
  0 siblings, 0 replies; 2+ messages in thread
From: Indu Bhagat @ 2024-01-12  8:35 UTC (permalink / raw)
  To: binutils

On 1/10/24 3:11 PM, Indu Bhagat wrote:
> Fix PR gas/31213.
> 
> gas/
> 	PR gas/31213
>          * gen-sframe.c (sframe_do_cfi_insn): Add new warning.
> 
> gas/testsuite/
> 	* gas/cfi-sframe/common-empty-1.d: Test the new warning as well.
> 	* gas/cfi-sframe/common-empty-2.d: Likewise.
> ---
>   gas/gen-sframe.c                              | 34 ++++++++++++-------
>   gas/testsuite/gas/cfi-sframe/common-empty-1.d |  1 +
>   gas/testsuite/gas/cfi-sframe/common-empty-2.d |  1 +
>   3 files changed, 23 insertions(+), 13 deletions(-)
> 

Committed.

> diff --git a/gas/gen-sframe.c b/gas/gen-sframe.c
> index 3c212f3a882..75781fc8ccb 100644
> --- a/gas/gen-sframe.c
> +++ b/gas/gen-sframe.c
> @@ -1247,25 +1247,33 @@ sframe_do_cfi_insn (struct sframe_xlate_ctx *xlate_ctx,
>       case DW_CFA_GNU_window_save:
>         err = sframe_xlate_do_gnu_window_save (xlate_ctx, cfi_insn);
>         break;
> +    /* Other CFI opcodes are not processed at this time.
> +       These do not impact the coverage of the basic stack tracing
> +       information as conveyed in the SFrame format.
> +	- DW_CFA_register,
> +	- etc.  */
> +    case DW_CFA_register:
> +      if (cfi_insn->u.rr.reg1 == SFRAME_CFA_SP_REG
> +#ifdef SFRAME_FRE_RA_TRACKING
> +	  || cfi_insn->u.rr.reg1 == SFRAME_CFA_RA_REG
> +#endif
> +	  || cfi_insn->u.rr.reg1 == SFRAME_CFA_FP_REG)
> +	err = SFRAME_XLATE_ERR_NOTREPRESENTED;
> +      break;
>       case DW_CFA_undefined:
>       case DW_CFA_same_value:
>         break;
>       default:
> -      {
> -	/* Other CFI opcodes are not processed at this time.
> -	   These do not impact the coverage of the basic stack tracing
> -	   information as conveyed in the SFrame format.
> -	    - DW_CFA_register,
> -	    - ...
> -
> -	   Following skipped operations do, however, impact the asynchronicity:
> -	     - CFI_escape  */
> -
> -	err = SFRAME_XLATE_ERR_NOTREPRESENTED;
> -	// printf (_("SFrame Unsupported or unknown Dwarf CFI number: %#x\n"), op);
> -      }
> +      /* Following skipped operations do, however, impact the asynchronicity:
> +	  - CFI_escape.  */
> +      err = SFRAME_XLATE_ERR_NOTREPRESENTED;
>       }
>   
> +  /* An error here will cause no SFrame FDE later.  Warn the user because this
> +     will affect the overall coverage and hence, asynchronicity.  */
> +  if (err)
> +    as_warn (_("skipping SFrame FDE due to DWARF CFI op %#x"), op);
> +
>     return err;
>   }
>   
> diff --git a/gas/testsuite/gas/cfi-sframe/common-empty-1.d b/gas/testsuite/gas/cfi-sframe/common-empty-1.d
> index 141922517f0..b133b15b051 100644
> --- a/gas/testsuite/gas/cfi-sframe/common-empty-1.d
> +++ b/gas/testsuite/gas/cfi-sframe/common-empty-1.d
> @@ -1,4 +1,5 @@
>   #as: --gsframe
> +#warning: skipping SFrame FDE due to DWARF CFI op 0xa
>   #objdump: --sframe=.sframe
>   #name: Uninteresting cfi directives generate an empty SFrame section
>   #...
> diff --git a/gas/testsuite/gas/cfi-sframe/common-empty-2.d b/gas/testsuite/gas/cfi-sframe/common-empty-2.d
> index ab8de0b8afa..c5bc8594f1b 100644
> --- a/gas/testsuite/gas/cfi-sframe/common-empty-2.d
> +++ b/gas/testsuite/gas/cfi-sframe/common-empty-2.d
> @@ -1,4 +1,5 @@
>   #as: --gsframe
> +#warning: skipping SFrame FDE due to DWARF CFI op 0xe
>   #objdump: --sframe=.sframe
>   #name: SFrame supports only FP/SP based CFA
>   #...
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-01-12  8:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-10 23:11 [PATCH] gas: sframe: warn when skipping SFrame FDE generation Indu Bhagat
2024-01-12  8:35 ` Indu Bhagat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).