Skip to content
  • Simon Marlow's avatar
    ELF/x86_64: map object file sections separately into the low 2GB · 04e83666
    Simon Marlow authored
    On 64-bit ELF we need to link object files into the low 2GB due to the
    small memory model.  Previously we would map the entire object file
    using MAP_32BIT, but the object file can consist of 75% or more
    symbols, which only need to be present during linking, so this is
    wasteful.  In our particular application, we're already running out of
    space here.
    
    This patch changes the way we load object files on ELF platforms so
    that the object is first mapped above the 2GB boundary, parsed, and
    then the important sections are re-mapped into the low 2GB area.
    
    Test Plan:
    validate
    (also needs testing on OS X & Windows, preferably 32 & 64 bit)
    
    Reviewers: Phyx, trommler, bgamari, austin
    
    Subscribers: hsyl20, thomie, bgamari
    
    Differential Revision: https://phabricator.haskell.org/D975
    04e83666