Investigate replacing the rts runtime linker with components from llvm
In some configurations ghc does not have access to a suitable system runtime linker, and so implements it's own runtime linker to support ghci and template haskell.
Some examples of configurations that require this:
- Windows staticly linked ghc
- linux staticly linked ghc
The maintenance of the rts linker is a significant burden on ghc.
The llvm project has (at least) two alternative runtime linkers in it's tree:
- RuntimeDyld: https://github.com/llvm/llvm-project/tree/main/llvm/lib/ExecutionEngine/RuntimeDyld Overview: https://llvm.org/docs/MCJITDesignAndImplementation.html
- JitLink: https://github.com/llvm/llvm-project/tree/main/llvm/lib/ExecutionEngine/JITLink Overview: https://llvm.org/docs/JITLink.html#jitlink-availability-and-feature-status
The former is older and supports ELF,COFF,MachO. The latter is newer, under active development, and does not as of yet support COFF.
Both are C++ librarires which would mean ghc would grow a new dependency on stdc++.
It would likely not be worth pursuing this unless we could delete the rts linker, although perhaps deleting support for one or more of ELF/COFF/MachO would be worthwhile.