diff options
Diffstat (limited to 'media-sound/reaper-bin/files/libSwell-makefile-lazy-binding.patch')
-rw-r--r-- | media-sound/reaper-bin/files/libSwell-makefile-lazy-binding.patch | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/media-sound/reaper-bin/files/libSwell-makefile-lazy-binding.patch b/media-sound/reaper-bin/files/libSwell-makefile-lazy-binding.patch new file mode 100644 index 000000000000..9d9508071af8 --- /dev/null +++ b/media-sound/reaper-bin/files/libSwell-makefile-lazy-binding.patch @@ -0,0 +1,46 @@ +From d7fa7b22fdbc894a9986ab686b9c009d25f8cae7 Mon Sep 17 00:00:00 2001 +From: "Jason A. Donenfeld" <Jason@zx2c4.com> +Date: Tue, 2 Apr 2024 01:03:30 +0200 +Subject: [PATCH] swell-linux: ensure LD lazily binds symbols + +On newer toolchains that by default set `-Wl,-z,now`, such as Gentoo's +23.0 toolchain, setting PRELOAD_GDK causes swell's dlopen() to fail with +an error like: + + Error loading '/opt/REAPER/libSwell.so': /opt/REAPER/libSwell.so: undefined symbol: gdk_x11_window_get_xid + +This is because -z,now, according to the man page, "When generating an +executable or shared library, mark it to tell the dynamic linker to +resolve all symbols when the program is started, or when the shared +library is loaded by dlopen, instead of deferring function call +resolution to the point when the function is first called." This is +basically the opposite of what swell's preloading feature wants. + +This can be overridden by setting -z,lazy, which according to the man +page, "When generating an executable or shared library, mark it to tell +the dynamic linker to defer function call resolution to the point when +the function is called (lazy binding), rather than at load time." + +So pass -Wl,-z,lazy in the preloading case, so that it works no matter +what the toolchain defaults are. +--- + WDL/swell/Makefile | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/WDL/swell/Makefile b/WDL/swell/Makefile +index 9e7e2d87..8033fb30 100644 +--- a/WDL/swell/Makefile ++++ b/WDL/swell/Makefile +@@ -140,6 +140,9 @@ ifndef NOGDK + endif + endif + LINKEXTRA += -lGL ++ ifdef PRELOAD_GDK ++ CFLAGS += -Wl,-z,lazy ++ endif + endif + + CXXFLAGS = $(CFLAGS) +-- +2.44.0 + |