Yes, look good to me. Wouldn't it make sense to add __mingww64_stpcpy function, so we could provide this function in an more compatible way?
Thanks, Kai Am Fr., 14. Okt. 2022 um 14:16 Uhr schrieb LIU Hao <[email protected]>: > > 在 2022/10/14 19:38, Martin Storsjö 写道: > > Initially, it may seem like this function might not be needed in any > > form, since mingw-w64 lacks the main stpcpy function. > > > > However, third party projects may contain their own implementation of > > the stpcpy function. When GCC sees a declaration of the stpcpy function, > > it assumes that it is legal to do optimizations on strcpy+strlen into > > stpcpy. > > > > When strcpy is wrapped with fortification wrappers, so that strcpy > > ends up calling __builtin___strcpy_chk (which then calls __strcpy_chk), > > GCC can also transform this into __builtin___stpcpy_chk, which can > > generate a call to __stpcpy_chk. > > > > GCC's libssp does provide an implementation of __stpcpy_chk, even if > > the platform itself lacks stpcpy. > > > > Therefore, mingw-w64-crt's implementation of the ssp routines also > > does need an implementation of __stpcpy_chk, even if it is hard > > to practically produce calls to it. > > > > This should fix one issue discussed at > > https://github.com/msys2/MINGW-packages/issues/5803#issuecomment-1276812143. > > > > Signed-off-by: Martin Storsjö <[email protected]> > > --- > > mingw-w64-crt/Makefile.am | 2 +- > > mingw-w64-crt/ssp/stpcpy_chk.c | 19 +++++++++++++++++++ > > 2 files changed, 20 insertions(+), 1 deletion(-) > > create mode 100644 mingw-w64-crt/ssp/stpcpy_chk.c > > > > LGTM. Thanks. > > > -- > Best regards, > LIU Hao > _______________________________________________ > Mingw-w64-public mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/mingw-w64-public _______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
