summaryrefslogtreecommitdiff
path: root/recipes
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2017-02-08 16:34:29 +0200
committerSebastian Dröge <sebastian@centricular.com>2017-02-08 16:37:13 +0200
commitcefbc4e1e0f3c80a42c1afcd02d3654272fa9bbb (patch)
tree075a1e03fb46b7903571a234f18f098949fab85a /recipes
parentb9d550be16d870c03185241c688319155e49d0b5 (diff)
glib: Fixup the RTLD_DEFAULT patch to also work on all 32 bit devices
Diffstat (limited to 'recipes')
-rw-r--r--recipes/glib/0018-Check-for-RTLD_LAZY-and-others-in-configure.patch16
-rw-r--r--recipes/glib/0018-Don-t-use-RTLD_DEFAULT-on-Android-for-g_module_self.patch60
2 files changed, 56 insertions, 20 deletions
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
index bae2df62..1aa65d98 100644
--- 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
@@ -1,20 +1,26 @@
-From 3f63a6990de4c581ec374b00a000b29a605c92a7 Mon Sep 17 00:00:00 2001
+From 943cffea01804ff4e134d2cdc8a732df37961b55 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
+Subject: [PATCH 1/2] =?UTF-8?q?gmodule=20=E2=80=93=20Check=20for=20RTLD=5F?=
+ =?UTF-8?q?LAZY=20and=20others=20in=20configure?=
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
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.
+
+https://bugzilla.gnome.org/show_bug.cgi?id=776876
---
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
+index 5607a6323..17ae3b7a0 100644
--- a/configure.ac
+++ b/configure.ac
-@@ -1506,6 +1506,16 @@ dnl *** check whether we need preceeding underscores
+@@ -1492,6 +1492,16 @@ dnl *** check whether we need preceeding underscores
G_MODULE_NEED_USCORE=0
fi
@@ -32,7 +38,7 @@ index 00991c5..94d35be 100644
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
+index 20225df80..e452e3495 100644
--- a/gmodule/gmodule-dl.c
+++ b/gmodule/gmodule-dl.c
@@ -57,17 +57,18 @@
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
index c87d063d..49d55088 100644
--- 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
@@ -1,36 +1,66 @@
-From 0c00d8a2641b109323fdc4c9fa20bc9668e36ef6 Mon Sep 17 00:00:00 2001
+From 5b71ac916735c709edc9d5ea77d78721ddfad6f3 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()
+Date: Wed, 8 Feb 2017 16:27:34 +0200
+Subject: [PATCH 2/2] =?UTF-8?q?gmodule=20=E2=80=93=20Don't=20use=20RTLD=5F?=
+ =?UTF-8?q?DEFAULT=20on=20Android=20for=20g=5Fmodule=5Fself()=20on=20Andro?=
+ =?UTF-8?q?id=2064=20bit?=
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
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.
+By dlopen'ing NULL, we get the same on all 64 bit Android variants and it
+actually works instead of erroring out. On 32 bit Android, dlopen() of
+NULL unfortunately usually gives us something useless that finds no
+symbols whatsoever.
+
+https://bugzilla.gnome.org/show_bug.cgi?id=776876
---
- gmodule/gmodule-dl.c | 5 -----
- 1 file changed, 5 deletions(-)
+ gmodule/gmodule-dl.c | 18 +++++++++++++++---
+ 1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/gmodule/gmodule-dl.c b/gmodule/gmodule-dl.c
-index e452e34..68e8e3d 100644
+index e452e3495..80ef80ceb 100644
--- a/gmodule/gmodule-dl.c
+++ b/gmodule/gmodule-dl.c
-@@ -111,12 +111,7 @@ _g_module_self (void)
+@@ -111,8 +111,14 @@ _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
++
++ /* 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 RTLD_DEFAULT
++ * is NULL, which is considered an invalid module.
++ */
++#if defined(__BIONIC__) && !defined(__LP64__)
+ handle = RTLD_DEFAULT;
+ #else
handle = dlopen (NULL, RTLD_GLOBAL | RTLD_LAZY);
--#endif
- if (!handle)
- g_module_set_error (fetch_dlerror (TRUE));
-
+@@ -129,9 +135,15 @@ _g_module_close (gpointer handle,
+ {
+ /* are there any systems out there that have dlopen()/dlclose()
+ * without a reference count implementation?
++ *
++ * See above for the Android special case
+ */
++#if defined(__BIONIC__) && !defined(__LP64__)
++ is_unref = (handle != RTLD_DEFAULT);
++#else
+ is_unref |= 1;
+-
++#endif
++
+ if (is_unref)
+ {
+ if (dlclose (handle) != 0)
--
2.11.0