This tries to extract the linker only (non codegen changes) from !3641 (closed). It's effectively two more forwards ports from the ghc-8.10 branch.
Fixes #17559