summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2017-01-04 22:16:14 +0200
committerSebastian Dröge <sebastian@centricular.com>2017-01-04 22:24:32 +0200
commitcb45a67b3fe20b8cd412744ca30a5d69e8f2ca82 (patch)
tree9f0fd08868bf9f981432f82e68655523b8775028
parent6d71fcf7f052963f9ef0a6734138f6a32c6eccff (diff)
glib: Various GModule fixes for 64 bit Android
It didn't work at all, and especially g_module_open(NULL, ...) was failing, which broke the androidmedia plugin and other things. https://bugzilla.gnome.org/show_bug.cgi?id=776876
-rw-r--r--recipes/build-tools/glib-tools.recipe4
-rw-r--r--recipes/glib.recipe4
-rw-r--r--recipes/glib/0018-Check-for-RTLD_LAZY-and-others-in-configure.patch62
-rw-r--r--recipes/glib/0018-Don-t-use-RTLD_DEFAULT-on-Android-for-g_module_self.patch36
4 files changed, 104 insertions, 2 deletions
diff --git a/recipes/build-tools/glib-tools.recipe b/recipes/build-tools/glib-tools.recipe
index 358cf265..2184e6b5 100644
--- a/recipes/build-tools/glib-tools.recipe
+++ b/recipes/build-tools/glib-tools.recipe
@@ -20,7 +20,9 @@ class Recipe(recipe.Recipe):
"../glib/0008-gdbus-codgen-Use-a-proper-shebang-in-the-generator.patch",
"../glib/0009-Unhide-_g_io_modules_ensure_extension_points_registe.patch",
'../glib/0015-Implementation-of-Cocoa-event-loop-integration-in-GM.patch',
- '../glib/0017-GSocket-Fix-race-conditions-on-Win32-if-multiple-thr.patch'
+ '../glib/0017-GSocket-Fix-race-conditions-on-Win32-if-multiple-thr.patch',
+ '../glib/0018-Check-for-RTLD_LAZY-and-others-in-configure.patch',
+ '../glib/0018-Don-t-use-RTLD_DEFAULT-on-Android-for-g_module_self.patch'
]
def prepare(self):
diff --git a/recipes/glib.recipe b/recipes/glib.recipe
index 0afab469..8ea52d0d 100644
--- a/recipes/glib.recipe
+++ b/recipes/glib.recipe
@@ -37,7 +37,9 @@ class Recipe(recipe.Recipe):
"glib/0008-gdbus-codgen-Use-a-proper-shebang-in-the-generator.patch",
"glib/0009-Unhide-_g_io_modules_ensure_extension_points_registe.patch",
'glib/0015-Implementation-of-Cocoa-event-loop-integration-in-GM.patch',
- 'glib/0017-GSocket-Fix-race-conditions-on-Win32-if-multiple-thr.patch'
+ 'glib/0017-GSocket-Fix-race-conditions-on-Win32-if-multiple-thr.patch',
+ 'glib/0018-Check-for-RTLD_LAZY-and-others-in-configure.patch',
+ 'glib/0018-Don-t-use-RTLD_DEFAULT-on-Android-for-g_module_self.patch'
]
files_libs = [
diff --git a/recipes/glib/0018-Check-for-RTLD_LAZY-and-others-in-configure.patch b/recipes/glib/0018-Check-for-RTLD_LAZY-and-others-in-configure.patch
new file mode 100644
index 00000000..bae2df62
--- /dev/null
+++ b/recipes/glib/0018-Check-for-RTLD_LAZY-and-others-in-configure.patch
@@ -0,0 +1,62 @@
+From 3f63a6990de4c581ec374b00a000b29a605c92a7 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= <sebastian@centricular.com>
+Date: Wed, 4 Jan 2017 21:39:48 +0200
+Subject: [PATCH] Check for RTLD_LAZY and others in configure
+
+They are no #defines on Android but enum values, and on 64 bit Android
+they have different values than what we would otherwise fall-back to.
+---
+ configure.ac | 10 ++++++++++
+ gmodule/gmodule-dl.c | 7 ++++---
+ 2 files changed, 14 insertions(+), 3 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 00991c5..94d35be 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1506,6 +1506,16 @@ dnl *** check whether we need preceeding underscores
+ G_MODULE_NEED_USCORE=0
+ fi
+
++ AC_CHECK_DECL([RTLD_LAZY],
++ [AC_DEFINE(HAVE_RTLD_LAZY, 1, [Define to 1 if RTLD_LAZY is available])],
++ [], [[#include <dlfcn.h>]])
++ AC_CHECK_DECL([RTLD_NOW],
++ [AC_DEFINE(HAVE_RTLD_NOW, 1, [Define to 1 if RTLD_NOW is available])],
++ [], [[#include <dlfcn.h>]])
++ AC_CHECK_DECL([RTLD_GLOBAL],
++ [AC_DEFINE(HAVE_RTLD_GLOBAL, 1, [Define to 1 if RTLD_GLOBAL is available])],
++ [], [[#include <dlfcn.h>]])
++
+ LDFLAGS="$LDFLAGS_orig"
+ dnl *** check for having dlerror()
+ AC_CHECK_FUNC(dlerror,
+diff --git a/gmodule/gmodule-dl.c b/gmodule/gmodule-dl.c
+index 20225df..e452e34 100644
+--- a/gmodule/gmodule-dl.c
++++ b/gmodule/gmodule-dl.c
+@@ -57,17 +57,18 @@
+ * RTLD_GLOBAL - the external symbols defined in the library will be made
+ * available to subsequently loaded libraries.
+ */
+-#ifndef RTLD_LAZY
++#ifndef HAVE_RTLD_LAZY
+ #define RTLD_LAZY 1
+ #endif /* RTLD_LAZY */
+-#ifndef RTLD_NOW
++#ifndef HAVE_RTLD_NOW
+ #define RTLD_NOW 0
+ #endif /* RTLD_NOW */
+ /* some systems (OSF1 V5.0) have broken RTLD_GLOBAL linkage */
+ #ifdef G_MODULE_BROKEN_RTLD_GLOBAL
+ #undef RTLD_GLOBAL
++#undef HAVE_RTLD_GLOBAL
+ #endif /* G_MODULE_BROKEN_RTLD_GLOBAL */
+-#ifndef RTLD_GLOBAL
++#ifndef HAVE_RTLD_GLOBAL
+ #define RTLD_GLOBAL 0
+ #endif /* RTLD_GLOBAL */
+
+--
+2.11.0
+
diff --git a/recipes/glib/0018-Don-t-use-RTLD_DEFAULT-on-Android-for-g_module_self.patch b/recipes/glib/0018-Don-t-use-RTLD_DEFAULT-on-Android-for-g_module_self.patch
new file mode 100644
index 00000000..c87d063d
--- /dev/null
+++ b/recipes/glib/0018-Don-t-use-RTLD_DEFAULT-on-Android-for-g_module_self.patch
@@ -0,0 +1,36 @@
+From 0c00d8a2641b109323fdc4c9fa20bc9668e36ef6 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= <sebastian@centricular.com>
+Date: Wed, 4 Jan 2017 22:02:47 +0200
+Subject: [PATCH 2/2] Don't use RTLD_DEFAULT on Android for g_module_self()
+
+On 64 bit Android this is #defined to 0, which is considered an invalid
+library handle in all other cases. RTLD_DEFAULT is only supposed to be
+used with dlsym() it seems, and the usage here was just an
+"optimization" before.
+
+By dlopen'ing NULL, we get the same on all Android variants and it
+actually works instead of erroring out.
+---
+ gmodule/gmodule-dl.c | 5 -----
+ 1 file changed, 5 deletions(-)
+
+diff --git a/gmodule/gmodule-dl.c b/gmodule/gmodule-dl.c
+index e452e34..68e8e3d 100644
+--- a/gmodule/gmodule-dl.c
++++ b/gmodule/gmodule-dl.c
+@@ -111,12 +111,7 @@ _g_module_self (void)
+ /* to query symbols from the program itself, special link options
+ * are required on some systems.
+ */
+-
+-#ifdef __BIONIC__
+- handle = RTLD_DEFAULT;
+-#else
+ handle = dlopen (NULL, RTLD_GLOBAL | RTLD_LAZY);
+-#endif
+ if (!handle)
+ g_module_set_error (fetch_dlerror (TRUE));
+
+--
+2.11.0
+