Skip to content
Snippets Groups Projects
Forked from Glasgow Haskell Compiler / GHC
Source project has a limited visibility.
  • Andreas Klebinger's avatar
    08ba8720
    ghc-the-library: Retain cafs in both static in dynamic builds. · 08ba8720
    Andreas Klebinger authored and Marge Bot's avatar Marge Bot committed
    We use keepCAFsForGHCi.c to force -fkeep-cafs behaviour by using a
    __attribute__((constructor)) function.
    
    This broke for static builds where the linker discarded the object file
    since it was not reverenced from any exported code. We fix this by
    asserting that the flag is enabled using a function in the same module
    as the constructor. Which causes the object file to be retained by the
    linker, which in turn causes the constructor the be run in static builds.
    
    This changes nothing for dynamic builds using the ghc library. But causes
    static to also retain CAFs (as we expect them to).
    
    Fixes #22417.
    
    -------------------------
    Metric Decrease:
        T21839r
    -------------------------
    08ba8720
    History
    ghc-the-library: Retain cafs in both static in dynamic builds.
    Andreas Klebinger authored and Marge Bot's avatar Marge Bot committed
    We use keepCAFsForGHCi.c to force -fkeep-cafs behaviour by using a
    __attribute__((constructor)) function.
    
    This broke for static builds where the linker discarded the object file
    since it was not reverenced from any exported code. We fix this by
    asserting that the flag is enabled using a function in the same module
    as the constructor. Which causes the object file to be retained by the
    linker, which in turn causes the constructor the be run in static builds.
    
    This changes nothing for dynamic builds using the ghc library. But causes
    static to also retain CAFs (as we expect them to).
    
    Fixes #22417.
    
    -------------------------
    Metric Decrease:
        T21839r
    -------------------------
Code owners
Assign users and groups as approvers for specific file changes. Learn more.