Making GHC work on BSD

Simon Marlow marlowsd at
Wed Sep 10 06:57:11 EDT 2008

Matthias Kilian wrote:
> On Tue, Sep 09, 2008 at 03:00:59PM +0100, Simon Marlow wrote:
>>> Is this a change from 6.8.3?  NetBSD currently provides 6.8.3 as an
>>> optional package for NetBSD/i386 4.0, with ghci included and without
>>> any mmap patches as far as I know.  It was also working for me on
>>> NetBSD/amd64 (which is the platform that would actually need MAP_32BIT?)
>> Yes, the code changed in the HEAD, and currently uses mremap(), which only 
>> exists on Linux.  We need similar hacks that were done in 6.8.3 to get the 
>> BSDs to work, that is to allocate memory from some predefined address in 
>> the lower 2Gb of the address space.
> BTW: are there any big plans[tm] to replace all this OS specific
> hacks by something like dlopen(3) and friends for GHC 6.12? I really
> don't want to hack on Linker.c just to be see that hacking obsoleted
> in a year ;-)

I don't think we can do it all with dlopen().  Even when we have shared 
libraries for all the packages and the RTS, so we could use dlopen() to 
load those, we still need to be able to link plain .o files.  I suppose 
dlopen() migth be able to load ordinary .o files these days, but it 
probably won't populate its symbol table with symbols from the .o unless 
it was linked with --export-dynamic or something.


More information about the Glasgow-haskell-users mailing list