summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2016-06-06 16:47:18 +0300
committerSebastian Dröge <sebastian@centricular.com>2016-06-07 10:03:45 +0300
commit577f883fab66a0af27ffe2dc24d2bc6a1b2f9806 (patch)
tree14ea19e287e48cbda4bcf7bf652df1c9cf2686b0
parent2a7a4498f6240392a096f9e13cc0805fbf35e062 (diff)
android: Work around NDK ABI incompatibility around bsd_signal/signal in a different way
Get the correct symbol via dlsym() instead of letting the linker figure it out. Letting the linker do it can bring us into infinite recursion calling into our very own weak symbol. https://bugzilla.gnome.org/show_bug.cgi?id=766235
-rw-r--r--config/cross-android.cbc1
-rw-r--r--data/ndk-build/gstreamer_android-1.0.c.in30
2 files changed, 30 insertions, 1 deletions
diff --git a/config/cross-android.cbc b/config/cross-android.cbc
index 4d72bbfd..d4a8f45d 100644
--- a/config/cross-android.cbc
+++ b/config/cross-android.cbc
@@ -7,3 +7,4 @@ target_distro_version = DistroVersion.ANDROID_GINGERBREAD
target_arch = Architecture.ARM
#variants = ['nodebug']
+allow_parallel_build = True
diff --git a/data/ndk-build/gstreamer_android-1.0.c.in b/data/ndk-build/gstreamer_android-1.0.c.in
index 54ede21d..da3851ee 100644
--- a/data/ndk-build/gstreamer_android-1.0.c.in
+++ b/data/ndk-build/gstreamer_android-1.0.c.in
@@ -8,10 +8,38 @@
* symbol but only signal().
* See https://bugzilla.gnome.org/show_bug.cgi?id=766235
*/
+static gpointer
+load_real_signal (gpointer data)
+{
+ GModule *module;
+ gpointer ret = NULL;
+
+ module = g_module_open ("libc.so", G_MODULE_BIND_LOCAL);
+ g_module_symbol (module, "signal", &ret);
+
+ /* As fallback, let's try bsd_signal */
+ if (ret == NULL) {
+ g_warning ("Can't find signal(3) in libc.so!");
+ g_module_symbol (module, "bsd_signal", &ret);
+ }
+
+ g_module_close (module);
+
+ return ret;
+}
+
__sighandler_t bsd_signal(int signum, __sighandler_t handler) __attribute__((weak));
__sighandler_t bsd_signal(int signum, __sighandler_t handler)
{
- return signal(signum, handler);
+ static GOnce gonce = G_ONCE_INIT;
+ __sighandler_t (*real_signal) (int signum, __sighandler_t handler);
+
+ g_once (&gonce, load_real_signal, NULL);
+
+ real_signal = gonce.retval;
+ g_assert (real_signal != NULL);
+
+ return real_signal(signum, handler);
}
static jobject _context = NULL;