-fmain-is
flag. The trouble is
that the runtime system is fixed, so what symbol should it link to?
The current solution is this. Suppose the main function is Foo.run
.
Foo
, GHC adds an extra definition:
:Main.main = runIO Foo.runNow the RTS can invoke
:Main.main
to start the program. (This extra
definition is inserted in TcRnDriver.checkMain.)
init_:Main
, so when compiling the main module (Foo in this case),
as well as generating init_Foo
as usual, GHC also generates
init_zcMain() { init_Foo; }This extra initialisation code is generated in CodeGen.mkModuleInit.