[Haddock] [haddock] #178: Haddock 2.4.2 fails to parse TemplateHaskell modules on x86_64 due to recent binutils

haddock haddock at projects.haskell.org
Wed Aug 17 04:29:05 BST 2011


#178: Haddock 2.4.2 fails to parse TemplateHaskell modules on x86_64 due to
recent binutils
-------------------------+--------------------------------------------------
Reporter:  JohnMillikin  |       Owner:       
    Type:  defect        |      Status:  new  
Priority:  major         |   Milestone:  2.4.2
 Version:  2.4.2         |    Keywords:       
-------------------------+--------------------------------------------------
 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
 }}}

-- 
Ticket URL: <http://trac.haskell.org/haddock/ticket/178>
haddock <http://www.haskell.org/haddock>
Haddock, The Haskell Documentation Tool


More information about the Haddock mailing list