[Haskell-cafe] Re: compiling shared library with GHC on x86-64

Simon Marlow simonmarhaskell at gmail.com
Wed Jun 6 08:00:49 EDT 2007

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.


More information about the Haskell-Cafe mailing list