https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125205
--- Comment #8 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Rainer Orth from comment #7)
> (In reply to H.J. Lu from comment #6)
> > (In reply to Rainer Orth from comment #5)
> > > On Linux/i686 the __stack_chk_fail_local reference is resolved from
> > >
> > > /usr/lib32/libc_nonshared.a
> > >
> > > which gets dragged in by /lib/../lib32/libc.so:
> > >
> > > /* GNU ld script
> > > Use the shared library, but some functions are only in
> > > the static library, so try that secondarily. */
> > > OUTPUT_FORMAT(elf32-i386)
> > > GROUP ( /lib32/libc.so.6 /usr/lib32/libc_nonshared.a AS_NEEDED (
> > > /lib/ld-linux.
> > > so.2 ) )
> > >
> > > Solaris has no such think, so would need to link with -lssp_nonshared
> > > instead!?
> >
> > You need to find a way to support __attribute__ ((optimize
> > ("stack-protector-all")))
> > on Solaris or disallow it on Solaris.
>
> I don't think so: if, just for the sake of argument, if you replace the
> libc.so
> linker script on Linux by a symlink to libc.so.6, the test FAILs exactly the
> same as on Solaris, assuming Linux/x86 *does* support that attribute.
>
> As I said, it seems that the test needs to be linked with -lssp_nonshared
> -lssp
> on targets withoutTARGET_LIBC_PROVIDES_SSP. However, the LINK_SSP_SPEC in
> gcc.cc doesn't do that for -mstack-protector-guard=global. Looks like a bug
> in my book.
>
I don't think -mstack-protector-guard=global matters. The same test
should fail to link without -mstack-protector-guard=global on Solaris.