[V2 25/36] [SFrame-V3] gas: sframe: testsuite: reject .cfi_register REG_SP, REG

Jens Remus jremus@linux.ibm.com
Wed Jan 7 14:18:37 GMT 2026


On 1/7/2026 9:42 AM, Indu Bhagat wrote:

Maybe change commit title as follows to align with the previous:

gas: sframe: testsuite: skip SFrame FDE if .cfi_register SP, reg


Please add a short commit message why this is the right thing to do.
For instance:

SFrame does not track the SP.  For recovering of the SP SFrame relies on
the architecture/ABI's CFA definition:

  CFA = SP [+ offset   // on s390x]

Which results in the following implicit CFA value offset rule for SP:

  SP = CFA [- offset   // on s390x]

Where offset is zero for most architectures/ABIs, except s390x.

Therefore .cfi_register SP, reg directives must be rejected, as they
cannot be represented in SFrame.

> gas/
> 	* gas/gen-sframe.c (s390_sframe_xlate_do_register): Check for
> 	REG_SP and reject while generating a warning.
> 	(sframe_xlate_do_register): Likewise.
> gas/testsuite/
> 	* gas/cfi-sframe/cfi-sframe-s390x-err-4.d: New test.
> 	* gas/cfi-sframe/cfi-sframe-s390x-err-4.s: Likewise.
> 	* gas/cfi-sframe/cfi-sframe-x86_64-empty-5.d: Likewise.
> 	* gas/cfi-sframe/cfi-sframe-x86_64-empty-5.s: Likewise.
> 	* gas/cfi-sframe/cfi-sframe.exp: Add new tests.

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

What about rejecting .cfi_offset SP, offset directives as well?  Except
for s390x, where the SP is saved in most cases on the stack, due to the
use of the Store Multiple (STMG) and Load Multiple (LMG) instructions
in the prologue and epilogue.

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