[orc-rt] Add DlfcnLoaderAdapter. (#245120)
DlfcnLoaderAdapter simplifies exposing an ORC runtime loader through the
dlfcn.h APIs. Subclasses implement dlopen, dlclose, dlsym, and dladdr in
terms of their underlying loader, reporting failures with Error and
Expected as usual in the ORC runtime. The adapter takes care of
translating those results into dlfcn.h's error-reporting scheme: each
failure returns the operation's POSIX failure value, and its message is
made available to the calling thread through dlerror. Failures are also
logged, under a new LoaderAPIs logging category.
JIT'd code reaches an adapter through C entry points
(orc_rt_DlfcnLoaderAdapter_*) and an instance symbol,
orc_rt_DlfcnLoaderAdapter_Instance, which the adapter adds to a symbol
table supplied by its creator. The creator publishes that table to the
session once the whole loader system has been constructed.
Supporting changes:
- orc-rt-c/bedrock/sys/posix/dlfcn-types.h provides orc_rt_Dl_info and
ORC_RT_RTLD_* constants: the host's own definitions where the runtime is
built with its POSIX host implementation, so that the adapter matches
the host's dlfcn ABI, and the runtime's own elsewhere, so that the
adapter doesn't depend on <dlfcn.h>. ORC_RT_TARGET_POSIX is now recorded
in orc-rt-c/config.h so that this choice is made once, when the
runtime's build is configured.
- ORC_RT_STRINGIFY, used to name the instance symbol.