https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125205
--- Comment #12 from H.J. Lu <hjl.tools at gmail dot com> --- (In reply to [email protected] from comment #11) > >> I don't think -mstack-protector-guard=global matters. The same test > >> should fail to link without -mstack-protector-guard=global on Solaris. > > > > One way to fix it may be to use > > > > #define LINK_SSP_SPEC "--push-state --as-needed -lssp_nonshared -lssp > > --pop-state" > > > > for Solaris. > > This is *not* Solaris-specific, but affects all targets with > TARGET_LIBC_PROVIDES_SSP undefined. So this *should* happen in the > gcc.cc version of LINK_SSP_SPEC. Besides all of > --push-state/--pop-state, and --as-needed are GNU ld-specific, so this > cannot work in general. And why should this case be special if the > -fstack-protector* options *do* already trigger linking with > -lssp_nonshared? __attribute__ ((optimize ("stack-protector-all"))) triggers libssp requirement. But GCC driver doesn't know about attribute. That is why systems which don't have libc with ssp support don't support __attribute__ ((optimize ("stack-protector-all"))). "--push-state --as-needed -lssp_nonshared -lssp --pop-state" is one way to work around it.
