Skip to content

WIP: Dynamic linking and threading support on Windows

This MR Adds DYNAMIC_WAY and DYNAMIC_TOO support to Windows.

GHC seems to have a misunderstanding of how dynamic linking works on Windows. A lot of the internal confusion stems from the fact that GHC does not use the PLT and GOT stubs on Windows.

Linking against import libraries and removing all the special casing code in GHC for Windows makes it work (With some manual build intervention atm until RTS dist is refactored).

This has most of the linking work done, just need to rework how the RTS build packages are named. The chosen approach should not have any issues with scaling no matter how many symbols GHC gets.

TODO:

  • Refactor RTS layout such that every RTS is named the same but placed in different folders, allowing dlopen and LoadLibrary to be able to control which RTS is loaded based on the LIBRARY_PATHs.
  • Work out distribution
  • Work out packaging
  • See if using system linker is not too slow
  • MMap import libraries so we don't spend a lot of time reading them.
  • Documentation

Merge request reports