[GHC] #13810: Gold linker fails

GHC ghc-devs at haskell.org
Sat Jun 24 14:42:17 UTC 2017


#13810: Gold linker fails
---------------------------------+----------------------------------------
        Reporter:  ksaric        |                Owner:  (none)
            Type:  bug           |               Status:  new
        Priority:  normal        |            Milestone:
       Component:  Compiler      |              Version:  8.0.1
      Resolution:                |             Keywords:  linker
Operating System:  Linux         |         Architecture:  Unknown/Multiple
 Type of failure:  None/Unknown  |            Test Case:
      Blocked By:                |             Blocking:
 Related Tickets:                |  Differential Rev(s):
       Wiki Page:                |
---------------------------------+----------------------------------------

Comment (by bgamari):

 > Do you mean gold?

 Whoops, yes.

 > I don't quite understand this. Isn't the key problem here that the
 concept of the "ld program" and the "ld-options" are unhealthily mixed up?
 >
 > In other words, isn't the problem here that we're linking through the
 compiler (e.g. `gcc`) instead of the actual linker binary? Because
 otherwise we'd not even be using the `-fuse-ld` flag.

 I've played around with the idea of involing `ld` ourselves and have
 concluded that it's almost certainly going to hurt more than it helps.
 Linking tends to be terribly platform specific and rather difficult to get
 right (see also: `gcc -dumpspecs`). Moreover, linkers on many platforms
 tend to be, shall we say, quirky. I don't see us being able to robustly
 implement the logic necessary to drive the linker as well as `gcc`.

 Keep in mind that GHC is not only responsible for linking Haskell; we are
 often asked to link against native code, some of which may require
 peculiar linking behavior (e.g. one of those many rules seen in `gcc
 -dumpspecs`). This isn't to say that `gcc`'s abstraction over linking is
 quite perfect; far from it. However, it's IMHO much better than having to
 dive into the muck ourselves.

 Moreover, I don't think thinking ourselves would necessarily help the crux
 of this problem: the user essentially gave us conflicting linking options.
 Really, the user shouldn't have to give us *any* linker options in this
 case; `ghc` should just handle linker choice for you.

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


More information about the ghc-tickets mailing list