You’ve asked several questions, so lets answer them one by one.
Is that mean GHC complie the rts into the executable file when I compiling a Haskell program?
Yes, the RTS is compiled into the executable file when compiling a Haskell program. However, Haskell can also interpret code, using GHCi, or by running the source code as a script. In those cases, the we are using the RTS that is bundled with GHC.
why the diagram show the rts is a bridge between complied haskell code
and the c client code
? / Could someone please told me what the GHC’s runtime system is?
@jaror already covers this but I’ll add to it: Haskell is based on lambda calculus, which has no concept of input / output, threading, memory, filesystems, etc. In order to get those things, we have bind Haskell to the operating system, because that is what the operating system is responsible for - managing programs and their resources. The RTS acts as a bridge and provides ‘functions’ to Haskell that cannot otherwise be written in it, because they are dependent on the OS (and so in some sense, the RTS acts as a portability layer, too).
I have found generated code for my confusion,but it disoriented me again.
Haskell source code undergoes transformation into several intermediate representations as it is being compiled to binary. STG stands for Spineless Tagless Graph-reduction machine and is one of those representations. Naive methods of performing lambda calculus can be very slow, and the STG machine is used for efficiency.
Compiling down to STG is a different part of the pipeline from the RTS.