[GHC] #6063: GHC's build-time ld-flag checks are problematic

GHC cvs-ghc at haskell.org
Sat May 4 23:27:29 CEST 2013


#6063: GHC's build-time ld-flag checks are problematic
---------------------------------+------------------------------------------
    Reporter:  parcs             |       Owner:  thoughtpolice          
        Type:  bug               |      Status:  new                    
    Priority:  high              |   Milestone:  7.8.1                  
   Component:  Compiler          |     Version:  7.4.1                  
    Keywords:                    |          Os:  Linux                  
Architecture:  Unknown/Multiple  |     Failure:  GHC doesn't work at all
  Difficulty:  Unknown           |    Testcase:                         
   Blockedby:                    |    Blocking:                         
     Related:  #4862             |  
---------------------------------+------------------------------------------

Comment(by thoughtpolice):

 I have a patch for this now. I decided to generalize it a little and added
 functionality to generally detect linker information at runtime, and
 distinguish between several cases. I have verified it works and am
 validating on my Mac OS X machine and my other Linux machines. I will set
 up a Windows machine as well.

 I'd like some code review before I push this patch to the tree directly.
 If Ian or anyone else would like to give feedback, please do so. If there
 aren't any complaints I'll push this myself.

 @nh2 - no, this was not fixed in that work. The issue is a little more
 complicated. Please see my commit message and patch which details the
 issue fairly clearly.

 {{{
 commit e1825358b318f847aca19a230fb0a4377830d767
 Author: Austin Seipp <aseipp at pobox.com>
 Date:   Sat May 4 16:07:22 2013 -0500

     Detect linker information at runtime. Fixes Trac #6063

     Previously, we did ./configure time checks to see if 'GNU ld'
 supported
     certain options. If it does, we bake those options into the link step.
     See Trac #5240. Ergo, this is a build-time configuration.

     Unfortunately, the linker we use at runtime can change for several
     reasons. One is that the user specifies -pgml 'foo'. The other is if
     /usr/bin/ld or whatnot literally *changes* from when GHC was built.
     Obviously, not every linker supports these options, like GNU gold,
     and that would lead to linking failure. This is Trac #6063.

     What this ultimately means is that we need to check at runtime what
     linker we're using. Always. This is actually a little bit complicated
     because we normally use the C compiler as our linker. Also, OS X does
     not support gold OR ld, Windows only has GNU ld, etc.

     Finally, this patch also unconditionally gives '--hash-size=31' and
     '--reduce-memory-overheads' to the system linker if it's GNU ld. These
     options have been supported for 8+ years from what I can see, and
 there
     are probably a lot of *other* reasons why GHC would not work with such
     an ancient binutils, all things considered.

     See Note [Run-time linker info] in SysTools for more details. There
     are plenty of comments as well in the surrounding code.

     Signed-off-by: Austin Seipp <aseipp at pobox.com>
 }}}

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



More information about the ghc-tickets mailing list