windows: include aux lib dir path explicitly so e.g. cabal can't override it.
Upstream mingw64 have updated the namespace of some internal symbols used in the crt[1].
This ABI break however is only safe if any libraries using the symbol are updated at the same time.
Normally pacman enforces this but we have a problem with our toolchain. In this case the support library libmingw32.a
references these internal symbols:
.bss 0x0000000000532370 0x10 C:\ghcup\msys64\mingw64\lib/libmingw32.a(lib64_libmingw32_a-tlssup.o)
0x0000000000532370 __mingw_initltssuo_force
0x0000000000532378 __mingw_initltsdrot_force
0x000000000053237c _tls_index
0x0000000000532374 __mingw_initltsdyn_force
This now causes an ABI mismatch as we try to link this updated libmingw32
using the old crt
. The reason this happens is because we've isolated the path to the crt to make the toolchain portable, but the directory which contains libmingw32
was never explicitly
added to the base directories.
Previously this wasn't needed as there was no ABI difference and the toolchain will find it on it's own as it's an implicit
directory.
However when tools like choco
or ghcup
add paths to extra-library-dirs
these explicit paths get priority over the implicit paths, and so we end up linking against the system version of these libraries.
To fix this we need to explicitly add the library containing such libraries to the driver. This isolates us from ABI changes.
Fixes #21111
[1] https://www.mail-archive.com/mingw-w64-public@lists.sourceforge.net/msg18885.html