#5528: mkExtraObjToLinkIntoBinary invokes cc differently
---------------------------------+------------------------------------------
    Reporter:  MtnViewMark       |       Owner:                         
        Type:  bug               |      Status:  new                    
    Priority:  normal            |   Component:  Driver                 
     Version:  7.0.2             |    Keywords:                         
    Testcase:                    |   Blockedby:                         
          Os:  Unknown/Multiple  |    Blocking:                         
Architecture:  Unknown/Multiple  |     Failure:  GHC doesn't work at all
---------------------------------+------------------------------------------
 When GHC is performing a final link of an executable, it invokes
 mkExtraObjToLinkIntoBinary (in DriverPipeline.hs) to compile a small file
 that encodes things like the -rtsopts option (among other things). That
 calls mkExtraCObj in turn (it's the only caller) which uses SysTools.runCc
 to invoke the host compiler.

 However, runCc extracts the executable name and arguments from the command
 line options from the sPgm_c :: (String, [Option]) field of Settings.
 However, the -optc option doesn't append its argument to sPgm_c's [Option]
 list, and so runCc, and hence the compilation in mkExtraCObj doesn't get
 the benefit of the -optc argument.

 Contrast this to the handling of the -pgmP and -optP options, where -optP
 *does* append onto sPgm_P's [Option] list.

 Now, it turns out that the -optc flags are used, but only in the more
 complex doCpp and runPhase functions (which are the only two other calls
 to runCc).  So either a) -optc should add onto sPgm_c's [Option] list, or
 b) mkExtraCObj should call one of doCpp or runPhase. In the first case,
 then handling of the -optc options would need to be removed from doCpp and
 runPhase (since they would be handled by runCc, getting them via sPgm_c
 (it already tries to!)). This may not look safe to factor out of doCpp,
 but inspection will see that it is (the two Bool args are only called
 True/False, or False/True...)

 WHY DOES THIS MATTER? A fine question to ask at this point.... If you are
 compiling in an environment in which the compiler will need an extra
 argument (say /usr/include isn't around and you need -I/somewhere-else),
 then you'd expect to set this -optc -- only it won't get used for that one
 compile generated at final link (for the rtsopts). This will cause your
 compile to fail.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5528>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to