Each module that uses static keyword declares an initialization function of
the form hs_spt_init_<module>() which is emitted into the _stub.c file and
annotated with attribute((constructor)) so that it gets executed at
startup time.
The function's purpose is to call hs_spt_insert to insert the static
pointers of this module in the hashtable of the RTS, and it looks something
like this:
where the constants are fingerprints produced from the static forms.
The linker must find the definitions matching the extern StgPtr name
declarations. For this to work, the identifiers of static pointers need to be
exported. This is done in GHC.Core.Opt.SetLevels.newLvlVar.
There is also a finalization function for the time when the module is
unloaded.