Skip to content

Linking avoidance on Windows/OS X

GHC.Linker.ExtraObj.checkLinkInfo is used to check that the link info that GHC stores in binaries hasn't changed to avoid relinking.

-- Returns 'False' if the previous binary was linked with "the same options",
-- and we can avoid linking. I.e. returns True if linking is needed.
checkLinkInfo :: Logger -> DynFlags -> [UnitId] -> FilePath -> IO Bool
checkLinkInfo logger dflags pkg_deps exe_file
 | not (platformSupportsSavingLinkOpts (platformOS (targetPlatform dflags)))
 -- ToDo: Windows and OS X do not use the ELF binary format, so
 -- readelf does not work there.  We need to find another way to do
 -- this.
 = return False -- conservatively we should return True, but not
                -- linking in this case was the behaviour for a long
                -- time so we leave it as-is.
...

This was introduced in 814edf44

We should fix this properly:

  1. return True when we don't have the link info
  2. find a way to store/retrieve the link info on OSX/Windows
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information