]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gas: aarch64: testsuite: add new tests for SCFI users/ibhagat/try-scfi-aarch64-v5
authorIndu Bhagat <indu.bhagat@oracle.com>
Mon, 11 Dec 2023 06:08:03 +0000 (22:08 -0800)
committerIndu Bhagat <indu.bhagat@oracle.com>
Sat, 13 Jul 2024 05:48:11 +0000 (22:48 -0700)
commit566a29d1d2f5d9e2f7df52be3f2dad81435287f3
treef36a301ee3e5dab2b0a60e62d6b85bf07331df9a
parente66ee719bf9e7fab7a2ea7e93fbd04fcc8267649
gas: aarch64: testsuite: add new tests for SCFI

[Changes in V5]
 - Rename the previously added testcase scfi-diag-3 for SVE memory op to
   scfi-unsupported-2.  This will help keep track of the work to be done
   in near future.
 - Add new testcase scfi-diag-3 where the insn " b symbol+1" leads to an
   error:
      "Error: SCFI: 0x14000000 op with non-zero addend to sym not supported"
 - Add "stg sp, [sp, 32]!" and "ldpsw x8, x15, [sp, -256]" to ginsn-ldst-1.
 - Add prfm, irg, addg ops to ginsn-misc-1.
 - Add ldrsw, ldpsw ops to ginsn-misc-1.
 - Adjust ginsn-ldst-1 as now S and W register loads and stores are
   skipped.
 - Added a new testcase scfi-ldstnap-1 which includes some insns from
   iclass ldstnapair_offs.
[End of changes in V5]

[Changes in V4]
 - New testcases for FP callee-saved registers.
   scfi-callee-saved-fp-1.s uses D registers, scfi-callee-saved-fp-2.s
   uses Q registers and is run with -mbig-endian.
 - Added new ops (movk, prfm) to ginsn-misc-1. These ops are not
   relevant for SCFI correctness; this testcase merely
   ensures graceful handling of ginsn creation for such insns.
 - Fixed ginsn-ldst-1 as it included some load / store ops with D
   registers, which we now handle.  Also added some insns using W and S
   registers.
 - Added a new test scfi-diag-3 where SCFI machinery reports the
   following error when it sees an SVE memory op with callee-saved
   register:
    "Error: SCFI: unhandled op 0xe5e0e000 may cause incorrect CFI"
[End of changes in V4]

[No changes in V3]

[Changes in V2]
 - new testcase scfi-cfg-4.s for the changes in cmp_scfi_state.
 - new testcase ginsn-arith-1.s for ginsn creation for various add sub insns.
 - removed redundant insns from ginsn-misc-1.s, some of those insns are
   now in ginsn-arith-1.s.
 - added more ld st opts in ginsn-ldst-1.s testcase.
[End of changes in V2]

Similar to the x86_64 testcases, some .s files contain the corresponding
CFI directives.  This helps in validating the synthesized CFI by running
those tests with and without the --scfi=experimental command line
option.

GAS issues some diagnostics, enabled by default, with
--scfi=experimental.  The diagnostics have been added with an intent to
help user correct inadvertent errors in their hand-written asm.  An
error is issued when GAS finds that input asm is not amenable to
accurate CFI synthesis.  The existing scfi-diag-*.s tests in the
gas/testsuite/gas/scfi/x86_64 directory test some SCFI diagnostics
already:

      - (#1) "Warning: SCFI: Asymetrical register restore"
      - (#2) "Error: SCFI: usage of REG_FP as scratch not supported"
      - (#3) "Error: SCFI: unsupported stack manipulation pattern"
      - (#4) "Error: untraceable control flow for func 'XXX'"

In the newly added aarch64 testsuite, further tests for additional
diagnostics have been added:
 - scfi-diag-1.s in this patch highlights an aarch64-specific diagnostic:
   (#5) "Warning: SCFI: ignored probable save/restore op with reg offset"

Additionally, some testcases are added to showcase the (currently)
unsupported patterns, e.g., scfi-unsupported-1.s
        mov     x16, 4384
        sub     sp, sp, x16

gas/testsuite/:
* gas/scfi/README: Update comment to include aarch64.
* gas/scfi/aarch64/scfi-aarch64.exp: New file.
* gas/scfi/aarch64/ginsn-arith-1.l: New test.
* gas/scfi/aarch64/ginsn-arith-1.s: New test.
* gas/scfi/aarch64/ginsn-cofi-1.l: New test.
* gas/scfi/aarch64/ginsn-cofi-1.s: New test.
* gas/scfi/aarch64/ginsn-ldst-1.l: New test.
* gas/scfi/aarch64/ginsn-ldst-1.s: New test.
* gas/scfi/aarch64/scfi-callee-saved-fp-1.d: New test.
* gas/scfi/aarch64/scfi-callee-saved-fp-1.l: New test.
* gas/scfi/aarch64/scfi-callee-saved-fp-1.s: New test.
* gas/scfi/aarch64/scfi-callee-saved-fp-2.d: New test.
* gas/scfi/aarch64/scfi-callee-saved-fp-2.l: New test.
* gas/scfi/aarch64/scfi-callee-saved-fp-2.s: New test.
* gas/scfi/aarch64/scfi-cb-1.d: New test.
* gas/scfi/aarch64/scfi-cb-1.l: New test.
* gas/scfi/aarch64/scfi-cb-1.s: New test.
* gas/scfi/aarch64/scfi-cfg-1.d: New test.
* gas/scfi/aarch64/scfi-cfg-1.l: New test.
* gas/scfi/aarch64/scfi-cfg-1.s: New test.
* gas/scfi/aarch64/scfi-cfg-2.d: New test.
* gas/scfi/aarch64/scfi-cfg-2.l: New test.
* gas/scfi/aarch64/scfi-cfg-2.s: New test.
* gas/scfi/aarch64/scfi-cfg-3.d: New test.
* gas/scfi/aarch64/scfi-cfg-3.l: New test.
* gas/scfi/aarch64/scfi-cfg-3.s: New test.
* gas/scfi/aarch64/scfi-cfg-4.l: New test.
* gas/scfi/aarch64/scfi-cfg-4.s: New test.
* gas/scfi/aarch64/scfi-cond-br-1.d: New test.
* gas/scfi/aarch64/scfi-cond-br-1.l: New test.
* gas/scfi/aarch64/scfi-cond-br-1.s: New test.
* gas/scfi/aarch64/scfi-diag-1.l: New test.
* gas/scfi/aarch64/scfi-diag-1.s: New test.
* gas/scfi/aarch64/scfi-diag-2.l: New test.
* gas/scfi/aarch64/scfi-diag-2.s: New test.
* gas/scfi/aarch64/scfi-diag-3.l: New test.
* gas/scfi/aarch64/scfi-diag-3.s: New test.
* gas/scfi/aarch64/scfi-ldrp-1.d: New test.
* gas/scfi/aarch64/scfi-ldrp-1.l: New test.
* gas/scfi/aarch64/scfi-ldrp-1.s: New test.
* gas/scfi/aarch64/scfi-ldrp-2.d: New test.
* gas/scfi/aarch64/scfi-ldrp-2.l: New test.
* gas/scfi/aarch64/scfi-ldrp-2.s: New test.
* gas/scfi/aarch64/scfi-ldstnap-1.d: New test.
* gas/scfi/aarch64/scfi-ldstnap-1.l: New test.
* gas/scfi/aarch64/scfi-ldstnap-1.s: New test.
* gas/scfi/aarch64/scfi-strp-1.d: New test.
* gas/scfi/aarch64/scfi-strp-1.l: New test.
* gas/scfi/aarch64/scfi-strp-1.s: New test.
* gas/scfi/aarch64/scfi-strp-2.d: New test.
* gas/scfi/aarch64/scfi-strp-2.l: New test.
* gas/scfi/aarch64/scfi-strp-2.s: New test.
* gas/scfi/aarch64/scfi-unsupported-1.l: New test.
* gas/scfi/aarch64/scfi-unsupported-1.s: New test.
* gas/scfi/aarch64/scfi-unsupported-2.l: New test.
* gas/scfi/aarch64/scfi-unsupported-2.s: New test.
59 files changed:
gas/testsuite/gas/scfi/README
gas/testsuite/gas/scfi/aarch64/ginsn-arith-1.l [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/ginsn-arith-1.s [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/ginsn-cofi-1.l [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/ginsn-cofi-1.s [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/ginsn-ldst-1.l [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/ginsn-ldst-1.s [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/ginsn-misc-1.l [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/ginsn-misc-1.s [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/scfi-aarch64.exp [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/scfi-callee-saved-fp-1.d [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/scfi-callee-saved-fp-1.l [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/scfi-callee-saved-fp-1.s [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/scfi-callee-saved-fp-2.d [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/scfi-callee-saved-fp-2.l [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/scfi-callee-saved-fp-2.s [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/scfi-cb-1.d [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/scfi-cb-1.l [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/scfi-cb-1.s [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/scfi-cfg-1.d [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/scfi-cfg-1.l [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/scfi-cfg-1.s [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/scfi-cfg-2.d [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/scfi-cfg-2.l [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/scfi-cfg-2.s [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/scfi-cfg-3.d [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/scfi-cfg-3.l [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/scfi-cfg-3.s [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/scfi-cfg-4.d [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/scfi-cfg-4.l [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/scfi-cfg-4.s [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/scfi-cond-br-1.d [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/scfi-cond-br-1.l [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/scfi-cond-br-1.s [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/scfi-diag-1.l [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/scfi-diag-1.s [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/scfi-diag-2.l [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/scfi-diag-2.s [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/scfi-diag-3.l [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/scfi-diag-3.s [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/scfi-ldrp-1.d [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/scfi-ldrp-1.l [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/scfi-ldrp-1.s [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/scfi-ldrp-2.d [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/scfi-ldrp-2.l [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/scfi-ldrp-2.s [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/scfi-ldstnap-1.d [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/scfi-ldstnap-1.l [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/scfi-ldstnap-1.s [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/scfi-strp-1.d [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/scfi-strp-1.l [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/scfi-strp-1.s [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/scfi-strp-2.d [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/scfi-strp-2.l [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/scfi-strp-2.s [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/scfi-unsupported-1.l [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/scfi-unsupported-1.s [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/scfi-unsupported-2.l [new file with mode: 0644]
gas/testsuite/gas/scfi/aarch64/scfi-unsupported-2.s [new file with mode: 0644]