Browse Source

_xpcom: export all of mozglue due to more symbols going missing

Also move where the reloading happens to before doing anything with libxul,
since the new issue (WebCore::Decimal::Decimal(int)) is in a static constructor
Mook 11 years ago
parent
commit
2a82001e50
2 changed files with 33 additions and 28 deletions
  1. 3 1
      xpcom/src/module/Makefile.in
  2. 30 27
      xpcom/src/module/_xpcom.cpp

+ 3 - 1
xpcom/src/module/Makefile.in

@@ -88,7 +88,9 @@ else ifeq ($(OS_ARCH),WINNT)
                       $(NULL)
 else
   EXTRA_LIBS += $(XPCOM_STANDALONE_GLUE_LDOPTS) \
-                $(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib) \
+                $(MKSHLIB_FORCE_ALL) \
+                    $(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib) \
+                $(MKSHLIB_UNFORCE_ALL) \
                 $(NSPR_LIBS) \
                 $(MOZALLOC_LIB) \
                 $(NULL)

+ 30 - 27
xpcom/src/module/_xpcom.cpp

@@ -233,6 +233,36 @@ static bool EnsureXPCOM()
 		return true;
 	}
 
+	#if defined(XP_UNIX) && !defined(XP_MACOSX)
+		{
+			// On Linux only, re-open ourselves with RTLD_GLOBAL so we can export
+			// mozilla::HashBytes, so that libxul can use it.
+			// See https://bugzilla.mozilla.org/show_bug.cgi?id=763327
+			// (Python loads _xpcom.so without RTLD_GLOBAL, so the fact that we're
+			// exporting the symbol isn't enough for libxul to find it)
+			// Note that this is combined with MKSHLIB_FORCE_ALL in the makefile
+			// due to more symbols being missing this way
+			// (WebCore::Decimal::Decimal())
+			Dl_info hash_info;
+			if (!dladdr(reinterpret_cast<void*>(mozilla::HashBytes), &hash_info)) {
+				// well, we're buggered
+				PyErr_Format(PyExc_RuntimeError,
+				             "Failed to find _xpcom.so: %s", dlerror());
+				return false;
+			}
+			DUMP("Reloading %s\n", hash_info.dli_fname);
+			void *hlib_xpcom = dlopen(hash_info.dli_fname, RTLD_NOW | RTLD_GLOBAL | RTLD_NOLOAD);
+			if (!hlib_xpcom) {
+				PyErr_Format(PyExc_RuntimeError,
+				             "Failed to load %s: %s\n", hash_info.dli_fname, dlerror());
+				// Failed to reload _xpcom.so
+				return false;
+			}
+			// Python still has a handle on us, no worries about being closed
+			dlclose(hlib_xpcom);
+		}
+	#endif /* defined(XP_UNIX) && !defined(XP_MACOSX) */
+
 	nsresult rv;
 	char libNSPRPath[MAXPATHLEN] = {0};
 	if (!GetModulePath(libNSPRPath, MOZ_DLL_PREFIX "nspr4" MOZ_DLL_SUFFIX)) {
@@ -273,33 +303,6 @@ static bool EnsureXPCOM()
 
 	DUMP("Trying to init xpcom...\n");
 
-	#if defined(XP_UNIX) && !defined(XP_MACOSX)
-		{
-			// On Linux only, re-open ourselves with RTLD_GLOBAL so we can export
-			// mozilla::HashBytes, so that libxul can use it.
-			// See https://bugzilla.mozilla.org/show_bug.cgi?id=763327
-			// (Python loads _xpcom.so without RTLD_GLOBAL, so the fact that we're
-			// exporting the symbol isn't enough for libxul to find it)
-			Dl_info hash_info;
-			if (!dladdr(reinterpret_cast<void*>(mozilla::HashBytes), &hash_info)) {
-				// well, we're buggered
-				PyErr_Format(PyExc_RuntimeError,
-				             "Failed to find _xpcom.so: %s", dlerror());
-				return false;
-			}
-			DUMP("Reloading %s\n", hash_info.dli_fname);
-			void *hlib_xpcom = dlopen(hash_info.dli_fname, RTLD_NOW | RTLD_GLOBAL | RTLD_NOLOAD);
-			if (!hlib_xpcom) {
-				PyErr_Format(PyExc_RuntimeError,
-				             "Failed to load %s: %s\n", hash_info.dli_fname, dlerror());
-				// Failed to reload _xpcom.so
-				return false;
-			}
-			// Python still has a handle on us, no worries about being closed
-			dlclose(hlib_xpcom);
-		}
-	#endif /* defined(XP_UNIX) && !defined(XP_MACOSX) */
-
 	// not already initialized.
 	nsCOMPtr<nsIFile> ns_bin_dir;
 	// Chop off the libxpcom bit