File Cabal-fix-dynamic-exec-for-TH.patch of Package ghc

--- ghc-7.6.3/libraries/Cabal/Cabal/Distribution/Simple/GHC.hs~	2013-04-19 06:32:04.000000000 +0900
+++ ghc-7.6.3/libraries/Cabal/Cabal/Distribution/Simple/GHC.hs	2013-06-12 11:35:39.832840754 +0900
@@ -837,6 +837,8 @@
 
       dynamicOpts = vanillaOpts `mappend` mempty {
                       ghcOptDynamic        = toFlag True,
+                      ghcOptHiSuffix       = toFlag "dyn_hi",
+                      ghcOptObjSuffix      = toFlag "dyn_o",
                       ghcOptExtra          = ghcSharedOptions exeBi
                     }
 
@@ -855,9 +857,9 @@
   -- with profiling. This is because the code that TH needs to
   -- run at compile time needs to be the vanilla ABI so it can
   -- be loaded up and run by the compiler.
-  when (withProfExe lbi &&
+  when ((withProfExe lbi || withDynExe lbi) &&
         EnableExtension TemplateHaskell `elem` allExtensions exeBi) $
-    runGhcProg exeProfOpts { ghcOptNoLink = toFlag True }
+    runGhcProg vanillaOpts { ghcOptNoLink = toFlag True }
 
   runGhcProg exeOpts { ghcOptOutputFile = toFlag (targetDir </> exeNameReal) }