[PATCH,V5 9/9] gas: aarch64: testsuite: add new tests for SCFI

Richard Sandiford richard.sandiford@arm.com
Tue Jul 16 18:17:35 GMT 2024


The tests look really nice.

I did try to proof-read and understand each test, but it's always difficult
to know how effective that is due to the sheer amount of information.
The fact that the harness runs some tests twice, once with manual CFI
and once with SCFI, definitely helps with that though.

Indu Bhagat <indu.bhagat@oracle.com> writes:
> [...]
> diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-ldrp-2.s b/gas/testsuite/gas/scfi/aarch64/scfi-ldrp-2.s
> new file mode 100644
> index 00000000000..ac4ad6836ed
> --- /dev/null
> +++ b/gas/testsuite/gas/scfi/aarch64/scfi-ldrp-2.s
> @@ -0,0 +1,26 @@
> +# Testcase for various ldp / ldr instructions
> +	.text
> +	.align  2
> +	.global foo
> +	.type   foo, %function
> +foo:
> +	.cfi_startproc
> +	stp     x29, x30, [sp, -128]!
> +	.cfi_def_cfa_offset 128
> +	.cfi_offset 29, -128
> +	.cfi_offset 30, -120
> +	mov     x29, sp
> +	.cfi_def_cfa_register 29
> +	mov     sp, x29
> +	.cfi_def_cfa_register 31
> +# Post-indexed ldr
> +	ldr     x29, [sp], 8

FWIW, this is an ABI violation, since SP must be kept aligned to 16
bytes at all times.  The test is ok anyway (it's good to test invalid
code!) but it might be worth warning about in a future version.

(There was another instance in a later test -- just picked this one
as an example.)

The patch is OK, thanks.

Richard

> +	.cfi_restore 29
> +	.cfi_def_cfa_offset 120
> +# Post-indexed ldr
> +	ldr     x30, [sp], 120
> +	.cfi_restore 30
> +	.cfi_def_cfa_offset 0
> +	ret
> +	.cfi_endproc
> +	.size   foo, .-foo


More information about the Binutils mailing list