This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] i386: Mask out the CF_SET bit for -fcf-protection check


On Tue, Feb 6, 2018 at 10:20 PM, Tsimbalist, Igor V
<igor.v.tsimbalist@intel.com> 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 <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.

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
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]