summaryrefslogtreecommitdiff
path: root/devel/glib2/patches/patch-gmodule_gmodule-dl.c
blob: 1e9199f96102e7c556ec534ba3d3ed888c91c381 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
$NetBSD: patch-gmodule_gmodule-dl.c,v 1.4 2021/10/11 10:03:47 cirnatdan Exp $

RTL_GLOBAL is a bug.
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2171

--- gmodule/gmodule-dl.c.orig	2021-09-17 10:17:56.832962500 +0000
+++ gmodule/gmodule-dl.c
@@ -151,38 +151,13 @@ _g_module_open (const gchar *file_name,
 static gpointer
 _g_module_self (void)
 {
-  gpointer handle;
-  
-  /* to query symbols from the program itself, special link options
-   * are required on some systems.
-   */
-
-  /* On Android 32 bit (i.e. not __LP64__), dlopen(NULL)
-   * does not work reliable and generally no symbols are found
-   * at all. RTLD_DEFAULT works though.
-   * On Android 64 bit, dlopen(NULL) seems to work but dlsym(handle)
-   * always returns 'undefined symbol'. Only if RTLD_DEFAULT or 
-   * NULL is given, dlsym returns an appropriate pointer.
-   */
-  lock_dlerror ();
-#if defined(__BIONIC__)
-  handle = RTLD_DEFAULT;
-#else
-  handle = dlopen (NULL, RTLD_GLOBAL | RTLD_LAZY);
-#endif
-  if (!handle)
-    g_module_set_error (fetch_dlerror (TRUE));
-  unlock_dlerror ();
-  
-  return handle;
+  return RTLD_DEFAULT;
 }
 
 static void
 _g_module_close (gpointer handle)
 {
-#if defined(__BIONIC__)
   if (handle != RTLD_DEFAULT)
-#endif
     {
       lock_dlerror ();
       if (dlclose (handle) != 0)