Apply RTLD_NODELETE for USE_SANITIZER builds

This allows their stack trace to be symbolized in CI/Jenkins XSAN runs
This commit is contained in:
Junhyun Shim 2022-07-18 19:20:34 +02:00
parent 989e323991
commit 8b70c7050d
1 changed files with 6 additions and 1 deletions

View File

@ -3469,7 +3469,12 @@ void* loadLibrary(const char* lib_path) {
void* dlobj = nullptr;
#if defined(__unixish__)
dlobj = dlopen(lib_path, RTLD_LAZY | RTLD_LOCAL);
dlobj = dlopen(lib_path,
RTLD_LAZY | RTLD_LOCAL
#ifdef USE_SANITIZER // Keep alive dlopen()-ed libs for symbolized XSAN backtrace
| RTLD_NODELETE
#endif
);
if (dlobj == nullptr) {
TraceEvent(SevWarn, "LoadLibraryFailed").detail("Library", lib_path).detail("Error", dlerror());
}