
#8935: Obscure linker bug leads to crash in GHCi -------------------------------------+------------------------------------ Reporter: simonmar | Owner: simonmar Type: bug | Status: new Priority: high | Milestone: 7.8.3 Component: Runtime System | Version: 7.8.1-rc2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: GHCi crash | Difficulty: Rocket Science Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Comment (by simonmar): Replying to [comment:2 trommler]:
I tried the test program on openSUSE 12.3: {{{ environ = 0x601060 dlsym(deflt, "environ") = 0x601060 dlsym("libgmp", "environ") = 0x601060 dlsym("libpthread", "environ") = 0x601060 }}} Here is my libgmp: {{{ ls /usr/lib64/libgmp.so* /usr/lib64/libgmp.so /usr/lib64/libgmp.so.10 /usr/lib64/libgmp.so.10.0.5 }}}
IIRC POSIX.1 (but not C!) reserves variable {{{environ}}}. So I'd say it is a bug in Ubuntu's libgmp.
The original distro I encountered the problem on was CentOS. I don't think it is to do with gmp specifically, IIRC there were other libraries that cause the behaviour too (but I'd need to go back and check again). My partial theory is that because `environ` is a symbol with R_COPY relocation, the linker is confused and has returned the original location (before the contents were copied and the symbol relocated). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8935#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler