[GHC] #2615: ghci doesn't play nice with linker scripts

GHC ghc-devs at haskell.org
Thu Jan 29 06:21:08 UTC 2015


#2615: ghci doesn't play nice with linker scripts
-------------------------------------+-------------------------------------
        Reporter:  AlecBerryman      |                   Owner:
            Type:  bug               |                  Status:  new
        Priority:  high              |               Milestone:  6.12.3
       Component:  GHCi              |                 Version:  7.0.3
      Resolution:                    |                Keywords:  dlopen,
Operating System:  Linux             |  dynamic linking
 Type of failure:  Incorrect result  |            Architecture:
  at runtime                         |  Unknown/Multiple
      Blocked By:                    |               Test Case:
 Related Tickets:                    |                Blocking:
                                     |  Differential Revisions:
-------------------------------------+-------------------------------------
Changes (by Jinhui_Chen):

 * cc: hvr (added)
 * owner:  hgolden =>
 * status:  closed => new
 * resolution:  fixed =>


Comment:

 I recently encounter a problem which I think is related to this bug. This
 is illustrated by this Haskell program:

 {{{
 import ObjLink
 import Foreign
 import Foreign.C.Types
 import Foreign.C.String

 foreign import ccall "setlocale" c_setlocale :: CInt -> CString -> IO
 CString

 main = do
   withCString "zh_CN.UTF-8" $ \lc -> c_setlocale 5 lc
   r <- loadDLL "/usr/lib/libc.so"
   putStrLn (show r)
 }}}
 which outputs:

 {{{
 Just "/usr/lib/libc.so: \26080\25928\30340 ELF \22836"
 }}}
 The "\26080\25928\30340 ELF \22836" part is "无效的ELF头" in Chinese.

 I suspect the problem is caused by addDLL function, which expects dlopen
 to return "invalid ELF header", and that is not true on non-C/non-en
 locales.

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


More information about the ghc-tickets mailing list