Skip to content
Snippets Groups Projects
Forked from Glasgow Haskell Compiler / GHC
6891 commits behind, 481 commits ahead of the upstream repository.
Andreas Klebinger's avatar
Andreas Klebinger authored
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
Name Last commit Last update
..
cutils.c
genSym.c
keepCAFsForGHCi.c