[lldb/PlatformPOSIX] Change LoadImage default to RTLD_LAZY (reapply)

In general, it seems like the debugger should allow programs to load & run with
libraries as far as possible, instead of defaulting to being super-picky about
unavailable symbols.

This is critical on macOS/Darwin, as libswiftCore.dylib may 1) export a version
symbol using @available markup and then 2) expect that other exported APIs are
only dynamically used once the version symbol is checked. We can't open a
version of the library built with a bleeding-edge SDK on an older OS without
RTLD_LAXY (or pervasive/expensive @available markup added to dyld APIs).

This was previously committed as cb8c1ee269da and reverted due to
unknown failures on the Linux bots. This version adds additional asserts
to check that the shared objects are where we expect them & that calling
f1() from libt1 produces the expected value. The Linux failure is
tracked by https://bugs.llvm.org/show_bug.cgi?id=49656.

See: https://lists.llvm.org/pipermail/lldb-dev/2021-March/016796.html

Differential Revision: https://reviews.llvm.org/D98879

GitOrigin-RevId: 4bd2bfb6ec0980853d7f9d1874e0547b68b7a61e
9 files changed