Bug 734832 - Forcibly export a __dso_handle symbol from libmozglue.so on android. r=blassey
authorMike Hommey <mh+mozilla@glandium.org>
Tue, 13 Mar 2012 09:49:18 +0100
changeset 88938 35fb1400f0f7ab7fffaaf7836f6f38639aaa872d
parent 88937 28920721ac6d41674158819e029bcbb8e4395f04
child 88939 d932f160f91c374e97ef1773e32d8be1f6b82fb7
push id22233
push usermak77@bonardo.net
push dateTue, 13 Mar 2012 13:50:06 +0000
treeherdermozilla-central@d87ad51531b5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersblassey
bugs734832
milestone13.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 734832 - Forcibly export a __dso_handle symbol from libmozglue.so on android. r=blassey
mozglue/android/APKOpen.cpp
--- a/mozglue/android/APKOpen.cpp
+++ b/mozglue/android/APKOpen.cpp
@@ -72,16 +72,32 @@
 #endif
 #include "application.ini.h"
 
 /* Android headers don't define RUSAGE_THREAD */
 #ifndef RUSAGE_THREAD
 #define RUSAGE_THREAD 1
 #endif
 
+extern "C" {
+/*
+ * To work around http://code.google.com/p/android/issues/detail?id=23203
+ * we don't link with the crt objects. In some configurations, this means
+ * a lack of the __dso_handle symbol because it is defined there, and
+ * depending on the android platform and ndk versions used, it may or may
+ * not be defined in libc.so. In the latter case, we fail to link. Defining
+ * it here as weak makes us provide the symbol when it's not provided by
+ * the crt objects, making the change transparent for future NDKs that
+ * would fix the original problem. On older NDKs, it is not a problem
+ * either because the way __dso_handle was used was already broken (and
+ * the custom linker works around it).
+ */
+  NS_EXPORT __attribute__((weak)) void *__dso_handle;
+}
+
 typedef int mozglueresult;
 
 enum StartupEvent {
 #define mozilla_StartupTimeline_Event(ev, z) ev,
 #include "StartupTimeline.h"
 #undef mozilla_StartupTimeline_Event
 };