[PATCH] gas: fix silent failure of .cfi_sections .sframe on unsupported targets

Jens Remus jremus@linux.ibm.com
Fri Mar 13 13:28:55 GMT 2026


On 3/10/2026 7:07 AM, Indu Bhagat wrote:
> [Resending as I messed up one of the email in the to list in the
> previous attempt].
> 
> Starting in Binutils 2.46, the .cfi_sections .sframe directive failed
> silently when targeting unsupported architectures (e.g., i386 or even
> x32 on x86_64).  This happened because the sframe_as_bad macro only
> checked for the command-line flag --gsframe (GEN_SFRAME_ENABLED) and
> ignored the explicit request via the assembler directive
> (CFI_EMIT_sframe).
> 
> This patch ensures that an error is emitted (for unsupported targets) if
> SFrame is requested via either the command line or the .cfi_sections
> directive, while maintaining silence for 'opportunistic' sframe
> generation (GEN_SFRAME_CONFIG_ENABLED).
> 
> Add two testcases:
>   - cfi-sframe-x86_64-err-1.d: usage of --32 with .cfi_sections .sframe,
>   - cfi-sframe-x86_64-err-2.d: usage of --gsframe --32 without
>     .cfi_sections .sframe
> GAS is expected to error out in both the cases.
> 
> This fixes PR gas/33962 - .cfi_sections directive with .sframe on
> unsupported targets does not error.
> 
> gas/
> 	PR gas/33962
> 	* dw2gencfi.c (dot_cfi_sections): Ensure as_bad is called if
> 	SFrame was explicitly requested via directive.
> 	* gen-sframe.h: Remove sframe_as_bad macro.
> gas/testsuite/
> 	PR gas/33962
> 	* gas/cfi-sframe/cfi-sframe-x86_64-err-1.s: New test.
> 	* gas/cfi-sframe/cfi-sframe-x86_64-err-1.d: New test.
> 	* gas/cfi-sframe/cfi-sframe-x86_64-err-2.s: New test.
> 	* gas/cfi-sframe/cfi-sframe-x86_64-err-1.d: New test.

Nit: You listed cfi-sframe-x86_64-err-1.d twice. :-)

> 	* gas/cfi-sframe/cfi-sframe.exp: Run the new tests.
Regards,
Jens
-- 
Jens Remus
Linux on Z Development (D3303)
jremus@de.ibm.com / jremus@linux.ibm.com

IBM Deutschland Research & Development GmbH; Vorsitzender des Aufsichtsrats: Wolfgang Wendt; Geschäftsführung: David Faller; Sitz der Gesellschaft: Ehningen; Registergericht: Amtsgericht Stuttgart, HRB 243294
IBM Data Privacy Statement: https://www.ibm.com/privacy/



More information about the Binutils mailing list