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

Alexander Vodomerov alex at sectorb.msk.ru
Wed Jun 6 05:55:58 EDT 2007


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):

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,

More information about the Haskell-Cafe mailing list