Windows linker doesn't use of Win32-based wstat
For a long time one major source of test failures on Windows were the plugins tests. Around two years ago I marked them as fragile (#16405 (closed)) but recently I noticed they have started failing in a different failure mode from what I noted then. For instance, this recent job failed with:
ghc: loadObj: C:/GitLabRunner/builds/0/618805/tmp/ghctest-6gvkzeix/test spaces/testsuite/tests/plugins/T15858.run/plugin-recomp/pkg.plugins01/install/x86_64-windows-ghc-9.1.20210315/plugin-recompilation-0.1-LjgD59VSabQL98sd6yYhf5/HSplugin-recompilation-0.1-LjgD59VSabQL98sd6yYhf5.o: file doesn't exist
This suggests that the problem is to do with long path support in the linker.
I did some digging and found that this error almost certainly originates from Linker.c:preloadObjectFile
. In particular, this uses pathstat
, which is in turn defined in terms of wstat
. This is wrong. It should be defined in terms of __rts__wstat
, which is itself defined in terms of Win32 long-path-aware interfaces (in utils/fs.c
).