Ticket #178 (new defect)

Opened 3 years ago

Last modified 2 years ago

Haddock 2.4.2 fails to parse TemplateHaskell modules on x86_64 due to recent binutils

Reported by: JohnMillikin Owned by:
Priority: minor Milestone:
Version: 2.4.2 Keywords:
Cc:

Description

I know this is a relatively old version, but it's what's packaged with GHC 6.10. I figure it's worth releasing a ...1 on Hackage, if nothing else.

Ticket #5050 describes how -fvia-C generates invalid assembly on x86_64, which is caught and refused by recent versions of binutils. The workaround is to not use -fvia-C.

Haddock 2.4.2 is hard-coded to use -fvia-C if the TemplateHaskell language extension is enabled. This prevents TH-enabled packages from having their documentation generated:

-- th_error.hs
{-# LANGUAGE TemplateHaskell #-}
module Main (main) where

main :: IO ()
main = return ()
$ /opt/ghc-6.10.4/bin/haddock th_error.hs 
/tmp/ghc18204_0/ghc18204_0.s: Assembler messages:

/tmp/ghc18204_0/ghc18204_0.s:160:0:
     Error: .size expression for Main_main_entry does not evaluate to a constant

/tmp/ghc18204_0/ghc18204_0.s:160:0:
     Error: .size expression for ZCMain_main_entry does not evaluate to a constant

This error can be solved by patching Haddock to use the equivalent of -fasm:

diff -ur haddock-2.4.2/src/Haddock/Interface.hs haddock-2.4.2.new//src/Haddock/Interface.hs
--- haddock-2.4.2/src/Haddock/Interface.hs	2009-03-21 12:22:17.000000000 -0700
+++ haddock-2.4.2.new//src/Haddock/Interface.hs	2011-08-16 20:25:31.551414886 -0700
@@ -97,9 +97,9 @@
   modgraph' <- if needsTemplateHaskell modgraph
        then do
          dflags <- getSessionDynFlags
-         setSessionDynFlags dflags { hscTarget = HscC } 
+         setSessionDynFlags dflags { hscTarget = HscAsm } 
          -- we need to set HscC on all the ModSummaries as well
-         let addHscC m = m { ms_hspp_opts = (ms_hspp_opts m) { hscTarget = HscC } }  
+         let addHscC m = m { ms_hspp_opts = (ms_hspp_opts m) { hscTarget = HscAsm } }  
          return (map addHscC modgraph)
        else return modgraph
 #else

Change History

Changed 3 years ago by waern

  • priority changed from major to minor

Changed 2 years ago by anonymous

  • milestone 2.4.2 deleted

Milestone 2.4.2 deleted

Note: See TracTickets for help on using tickets.