public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Tsimbalist, Igor V" <igor.v.tsimbalist@intel.com>
To: "H.J. Lu" <hjl.tools@gmail.com>,
	"gcc-patches@gcc.gnu.org"	<gcc-patches@gcc.gnu.org>
Cc: Uros Bizjak <ubizjak@gmail.com>,
	"Tsimbalist, Igor V"	<igor.v.tsimbalist@intel.com>
Subject: RE: [PATCH] i386: Mask out the CF_SET bit for -fcf-protection check
Date: Tue, 06 Feb 2018 21:20:00 -0000	[thread overview]
Message-ID: <D511F25789BA7F4EBA64C8A63891A00291FB166A@IRSMSX102.ger.corp.intel.com> (raw)
In-Reply-To: <20180206210927.GA238859@intel.com>

> -----Original Message-----
> From: gcc-patches-owner@gcc.gnu.org [mailto:gcc-patches-
> owner@gcc.gnu.org] On Behalf Of H.J. Lu
> Sent: Tuesday, February 6, 2018 10:09 PM
> To: gcc-patches@gcc.gnu.org
> Cc: Uros Bizjak <ubizjak@gmail.com>; Tsimbalist, Igor V
> <igor.v.tsimbalist@intel.com>
> Subject: [PATCH] i386: Mask out the CF_SET bit for -fcf-protection check
> 
> Since ix86_option_override_internal sets the CF_SET bit in
> flag_cf_protection and it can be called more than once via pragma,
> we need to mask out the CF_SET bit when checking flag_cf_protection.
> 
> OK for trunk if there is no regression?

Ok from CET viewpoint.

Thanks,
Igor

> H.J.
> ---
> 	PR target/84248
> 	* config/i386/i386.c (ix86_option_override_internal): Mask out
> 	the CF_SET bit when checking -fcf-protection.
> ---
>  gcc/config/i386/i386.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
> index 6c612c77987..ef7ff89bcbb 100644
> --- a/gcc/config/i386/i386.c
> +++ b/gcc/config/i386/i386.c
> @@ -4913,12 +4913,12 @@ ix86_option_override_internal (bool
> main_args_p,
>        = build_target_option_node (opts);
> 
>    /* Do not support control flow instrumentation if CET is not enabled.  */
> -  if (opts->x_flag_cf_protection != CF_NONE)
> +  cf_protection_level cf_protection
> +    = (cf_protection_level) (opts->x_flag_cf_protection & ~CF_SET);
> +  if (cf_protection != CF_NONE)
>      {
> -      switch (flag_cf_protection)
> +      switch (cf_protection)
>  	{
> -	case CF_NONE:
> -	  break;
>  	case CF_BRANCH:
>  	  if (! TARGET_IBT_P (opts->x_ix86_isa_flags2))
>  	    {
> @@ -4953,7 +4953,7 @@ ix86_option_override_internal (bool main_args_p,
>  	}
> 
>        opts->x_flag_cf_protection =
> -	(cf_protection_level) (opts->x_flag_cf_protection | CF_SET);
> +	(cf_protection_level) (cf_protection | CF_SET);
>      }
> 
>    if (ix86_tune_features [X86_TUNE_AVOID_128FMA_CHAINS])
> --
> 2.14.3

  reply	other threads:[~2018-02-06 21:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-06 21:09 H.J. Lu
2018-02-06 21:20 ` Tsimbalist, Igor V [this message]
2018-02-07  8:52   ` Uros Bizjak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=D511F25789BA7F4EBA64C8A63891A00291FB166A@IRSMSX102.ger.corp.intel.com \
    --to=igor.v.tsimbalist@intel.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hjl.tools@gmail.com \
    --cc=ubizjak@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).