From 8cc4ce94b83c2d1365088d0c73040d2751359012 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Sun, 12 Jul 2026 20:14:12 -0600 Subject: [PATCH] Mods: Don't use RTLD_DEEPBIND with ASAN --- src/dusk/mods/loader/native_module.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/dusk/mods/loader/native_module.cpp b/src/dusk/mods/loader/native_module.cpp index aa4a369fb0..edd3addb4f 100644 --- a/src/dusk/mods/loader/native_module.cpp +++ b/src/dusk/mods/loader/native_module.cpp @@ -6,6 +6,14 @@ #include #endif +#if defined(__SANITIZE_ADDRESS__) +#define ADDRESS_SANITIZER 1 +#elif defined(__has_feature) +#if __has_feature(address_sanitizer) +#define ADDRESS_SANITIZER 1 +#endif +#endif + namespace { #if defined(_WIN32) void* pl_dlopen(const std::filesystem::path& p) { @@ -31,7 +39,7 @@ std::string pl_dlerror() { #include void* pl_dlopen(const std::filesystem::path& p) { int flags = RTLD_LAZY | RTLD_LOCAL; -#if defined(RTLD_DEEPBIND) +#if defined(RTLD_DEEPBIND) && !defined(ADDRESS_SANITIZER) flags |= RTLD_DEEPBIND; #endif return dlopen(p.c_str(), flags);