Re: [PATCH] Link to -lssp when available (fixes mingw build)

Eli Zaretskii
2019-12-18T19:57:45Z

> From: Christian Biesinger <cbiesinger@google.com>
> Date: Wed, 18 Dec 2019 13:50:00 -0600
> Cc: gdb-patches <gdb-patches@sourceware.org>
>
> Hmm, yeah, you are right. But it doesn't work!
> $ g++ test.cc -O2 -lssp_nonshared
> C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
> C:\msys64\tmp\ccmAuUCu.o:test.cc:(.text.startup+0x1f): undefined
> reference to `__strcpy_chk'
> collect2.exe: error: ld returned 1 exit status

AFAIK, you need to link with -lssp_nonshared -lssp. My GCC's specs
have this:

*link_ssp:
%{fstack-protector|fstack-protector-all|fstack-protector-strong|fstack-protector-explicit:-lssp_nonshared -lssp}

> So I guess that's actually for something else? I think
> https://sourceware.org/ml/gdb-patches/2019-12/msg00787.html is the
> best option.

I agree, FWIW.