Skip to content
  • Tamar Christina's avatar
    Remove lookup of sections by name instead use the index numbers as offsets · 49e414a7
    Tamar Christina authored
    Summary:
    This patch comes from @awson
    
    {{{
    Playing with `-fsplit-sections` on Windows I've found a pile of ancient
    (it was borrowed from Hugs interpreter code and I don't even know when
    was it created), absolutely redundant and plain wrong code in RTS linker.
    
    Technically it is a bug, but it doesn't break things when used with
    current Windows binutils with no special linker scripts involved.
    
    OTOH, it slows down runtime linker on Windows noticeably and thus can
    be considered as a performance bug.
    
    The nice side-effect for existing users is that GHCi now loads compiled
    object code much faster on Windows.
    }}}
    
    More specifically, sections were being looked up by name by doing a loop
    over all sections until the section with the given name is found.
    
    The new approach uses the section index and finds the section in O(1) time
    based on information gathered when we originally processed the section
    
    Test Plan: ./validate (was run on GHC x86)
    
    Reviewers: austin, awson, erikd, thomie, bgamari
    
    Reviewed By: thomie, bgamari
    
    Subscribers: awson, #ghc_windows_task_force
    
    Differential Revision: https://phabricator.haskell.org/D1773
    
    GHC Trac Issues: #11388
    49e414a7