Bug 1441454 - Dynamically load library with global linkage so that we can access symbols within them, r=jorendorff
authorSteve Fink <sfink@mozilla.com>
Thu, 01 Mar 2018 12:40:47 -0800
changeset 461454 4c72627cfc6c2dafb4590637fe1f3b5a24e133a4
parent 461453 eb4f0b54214919a81d43a2b3255f4d5be93734e7
child 461455 99809c2e06ae8aa4cc8fa8109c1c94ec61f6cd4b
push id1683
push usersfraser@mozilla.com
push dateThu, 26 Apr 2018 16:43:40 +0000
treeherdermozilla-release@5af6cb21869d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff
bugs1441454
milestone60.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 1441454 - Dynamically load library with global linkage so that we can access symbols within them, r=jorendorff
js/src/shell/js.cpp
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -8885,17 +8885,20 @@ class AutoLibraryLoader {
 
     ~AutoLibraryLoader() {
         for (auto dll : libraries) {
             PR_UnloadLibrary(dll);
         }
     }
 
     PRLibrary* load(const char* path) {
-        PRLibrary* dll = PR_LoadLibrary(path);
+        PRLibSpec libSpec;
+        libSpec.type = PR_LibSpec_Pathname;
+        libSpec.value.pathname = path;
+        PRLibrary* dll = PR_LoadLibraryWithFlags(libSpec, PR_LD_NOW | PR_LD_GLOBAL);
         if (!dll) {
 #ifdef JS_POSIX_NSPR
             fprintf(stderr, "LoadLibrary '%s' failed: %s\n", path, dlerror());
 #else
             fprintf(stderr, "LoadLibrary '%s' failed with code %d\n", path, PR_GetError());
 #endif
             MOZ_CRASH("Failed to load library");
         }