]> git.ipfire.org Git - thirdparty/gcc.git/commit
RISC-V: Fix vector cfi notes for stack-clash protection
authorRaphael Moreira Zinsly <rzinsly@ventanamicro.com>
Wed, 21 Aug 2024 21:08:54 +0000 (18:08 -0300)
committerRaphael Moreira Zinsly <rzinsly@ventanamicro.com>
Thu, 22 Aug 2024 13:26:04 +0000 (10:26 -0300)
commita025081991cca1734fb642e6609772cfce8be4d1
treeae12127a58412ce891d87593ed3eaf9de9526964
parent51761c50f843d5be4e24172535e4524b5072f24c
RISC-V: Fix vector cfi notes for stack-clash protection

The stack-clash code is generating wrong cfi directives in
riscv_v_adjust_scalable_frame because REG_CFA_DEF_CFA has a different
encoding than REG_FRAME_RELATED_EXPR, this patch fixes the offset sign
in prologue and starts using REG_CFA_DEF_CFA in the epilogue.

gcc/ChangeLog:

* config/riscv/riscv.cc (riscv_v_adjust_scalable_frame): Add
epilogue code for stack-clash and fix prologue cfi note.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/stack-check-cfa-3.c: Fix the expected output.
gcc/config/riscv/riscv.cc
gcc/testsuite/gcc.target/riscv/stack-check-cfa-3.c