[Bug driver/117992] gcc -flto -fharden leads to warning
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Dec 11 10:30:22 GMT 2024
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117992
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org,
| |mpolacek at gcc dot gnu.org
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The warning is weird, any_link_options_p is set when -r, -shared, -no-pie or
-pie is seen and static_p is set when -static is seen. And when any of that is
seen (defaulted or not), -Whardened warns.
Now, surely LD_PIE_SPEC shouldn't be added if any of those are seen.
Why isn't -z now and/or -z relro added when -static isn't seen isn't clear to
me, those
options make perfect sense even for -shared, or -no-pie or explicit (or
defaulted) -pie. -r doesn't really need those.
Warning that we didn't add -pie because one supplied it explicitly is just
weird.
Similarly warning when -shared is seen, -shared doesn't remove any of the
hardening properties. Similarly -r. So I'd just warn if -static or -no-pie
was seen.
Do we warn with -fhardened if one uses explicit -fstack-protector-strong with
it?
More information about the Gcc-bugs
mailing list