[PATCH 1/3] winex11.drv: stop using RTLD_GLOBAL

Emil Velikov emil.l.velikov at gmail.com
Sun Oct 10 15:06:17 CDT 2021


The flag was required to promote internal symbols into the global name
space. That was required since a few of the libraries were under-linked.

The last one being Mesa's libGL and dri drivers.

In there, older versions of Mesa were missing the libglapi symbols,
which were resolved via RTLD_GLOBAL hack(s).

That hasn't no been an issue for over 5 years, so drop these
workarounds.

Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
I would wager that other in-tree RTLD_GLOBAL users are similar in
nature. Yet I lack the specific knowledge - hence I've left them as-is.
---
 dlls/winex11.drv/opengl.c      | 2 +-
 dlls/winex11.drv/x11drv_main.c | 6 +++---
 dlls/winex11.drv/xrandr.c      | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c
index 791787cfd3a..6741daa42fb 100644
--- a/dlls/winex11.drv/opengl.c
+++ b/dlls/winex11.drv/opengl.c
@@ -551,7 +551,7 @@ static BOOL WINAPI init_opengl( INIT_ONCE *once, void *param, void **context )
 
     /* No need to load any other libraries as according to the ABI, libGL should be self-sufficient
        and include all dependencies */
-    opengl_handle = dlopen( SONAME_LIBGL, RTLD_NOW | RTLD_GLOBAL );
+    opengl_handle = dlopen( SONAME_LIBGL, RTLD_NOW );
     if (opengl_handle == NULL)
     {
         ERR( "Failed to load libGL: %s\n", dlerror() );
diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c
index e8b273d055e..b8b557e3546 100644
--- a/dlls/winex11.drv/x11drv_main.c
+++ b/dlls/winex11.drv/x11drv_main.c
@@ -474,7 +474,7 @@ static int xcomp_error_base;
 
 static void X11DRV_XComposite_Init(void)
 {
-    void *xcomposite_handle = dlopen(SONAME_LIBXCOMPOSITE, RTLD_NOW);
+    void *xcomposite_handle = dlopen(SONAME_LIBXCOMPOSITE, RTLD_NOW );
     if (!xcomposite_handle)
     {
         TRACE("Unable to open %s, XComposite disabled\n", SONAME_LIBXCOMPOSITE);
@@ -573,7 +573,7 @@ static void init_visuals( Display *display, int screen )
 static BOOL process_attach(void)
 {
     Display *display;
-    void *libx11 = dlopen( SONAME_LIBX11, RTLD_NOW|RTLD_GLOBAL );
+    void *libx11 = dlopen( SONAME_LIBX11, RTLD_NOW );
 
     if (!libx11)
     {
@@ -583,7 +583,7 @@ static BOOL process_attach(void)
     pXGetEventData = dlsym( libx11, "XGetEventData" );
     pXFreeEventData = dlsym( libx11, "XFreeEventData" );
 #ifdef SONAME_LIBXEXT
-    dlopen( SONAME_LIBXEXT, RTLD_NOW|RTLD_GLOBAL );
+    dlopen( SONAME_LIBXEXT, RTLD_NOW );
 #endif
 
     setup_options();
diff --git a/dlls/winex11.drv/xrandr.c b/dlls/winex11.drv/xrandr.c
index 8faece9023a..3c9ef27ff5f 100644
--- a/dlls/winex11.drv/xrandr.c
+++ b/dlls/winex11.drv/xrandr.c
@@ -88,7 +88,7 @@ static int load_xrandr(void)
 {
     int r = 0;
 
-    if (dlopen(SONAME_LIBXRENDER, RTLD_NOW|RTLD_GLOBAL) &&
+    if (dlopen(SONAME_LIBXRENDER, RTLD_NOW) &&
         (xrandr_handle = dlopen(SONAME_LIBXRANDR, RTLD_NOW)))
     {
 
-- 
2.33.0




More information about the wine-devel mailing list