Stop using mremap() to allocate space for trampolines
authorSimon Marlow <marlowsd@gmail.com>
Mon, 15 Sep 2008 14:59:24 +0000 (14:59 +0000)
committerSimon Marlow <marlowsd@gmail.com>
Mon, 15 Sep 2008 14:59:24 +0000 (14:59 +0000)
commitbf7e78fa99b8e73b33aeecc8e86776f42cff33d4
treec61c32d117a28211e6fa0c4589b644c9550d15be
parent6c0441c137c46d4773c088671e1ce84844e94b7c
Stop using mremap() to allocate space for trampolines

This was causing problems because sometimes mremap() moved the memory
we had allocated from the low 2Gb to above the 2Gb boundary, causing
some linkages to fail.  There's no MAP_32BIT flag to mremap().

So now we just use mmap(MAP_ANON|MAP_32BIT) to allocated space for the
trampolines.  People without MAP_32BIT (eg. *BSD) will still have to
do something else here, such as allocating memory from a fixed
address; so I've made it slightly easier for those guys, but there's
still work to do (#2063).

One solution (that Simon PJ is advocating) is to turn on -fPIC by
default on x86-64.  This is a good solution as it removes the need for
MAP_32BIT, but doesn't work with -fvia-C, so probably this is for
later.
rts/Linker.c