[GHC] #9280: GHCi crash:

GHC ghc-devs at haskell.org
Mon Jul 7 15:01:25 UTC 2014


#9280: GHCi crash:
------------------------------------------+--------------------------------
       Reporter:  mietek                  |             Owner:
           Type:  bug                     |            Status:  new
       Priority:  normal                  |         Milestone:
      Component:  GHCi                    |           Version:  7.8.2
       Keywords:  crash, dynamic linking  |  Operating System:
   Architecture:  x86_64 (amd64)          |  Unknown/Multiple
     Difficulty:  Unknown                 |   Type of failure:  GHCi crash
     Blocked By:                          |         Test Case:
Related Tickets:                          |          Blocking:
------------------------------------------+--------------------------------
 Given a statically-linked Haskell object file, interactive GHCi 7.8.2
 crashes.

 {{{
 $ cat >Foo.hs <<EOF
 module Foo where

 foo :: IO ()
 foo = print "Foo"
 EOF
 }}}


 On OS X:

 {{{
 $ ghc -Wall -c -o Foo.o Foo.hs
 }}}
 {{{
 $ ghci -v Foo.o
 GHCi, version 7.8.2: http://www.haskell.org/ghc/  :? for help
 Glasgow Haskell Compiler, Version 7.8.2, stage 2 booted by GHC version
 7.6.3
 Using binary package database:
 /opt/ghc-7.8.2/lib/ghc-7.8.2/package.conf.d/package.cache
 wired-in package ghc-prim mapped to ghc-
 prim-0.3.1.0-948744e1f99cc8bcc7c7d3ba60c7c2d8
 wired-in package integer-gmp mapped to integer-
 gmp-0.5.1.0-dc47f6b546fc171f67a7f7d311684a99
 wired-in package base mapped to
 base-4.7.0.0-a333addb6892f3cc2e6baa5ec782bd04
 wired-in package rts mapped to builtin_rts
 wired-in package template-haskell mapped to template-
 haskell-2.9.0.0-ed6ecfb467e6936688bb20f968f702e1
 wired-in package dph-seq not found.
 wired-in package dph-par not found.
 Hsc static flags:
 Loading package ghc-prim ... linking ... done.
 Loading package integer-gmp ... linking ... done.
 *** gcc:
 /usr/bin/gcc -m64 -fno-stack-protector -DTABLES_NEXT_TO_CODE
 -L/opt/ghc-7.8.2/lib/ghc-7.8.2/base-4.7.0.0 --print-file-name
 libiconv.dylib
 Loading package base ... linking ... done.
 Loading object (static) Foo.o ... Created temporary directory:
 /var/folders/26/0tzj1txn0vb_0061l4z4rsmr0000gn/T/ghc41409_0
 *** Linker:
 /usr/bin/gcc -m64 -fno-stack-protector -DTABLES_NEXT_TO_CODE -m64
 -dynamiclib -o
 /var/folders/26/0tzj1txn0vb_0061l4z4rsmr0000gn/T/ghc41409_0/ghc41409_1.dylib
 Foo.o -undefined dynamic_lookup -single_module -install_name
 '@rpath/ghc41409_1.dylib' -L/opt/ghc-7.8.2/lib/ghc-7.8.2/base-4.7.0.0
 -Wl,-rpath -Wl,/opt/ghc-7.8.2/lib/ghc-7.8.2/base-4.7.0.0
 -L/opt/ghc-7.8.2/lib/ghc-7.8.2/integer-gmp-0.5.1.0 -Wl,-rpath
 -Wl,/opt/ghc-7.8.2/lib/ghc-7.8.2/integer-gmp-0.5.1.0
 -L/opt/ghc-7.8.2/lib/ghc-7.8.2/ghc-prim-0.3.1.0 -Wl,-rpath
 -Wl,/opt/ghc-7.8.2/lib/ghc-7.8.2/ghc-prim-0.3.1.0
 -L/opt/ghc-7.8.2/lib/ghc-7.8.2/rts-1.0 -Wl,-rpath
 -Wl,/opt/ghc-7.8.2/lib/ghc-7.8.2/rts-1.0 -lHSbase-4.7.0.0-ghc7.8.2
 -lHSinteger-gmp-0.5.1.0-ghc7.8.2 -lHSghc-prim-0.3.1.0-ghc7.8.2 -liconv
 ld: illegal text-relocation to
 '_ghczmprim_GHCziCString_unpackCStringzh_closure' in
 /opt/ghc-7.8.2/lib/ghc-7.8.2/ghc-prim-0.3.1.0/libHSghc-
 prim-0.3.1.0-ghc7.8.2.dylib from '_sVK_info' in Foo.o for architecture
 x86_64
 clang: error: linker command failed with exit code 1 (use -v to see
 invocation)
 *** Deleting temp files:
 Deleting:
 /var/folders/26/0tzj1txn0vb_0061l4z4rsmr0000gn/T/ghc41409_0/ghc41409_1.dylib
 Warning: deleting non-existent
 /var/folders/26/0tzj1txn0vb_0061l4z4rsmr0000gn/T/ghc41409_0/ghc41409_1.dylib
 *** Deleting temp dirs:
 Deleting: /var/folders/26/0tzj1txn0vb_0061l4z4rsmr0000gn/T/ghc41409_0
 }}}


 On Linux, without `-fPIC`:

 {{{
 $ ghc -Wall -c -o Foo.o Foo.hs
 }}}
 {{{
 ghci -v Foo.o
 GHCi, version 7.8.2: http://www.haskell.org/ghc/  :? for help
 Glasgow Haskell Compiler, Version 7.8.2, stage 2 booted by GHC version
 7.6.3
 Using binary package database:
 /app/.halcyon/ghc/lib/ghc-7.8.2/package.conf.d/package.cache
 wired-in package ghc-prim mapped to ghc-
 prim-0.3.1.0-948744e1f99cc8bcc7c7d3ba60c7c2d8
 wired-in package integer-gmp mapped to integer-
 gmp-0.5.1.0-dc47f6b546fc171f67a7f7d311684a99
 wired-in package base mapped to
 base-4.7.0.0-018311399e3b6350d5be3a16b144df9b
 wired-in package rts mapped to builtin_rts
 wired-in package template-haskell mapped to template-
 haskell-2.9.0.0-dcc8c210fb02937e104bc1784d7b0f06
 wired-in package dph-seq not found.
 wired-in package dph-par not found.
 Hsc static flags:
 Loading package ghc-prim ... linking ... done.
 *** gcc:
 /usr/bin/gcc -fno-stack-protector -DTABLES_NEXT_TO_CODE
 -L/app/.halcyon/ghc/lib/ghc-7.8.2/integer-gmp-0.5.1.0 --print-file-name
 libgmp.so
 Loading package integer-gmp ... linking ... done.
 Loading package base ... linking ... done.
 Loading object (static) Foo.o ... Created temporary directory:
 /tmp/ghc7203_0
 *** Linker:
 /usr/bin/gcc -fno-stack-protector -DTABLES_NEXT_TO_CODE -o
 /tmp/ghc7203_0/ghc7203_1.so Foo.o -shared -Wl,-Bsymbolic
 -Wl,-h,ghc7203_1.so -L/app/.halcyon/ghc/lib/ghc-7.8.2/base-4.7.0.0
 -Wl,-rpath -Wl,/app/.halcyon/ghc/lib/ghc-7.8.2/base-4.7.0.0
 -L/app/.halcyon/ghc/lib/ghc-7.8.2/integer-gmp-0.5.1.0 -Wl,-rpath
 -Wl,/app/.halcyon/ghc/lib/ghc-7.8.2/integer-gmp-0.5.1.0
 -L/app/.halcyon/ghc/lib/ghc-7.8.2/ghc-prim-0.3.1.0 -Wl,-rpath
 -Wl,/app/.halcyon/ghc/lib/ghc-7.8.2/ghc-prim-0.3.1.0
 -L/app/.halcyon/ghc/lib/ghc-7.8.2/rts-1.0 -Wl,-rpath
 -Wl,/app/.halcyon/ghc/lib/ghc-7.8.2/rts-1.0 -lHSbase-4.7.0.0-ghc7.8.2
 -lHSinteger-gmp-0.5.1.0-ghc7.8.2 -lHSghc-prim-0.3.1.0-ghc7.8.2 -lgmp '-Wl
 ,--hash-size=31' -Wl,--reduce-memory-overheads
 /usr/bin/ld: Foo.o: relocation R_X86_64_32S against
 `stg_bh_upd_frame_info' can not be used when making a shared object;
 recompile with -fPIC
 Foo.o: could not read symbols: Bad value
 collect2: ld returned 1 exit status
 *** Deleting temp files:
 Deleting: /tmp/ghc7203_0/ghc7203_1.so
 Warning: deleting non-existent /tmp/ghc7203_0/ghc7203_1.so
 *** Deleting temp dirs:
 Deleting: /tmp/ghc7203_0
 }}}


 On Linux, with `-fPIC`:

 {{{
 $ ghc -Wall -c -fPIC -o Foo.o Foo.hs
 }}}
 {{{
 $ ghci -v Foo.o
 GHCi, version 7.8.2: http://www.haskell.org/ghc/  :? for help
 Glasgow Haskell Compiler, Version 7.8.2, stage 2 booted by GHC version
 7.6.3
 Using binary package database:
 /app/.halcyon/ghc/lib/ghc-7.8.2/package.conf.d/package.cache
 wired-in package ghc-prim mapped to ghc-
 prim-0.3.1.0-948744e1f99cc8bcc7c7d3ba60c7c2d8
 wired-in package integer-gmp mapped to integer-
 gmp-0.5.1.0-dc47f6b546fc171f67a7f7d311684a99
 wired-in package base mapped to
 base-4.7.0.0-018311399e3b6350d5be3a16b144df9b
 wired-in package rts mapped to builtin_rts
 wired-in package template-haskell mapped to template-
 haskell-2.9.0.0-dcc8c210fb02937e104bc1784d7b0f06
 wired-in package dph-seq not found.
 wired-in package dph-par not found.
 Hsc static flags:
 Loading package ghc-prim ... linking ... done.
 *** gcc:
 /usr/bin/gcc -fno-stack-protector -DTABLES_NEXT_TO_CODE
 -L/app/.halcyon/ghc/lib/ghc-7.8.2/integer-gmp-0.5.1.0 --print-file-name
 libgmp.so
 Loading package integer-gmp ... linking ... done.
 Loading package base ... linking ... done.
 Loading object (static) Foo.o ... Created temporary directory:
 /tmp/ghc7223_0
 *** Linker:
 /usr/bin/gcc -fno-stack-protector -DTABLES_NEXT_TO_CODE -o
 /tmp/ghc7223_0/ghc7223_1.so Foo.o -shared -Wl,-Bsymbolic
 -Wl,-h,ghc7223_1.so -L/app/.halcyon/ghc/lib/ghc-7.8.2/base-4.7.0.0
 -Wl,-rpath -Wl,/app/.halcyon/ghc/lib/ghc-7.8.2/base-4.7.0.0
 -L/app/.halcyon/ghc/lib/ghc-7.8.2/integer-gmp-0.5.1.0 -Wl,-rpath
 -Wl,/app/.halcyon/ghc/lib/ghc-7.8.2/integer-gmp-0.5.1.0
 -L/app/.halcyon/ghc/lib/ghc-7.8.2/ghc-prim-0.3.1.0 -Wl,-rpath
 -Wl,/app/.halcyon/ghc/lib/ghc-7.8.2/ghc-prim-0.3.1.0
 -L/app/.halcyon/ghc/lib/ghc-7.8.2/rts-1.0 -Wl,-rpath
 -Wl,/app/.halcyon/ghc/lib/ghc-7.8.2/rts-1.0 -lHSbase-4.7.0.0-ghc7.8.2
 -lHSinteger-gmp-0.5.1.0-ghc7.8.2 -lHSghc-prim-0.3.1.0-ghc7.8.2 -lgmp '-Wl
 ,--hash-size=31' -Wl,--reduce-memory-overheads
 /usr/bin/ld: Foo.o: relocation R_X86_64_PC32 against undefined symbol
 `ghczmprim_GHCziCString_unpackCStringzh_closure' can not be used when
 making a shared object; recompile with -fPIC
 /usr/bin/ld: final link failed: Bad value
 collect2: ld returned 1 exit status
 *** Deleting temp files:
 Deleting: /tmp/ghc7223_0/ghc7223_1.so
 Warning: deleting non-existent /tmp/ghc7223_0/ghc7223_1.so
 *** Deleting temp dirs:
 Deleting: /tmp/ghc7223_0
 }}}

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


More information about the ghc-tickets mailing list