never executed always true always false
1 module GHC.Linker
2 (
3 )
4 where
5
6 import GHC.Prelude ()
7 -- We need this dummy dependency for the make build system. Otherwise it
8 -- tries to load GHC.Types which may not be built yet.
9
10 -- Note [Linkers and loaders]
11 -- ~~~~~~~~~~~~~~~~~~~~~~~~~~
12 --
13 -- Linkers are used to produce linked objects (.so, executables); loaders are
14 -- used to link in memory (e.g., in GHCi) with the already loaded libraries
15 -- (ghc-lib, rts, etc.).
16 --
17 -- Linking can usually be done with an external linker program ("ld"), but
18 -- loading is more tricky:
19 --
20 -- * Fully dynamic:
21 -- when GHC is built as a set of dynamic libraries (ghc-lib, rts, etc.)
22 -- and the modules to load are also compiled for dynamic linking, a
23 -- solution is to fully rely on external tools:
24 --
25 -- 1) link a .so with the external linker
26 -- 2) load the .so with POSIX's "dlopen"
27 --
28 -- * When GHC is built as a static program or when libraries we want to load
29 -- aren't compiled for dynamic linking, GHC uses its own loader ("runtime
30 -- linker"). The runtime linker is part of the rts (rts/Linker.c).
31 --
32 -- Note that within GHC's codebase we often use the word "linker" to refer to
33 -- the static object loader in the runtime system.
34 --
35 -- Loading can be delegated to an external interpreter ("iserv") when
36 -- -fexternal-interpreter is used.