Support stack-protector in new clang based toolchain
The move to the clang based toolchain inadvertedly regressed being able to link against sources compiled with -fstack-protector
which requires the ability to be able to link against the libssp support functions [1][2].
With the GCC based toolchains we got this because GCC builds libssp
as that's part of it's built tree. Clang doesn't and instead relies on the libc to provide the symbols. Typically on Linux this is provided by glibc.
However at the time the clang package was chosen for GHC the mingw-w64-crt
did not provide this yet, but it does now [3]
So a couple of things:
- For newer GHC releases we should upgrade the packaged clang and crt to at least clang 10. (It's currently 9.)
- For current and newer GHCs we should provide
mingw-w64-clang-x86_64-libssp
as part of the packaging. Which version is very very important.- For the clang 9 based toolchains we require version
7.3.0-1
as this one will contain the import library that is missing from the crt. - For clang 10+ we require at least version
7.3.0-3
as this resolves a symbol conflict because the crt is now providing the symbols.
- For the clang 9 based toolchains we require version
For this to work it requires the recent fixes @bgamari made such that the -L
paths of the base toolchain is taken over that of the system one, otherwise you'll get the symbol conflict with the crt if your system clang is too new.
[1] https://github.com/fjvallarino/monomer/issues/258
[2] https://github.com/haskell-game/sdl2/issues/277
[3] https://packages.msys2.org/package/mingw-w64-clang-x86_64-crt-git?repo=clang64