[GHC] #8935: Obscure linker bug leads to crash in GHCi

GHC ghc-devs at haskell.org
Sun May 4 10:45:37 UTC 2014


#8935: Obscure linker bug leads to crash in GHCi
-------------------------------------+------------------------------------
        Reporter:  simonmar          |            Owner:  simonmar
            Type:  bug               |           Status:  infoneeded
        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 trommler):

 Replying to [comment:12 dagit]:
 Great, thanks!
 > {{{
 >       5823:   symbol=environ;  lookup in file=/usr/lib64/libgmp.so [0]
 >       5823:   symbol=environ;  lookup in file=/lib64/libc.so.6 [0]
 > }}}

 That looks like we have found the reason, why openSUSE behaves differently
 here:
 On openSUSE {{{libgmp.so}}} is never checked for {{{environ}}} because
 {{{ld.so}}} looks in {{{check-environ}}} first. {{{check-environ}}} has
 symbol {{{environ}}}, because of the {{{extern char** environ;}}} in line
 7.

 According to gABI
 [http://refspecs.linuxbase.org/elf/gabi4+/ch5.dynamic.html] this is the
 default behavior. To override that one can set set the flag
 {{{DF_SYMBOLIC}}} in the shared library's header and I suspect Fedora does
 that.

 The behavior is defined as follows in gABI:

 DF_SYMBOLIC
     If this flag is set in a shared object library, the dynamic linker's
 symbol resolution algorithm for references within the library is changed.
 Instead of starting a symbol search with the executable file, the dynamic
 linker starts from the shared object itself. If the shared object fails to
 supply the referenced symbol, the dynamic linker then searches the
 executable file and other shared objects as usual.

 Could you post the output of {{{readelf -h /usr/lib64/libgmp.so.10}}} to
 confirm. Replace 10 with the version on your system.

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


More information about the ghc-tickets mailing list