Let exposedPackages be the set of packages thus exposed.
Let depExposedPackages be the transitive closure from exposedPackages of
their dependencies.

When searching for a module from an preload import declaration,
only the exposed modules in exposedPackages are valid.

When searching for a module from an implicit import, all modules
from depExposedPackages are valid.

When linking in a compilation manager mode, we link in packages the
program depends on (the compiler knows this list by the
time it gets to the link step). Also, we link in all packages
which were mentioned with preload -package flags on the command-line,
or are a transitive dependency of same, or are "base"/"rts".
The reason for this is that we might need packages which don't
contain any Haskell modules, and therefore won't be discovered
by the normal mechanism of dependency tracking.

Call this after parseDynFlags. It reads the package
database files, and sets up various internal tables of package
information, according to the package-related flags on the
command-line (-package, -hide-package etc.)

Returns a list of packages to link in if we're doing dynamic linking.
This list contains the packages that the user explicitly mentioned with
-package flags.