https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77267
--- Comment #9 from Alexander Ivchenko <aivchenk at gmail dot com> --- Looks like exactly the same discussion happened when '-z bndplt' option was discussed. Here is the reference: https://patchwork.ozlabs.org/patch/456557/ . It's a long one, but seems that the consensus was formulated by Jeff Law: "I guess the one thing I don't like here is that whether or not to pass -z bndplt is made at the time we configure GCC. Yet, it's trivial for someone to change the system linker later, either to gold or from an old BFD linker that doesn't support -z bndplt to one that does support -z bndplt. [ Note we have the same issue with certain assembler feature tests. ] I'm not aware of any real infrastructure in GCC to query the behavior of the linker at link time and then customize the options passed. So if it's going to be configurable, then that's the only time to do the test." ... "So, in an ideal world, we'd query the linker at link time and pass the flag anytime we have a linker that supports the capability and perhaps warn if the linker doesn't support that capability. Given we're not in that ideal world, I think Ilya's patch is reasonable and should be installed."