Fix linking of preloaded object files.

Handle preloaded object files like all other objects that
are loaded later.

Fixes #8935.
Explicitly request local scope in dlopen.

POSIX says one of RTLD_GLOBAL or RTLD_LOCAL should be given in flags
otherwise the behaviour is implementation dependent. We want local,
so say so.