Skip to content
Snippets Groups Projects
Commit b8b148bc authored by Marek Polacek's avatar Marek Polacek
Browse files

target: missing -Whardened with -fcf-protection=none [PR114606]


-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.

Reviewed-by: default avatarJakub Jelinek <jakub@redhat.com>
parent 4a94551d
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment