Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fix the logic for building profiled executables with TemplateHaskell.

This was broken in 5f50fb1: Instead of a vanilla version, the code would
build a profiling version of the objects for TH.
  • Loading branch information...
commit 51ba2b4d0b903f1c7604b2c4c3e951bf38f97dcd 1 parent 96c3f33
Bertram Felgenhauer int-e authored

Showing 1 changed file with 7 additions and 6 deletions. Show diff stats Hide diff stats

  1. +7 6 Cabal/Distribution/Simple/GHC.hs
13 Cabal/Distribution/Simple/GHC.hs
@@ -840,16 +840,17 @@ buildExe verbosity _pkg_descr lbi
840 840 ghcOptExtra = ghcSharedOptions exeBi
841 841 }
842 842
843   - exeOpts | withDynExe lbi = dynamicOpts
844   - | otherwise = vanillaOpts
  843 + exeNoProfOpts | withDynExe lbi = dynamicOpts
  844 + | otherwise = vanillaOpts
845 845
846   - exeProfOpts = exeOpts `mappend` mempty {
  846 + exeOpts | withProfExe lbi = vanillaOpts `mappend` mempty {
847 847 ghcOptProfilingMode = toFlag True,
848 848 ghcOptHiSuffix = toFlag "p_hi",
849 849 ghcOptObjSuffix = toFlag "p_o",
850   - ghcOptExtra = ghcProfOptions exeBi,
851   - ghcOptNoLink = toFlag True
  850 + ghcOptExtra = ghcProfOptions exeBi
852 851 }
  852 + | otherwise = exeNoProfOpts
  853 +
853 854 -- For building exe's for profiling that use TH we actually
854 855 -- have to build twice, once without profiling and the again
855 856 -- with profiling. This is because the code that TH needs to
@@ -857,7 +858,7 @@ buildExe verbosity _pkg_descr lbi
857 858 -- be loaded up and run by the compiler.
858 859 when (withProfExe lbi &&
859 860 EnableExtension TemplateHaskell `elem` allExtensions exeBi) $
860   - runGhcProg exeProfOpts { ghcOptNoLink = toFlag True }
  861 + runGhcProg exeNoProfOpts { ghcOptNoLink = toFlag True }
861 862
862 863 runGhcProg exeOpts { ghcOptOutputFile = toFlag (targetDir </> exeNameReal) }
863 864

0 comments on commit 51ba2b4

Please sign in to comment.
Something went wrong with that request. Please try again.