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

Christian Biesinger via gdb-patches gdb-patches@sourceware.org
Wed Dec 18 20:41:00 GMT 2019


On Wed, Dec 18, 2019 at 1:57 PM Eli Zaretskii <eliz@gnu.org> wrote:
>
> > 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}

Ah ok, so that doesn't help us.

> > 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.

OK, sounds good.

BTW -- you mentioned a licensing issue with depending on DLLs. Doesn't
libstdc++ and perhaps others have the same issue? Or does mingw.org
link it statically?

My msys2/mingw64 gcc depends on these DLLs outside of SYSTEM32:
        libpython3.8.dll => /mingw64/bin/libpython3.8.dll (0x70840000)
        libwinpthread-1.dll => /mingw64/bin/libwinpthread-1.dll (0x64940000)
        libgcc_s_seh-1.dll => /mingw64/bin/libgcc_s_seh-1.dll (0x61440000)
        libstdc++-6.dll => /mingw64/bin/libstdc++-6.dll (0x6fc40000)

Christian



More information about the Gdb-patches mailing list