Currently with our mingw-w64/gcc builds we provide among other things stack smashing protection (SSP). We want to do the same for mingw-w64/clang builds.
I guess what we can do, instead of building libssp with build-libssp.sh in a separate step, is to just use the static libraries we build for mingw-w64 anyway.
FWIW, starting from GCC 8, there is --disable-libssp configure time option, because "On many targets library support is provided by the C library instead."
I guess what we can do, instead of building libssp with build-libssp.sh in a separate step, is to just use the static libraries we build for mingw-w64 anyway.
That approach is not working very well it seems. I used my bug_29013 branch for tor-browser and bug_29013_v2 for tor-browser-build.
First of all for some reason we need the *.dll as well in the Browser dir (I thought ssp got statically linked in) but copying it over results in crashes both on 32bit and 64bit versions during start-up.
I guess what we can do, instead of building libssp with build-libssp.sh in a separate step, is to just use the static libraries we build for mingw-w64 anyway.
That approach is not working very well it seems. I used my bug_29013 branch for tor-browser and bug_29013_v2 for tor-browser-build.
First of all for some reason we need the *.dll as well in the Browser dir (I thought ssp got statically linked in) but copying it over results in crashes both on 32bit and 64bit versions during start-up.
More digging is needed here.
Using the llvm-mingw approach results in the same problems. I guess I need to look closer in a debugger what's crashing here. Might help to solve #31546 (moved) first, though.
So, not adding libssp.dll.a solves actually both issues I had (the dynamically linking and the crashes). I might be tempted to pick this up to get it still into 9.0 or 9.5a1 if the former is too risky. :) (thanks again, Martin)
So, not adding libssp.dll.a solves actually both issues I had (the dynamically linking and the crashes). I might be tempted to pick this up to get it still into 9.0 or 9.5a1 if the former is too risky. :) (thanks again, Martin)
The first patch is using our own mingw-w64 which we build anyway and is just copying the .a libs over. The tor-browser patch essentially backs out the special treatment of mingw-w64-clang.
Trac: Actualpoints: N/Ato 1.5 Status: new to needs_review Keywords: TorBrowserTeam201910 deleted, TorBrowserTeam201910R added
FWIW: I am not really sure how to test that for Windows stack canaries are embedded in the binaries but I can see that the linker is at least loading libssp.a for ___stack_chk_fail during linking.
Is there any advantage of this approach vs. SSPStrong (via UCRT?) enabled by default in clang-cl?
I don't know to be honest. I feel we are on the safer side following llvm-mingw here as that approach seems to be working. I'd be happy looking over a patch for your approach, though.
How does it work for e.g. libcxx if it is not enabled globally?
llvm-mingw seems to be made for UCRT explicitly, so it can follow clang-cl's defaults and avoid dependency on GCC. Talk to Martin about it.
The two patches look good to me. I also checked that a 32bit and 64bit build with those two patches are still working for me on a Windows 7 VM.
I cherry-picked the tor-browser commit as 4b8a33af9610111d87dc5a901d06bcc20f1cc7b0, and merged the tor-browser-build commit with effde40cc5643080d45670d889a2fd81a6d39c67.
Trac: Status: needs_review to closed Resolution: N/Ato fixed