Generate object files for older versions of GHC

This works around GHC bug #8942, for the versions of GHC which are
affected by this bug.
Merge pull request #2119 from gelisam/generate-object-files

Generate object files for older versions of GHC