On Tue, Nov 26, 2024 at 05:35:50PM -0500, Marek Polacek wrote:
> Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk?
> 
> -- >8 --
> As the manual states, using "-fhardened -fstack-protector" will produce
> a warning because -fhardened wants to enable -fstack-protector-strong,
> but it can't since it's been overriden by the weaker -fstack-protector.
> 
> -fhardened also attempts to enable -Wl,-z,relro,-z,now.  By the same
> logic as above, "-fhardened -z norelro" or "-fhardened -z lazy" should
> produce the same warning.  But we don't detect this combination, so
> this patch fixes it.  I also renamed a variable to better reflect its
> purpose.
> 
> Also don't check warn_hardened in process_command, since it's always
> true there.
> 
> Also tweak wording in the manual as Jon Wakely suggested on IRC.
> 
>       PR driver/117739
> 
> gcc/ChangeLog:
> 
>       * doc/invoke.texi: Tweak wording for -Whardened.
>       * gcc.cc (driver_handle_option): If -z lazy or -z norelro was
>       specified, don't enable linker hardening.
>       (process_command): Don't check warn_hardened.
> 
> gcc/testsuite/ChangeLog:
> 
>       * c-c++-common/fhardened-16.c: New test.
>       * c-c++-common/fhardened-17.c: New test.
>       * c-c++-common/fhardened-18.c: New test.
>       * c-c++-common/fhardened-19.c: New test.
>       * c-c++-common/fhardened-20.c: New test.
>       * c-c++-common/fhardened-21.c: New test.

LGTM.

        Jakub

Reply via email to