From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 97895 invoked by alias); 7 Feb 2018 08:52:17 -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 97885 invoked by uid 89); 7 Feb 2018 08:52:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.9 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-it0-f49.google.com Received: from mail-it0-f49.google.com (HELO mail-it0-f49.google.com) (209.85.214.49) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 07 Feb 2018 08:52:14 +0000 Received: by mail-it0-f49.google.com with SMTP id k131so1347238ith.4 for ; Wed, 07 Feb 2018 00:52:14 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=77K3g+kxmiHczm3jP0yW7b3DMlOXGlYiSM2/c3qTLio=; b=E4oQGPm0yOYD3Ls+i6KgmSkykdhcTd4do9tbA5gr36dyEm5mGcWBOFKzEgbiLVJrlk Luy1JU74if8dhAe3WAuEvUWWSjOCCl84vrCPq9KD7mzm20mRcqLD27pQzlfhumxumB2b zhxc17lymG3CNyoWeerfQOuw5WIbq914BoEWJnDOzUt6pEoW3wpxLe4JUnqNc38PPcRa U2rcKNY7G/uO7VCTyT6Kx6m0BdAcHr6pISuCt/9wefBALXHioC/f8IN6uQeq+S9kLaAQ rIQYDa7L4nNuF2NgOKeVONu4fEOfUFgsHSQj6yS6A6Wfxkrvp6EGyYafuuCFylJD91IP o7PQ== X-Gm-Message-State: APf1xPA7IjAedbSL8QNetRI8lUg2D6onIXSxWpDRGjbyHpPD0jDFgBKa sxuytz+YWC2TPXv6Tt701+8Z4sA4U0nzLaiQleg= X-Google-Smtp-Source: AH8x226vOqN2XLFnAA+CXlol04lZGDcZ2jqg0NGPf4m+lQXaiJKTik5rTK91DkdbfCC3Ft7DCYusWYXoeuzUYSyHq8E= X-Received: by 10.36.104.149 with SMTP id v143mr6899913itb.2.1517993533161; Wed, 07 Feb 2018 00:52:13 -0800 (PST) MIME-Version: 1.0 Received: by 10.2.163.146 with HTTP; Wed, 7 Feb 2018 00:52:12 -0800 (PST) In-Reply-To: References: <20180206210927.GA238859@intel.com> From: Uros Bizjak Date: Wed, 07 Feb 2018 08:52:00 -0000 Message-ID: Subject: Re: [PATCH] i386: Mask out the CF_SET bit for -fcf-protection check To: "Tsimbalist, Igor V" Cc: "H.J. Lu" , "gcc-patches@gcc.gnu.org" Content-Type: text/plain; charset="UTF-8" X-SW-Source: 2018-02/txt/msg00305.txt.bz2 On Tue, Feb 6, 2018 at 10:20 PM, Tsimbalist, Igor V wrote: >> -----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 >> >> 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. OK. Thanks, Uros. > 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 >