x86: Error on -fcf-protection with incompatible target
authorH.J. Lu <hjl.tools@gmail.com>
Thu, 14 Jan 2021 13:56:46 +0000 (05:56 -0800)
committerH.J. Lu <hjl.tools@gmail.com>
Thu, 14 Jan 2021 15:42:47 +0000 (07:42 -0800)
commit77d372abec0fbf2cfe922e3140ee3410248f979e
treeb343dabd8ebc7c2b099217466f56126694a96775
parent5ebdd53534db25401473db5f6a0ad30f41410241
x86: Error on -fcf-protection with incompatible target

-fcf-protection with CF_BRANCH inserts ENDBR32 at function entries.
ENDBR32 is NOP only on 64-bit processors and 32-bit TARGET_CMOV
processors.  Issue an error for -fcf-protection with CF_BRANCH when
compiling for 32-bit non-TARGET_CMOV targets.

gcc/

PR target/98667
* config/i386/i386-options.c (ix86_option_override_internal):
Issue an error for -fcf-protection with CF_BRANCH when compiling
for 32-bit non-TARGET_CMOV targets.

gcc/testsuite/

PR target/98667
* gcc.target/i386/pr98667-1.c: New file.
* gcc.target/i386/pr98667-2.c: Likewise.
* gcc.target/i386/pr98667-3.c: Likewise.
gcc/config/i386/i386-options.c
gcc/testsuite/gcc.target/i386/pr98667-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr98667-2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr98667-3.c [new file with mode: 0644]