https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127949

--- Comment #2 from Mark Esler <mark at markesler dot com> ---
A related -fhardened fault in the driver, noted here rather than filed while
this PR
is open; I can file it separately if that is preferred.

-fhardened adds -z now and -z relro unless the command line opts out. gcc.cc
recognises the opt-out in four exact spellings only:

  -Wl,-z,lazy    -Wl,-z,norelro    -z lazy    -z norelro

Other spellings of the same request are not recognised, and the driver appends
-z now -z relro after them, so the user's option is silently overridden:

  -Wl,-O1,-z,lazy
  -Wl,-zlazy
  -Xlinker -z -Xlinker lazy
  -Wl,-z,relro,-z,norelro
  -Wl,-znorelro
  -Xlinker -znorelro

Measured on trunk d871a07 with GNU ld 2.46.1. As with -fstack-clash-protection
in
this PR and -fcf-protection in PR 114606, an explicit user choice loses to
-fhardened with no diagnostic.

Reply via email to