From 102c48d7a1054f0743cd18f2ae09e4b2dab5c846 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 9 Feb 2023 21:08:36 +0100 Subject: [PATCH] Prefer symbols from plugins Now that we can require glibc 2.3.4, we can use RTLD_DEEPBIND. This can help with plugins that do no hide symbols for their contained statically linked libraries, and instead would use use symbols. Note: This only works on Linux. --- libs/ardour/linux_vst_support.cc | 4 ++-- libs/ardour/vst3_module.cc | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/ardour/linux_vst_support.cc b/libs/ardour/linux_vst_support.cc index 032abdf257..e4f25233a3 100644 --- a/libs/ardour/linux_vst_support.cc +++ b/libs/ardour/linux_vst_support.cc @@ -103,7 +103,7 @@ static void* vstfx_load_vst_library(const char* path) you get some occasional failures to load - dlerror reports invalid arguments*/ - if ((dll = dlopen (path, RTLD_LOCAL | RTLD_LAZY)) != 0) { + if ((dll = dlopen (path, RTLD_LOCAL | RTLD_LAZY | RTLD_DEEPBIND)) != 0) { return dll; } @@ -151,7 +151,7 @@ static void* vstfx_load_vst_library(const char* path) /*Try and load the library*/ - if ((dll = dlopen(full_path, RTLD_LOCAL | RTLD_LAZY)) != 0) { + if ((dll = dlopen (full_path, RTLD_LOCAL | RTLD_LAZY | RTLD_DEEPBIND)) != 0) { /*Succeeded */ break; } diff --git a/libs/ardour/vst3_module.cc b/libs/ardour/vst3_module.cc index f954d28910..ad649b1563 100644 --- a/libs/ardour/vst3_module.cc +++ b/libs/ardour/vst3_module.cc @@ -169,7 +169,7 @@ class VST3LinuxModule : public VST3PluginModule public: VST3LinuxModule (std::string const& path) { - if ((_dll = dlopen (path.c_str (), RTLD_LOCAL | RTLD_LAZY)) == 0) { + if ((_dll = dlopen (path.c_str (), RTLD_LOCAL | RTLD_LAZY | RTLD_DEEPBIND)) == 0) { PBD::error << string_compose (_("Could not load VST3 plugin '%1': %2"), path, dlerror ()) << endmsg; throw failed_constructor (); }