[GHC] #10161: GHC does not relink if a library's code changed

GHC ghc-devs at haskell.org
Sun Mar 15 16:10:44 UTC 2015


#10161: GHC does not relink if a library's code changed
-------------------------------------+-------------------------------------
              Reporter:  nh2         |             Owner:
                  Type:  bug         |            Status:  new
              Priority:  normal      |         Milestone:
             Component:  Compiler    |           Version:  7.8.4
              Keywords:              |  Operating System:  Unknown/Multiple
          Architecture:              |   Type of failure:  None/Unknown
  Unknown/Multiple                   |        Blocked By:
             Test Case:              |   Related Tickets:
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------
 Test case for reproducing: https://github.com/nh2/ghc-relinking-avoidance-
 bug/

 ----

 {{{myexe}}} is an executable that depends on {{{mylib}}}, whose {{{myfun =
 putStrLn "output 1"}}}.

 If we install {{{mylib}}}, compile {{{myexe}}}, then change mylib's code
 to {{{myfun = putStrLn "output 2"}}}, re-install it, and then compile
 {{{myexe}}}, then GHC does not notice that the library code changed.

 It avoids re-linking myexe, with the result that the program prints
 {{{output 1}}} when you told it to compile against code that prints
 {{{output 2}}}.

 ----

 Note that I had to use {{{NOINLINE myfun}}} to trigger the bug, since
 otherwise {{{myfun}}}'s code would have ended up in the interface file,
 thus changing the package ID, which naturally forces GHC to relink (even
 re-compile).

 With the {{{NOINLINE}}}, the package IDs of the two different versions of
 {{{myfun}}} are completely identical. I think that is correct, since the
 package ID only hashes the API and ABI, not the actual implementation,
 right?

 How does GHC decide when to relink? I think in the present case, it
 doesn't notice that the object/archive file of the library changed. Does
 it check that somehow? Just looking at API and API can't be enough to make
 a decision for linking.

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


More information about the ghc-tickets mailing list