[v3,12/15] gas: Don't skip SFrame FDE if .cfi_register specifies RA w/o tracking

Message ID 20240412144718.4191286-13-jremus@linux.ibm.com
State New
Headers
Series sframe: Enhancements to SFrame info generation |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_binutils_check--master-arm success Testing passed

Commit Message

Jens Remus April 12, 2024, 2:47 p.m. UTC
  Do not skip SFrame FDE if .cfi_register specifies RA register without
RA tracking being actually used. Without RA tracking the register
contents can always be restored from the stack using the fixed
RA offset from CFA.

gas/
	* gen-sframe.c (sframe_xlate_do_register): Do not skip SFrame
	FDE if .cfi_register specifies RA register without RA tracking
	being used.

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
---

Notes (jremus):
    Changes v2 -> v3:
    - New patch.

 gas/gen-sframe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Indu Bhagat April 18, 2024, 8:36 p.m. UTC | #1
On 4/12/24 07:47, Jens Remus wrote:
> Do not skip SFrame FDE if .cfi_register specifies RA register without
> RA tracking being actually used. Without RA tracking the register
> contents can always be restored from the stack using the fixed
> RA offset from CFA.
> 
> gas/
> 	* gen-sframe.c (sframe_xlate_do_register): Do not skip SFrame
> 	FDE if .cfi_register specifies RA register without RA tracking
> 	being used.
> 

OK.

Thanks

> Signed-off-by: Jens Remus <jremus@linux.ibm.com>
> ---
> 
> Notes (jremus):
>      Changes v2 -> v3:
>      - New patch.
> 
>   gas/gen-sframe.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/gas/gen-sframe.c b/gas/gen-sframe.c
> index 98166de8cc01..61c846f214ee 100644
> --- a/gas/gen-sframe.c
> +++ b/gas/gen-sframe.c
> @@ -1160,7 +1160,7 @@ sframe_xlate_do_register (struct sframe_xlate_ctx *xlate_ctx ATTRIBUTE_UNUSED,
>        stack trace information.  */
>     if (cfi_insn->u.rr.reg1 == SFRAME_CFA_SP_REG
>   #ifdef SFRAME_FRE_RA_TRACKING
> -      || (cfi_insn->u.rr.reg1 == SFRAME_CFA_RA_REG)
> +      || (sframe_ra_tracking_p () && cfi_insn->u.rr.reg1 == SFRAME_CFA_RA_REG)
>   #endif
>         || cfi_insn->u.rr.reg1 == SFRAME_CFA_FP_REG)
>       {
  

Patch

diff --git a/gas/gen-sframe.c b/gas/gen-sframe.c
index 98166de8cc01..61c846f214ee 100644
--- a/gas/gen-sframe.c
+++ b/gas/gen-sframe.c
@@ -1160,7 +1160,7 @@  sframe_xlate_do_register (struct sframe_xlate_ctx *xlate_ctx ATTRIBUTE_UNUSED,
      stack trace information.  */
   if (cfi_insn->u.rr.reg1 == SFRAME_CFA_SP_REG
 #ifdef SFRAME_FRE_RA_TRACKING
-      || (cfi_insn->u.rr.reg1 == SFRAME_CFA_RA_REG)
+      || (sframe_ra_tracking_p () && cfi_insn->u.rr.reg1 == SFRAME_CFA_RA_REG)
 #endif
       || cfi_insn->u.rr.reg1 == SFRAME_CFA_FP_REG)
     {