File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # GHC Flags
2+
3+ There are 2 types of GHC flags.
4+ 1 . Compiler flags
5+ 2 . RTS flags
6+
7+ The RTS flags are in ` ghc/rts/RtsFlags.c ` .
8+ To add an RTS flag one needs to edit this file and make some follow-up changes.
9+
10+ The Compiler flags are in ` ghc/compiler/main/DynFlags.hs ` .
11+ One needs to edit this file to add a dynamic flag.
12+
13+ ## FAQ:
14+
15+ ** Q:** What is the difference between an RTS flag and a Compiler flag?
16+
17+ A Compiler flag is a flag that the compiler takes. ie. ` ghc ` . Whereas the RTS
18+ flag is the flag that the executable generated by the compiler takes.
19+
20+
21+ ** Q:** The Compiler flags seem to set some C Flags for a few options (for
22+ example "-DTRACING" when "-eventlog" is enabled, etc.). This is
23+ meta-programming. How does this work? Does a mini compilation happen
24+ everytime we invoke GHC?
25+
26+ We can describe what happens with eventlog which might answer the above
27+ question. WRT eventlog, the compiler has 2 versions of the RTS. One with
28+ eventlog enabled and one with eventlog disabled. The executable is linked with
29+ the RTS with the eventlog enabled when the ` -eventlog ` flag is enabled.
30+
31+ ## TODO:
32+
33+ We need to add 2 types of flags:
34+ 1 . A Compiler flag to enable perf counter structures.
35+ 2 . An RTS flag to enable the update of the counters.
36+
37+ This is similar to the eventlog approach.
38+ - ` -eventlog ` (Compiler flag) to enable the eventlog.
39+ - ` -l ` (RTS flag) to actually do the accounting.
You can’t perform that action at this time.
0 commit comments