Skip to content
  • Simon Marlow's avatar
    Stop using mremap() to allocate space for trampolines · bf7e78fa
    Simon Marlow authored
    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.
    bf7e78fa