This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RE: [PATCH] x86: Compile with -fcf-protection=none -mno-cet
- From: "Tsimbalist, Igor V" <igor dot v dot tsimbalist at intel dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, Uros Bizjak <ubizjak at gmail dot com>
- Cc: "Tsimbalist, Igor V" <igor dot v dot tsimbalist at intel dot com>
- Date: Wed, 18 Apr 2018 08:59:29 +0000
- Subject: RE: [PATCH] x86: Compile with -fcf-protection=none -mno-cet
- Dlp-product: dlpe-windows
- Dlp-reaction: no-action
- Dlp-version: 11.0.200.100
- References: <20180415105915.GA26608@intel.com>
> -----Original Message-----
> From: Lu, Hongjiu
> Sent: Sunday, April 15, 2018 12:59 PM
> To: gcc-patches@gcc.gnu.org; Uros Bizjak <ubizjak@gmail.com>; Tsimbalist,
> Igor V <igor.v.tsimbalist@intel.com>
> Subject: [PATCH] x86: Compile with -fcf-protection=none -mno-cet
>
> These tests must be compiled with -fcf-protection=none -mno-cet.
Why -mno-cet is needed? -fcf-protection=none should not require any extra options.
Igor
> OK for trunk?
>
> H.J.
> ----
> * c-c++-common/attr-nocf-check-1.c: Compile with
> -fcf-protection=none -mno-cet for x86 targets.
> * c-c++-common/attr-nocf-check-3.c: Likewise.
> * gcc.dg/march-generic.c: Likewise.
> * gcc.target/i386/align-limit.c: Likewise.
> * gcc.target/i386/indirect-thunk-attr-7.c: Likewise.
> * gcc.target/i386/indirect-thunk-extern-7.c: Likewise.
> * gcc.target/i386/ret-thunk-26.c: Likewise.
> ---
> gcc/testsuite/c-c++-common/attr-nocf-check-1.c | 1 +
> gcc/testsuite/c-c++-common/attr-nocf-check-3.c | 1 +
> gcc/testsuite/gcc.dg/march-generic.c | 2 +-
> gcc/testsuite/gcc.target/i386/align-limit.c | 2 +-
> gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c | 2 +-
> gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c | 2 +-
> gcc/testsuite/gcc.target/i386/ret-thunk-26.c | 2 +-
> 7 files changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/gcc/testsuite/c-c++-common/attr-nocf-check-1.c
> b/gcc/testsuite/c-c++-common/attr-nocf-check-1.c
> index 15f69731b91..4d579136b5a 100644
> --- a/gcc/testsuite/c-c++-common/attr-nocf-check-1.c
> +++ b/gcc/testsuite/c-c++-common/attr-nocf-check-1.c
> @@ -1,4 +1,5 @@
> /* { dg-do compile } */
> +/* { dg-additional-options "-fcf-protection=none -mno-cet" { target i?86-*-
> * x86_64-*-* } } */
>
> int func (int) __attribute__ ((nocf_check)); /* { dg-warning "'nocf_check'
> attribute ignored" } */
> int (*fptr) (int) __attribute__ ((nocf_check)); /* { dg-warning "'nocf_check'
> attribute ignored" } */
> diff --git a/gcc/testsuite/c-c++-common/attr-nocf-check-3.c
> b/gcc/testsuite/c-c++-common/attr-nocf-check-3.c
> index ad1ca7eec9b..da58d560a31 100644
> --- a/gcc/testsuite/c-c++-common/attr-nocf-check-3.c
> +++ b/gcc/testsuite/c-c++-common/attr-nocf-check-3.c
> @@ -1,4 +1,5 @@
> /* { dg-do compile } */
> +/* { dg-additional-options "-fcf-protection=none -mno-cet" { target i?86-*-
> * x86_64-*-* } } */
>
> int foo (void) __attribute__ ((nocf_check)); /* { dg-warning "'nocf_check'
> attribute ignored" } */
> void (*foo1) (void) __attribute__((nocf_check)); /* { dg-warning "'nocf_check'
> attribute ignored" } */
> diff --git a/gcc/testsuite/gcc.dg/march-generic.c
> b/gcc/testsuite/gcc.dg/march-generic.c
> index fb5b83c7d74..94237fee0ca 100644
> --- a/gcc/testsuite/gcc.dg/march-generic.c
> +++ b/gcc/testsuite/gcc.dg/march-generic.c
> @@ -1,6 +1,6 @@
> /* { dg-do compile { target i?86-*-* x86_64-*-* } } */
> /* { dg-skip-if "" { *-*-* } { "-march=*" } { "" } } */
> -/* { dg-options "-march=generic" } */
> +/* { dg-options "-march=generic -fcf-protection=none -mno-cet" } */
> /* { dg-error "'generic' CPU can be used only for '-mtune=' switch" "" {
> target *-*-* } 0 } */
> /* { dg-bogus "march" "" { target *-*-* } 0 } */
> int i;
> diff --git a/gcc/testsuite/gcc.target/i386/align-limit.c
> b/gcc/testsuite/gcc.target/i386/align-limit.c
> index d3d8dc5656e..2560e7b242f 100644
> --- a/gcc/testsuite/gcc.target/i386/align-limit.c
> +++ b/gcc/testsuite/gcc.target/i386/align-limit.c
> @@ -1,5 +1,5 @@
> /* { dg-do compile } */
> -/* { dg-options "-O2 -falign-functions=64 -flimit-function-alignment -
> march=amdfam10" } */
> +/* { dg-options "-O2 -falign-functions=64 -flimit-function-alignment -
> march=amdfam10 -fcf-protection=none -mno-cet" } */
> /* { dg-final { scan-assembler ".p2align 6,,1" } } */
> /* { dg-final { scan-assembler-not ".p2align 6,,63" } } */
>
> diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c
> b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c
> index d53fc887dcc..64c2ff66692 100644
> --- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c
> +++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c
> @@ -1,5 +1,5 @@
> /* { dg-do compile } */
> -/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-
> return=keep -fno-pic" } */
> +/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-
> return=keep -fno-pic -fcf-protection=none -mno-cet" } */
>
> void func0 (void);
> void func1 (void);
> diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c
> b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c
> index 2b9a33e93dc..ff0138b4878 100644
> --- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c
> +++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c
> @@ -1,5 +1,5 @@
> /* { dg-do compile } */
> -/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-
> return=keep -mindirect-branch=thunk-extern -fno-pic" } */
> +/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-
> return=keep -mindirect-branch=thunk-extern -fno-pic -fcf-protection=none
> -mno-cet" } */
>
> void func0 (void);
> void func1 (void);
> diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-26.c
> b/gcc/testsuite/gcc.target/i386/ret-thunk-26.c
> index 9144e988735..45c823fc369 100644
> --- a/gcc/testsuite/gcc.target/i386/ret-thunk-26.c
> +++ b/gcc/testsuite/gcc.target/i386/ret-thunk-26.c
> @@ -1,6 +1,6 @@
> /* PR target/r84530 */
> /* { dg-do run } */
> -/* { dg-options "-Os -mfunction-return=thunk" } */
> +/* { dg-options "-Os -mfunction-return=thunk -fcf-protection=none -
> mno-cet" } */
>
> struct S { int i; };
> __attribute__((const, noinline, noclone))
> --
> 2.14.3