re-apply ac45d80e28bf3252297291955ecdb9d4c8235884

workaround for the stat64 bug (https://ghc.haskell.org/trac/ghc/ticket/7072)