compiling shared library with GHC on x86-64

Hello! I'm trying to build shared library from Haskell source to call it from external C program. Everything works fine on usual x86 machine. However, any attempt to compile code as position independent on x86-64 result in fatal error. This is simple example: $ cat adder.hs module Adder where f :: Int -> Int -> Int f x y = x + y $ ghc -fPIC -c adder.hs ghc-6.6.1: panic! (the 'impossible' happened) (GHC version 6.6.1 for x86_64-unknown-linux): initializePicBase Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug $ I've read source file compiler/nativeGen/PositionIndependentCode.hs and found that function initializePicBase is not implemented for x86-64 platform. Are there any plans to implement such a functionality? Are there any global difficulties with such an implementation or nobody just cared about it? What functions are needed to be implemented for building PIC code on x86-64? If it is not very difficult, may be I will try myself. What is best source of GHC code generator documentation? Any other ideas? With best regards, Alexander.

Alexander Vodomerov wrote:
Hello!
I'm trying to build shared library from Haskell source to call it from external C program. Everything works fine on usual x86 machine.
However, any attempt to compile code as position independent on x86-64 result in fatal error. This is simple example:
$ cat adder.hs module Adder where
f :: Int -> Int -> Int f x y = x + y
$ ghc -fPIC -c adder.hs ghc-6.6.1: panic! (the 'impossible' happened) (GHC version 6.6.1 for x86_64-unknown-linux): initializePicBase
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
$
I've read source file compiler/nativeGen/PositionIndependentCode.hs and found that function initializePicBase is not implemented for x86-64 platform.
Are there any plans to implement such a functionality? Are there any global difficulties with such an implementation or nobody just cared about it?
As you noticed, shared libraries are only partially implemented in GHC. There is a Google Summer of Code project to get shared libraries working, the work is ongoing right now, drop into #ghc on IRC to find out more. Cheers, Simon
participants (2)
-
Alexander Vodomerov
-
Simon Marlow