From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2522 invoked by alias); 6 Feb 2018 21:20:33 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 2510 invoked by uid 89); 6 Feb 2018 21:20:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.1 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-HELO: mga06.intel.com Received: from mga06.intel.com (HELO mga06.intel.com) (134.134.136.31) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 06 Feb 2018 21:20:31 +0000 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Feb 2018 13:20:30 -0800 X-ExtLoop1: 1 Received: from irsmsx154.ger.corp.intel.com ([163.33.192.96]) by orsmga008.jf.intel.com with ESMTP; 06 Feb 2018 13:20:29 -0800 Received: from irsmsx102.ger.corp.intel.com ([169.254.2.95]) by IRSMSX154.ger.corp.intel.com ([169.254.12.108]) with mapi id 14.03.0319.002; Tue, 6 Feb 2018 21:20:28 +0000 From: "Tsimbalist, Igor V" To: "H.J. Lu" , "gcc-patches@gcc.gnu.org" CC: Uros Bizjak , "Tsimbalist, Igor V" Subject: RE: [PATCH] i386: Mask out the CF_SET bit for -fcf-protection check Date: Tue, 06 Feb 2018 21:20:00 -0000 Message-ID: References: <20180206210927.GA238859@intel.com> In-Reply-To: <20180206210927.GA238859@intel.com> x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYzU0Mzg4ZWUtZTIzZS00NjE1LTk5NGItZTVmODA4NDlhODBhIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjIuNS4xOCIsIlRydXN0ZWRMYWJlbEhhc2giOiJnNTVcL2xNMjMzOWJDSVM3RU1FTm5McUhmWXZ0d1RvM2lSM09rcEFVYVpDbkFLXC9jbFpxNVVJaStNWUhmYnp1bVIifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-IsSubscribed: yes X-SW-Source: 2018-02/txt/msg00279.txt.bz2 > -----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 ; Tsimbalist, Igor V > > Subject: [PATCH] i386: Mask out the CF_SET bit for -fcf-protection check >=20 > 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. >=20 > 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(-) >=20 > 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, > =3D build_target_option_node (opts); >=20 > /* Do not support control flow instrumentation if CET is not enabled. = */ > - if (opts->x_flag_cf_protection !=3D CF_NONE) > + cf_protection_level cf_protection > + =3D (cf_protection_level) (opts->x_flag_cf_protection & ~CF_SET); > + if (cf_protection !=3D 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, > } >=20 > opts->x_flag_cf_protection =3D > - (cf_protection_level) (opts->x_flag_cf_protection | CF_SET); > + (cf_protection_level) (cf_protection | CF_SET); > } >=20 > if (ix86_tune_features [X86_TUNE_AVOID_128FMA_CHAINS]) > -- > 2.14.3