]> git.ipfire.org Git - thirdparty/gcc.git/commit
Provide -fcf-protection=branch,return.
authorliuhongt <hongtao.liu@intel.com>
Fri, 12 May 2023 07:15:08 +0000 (15:15 +0800)
committerliuhongt <hongtao.liu@intel.com>
Fri, 21 Jul 2023 03:06:15 +0000 (11:06 +0800)
commit1c6231c05bdccab3a21abcbb75e2094ea3e98782
tree0b6e17856085c3649c75f111f8120044bf5e7f4f
parent629ad1cfdaf542c454536d56ba9de19bd0a4b046
Provide -fcf-protection=branch,return.

Use EnumSet instead of EnumBitSet since CF_FULL is not power of 2.
It is a bit tricky for sets classification, cf_branch and cf_return
should be in different sets, but they both "conflicts" cf_full,
cf_none. And current EnumSet don't handle this well.

So in the current implementation, only cf_full,cf_none are exclusive
to each other, but they can be combined with any cf_branch, cf_return,
cf_check. It's not perfect, but still an improvement than original
one.

gcc/ChangeLog:

PR target/89701
* common.opt: (fcf-protection=): Add EnumSet attribute to
support combination of params.

gcc/testsuite/ChangeLog:

* c-c++-common/fcf-protection-10.c: New test.
* c-c++-common/fcf-protection-11.c: New test.
* c-c++-common/fcf-protection-12.c: New test.
* c-c++-common/fcf-protection-8.c: New test.
* c-c++-common/fcf-protection-9.c: New test.
* gcc.target/i386/pr89701-1.c: New test.
* gcc.target/i386/pr89701-2.c: New test.
* gcc.target/i386/pr89701-3.c: New test.
gcc/common.opt
gcc/testsuite/c-c++-common/fcf-protection-10.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/fcf-protection-11.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/fcf-protection-12.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/fcf-protection-8.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/fcf-protection-9.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr89701-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr89701-2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr89701-3.c [new file with mode: 0644]