public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Marek Polacek <polacek@redhat.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH v2] target: missing -Whardened with -fcf-protection=none [PR114606]
Date: Wed, 10 Apr 2024 19:53:45 +0200	[thread overview]
Message-ID: <ZhbSKYfYYZgbLBF2@tucnak> (raw)
In-Reply-To: <ZhBE1LBmt2m6NZIC@redhat.com>

On Fri, Apr 05, 2024 at 02:37:08PM -0400, Marek Polacek wrote:
> > This function is passed explicit opts and opts_set arguments, so it
> > shouldn't be using flag_something macros nor OPTION_SET_P, as the former
> > use global_options.x_flag_something rather than opts->x_flag_something
> > and the latter uses global_options_set.x_flag_something.
> 
> Ah right, so the other uses of OPTION_SET_P in ix86_option_override_internal
> are also wrong?

Most likely yes.

> > So, I think you want to use if (!opts_set->x_flag_cf_protection)
> > instead.
> 
> Fixed below, thanks.
> 
> New tests passed on x86_64-pc-linux-gnu, ok for trunk?

Ok, thanks.
> 
> -- >8 --
> -Whardened warns when -fhardened couldn't enable a hardening option
> because that option was disabled on the command line, e.g.:
> 
> $ ./cc1plus -quiet g.C -fhardened -O2 -fstack-protector
> cc1plus: warning: '-fstack-protector-strong' is not enabled by '-fhardened' because it was specified on the command line [-Whardened]
> 
> but it doesn't work as expected with -fcf-protection=none:
> 
> $ ./cc1plus -quiet g.C -fhardened -O2 -fcf-protection=none
> 
> because we're checking == CF_NONE which doesn't distinguish between nothing
> and -fcf-protection=none.  I should have used opts_set, like below.
> 
> 	PR target/114606
> 
> gcc/ChangeLog:
> 
> 	* config/i386/i386-options.cc (ix86_option_override_internal): Use
> 	opts_set rather than checking == CF_NONE.
> 
> gcc/testsuite/ChangeLog:
> 
> 	* gcc.target/i386/fhardened-1.c: New test.
> 	* gcc.target/i386/fhardened-2.c: New test.

	Jakub


      reply	other threads:[~2024-04-10 17:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-05 18:22 [PATCH] " Marek Polacek
2024-04-05 18:28 ` Jakub Jelinek
2024-04-05 18:37   ` [PATCH v2] " Marek Polacek
2024-04-10 17:53     ` Jakub Jelinek [this message]

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=ZhbSKYfYYZgbLBF2@tucnak \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=polacek@redhat.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).