[lldb-dev] Allowing PlatformPOSIX::LoadImage to lazy bind symbols

Vedant Kumar via lldb-dev lldb-dev at lists.llvm.org
Thu Mar 18 11:04:51 PDT 2021


Hello,

I'd like to allow PlatformPOSIX::LoadImage to lazy bind symbols (instead of failing to load a library if one of its exported symbols is in fact unavailable).

Essentially, I'd like for RTLD_LAZY to replace the current default of RTLD_NOW.

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).

I pitched this to Jim, who brought up the possibility of making the RTLD_ behavior configurable via some option. My thinking on that is, as approximately no users should notice the switch, it's not worth adding an option. (We can add one later if there's some actual demand.)

WDYT?

best,
vedant




More information about the lldb-dev mailing list