diff options
author | Ben Gamari <ben@smart-cactus.org> | 2020-09-09 15:39:59 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-09-18 15:56:25 -0400 |
commit | c492134912e5270180881b7345ee86dc32756bdd (patch) | |
tree | 00e738e307bb6ad44b1c52d70374d29cebd86712 /rts/RtsStartup.c | |
parent | 0799b3de3e3462224bddc0e4b6a3156d04a06361 (diff) | |
download | haskell-c492134912e5270180881b7345ee86dc32756bdd.tar.gz |
rts: Refactor foreign export tracking
This avoids calling `libc` in the initializers which are responsible for
registering foreign exports. We believe this should avoid the corruption
observed in #18548.
See Note [Tracking foreign exports] in rts/ForeignExports.c for an
overview of the new scheme.
Diffstat (limited to 'rts/RtsStartup.c')
-rw-r--r-- | rts/RtsStartup.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/rts/RtsStartup.c b/rts/RtsStartup.c index 497add5e92..b916010d34 100644 --- a/rts/RtsStartup.c +++ b/rts/RtsStartup.c @@ -20,6 +20,7 @@ #include "STM.h" /* initSTM */ #include "RtsSignals.h" #include "Weak.h" +#include "ForeignExports.h" /* processForeignExports */ #include "Ticky.h" #include "StgRun.h" #include "Prelude.h" /* fixupRTStoPreludeRefs */ @@ -339,7 +340,13 @@ hs_init_ghc(int *argc, char **argv[], RtsConfig rts_config) getStablePtr((StgPtr)processRemoteCompletion_closure); #endif - // Initialize the top-level handler system + /* + * process any foreign exports which were registered while loading the + * image + * */ + processForeignExports(); + + /* initialize the top-level handler system */ initTopHandler(); /* initialise the shared Typeable store */ |