Bug 852950 - Kill libxpcom. r=bsmedberg
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 20 Mar 2013 14:56:41 +0100
changeset 136760 20454bf62bb17e3ba15349e9830606b8df5e10de
parent 136759 2ab72bbb04db0dfbd0d313e10cf6a00dfe4f2e9f
child 136761 1bdcec714f374a6338e0ae9ca1ed72a135ac1fe6
push id2452
push userlsblakk@mozilla.com
push dateMon, 13 May 2013 16:59:38 +0000
treeherdermozilla-beta@d4b152d29d8d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg
bugs852950
milestone22.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 852950 - Kill libxpcom. r=bsmedberg Also refactored the xpcom standalone glue to reside in a single file and removed its use of realpath().
b2g/installer/package-manifest.in
b2g/installer/removed-files.in
browser/installer/package-manifest.in
browser/installer/removed-files.in
configure.in
mobile/android/installer/package-manifest.in
mozglue/android/APKOpen.cpp
toolkit/library/Makefile.in
toolkit/library/dependentlibs.py
toolkit/toolkit.mozbuild
xpcom/build/FrozenFunctions.cpp
xpcom/build/Makefile.in
xpcom/build/nsXPCOM.h
xpcom/build/nsXPCOMPrivate.h
xpcom/glue/nsCycleCollectorUtils.h
xpcom/glue/nsThreadUtils.h
xpcom/glue/standalone/Makefile.in
xpcom/glue/standalone/nsGlueLinking.h
xpcom/glue/standalone/nsGlueLinkingDlopen.cpp
xpcom/glue/standalone/nsGlueLinkingNull.cpp
xpcom/glue/standalone/nsGlueLinkingOS2.cpp
xpcom/glue/standalone/nsGlueLinkingOSX.cpp
xpcom/glue/standalone/nsGlueLinkingWin.cpp
xpcom/glue/standalone/nsXPCOMGlue.cpp
xpcom/glue/standalone/staticruntime/Makefile.in
xpcom/reflect/xptcall/public/xptcall.h
xpcom/reflect/xptcall/src/md/unix/xptcinvoke_alpha_openbsd.cpp
xpcom/reflect/xptcall/src/md/unix/xptcinvoke_amd64_openbsd.cpp
xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ipf32.s
xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ipf64.s
xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_mips.s
xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_mips64.s
xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_parisc_linux.s
xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc64_linux.s
xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_aix.s
xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_aix64.s
xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_ibmobj_aix.s
xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_linux.s
xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_openbsd.s
xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_rhapsody.s
xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc64_openbsd.s
xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc_linux_GCC3.s
xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc_solaris_GCC3.s
xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc_solaris_SUNW.s
xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparcv9_solaris_SUNW.s
xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_x86_solaris_SUNW.s
xpcom/reflect/xptcall/src/md/unix/xptcinvoke_gcc_x86_unix.cpp
xpcom/reflect/xptcall/src/md/unix/xptcinvoke_linux_alpha.cpp
xpcom/reflect/xptcall/src/md/unix/xptcinvoke_linux_m68k.cpp
xpcom/reflect/xptcall/src/md/unix/xptcinvoke_mips.cpp
xpcom/reflect/xptcall/src/md/unix/xptcinvoke_mips64.cpp
xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc64_linux.cpp
xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_linux.cpp
xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_openbsd.cpp
xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_rhapsody.cpp
xpcom/reflect/xptcall/src/md/unix/xptcinvoke_x86_64_solaris.cpp
xpcom/reflect/xptcall/src/md/unix/xptcinvoke_x86_64_unix.cpp
xpcom/reflect/xptcall/src/md/win32/xptcinvoke.cpp
xpcom/reflect/xptcall/src/md/win32/xptcinvoke_x86_64.cpp
xpcom/reflect/xptcall/src/md/win32/xptcinvoke_x86_gnu.cpp
xpcom/string/public/nsXPCOMStrings.h
xpcom/stub/Makefile.in
xpcom/stub/dependentlibs.py
xpcom/stub/moz.build
xpcom/stub/nsXPComStub.cpp
--- a/b2g/installer/package-manifest.in
+++ b/b2g/installer/package-manifest.in
@@ -49,17 +49,16 @@
 #ifndef MOZ_STATIC_JS
 @BINPATH@/@DLL_PREFIX@mozjs@DLL_SUFFIX@
 #endif
 #ifndef MOZ_FOLD_LIBS
 @BINPATH@/@DLL_PREFIX@plc4@DLL_SUFFIX@
 @BINPATH@/@DLL_PREFIX@plds4@DLL_SUFFIX@
 @BINPATH@/@DLL_PREFIX@nspr4@DLL_SUFFIX@
 #endif
-@BINPATH@/@DLL_PREFIX@xpcom@DLL_SUFFIX@
 @BINPATH@/@DLL_PREFIX@mozalloc@DLL_SUFFIX@
 #ifdef MOZ_DMD
 @BINPATH@/@DLL_PREFIX@dmd@DLL_SUFFIX@
 #endif
 #ifdef XP_MACOSX
 @BINPATH@/XUL
 #else
 @BINPATH@/@DLL_PREFIX@xul@DLL_SUFFIX@
--- a/b2g/installer/removed-files.in
+++ b/b2g/installer/removed-files.in
@@ -15,8 +15,9 @@ components/dom_sms.xpt
 @DLL_PREFIX@nspr4@DLL_SUFFIX@
 @DLL_PREFIX@plds4@DLL_SUFFIX@
 @DLL_PREFIX@plc4@DLL_SUFFIX@
 @DLL_PREFIX@ssl3@DLL_SUFFIX@
 @DLL_PREFIX@smime3@DLL_SUFFIX@
 @DLL_PREFIX@nssutil3@DLL_SUFFIX@
 @DLL_PREFIX@mozsqlite3@DLL_SUFFIX@
 #endif
+@DLL_PREFIX@xpcom@DLL_SUFFIX@
--- a/browser/installer/package-manifest.in
+++ b/browser/installer/package-manifest.in
@@ -64,17 +64,16 @@
 #endif
 #ifndef MOZ_NATIVE_NSPR
 #ifndef MOZ_FOLD_LIBS
 @BINPATH@/@DLL_PREFIX@nspr4@DLL_SUFFIX@
 @BINPATH@/@DLL_PREFIX@plc4@DLL_SUFFIX@
 @BINPATH@/@DLL_PREFIX@plds4@DLL_SUFFIX@
 #endif
 #endif
-@BINPATH@/@DLL_PREFIX@xpcom@DLL_SUFFIX@
 #ifdef XP_MACOSX
 @BINPATH@/XUL
 #else
 @BINPATH@/@DLL_PREFIX@xul@DLL_SUFFIX@
 #endif
 #ifdef XP_MACOSX
 @BINPATH@/@MOZ_CHILD_PROCESS_NAME@.app/
 @BINPATH@/@DLL_PREFIX@plugin_child_interpose@DLL_SUFFIX@
--- a/browser/installer/removed-files.in
+++ b/browser/installer/removed-files.in
@@ -21,16 +21,17 @@
 @DLL_PREFIX@nspr4@DLL_SUFFIX@
 @DLL_PREFIX@plds4@DLL_SUFFIX@
 @DLL_PREFIX@plc4@DLL_SUFFIX@
 @DLL_PREFIX@ssl3@DLL_SUFFIX@
 @DLL_PREFIX@smime3@DLL_SUFFIX@
 @DLL_PREFIX@nssutil3@DLL_SUFFIX@
 @DLL_PREFIX@mozsqlite3@DLL_SUFFIX@
 #endif
+@DLL_PREFIX@xpcom@DLL_SUFFIX@
 LICENSE
 browserconfig.properties
 chrome/US.jar
 chrome/app-chrome.manifest
 chrome/browser.manifest
 chrome/chrome.rdf
 chrome/chromelist.txt
 chrome/classic.jar
--- a/configure.in
+++ b/configure.in
@@ -1014,20 +1014,20 @@ MOZ_JPEG_CFLAGS=
 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/media/libjpeg)'
 MOZ_BZ2_CFLAGS=
 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
 MOZ_PNG_CFLAGS=
 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/media/libpng)'
 
 MOZ_JS_STATIC_LIBS='$(call EXPAND_LIBNAME_PATH,js_static,$(LIBXUL_DIST)/lib)'
 MOZ_JS_SHARED_LIBS='$(call EXPAND_LIBNAME_PATH,mozjs,$(LIBXUL_DIST)/lib)'
-DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core -lmozalloc'
+DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxul -lxpcom_core -lmozalloc'
 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
-XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom -lmozalloc'
-LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
+XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxul -lmozalloc'
+LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS)'
 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
 
 # These are specially defined on Windows only
 case "$target" in
 *-mingw*)
   XPCOM_STATICRUNTIME_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_staticruntime_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
   XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_staticruntime.$(LIB_SUFFIX)'
@@ -2111,18 +2111,18 @@ ia64*-hpux*)
         RC='$(WINDRES)'
         # Use static libgcc and libstdc++
         LDFLAGS="$LDFLAGS -static-libgcc -static-libstdc++"
         # Use temp file for windres (bug 213281)
         RCFLAGS='-O coff --use-temp-file'
         # mingw doesn't require kernel32, user32, and advapi32 explicitly
         LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32 -lnetapi32"
         MOZ_FIX_LINK_PATHS=
-        DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core -lmozalloc'
-        XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom -lmozalloc'
+        DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxul -lxpcom_core -lmozalloc'
+        XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxul -lmozalloc'
         DLL_PREFIX=
         IMPORT_LIB_SUFFIX=dll.a
 
         # We use mix of both POSIX and Win32 printf format across the tree, so format
         # warnings are useless on mingw.
         MOZ_C_SUPPORTS_WARNING(-Wno-, format, ac_c_has_wno_format)
         MOZ_CXX_SUPPORTS_WARNING(-Wno-, format, ac_cxx_has_wno_format)
     else
@@ -2177,19 +2177,19 @@ ia64*-hpux*)
         CFLAGS="$CFLAGS -we4553"
         CXXFLAGS="$CXXFLAGS -we4553"
         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib netapi32.lib"
         MOZ_DEBUG_FLAGS='-Zi'
         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
         WARNINGS_AS_ERRORS='-WX'
         MOZ_OPTIMIZE_FLAGS='-O1'
         MOZ_FIX_LINK_PATHS=
-        DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
-        XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
-        LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
+        DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
+        XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
+        LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
         LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
         dnl For profile-guided optimization
         PROFILE_GEN_CFLAGS="-GL"
         PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
         dnl XXX: PGO builds can fail with warnings treated as errors,
         dnl specifically "no profile data available" appears to be
         dnl treated as an error sometimes. This might be a consequence
@@ -2355,18 +2355,18 @@ ia64*-hpux*)
     BIN_FLAGS='-Zlinker /ST:0x100000'
     IMPLIB='emximp -o'
     FILTER='true'
     LDFLAGS='-Zmap'
     WARNINGS_AS_ERRORS='-Werror'
     MOZ_DEBUG_FLAGS="-g -fno-inline"
     MOZ_OPTIMIZE_FLAGS="-O2"
     MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
-    DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
-    LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
+    DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
+    LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
     TARGET_MD_ARCH=os2
     _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
     RC=rc.exe
     MC=mc.exe
     RCFLAGS='-n'
     MOZ_USER_DIR="Mozilla"
     ZIP="$ZIP -X"
     STRIP=lxlite
@@ -4591,32 +4591,34 @@ cairo-os2)
 cairo-cocoa)
     MOZ_WIDGET_TOOLKIT=cocoa
     AC_DEFINE(MOZ_WIDGET_COCOA)
     LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
     TK_LIBS='-framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook -framework OpenGL'
     TK_CFLAGS="-DNO_X11"
     CFLAGS="$CFLAGS $TK_CFLAGS"
     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
-    LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
+    DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/bin/XUL -lxpcom_core -lmozalloc'
+    XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/bin/XUL -lmozalloc'
     MOZ_USER_DIR="Mozilla"
     MOZ_FS_LAYOUT=bundle
     MOZ_WEBGL=1
     MOZ_INSTRUMENT_EVENT_LOOP=1
     ;;
 
 cairo-uikit)
     MOZ_WIDGET_TOOLKIT=uikit
     AC_DEFINE(MOZ_WIDGET_UIKIT)
     LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
     TK_CFLAGS="-DNO_X11"
     TK_LIBS='-framework Foundation -framework CoreFoundation -framework CoreGraphics -framework CoreText'
     CFLAGS="$CFLAGS $TK_CFLAGS"
     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
-    LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
+    DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/bin/XUL -lxpcom_core -lmozalloc'
+    XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/bin/XUL -lmozalloc'
     MOZ_USER_DIR="Mozilla"
     MOZ_FS_LAYOUT=bundle
     ;;
 
 cairo-android)
     AC_DEFINE(MOZ_WIDGET_ANDROID)
     MOZ_WIDGET_TOOLKIT=android
     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
--- a/mobile/android/installer/package-manifest.in
+++ b/mobile/android/installer/package-manifest.in
@@ -35,17 +35,16 @@
 #ifndef MOZ_STATIC_JS
 @BINPATH@/@DLL_PREFIX@mozjs@DLL_SUFFIX@
 #endif
 #ifndef MOZ_FOLD_LIBS
 @BINPATH@/@DLL_PREFIX@plc4@DLL_SUFFIX@
 @BINPATH@/@DLL_PREFIX@plds4@DLL_SUFFIX@
 @BINPATH@/@DLL_PREFIX@nspr4@DLL_SUFFIX@
 #endif
-@BINPATH@/@DLL_PREFIX@xpcom@DLL_SUFFIX@
 @BINPATH@/@DLL_PREFIX@mozalloc@DLL_SUFFIX@
 @BINPATH@/@DLL_PREFIX@mozglue@DLL_SUFFIX@
 @BINPATH@/@DLL_PREFIX@omxplugin@DLL_SUFFIX@
 @BINPATH@/@DLL_PREFIX@omxplugingb@DLL_SUFFIX@
 @BINPATH@/@DLL_PREFIX@omxplugingb235@DLL_SUFFIX@
 @BINPATH@/@DLL_PREFIX@omxpluginhc@DLL_SUFFIX@
 @BINPATH@/@DLL_PREFIX@omxpluginjb-htc@DLL_SUFFIX@
 @BINPATH@/@DLL_PREFIX@omxpluginsony@DLL_SUFFIX@
--- a/mozglue/android/APKOpen.cpp
+++ b/mozglue/android/APKOpen.cpp
@@ -219,21 +219,19 @@ loadGeckoLibs(const char *apkName)
   getrusage(RUSAGE_THREAD, &usage1);
   
   RefPtr<Zip> zip = ZipCollection::GetZip(apkName);
 
 #ifdef MOZ_CRASHREPORTER
   file_ids = (char *)extractBuf("lib.id", zip);
 #endif
 
-  char *file = new char[strlen(apkName) + sizeof("!/libxpcom.so")];
-  sprintf(file, "%s!/libxpcom.so", apkName);
-  __wrap_dlopen(file, RTLD_GLOBAL | RTLD_LAZY);
-  // libxul.so is pulled from libxpcom.so, so we don't need to give the full path
-  xul_handle = __wrap_dlopen("libxul.so", RTLD_GLOBAL | RTLD_LAZY);
+  char *file = new char[strlen(apkName) + sizeof("!/libxul.so")];
+  sprintf(file, "%s!/libxul.so", apkName);
+  xul_handle = __wrap_dlopen(file, RTLD_GLOBAL | RTLD_LAZY);
   delete[] file;
 
 #ifdef MOZ_CRASHREPORTER
   free(file_ids);
   file_ids = NULL;
 #endif
 
   if (!xul_handle) {
--- a/toolkit/library/Makefile.in
+++ b/toolkit/library/Makefile.in
@@ -684,8 +684,13 @@ ifdef ENABLE_TESTS
 DEFINES += -DENABLE_LAYOUTDEBUG
 endif
 endif
 
 ifeq (WINNT_1,$(OS_TARGET)_$(MOZ_PROFILE_USE))
 # Wrap linker to measure peak virtual memory usage.
 LD := $(PYTHON) $(topsrcdir)/build/link.py $(CURDIR)/linker-vsize $(LD)
 endif
+
+libs:: $(FINAL_TARGET)/dependentlibs.list
+
+$(FINAL_TARGET)/dependentlibs.list: dependentlibs.py $(SHARED_LIBRARY) $(wildcard $(if $(wildcard $(FINAL_TARGET)/dependentlibs.list),$(addprefix $(FINAL_TARGET)/,$(shell cat $(FINAL_TARGET)/dependentlibs.list))))
+	$(PYTHON) $< $(SHARED_LIBRARY) -L $(FINAL_TARGET) $(if $(TOOLCHAIN_PREFIX),$(addprefix -p ,$(TOOLCHAIN_PREFIX))) > $@
rename from xpcom/stub/dependentlibs.py
rename to toolkit/library/dependentlibs.py
--- a/xpcom/stub/dependentlibs.py
+++ b/toolkit/library/dependentlibs.py
@@ -1,14 +1,14 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 '''Given a library, dependentlibs.py prints the list of libraries it depends
-upon that are in the same directory.
+upon that are in the same directory, followed by the library itself.
 '''
 
 from optparse import OptionParser
 import os
 import re
 import fnmatch
 import subprocess
 import sys
@@ -87,17 +87,17 @@ def dependentlibs_otool(lib):
             cmd = tmp[1]
         elif cmd == 'LC_LOAD_DYLIB' and tmp[0] == 'name':
             deps.append(re.sub('^@executable_path/','',tmp[1]))
     proc.wait()
     return deps
 
 def dependentlibs(lib, libpaths, func):
     '''For a given library, returns the list of recursive dependencies that can
-    be found in the given list of paths'''
+    be found in the given list of paths, followed by the library itself.'''
     assert(libpaths)
     assert(isinstance(libpaths, list))
     deps = []
     for dep in func(lib):
         if dep in deps or os.path.isabs(dep):
             continue
         for dir in libpaths:
             deppath = os.path.join(dir, dep)
@@ -124,12 +124,12 @@ def main():
         func = dependentlibs_otool
     else:
         ext = os.path.splitext(lib)[1]
         assert(ext == '.dll')
         func = dependentlibs_dumpbin
     if not options.libpaths:
         options.libpaths = [os.path.dirname(lib)]
 
-    print '\n'.join(dependentlibs(lib, options.libpaths, func))
+    print '\n'.join(dependentlibs(lib, options.libpaths, func) + [lib])
 
 if __name__ == '__main__':
     main()
--- a/toolkit/toolkit.mozbuild
+++ b/toolkit/toolkit.mozbuild
@@ -202,17 +202,16 @@ if CONFIG['MOZ_GIO_COMPONENT']:
     add_tier_dir('platform', 'extensions/gio')
 
 # Applications can cheat and ask for code to be
 # built before libxul so it can be linked into libxul.
 add_tier_dir('platform', app_libxul_dirs)
 add_tier_dir('platform', app_libxul_static_dirs, static=True)
 
 add_tier_dir('platform', 'toolkit/library')
-add_tier_dir('platform', 'xpcom/stub')
 
 if CONFIG['MOZ_REPLACE_MALLOC']:
     add_tier_dir('platform', 'memory/replace')
 
 if CONFIG['NS_TRACE_MALLOC']:
     add_tier_dir('platform', 'tools/trace-malloc')
 
 if CONFIG['MOZ_ENABLE_GNOME_COMPONENT']:
rename from xpcom/stub/nsXPComStub.cpp
rename to xpcom/build/FrozenFunctions.cpp
--- a/xpcom/stub/nsXPComStub.cpp
+++ b/xpcom/build/FrozenFunctions.cpp
@@ -21,82 +21,82 @@ XPCOM_API(nsresult)
 NS_RegisterXPCOMExitRoutine(XPCOMExitRoutine exitRoutine, uint32_t priority);
 
 XPCOM_API(nsresult)
 NS_UnregisterXPCOMExitRoutine(XPCOMExitRoutine exitRoutine);
 
 static const XPCOMFunctions kFrozenFunctions = {
     XPCOM_GLUE_VERSION,
     sizeof(XPCOMFunctions),
-    &NS_InitXPCOM2_P,
-    &NS_ShutdownXPCOM_P,
-    &NS_GetServiceManager_P,
-    &NS_GetComponentManager_P,
-    &NS_GetComponentRegistrar_P,
-    &NS_GetMemoryManager_P,
-    &NS_NewLocalFile_P,
-    &NS_NewNativeLocalFile_P,
+    &NS_InitXPCOM2,
+    &NS_ShutdownXPCOM,
+    &NS_GetServiceManager,
+    &NS_GetComponentManager,
+    &NS_GetComponentRegistrar,
+    &NS_GetMemoryManager,
+    &NS_NewLocalFile,
+    &NS_NewNativeLocalFile,
     &NS_RegisterXPCOMExitRoutine,
     &NS_UnregisterXPCOMExitRoutine,
 
     // these functions were added post 1.4
-    &NS_GetDebug_P,
-    &NS_GetTraceRefcnt_P,
+    &NS_GetDebug,
+    &NS_GetTraceRefcnt,
 
     // these functions were added post 1.6
-    &NS_StringContainerInit_P,
-    &NS_StringContainerFinish_P,
-    &NS_StringGetData_P,
-    &NS_StringSetData_P,
-    &NS_StringSetDataRange_P,
-    &NS_StringCopy_P,
-    &NS_CStringContainerInit_P,
-    &NS_CStringContainerFinish_P,
-    &NS_CStringGetData_P,
-    &NS_CStringSetData_P,
-    &NS_CStringSetDataRange_P,
-    &NS_CStringCopy_P,
-    &NS_CStringToUTF16_P,
-    &NS_UTF16ToCString_P,
-    &NS_StringCloneData_P,
-    &NS_CStringCloneData_P,
+    &NS_StringContainerInit,
+    &NS_StringContainerFinish,
+    &NS_StringGetData,
+    &NS_StringSetData,
+    &NS_StringSetDataRange,
+    &NS_StringCopy,
+    &NS_CStringContainerInit,
+    &NS_CStringContainerFinish,
+    &NS_CStringGetData,
+    &NS_CStringSetData,
+    &NS_CStringSetDataRange,
+    &NS_CStringCopy,
+    &NS_CStringToUTF16,
+    &NS_UTF16ToCString,
+    &NS_StringCloneData,
+    &NS_CStringCloneData,
 
     // these functions were added post 1.7 (post Firefox 1.0)
-    &NS_Alloc_P,
-    &NS_Realloc_P,
-    &NS_Free_P,
-    &NS_StringContainerInit2_P,
-    &NS_CStringContainerInit2_P,
-    &NS_StringGetMutableData_P,
-    &NS_CStringGetMutableData_P,
+    &NS_Alloc,
+    &NS_Realloc,
+    &NS_Free,
+    &NS_StringContainerInit2,
+    &NS_CStringContainerInit2,
+    &NS_StringGetMutableData,
+    &NS_CStringGetMutableData,
     NULL,
 
     // these functions were added post 1.8
-    &NS_DebugBreak_P,
-    &NS_LogInit_P,
-    &NS_LogTerm_P,
-    &NS_LogAddRef_P,
-    &NS_LogRelease_P,
-    &NS_LogCtor_P,
-    &NS_LogDtor_P,
-    &NS_LogCOMPtrAddRef_P,
-    &NS_LogCOMPtrRelease_P,
-    &NS_GetXPTCallStub_P,
-    &NS_DestroyXPTCallStub_P,
-    &NS_InvokeByIndex_P,
+    &NS_DebugBreak,
+    &NS_LogInit,
+    &NS_LogTerm,
+    &NS_LogAddRef,
+    &NS_LogRelease,
+    &NS_LogCtor,
+    &NS_LogDtor,
+    &NS_LogCOMPtrAddRef,
+    &NS_LogCOMPtrRelease,
+    &NS_GetXPTCallStub,
+    &NS_DestroyXPTCallStub,
+    &NS_InvokeByIndex,
     nullptr,
     nullptr,
-    &NS_StringSetIsVoid_P,
-    &NS_StringGetIsVoid_P,
-    &NS_CStringSetIsVoid_P,
-    &NS_CStringGetIsVoid_P,
+    &NS_StringSetIsVoid,
+    &NS_StringGetIsVoid,
+    &NS_CStringSetIsVoid,
+    &NS_CStringGetIsVoid,
 
     // these functions were added post 1.9
-    &NS_CycleCollectorSuspect2_P,
-    &NS_CycleCollectorForget2_P
+    &NS_CycleCollectorSuspect2,
+    &NS_CycleCollectorForget2
 };
 
 EXPORT_XPCOM_API(nsresult)
 NS_GetFrozenFunctions(XPCOMFunctions *functions, const char* /* libraryPath */)
 {
     if (!functions)
         return NS_ERROR_OUT_OF_MEMORY;
 
@@ -110,405 +110,22 @@ NS_GetFrozenFunctions(XPCOMFunctions *fu
     size -= offsetof(XPCOMFunctions, init);
 
     memcpy(&functions->init, &kFrozenFunctions.init, size);
 
     return NS_OK;
 }
 
 /*
- * Stubs for nsXPCOM.h
- */
-
-#undef NS_InitXPCOM2
-EXPORT_XPCOM_API(nsresult)
-NS_InitXPCOM2(nsIServiceManager **result,
-              nsIFile *binDirectory,
-              nsIDirectoryServiceProvider *dirProvider)
-{
-  return NS_InitXPCOM2_P(result, binDirectory, dirProvider);
-}
-
-#undef NS_ShutdownXPCOM
-EXPORT_XPCOM_API(nsresult)
-NS_ShutdownXPCOM(nsIServiceManager *svcMgr)
-{
-  return NS_ShutdownXPCOM_P(svcMgr);
-}
-
-#undef NS_GetServiceManager
-EXPORT_XPCOM_API(nsresult)
-NS_GetServiceManager(nsIServiceManager* *result)
-{
-  return NS_GetServiceManager_P(result);
-}
-
-#undef NS_GetComponentManager
-EXPORT_XPCOM_API(nsresult)
-NS_GetComponentManager(nsIComponentManager* *result)
-{
-  return NS_GetComponentManager_P(result);
-}
-
-#undef NS_GetComponentRegistrar
-EXPORT_XPCOM_API(nsresult)
-NS_GetComponentRegistrar(nsIComponentRegistrar** result)
-{
-  return NS_GetComponentRegistrar_P(result);
-}
-
-#undef NS_GetMemoryManager
-EXPORT_XPCOM_API(nsresult)
-NS_GetMemoryManager(nsIMemory* *result)
-{
-  return NS_GetMemoryManager_P(result);
-}
-
-#undef NS_NewLocalFile
-EXPORT_XPCOM_API(nsresult)
-NS_NewLocalFile(const nsAString &path,
-                bool followLinks,
-                nsIFile **result)
-{
-  return NS_NewLocalFile_P(path, followLinks, result);
-}
-
-#undef NS_NewNativeLocalFile
-EXPORT_XPCOM_API(nsresult)
-NS_NewNativeLocalFile(const nsACString &path,
-                      bool followLinks,
-                      nsIFile **result)
-{
-  return NS_NewNativeLocalFile_P(path, followLinks, result);
-}
-
-#undef NS_GetDebug
-EXPORT_XPCOM_API(nsresult)
-NS_GetDebug(nsIDebug **result)
-{
-  return NS_GetDebug_P(result);
-}
-
-#undef NS_GetTraceRefcnt
-EXPORT_XPCOM_API(nsresult)
-NS_GetTraceRefcnt(nsITraceRefcnt **result)
-{
-  return NS_GetTraceRefcnt_P(result);
-}
-
-#undef NS_Alloc
-EXPORT_XPCOM_API(void*)
-NS_Alloc(size_t size)
-{
-  return NS_Alloc_P(size);
-}
-
-#undef NS_Realloc
-EXPORT_XPCOM_API(void*)
-NS_Realloc(void* ptr, size_t size)
-{
-  return NS_Realloc_P(ptr, size);
-}
-
-#undef NS_Free
-EXPORT_XPCOM_API(void)
-NS_Free(void* ptr)
-{
-  NS_Free_P(ptr);
-}
-
-#undef NS_DebugBreak
-EXPORT_XPCOM_API(void)
-NS_DebugBreak(uint32_t aSeverity, const char *aStr, const char *aExpr,
-              const char *aFile, int32_t aLine)
-{
-  NS_DebugBreak_P(aSeverity, aStr, aExpr, aFile, aLine);
-}
-
-#undef NS_LogInit
-EXPORT_XPCOM_API(void)
-NS_LogInit()
-{
-  NS_LogInit_P();
-}
-
-#undef NS_LogTerm
-EXPORT_XPCOM_API(void)
-NS_LogTerm()
-{
-  NS_LogTerm_P();
-}
-
-#undef NS_LogAddRef
-EXPORT_XPCOM_API(void)
-NS_LogAddRef(void* aPtr, nsrefcnt aNewRefCnt,
-             const char *aTypeName, uint32_t aInstanceSize)
-{
-  NS_LogAddRef_P(aPtr, aNewRefCnt, aTypeName, aInstanceSize);
-}
-
-#undef NS_LogRelease
-EXPORT_XPCOM_API(void)
-NS_LogRelease(void* aPtr, nsrefcnt aNewRefCnt, const char *aTypeName)
-{
-  NS_LogRelease_P(aPtr, aNewRefCnt, aTypeName);
-}
-
-#undef NS_LogCtor
-EXPORT_XPCOM_API(void)
-NS_LogCtor(void *aPtr, const char *aTypeName, uint32_t aInstanceSize)
-{
-  NS_LogCtor_P(aPtr, aTypeName, aInstanceSize);
-}
-
-#undef NS_LogDtor
-EXPORT_XPCOM_API(void)
-NS_LogDtor(void *aPtr, const char *aTypeName, uint32_t aInstanceSize)
-{
-  NS_LogDtor_P(aPtr, aTypeName, aInstanceSize);
-}
-
-#undef NS_LogCOMPtrAddRef
-EXPORT_XPCOM_API(void)
-NS_LogCOMPtrAddRef(void *aCOMPtr, nsISupports* aObject)
-{
-  NS_LogCOMPtrAddRef_P(aCOMPtr, aObject);
-}
-
-#undef NS_LogCOMPtrRelease
-EXPORT_XPCOM_API(void)
-NS_LogCOMPtrRelease(void *aCOMPtr, nsISupports* aObject)
-{
-  NS_LogCOMPtrRelease_P(aCOMPtr, aObject);
-}
-
-#undef NS_GetXPTCallStub
-EXPORT_XPCOM_API(nsresult)
-NS_GetXPTCallStub(REFNSIID aIID, nsIXPTCProxy* aOuter,
-                  nsISomeInterface* *aStub)
-{
-  return NS_GetXPTCallStub_P(aIID, aOuter, aStub);
-}
-
-#undef NS_DestroyXPTCallStub
-EXPORT_XPCOM_API(void)
-NS_DestroyXPTCallStub(nsISomeInterface* aStub)
-{
-  NS_DestroyXPTCallStub_P(aStub);
-}
-
-#undef NS_InvokeByIndex
-EXPORT_XPCOM_API(nsresult)
-NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
-                 uint32_t paramCount, nsXPTCVariant* params)
-{
-  return NS_InvokeByIndex_P(that, methodIndex, paramCount, params);
-}
-
-/*
  * Stubs for nsXPCOMPrivate.h
  */
 
 EXPORT_XPCOM_API(nsresult)
 NS_RegisterXPCOMExitRoutine(XPCOMExitRoutine exitRoutine, uint32_t priority)
 {
   return NS_OK;
 }
 
 EXPORT_XPCOM_API(nsresult)
 NS_UnregisterXPCOMExitRoutine(XPCOMExitRoutine exitRoutine)
 {
   return NS_OK;
 }
-
-/*
- * Stubs for nsStringAPI.h
- */
-
-#undef NS_StringContainerInit
-EXPORT_XPCOM_API(nsresult)
-NS_StringContainerInit(nsStringContainer &aStr)
-{
-  return NS_StringContainerInit_P(aStr);
-}
-
-#undef NS_StringContainerInit2
-EXPORT_XPCOM_API(nsresult)
-NS_StringContainerInit2(nsStringContainer &aStr,
-                        const PRUnichar   *aData,
-                        uint32_t           aDataLength,
-                        uint32_t           aFlags)
-{   
-  return NS_StringContainerInit2_P(aStr, aData, aDataLength, aFlags);
-}
-
-#undef NS_StringContainerFinish
-EXPORT_XPCOM_API(void)
-NS_StringContainerFinish(nsStringContainer &aStr)
-{
-  NS_StringContainerFinish_P(aStr);
-}
-
-#undef NS_StringGetData
-EXPORT_XPCOM_API(uint32_t)
-NS_StringGetData(const nsAString &aStr, const PRUnichar **aBuf, bool *aTerm)
-{
-  return NS_StringGetData_P(aStr, aBuf, aTerm);
-}
-
-#undef NS_StringGetMutableData
-EXPORT_XPCOM_API(uint32_t)
-NS_StringGetMutableData(nsAString &aStr, uint32_t aLen, PRUnichar **aBuf)
-{
-  return NS_StringGetMutableData_P(aStr, aLen, aBuf);
-}
-
-#undef NS_StringCloneData
-EXPORT_XPCOM_API(PRUnichar *)
-NS_StringCloneData(const nsAString &aStr)
-{
-  return NS_StringCloneData_P(aStr);
-}
-
-#undef NS_StringSetData
-EXPORT_XPCOM_API(nsresult)
-NS_StringSetData(nsAString &aStr, const PRUnichar *aBuf, uint32_t aCount)
-{
-  return NS_StringSetData_P(aStr, aBuf, aCount);
-}
-
-#undef NS_StringSetDataRange
-EXPORT_XPCOM_API(nsresult)
-NS_StringSetDataRange(nsAString &aStr, uint32_t aCutStart, uint32_t aCutLength,
-                      const PRUnichar *aBuf, uint32_t aCount)
-{
-  return NS_StringSetDataRange_P(aStr, aCutStart, aCutLength, aBuf, aCount);
-}
-
-#undef NS_StringCopy
-EXPORT_XPCOM_API(nsresult)
-NS_StringCopy(nsAString &aDest, const nsAString &aSrc)
-{
-  return NS_StringCopy_P(aDest, aSrc);
-}
-
-#undef NS_StringSetIsVoid
-EXPORT_XPCOM_API(void)
-NS_StringSetIsVoid(nsAString &aStr, const bool aIsVoid)
-{
-  NS_StringSetIsVoid_P(aStr, aIsVoid);
-}
-
-#undef NS_StringGetIsVoid
-EXPORT_XPCOM_API(bool)
-NS_StringGetIsVoid(const nsAString &aStr)
-{
-  return NS_StringGetIsVoid_P(aStr);
-}
-
-#undef NS_CStringContainerInit
-EXPORT_XPCOM_API(nsresult)
-NS_CStringContainerInit(nsCStringContainer &aStr)
-{
-  return NS_CStringContainerInit_P(aStr);
-}
-
-#undef NS_CStringContainerInit2
-EXPORT_XPCOM_API(nsresult)
-NS_CStringContainerInit2(nsCStringContainer &aStr,
-                         const char         *aData,
-                         uint32_t            aDataLength,
-                         uint32_t            aFlags)
-{   
-  return NS_CStringContainerInit2_P(aStr, aData, aDataLength, aFlags);
-}
-
-#undef NS_CStringContainerFinish
-EXPORT_XPCOM_API(void)
-NS_CStringContainerFinish(nsCStringContainer &aStr)
-{
-  NS_CStringContainerFinish_P(aStr);
-}
-
-#undef NS_CStringGetData
-EXPORT_XPCOM_API(uint32_t)
-NS_CStringGetData(const nsACString &aStr, const char **aBuf, bool *aTerm)
-{
-  return NS_CStringGetData_P(aStr, aBuf, aTerm);
-}
-
-#undef NS_CStringGetMutableData
-EXPORT_XPCOM_API(uint32_t)
-NS_CStringGetMutableData(nsACString &aStr, uint32_t aLen, char **aBuf)
-{
-  return NS_CStringGetMutableData_P(aStr, aLen, aBuf);
-}
-
-#undef NS_CStringCloneData
-EXPORT_XPCOM_API(char *)
-NS_CStringCloneData(const nsACString &aStr)
-{
-  return NS_CStringCloneData_P(aStr);
-}
-
-#undef NS_CStringSetData
-EXPORT_XPCOM_API(nsresult)
-NS_CStringSetData(nsACString &aStr, const char *aBuf, uint32_t aCount)
-{
-  return NS_CStringSetData_P(aStr, aBuf, aCount);
-}
-
-#undef NS_CStringSetDataRange
-EXPORT_XPCOM_API(nsresult)
-NS_CStringSetDataRange(nsACString &aStr, uint32_t aCutStart, uint32_t aCutLength,
-                       const char *aBuf, uint32_t aCount)
-{
-  return NS_CStringSetDataRange_P(aStr, aCutStart, aCutLength, aBuf, aCount);
-}
-
-#undef NS_CStringCopy
-EXPORT_XPCOM_API(nsresult)
-NS_CStringCopy(nsACString &aDest, const nsACString &aSrc)
-{
-  return NS_CStringCopy_P(aDest, aSrc);
-}
-
-#undef NS_CStringSetIsVoid
-EXPORT_XPCOM_API(void)
-NS_CStringSetIsVoid(nsACString &aStr, const bool aIsVoid)
-{
-  NS_CStringSetIsVoid_P(aStr, aIsVoid);
-}
-
-#undef NS_CStringGetIsVoid
-EXPORT_XPCOM_API(bool)
-NS_CStringGetIsVoid(const nsACString &aStr)
-{
-  return NS_CStringGetIsVoid_P(aStr);
-}
-
-#undef NS_CStringToUTF16
-EXPORT_XPCOM_API(nsresult)
-NS_CStringToUTF16(const nsACString &aSrc, nsCStringEncoding aSrcEncoding, nsAString &aDest)
-{
-  return NS_CStringToUTF16_P(aSrc, aSrcEncoding, aDest);
-}
-
-#undef NS_UTF16ToCString
-EXPORT_XPCOM_API(nsresult)
-NS_UTF16ToCString(const nsAString &aSrc, nsCStringEncoding aDestEncoding, nsACString &aDest)
-{
-  return NS_UTF16ToCString_P(aSrc, aDestEncoding, aDest);
-}
-
-#undef NS_CycleCollectorSuspect2
-EXPORT_XPCOM_API(nsPurpleBufferEntry*)
-NS_CycleCollectorSuspect2(void *obj, nsCycleCollectionParticipant *p)
-{
-  return NS_CycleCollectorSuspect2_P(obj, p);
-}
-
-#undef NS_CycleCollectorForget2
-EXPORT_XPCOM_API(bool)
-NS_CycleCollectorForget2(nsPurpleBufferEntry* e)
-{
-  return NS_CycleCollectorForget2_P(e);
-}
--- a/xpcom/build/Makefile.in
+++ b/xpcom/build/Makefile.in
@@ -32,16 +32,17 @@ endif
 CPPSRCS = \
   $(XPCOM_GLUE_SRC_LCPPSRCS) \
   $(XPCOM_GLUENS_SRC_LCPPSRCS) \
   nsXPComInit.cpp \
   nsXPCOMStrings.cpp \
   Services.cpp \
   Omnijar.cpp \
   FileLocation.cpp \
+  FrozenFunctions.cpp \
   $(NULL)
 
 ifeq (Darwin, $(OS_ARCH))
 CPPSRCS += mozPoisonWriteBase.cpp mozPoisonWriteMac.cpp
 else ifeq ($(OS_ARCH),WINNT)
 CPPSRCS += mozPoisonWriteBase.cpp mozPoisonWriteWin.cpp
 else
 CPPSRCS += mozPoisonWriteStub.cpp
--- a/xpcom/build/nsXPCOM.h
+++ b/xpcom/build/nsXPCOM.h
@@ -1,44 +1,16 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef nsXPCOM_h__
 #define nsXPCOM_h__
 
-/* Map frozen functions to private symbol names if not using strict API. */
-#ifdef MOZILLA_INTERNAL_API
-# define NS_InitXPCOM2               NS_InitXPCOM2_P
-# define NS_ShutdownXPCOM            NS_ShutdownXPCOM_P
-# define NS_GetServiceManager        NS_GetServiceManager_P
-# define NS_GetComponentManager      NS_GetComponentManager_P
-# define NS_GetComponentRegistrar    NS_GetComponentRegistrar_P
-# define NS_GetMemoryManager         NS_GetMemoryManager_P
-# define NS_NewLocalFile             NS_NewLocalFile_P
-# define NS_NewNativeLocalFile       NS_NewNativeLocalFile_P
-# define NS_GetDebug                 NS_GetDebug_P
-# define NS_GetTraceRefcnt           NS_GetTraceRefcnt_P
-# define NS_Alloc                    NS_Alloc_P
-# define NS_Realloc                  NS_Realloc_P
-# define NS_Free                     NS_Free_P
-# define NS_DebugBreak               NS_DebugBreak_P
-# define NS_LogInit                  NS_LogInit_P
-# define NS_LogTerm                  NS_LogTerm_P
-# define NS_LogAddRef                NS_LogAddRef_P
-# define NS_LogRelease               NS_LogRelease_P
-# define NS_LogCtor                  NS_LogCtor_P
-# define NS_LogDtor                  NS_LogDtor_P
-# define NS_LogCOMPtrAddRef          NS_LogCOMPtrAddRef_P
-# define NS_LogCOMPtrRelease         NS_LogCOMPtrRelease_P
-# define NS_CycleCollectorSuspect2   NS_CycleCollectorSuspect2_P
-# define NS_CycleCollectorForget2    NS_CycleCollectorForget2_P
-#endif
-
 #include "nscore.h"
 #include "nsXPCOMCID.h"
 
 #ifdef __cplusplus
 #define DECL_CLASS(c) class c
 #define DECL_STRUCT(c) struct c
 #else
 #define DECL_CLASS(c) typedef struct c c
--- a/xpcom/build/nsXPCOMPrivate.h
+++ b/xpcom/build/nsXPCOMPrivate.h
@@ -212,25 +212,25 @@ void LogTerm();
  * GRE_CONF_NAME          - Name of the GRE Configuration file
  */
 
 #if defined(XP_WIN32) || defined(XP_OS2)
 
 #define XPCOM_SEARCH_KEY  "PATH"
 #define GRE_CONF_NAME     "gre.config"
 #define GRE_WIN_REG_LOC   L"Software\\mozilla.org\\GRE"
-#define XPCOM_DLL         "xpcom.dll"
-#define LXPCOM_DLL        L"xpcom.dll"
+#define XPCOM_DLL         XUL_DLL
+#define LXPCOM_DLL        LXUL_DLL
 #define XUL_DLL           "xul.dll"
 #define LXUL_DLL          L"xul.dll"
 
 #else // Unix
 #include <limits.h> // for PATH_MAX
 
-#define XPCOM_DLL "libxpcom" MOZ_DLL_SUFFIX
+#define XPCOM_DLL         XUL_DLL
 
 // you have to love apple..
 #ifdef XP_MACOSX  
 #define XPCOM_SEARCH_KEY  "DYLD_LIBRARY_PATH"
 #define GRE_FRAMEWORK_NAME "XUL.framework"
 #define XUL_DLL            "XUL"
 #else
 #define XPCOM_SEARCH_KEY  "LD_LIBRARY_PATH"
--- a/xpcom/glue/nsCycleCollectorUtils.h
+++ b/xpcom/glue/nsCycleCollectorUtils.h
@@ -4,17 +4,16 @@
 
 #ifndef nsCycleCollectorUtils_h__
 #define nsCycleCollectorUtils_h__
 
 #include "nscore.h"
 #include "mozilla/threads/nsThreadIDs.h"
 
 #if defined(MOZILLA_INTERNAL_API)
-#define NS_IsCycleCollectorThread NS_IsCycleCollectorThread_P
 #if defined(XP_WIN)
 bool NS_IsCycleCollectorThread();
 #elif defined(NS_TLS)
 // Defined in nsThreadManager.cpp.
 extern NS_TLS mozilla::threads::ID gTLSThreadID;
 inline bool NS_IsCycleCollectorThread()
 {
   return gTLSThreadID == mozilla::threads::CycleCollector;
--- a/xpcom/glue/nsThreadUtils.h
+++ b/xpcom/glue/nsThreadUtils.h
@@ -14,33 +14,16 @@
 #include "nsIRunnable.h"
 #include "nsICancelableRunnable.h"
 #include "nsStringGlue.h"
 #include "nsCOMPtr.h"
 #include "nsAutoPtr.h"
 #include "mozilla/threads/nsThreadIDs.h"
 #include "mozilla/Likely.h"
 
-// This is needed on some systems to prevent collisions between the symbols
-// appearing in xpcom_core and xpcomglue.  It may be unnecessary in the future
-// with better toolchain support.
-#ifdef MOZILLA_INTERNAL_API
-# define NS_SetThreadName NS_SetThreadName_P
-# define NS_NewThread NS_NewThread_P
-# define NS_NewNamedThread NS_NewNamedThread_P
-# define NS_GetCurrentThread NS_GetCurrentThread_P
-# define NS_GetMainThread NS_GetMainThread_P
-# define NS_IsMainThread NS_IsMainThread_P
-# define NS_DispatchToCurrentThread NS_DispatchToCurrentThread_P
-# define NS_DispatchToMainThread NS_DispatchToMainThread_P
-# define NS_ProcessPendingEvents NS_ProcessPendingEvents_P
-# define NS_HasPendingEvents NS_HasPendingEvents_P
-# define NS_ProcessNextEvent NS_ProcessNextEvent_P
-#endif
-
 //-----------------------------------------------------------------------------
 // These methods are alternatives to the methods on nsIThreadManager, provided
 // for convenience.
 
 /**
  * Set name of the target thread.  This operation is asynchronous.
  */
 extern NS_COM_GLUE void
--- a/xpcom/glue/standalone/Makefile.in
+++ b/xpcom/glue/standalone/Makefile.in
@@ -15,39 +15,16 @@ EXTRA_DEPS += $(srcdir)/../objs.mk
 
 LIBRARY_NAME	= xpcomglue
 DIST_INSTALL	= 1
 
 LOCAL_INCLUDES	= \
 	-I$(srcdir)/../../build \
 	$(NULL)
 
-ifeq (Darwin,$(OS_ARCH))
-ifeq (uikit,$(MOZ_WIDGET_TOOLKIT))
-LINKSRC = nsGlueLinkingDlopen.cpp
-else
-LINKSRC = nsGlueLinkingOSX.cpp
-endif
-endif
-
-ifeq ($(OS_ARCH),WINNT)
-LINKSRC = nsGlueLinkingWin.cpp
-endif
-ifneq (,$(filter AIX DragonFly FreeBSD GNU GNU_% Linux NetBSD OpenBSD SunOS,$(OS_ARCH)))
-LINKSRC = nsGlueLinkingDlopen.cpp
-endif
-ifeq (OS2,$(OS_ARCH))
-LINKSRC = nsGlueLinkingOS2.cpp
-endif
-
-ifndef LINKSRC
-LINKSRC = nsGlueLinkingNull.cpp
-$(warning TinderboxPrint:<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=298044">Error: XPCOM Glue</a>)
-endif
-
 CPPSRCS		= \
 	$(XPCOM_GLUE_SRC_LCPPSRCS)   \
 	nsStringAPI.cpp              \
 	nsXPCOMGlue.cpp              \
 	$(LINKSRC)                   \
 	$(NULL)
 
 SDK_HEADERS     = \
deleted file mode 100644
--- a/xpcom/glue/standalone/nsGlueLinking.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef nsGlueLinking_h__
-#define nsGlueLinking_h__
-
-#include "nsXPCOMPrivate.h"
-
-#define XPCOM_DEPENDENT_LIBS_LIST "dependentlibs.list"
-
-NS_HIDDEN_(nsresult)
-XPCOMGlueLoad(const char *xpcomFile, GetFrozenFunctionsFunc *func);
-
-NS_HIDDEN_(void)
-XPCOMGlueUnload();
-
-typedef void (*DependentLibsCallback)(const char *aDependentLib, bool do_preload);
-
-NS_HIDDEN_(void)
-XPCOMGlueLoadDependentLibs(const char *xpcomDir, DependentLibsCallback cb);
-
-#endif // nsGlueLinking_h__
deleted file mode 100644
--- a/xpcom/glue/standalone/nsGlueLinkingDlopen.cpp
+++ /dev/null
@@ -1,248 +0,0 @@
-/* -*- Mode: C++; tab-width: 6; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "nsGlueLinking.h"
-#include "nsXPCOMGlue.h"
-#include "nscore.h"
-#include "mozilla/FileUtils.h"
-
-#if defined(LINUX) && !defined(ANDROID)
-#define _GNU_SOURCE
-#include <fcntl.h>
-#include <unistd.h>
-#include <limits.h>
-#endif
-
-#include <errno.h>
-#include <dlfcn.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-
-#if defined(SUNOS4) || defined(NEXTSTEP) || \
-    (defined(OPENBSD) || defined(NETBSD)) && !defined(__ELF__)
-#define LEADING_UNDERSCORE "_"
-#else
-#define LEADING_UNDERSCORE
-#endif
-
-#if defined(MOZ_LINKER) && !defined(ANDROID)
-extern "C" {
-NS_HIDDEN __typeof(dlopen) __wrap_dlopen;
-NS_HIDDEN __typeof(dlsym) __wrap_dlsym;
-NS_HIDDEN __typeof(dlclose) __wrap_dlclose;
-}
-
-#define dlopen __wrap_dlopen
-#define dlsym __wrap_dlsym
-#define dlclose __wrap_dlclose
-#endif
-
-#ifdef NS_TRACE_MALLOC
-extern "C" {
-NS_EXPORT_(__ptr_t) __libc_malloc(size_t);
-NS_EXPORT_(__ptr_t) __libc_calloc(size_t, size_t);
-NS_EXPORT_(__ptr_t) __libc_realloc(__ptr_t, size_t);
-NS_EXPORT_(void)    __libc_free(__ptr_t);
-NS_EXPORT_(__ptr_t) __libc_memalign(size_t, size_t);
-NS_EXPORT_(__ptr_t) __libc_valloc(size_t);
-}
-
-static __ptr_t (*_malloc)(size_t) = __libc_malloc;
-static __ptr_t (*_calloc)(size_t, size_t) = __libc_calloc;
-static __ptr_t (*_realloc)(__ptr_t, size_t) = __libc_realloc;
-static void (*_free)(__ptr_t) = __libc_free;
-static __ptr_t (*_memalign)(size_t, size_t) = __libc_memalign;
-static __ptr_t (*_valloc)(size_t) = __libc_valloc;
-
-NS_EXPORT_(__ptr_t) malloc(size_t size)
-{
-    return _malloc(size);
-}
-
-NS_EXPORT_(__ptr_t) calloc(size_t nmemb, size_t size)
-{
-    return _calloc(nmemb, size);
-}
-
-NS_EXPORT_(__ptr_t) realloc(__ptr_t ptr, size_t size)
-{
-    return _realloc(ptr, size);
-}
-
-NS_EXPORT_(void) free(__ptr_t ptr)
-{
-    _free(ptr);
-}
-
-NS_EXPORT_(void) cfree(__ptr_t ptr)
-{
-    _free(ptr);
-}
-
-NS_EXPORT_(__ptr_t) memalign(size_t boundary, size_t size)
-{
-    return _memalign(boundary, size);
-}
-
-NS_EXPORT_(int)
-posix_memalign(void **memptr, size_t alignment, size_t size)
-{
-    __ptr_t ptr = _memalign(alignment, size);
-    if (!ptr)
-        return ENOMEM;
-    *memptr = ptr;
-    return 0;
-}
-
-NS_EXPORT_(__ptr_t) valloc(size_t size)
-{
-    return _valloc(size);
-}
-#endif /* NS_TRACE_MALLOC */
-
-struct DependentLib
-{
-    void         *libHandle;
-    DependentLib *next;
-};
-
-static DependentLib *sTop;
-static void* sXULLibHandle;
-
-static void
-AppendDependentLib(void *libHandle)
-{
-    DependentLib *d = new DependentLib;
-    if (!d)
-        return;
-
-    d->next = sTop;
-    d->libHandle = libHandle;
-
-    sTop = d;
-}
-
-static void
-ReadDependentCB(const char *aDependentLib, bool do_preload)
-{
-#if defined(LINUX) && !defined(ANDROID)
-    if (do_preload)
-        mozilla::ReadAheadLib(aDependentLib);
-#endif
-    void *libHandle = dlopen(aDependentLib, RTLD_GLOBAL | RTLD_LAZY);
-    if (!libHandle)
-        return;
-
-    AppendDependentLib(libHandle);
-}
-
-nsresult
-XPCOMGlueLoad(const char *xpcomFile, GetFrozenFunctionsFunc *func)
-{
-    char xpcomDir[MAXPATHLEN];
-    if (realpath(xpcomFile, xpcomDir)) {
-        char *lastSlash = strrchr(xpcomDir, '/');
-        if (lastSlash) {
-            *lastSlash = '\0';
-
-            XPCOMGlueLoadDependentLibs(xpcomDir, ReadDependentCB);
-
-#ifdef __GLIBC__
-            // XUL_DLL is already loaded by XPCOMGlueLoadDependentLibs, so
-            // dlopening without the full path will return that one.
-            sXULLibHandle = dlopen(XUL_DLL, RTLD_GLOBAL | RTLD_LAZY);
-#else
-            snprintf(lastSlash, MAXPATHLEN - strlen(xpcomDir), "/" XUL_DLL);
-
-            sXULLibHandle = dlopen(xpcomDir, RTLD_GLOBAL | RTLD_LAZY);
-#endif
-
-#ifdef NS_TRACE_MALLOC
-            _malloc = (__ptr_t(*)(size_t)) dlsym(sXULLibHandle, "malloc");
-            _calloc = (__ptr_t(*)(size_t, size_t)) dlsym(sXULLibHandle, "calloc");
-            _realloc = (__ptr_t(*)(__ptr_t, size_t)) dlsym(sXULLibHandle, "realloc");
-            _free = (void(*)(__ptr_t)) dlsym(sXULLibHandle, "free");
-            _memalign = (__ptr_t(*)(size_t, size_t)) dlsym(sXULLibHandle, "memalign");
-            _valloc = (__ptr_t(*)(size_t)) dlsym(sXULLibHandle, "valloc");
-#endif
-        }
-    }
-
-    // RTLD_DEFAULT is not defined in non-GNU toolchains, and it is
-    // (void*) 0 in any case.
-
-    void *libHandle = nullptr;
-
-    if (xpcomFile[0] != '.' || xpcomFile[1] != '\0') {
-        libHandle = dlopen(xpcomFile, RTLD_GLOBAL | RTLD_LAZY);
-        if (libHandle) {
-            AppendDependentLib(libHandle);
-        } else {
-            fprintf(stderr, "XPCOMGlueLoad error for file %s:\n%s\n", xpcomFile,
-                    dlerror());
-        }
-    }
-
-    GetFrozenFunctionsFunc sym =
-        (GetFrozenFunctionsFunc) dlsym(libHandle,
-                                       LEADING_UNDERSCORE "NS_GetFrozenFunctions");
-
-    if (!sym) { // No symbol found.
-        XPCOMGlueUnload();
-        return NS_ERROR_NOT_AVAILABLE;
-    }
-
-    *func = sym;
-
-    return NS_OK;
-}
-
-void
-XPCOMGlueUnload()
-{
-    while (sTop) {
-        dlclose(sTop->libHandle);
-
-        DependentLib *temp = sTop;
-        sTop = sTop->next;
-
-        delete temp;
-    }
-
-    if (sXULLibHandle) {
-#ifdef NS_TRACE_MALLOC
-        _malloc = __libc_malloc;
-        _calloc = __libc_calloc;
-        _realloc = __libc_realloc;
-        _free = __libc_free;
-        _memalign = __libc_memalign;
-        _valloc = __libc_valloc;
-#endif
-        dlclose(sXULLibHandle);
-        sXULLibHandle = nullptr;
-    }
-}
-
-nsresult
-XPCOMGlueLoadXULFunctions(const nsDynamicFunctionLoad *symbols)
-{
-    // We don't null-check sXULLibHandle because this might work even
-    // if it is null (same as RTLD_DEFAULT)
-
-    nsresult rv = NS_OK;
-    while (symbols->functionName) {
-        char buffer[512];
-        snprintf(buffer, sizeof(buffer),
-                 LEADING_UNDERSCORE "%s", symbols->functionName);
-
-        *symbols->function = (NSFuncPtr) dlsym(sXULLibHandle, buffer);
-        if (!*symbols->function)
-            rv = NS_ERROR_LOSS_OF_SIGNIFICANT_DATA;
-
-        ++symbols;
-    }
-    return rv;
-}
deleted file mode 100644
--- a/xpcom/glue/standalone/nsGlueLinkingNull.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-/* -*- Mode: C++; tab-width: 6; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "nsGlueLinking.h"
-
-#include <stdio.h>
-
-nsresult
-XPCOMGlueLoad(const char *xpcomFile, GetFrozenFunctionsFunc *func)
-{
-    fprintf(stderr, "XPCOM glue dynamic linking is not implemented on this platform!");
-
-    *func = nullptr;
-
-    return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-void
-XPCOMGlueUnload()
-{
-}
deleted file mode 100644
--- a/xpcom/glue/standalone/nsGlueLinkingOS2.cpp
+++ /dev/null
@@ -1,156 +0,0 @@
-/* -*- Mode: C++; tab-width: 6; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "nsGlueLinking.h"
-#include "nsXPCOMGlue.h"
-
-#define INCL_DOS
-#define INCL_DOSERRORS
-#include <os2.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-struct DependentLib
-{
-    HMODULE     libHandle;
-    DependentLib *next;
-};
-
-static DependentLib *sTop;
-HMODULE sXULLibrary = NULLHANDLE;
-
-static void
-AppendDependentLib(HMODULE libHandle)
-{
-    DependentLib *d = new DependentLib;
-    if (!d)
-        return;
-
-    d->next = sTop;
-    d->libHandle = libHandle;
-
-    sTop = d;
-}
-
-static void
-ReadDependentCB(const char *aDependentLib, bool do_preload)
-{
-    CHAR pszError[_MAX_PATH];
-    ULONG ulrc = NO_ERROR;
-    HMODULE h;
-
-    ulrc = DosLoadModule(pszError, _MAX_PATH, aDependentLib, &h);
-
-    if (ulrc != NO_ERROR)
-        return;
-
-    AppendDependentLib(h);
-}
-
-// like strpbrk but finds the *last* char, not the first
-static char*
-ns_strrpbrk(char *string, const char *strCharSet)
-{
-    char *found = NULL;
-    for (; *string; ++string) {
-        for (const char *search = strCharSet; *search; ++search) {
-            if (*search == *string) {
-                found = string;
-                // Since we're looking for the last char, we save "found"
-                // until we're at the end of the string.
-            }
-        }
-    }
-
-    return found;
-}
-
-nsresult
-XPCOMGlueLoad(const char *xpcomFile, GetFrozenFunctionsFunc *func)
-{
-    CHAR pszError[_MAX_PATH];
-    ULONG ulrc = NO_ERROR;
-    HMODULE h;
-
-    if (xpcomFile[0] == '.' && xpcomFile[1] == '\0') {
-        xpcomFile = XPCOM_DLL;
-    }
-    else {
-        char xpcomDir[MAXPATHLEN];
-
-        _fullpath(xpcomDir, xpcomFile, sizeof(xpcomDir));
-        char *lastSlash = ns_strrpbrk(xpcomDir, "/\\");
-        if (lastSlash) {
-            *lastSlash = '\0';
-
-            XPCOMGlueLoadDependentLibs(xpcomDir, ReadDependentCB);
-
-            snprintf(lastSlash, MAXPATHLEN - strlen(xpcomDir), "\\" XUL_DLL);
-
-            DosLoadModule(pszError, _MAX_PATH, xpcomDir, &sXULLibrary);
-        }
-    }
-
-    ulrc = DosLoadModule(pszError, _MAX_PATH, xpcomFile, &h);
-
-    if (ulrc != NO_ERROR)
-        return nullptr;
-
-    AppendDependentLib(h);
-
-    GetFrozenFunctionsFunc sym;
-
-    ulrc = DosQueryProcAddr(h, 0, "_NS_GetFrozenFunctions", (PFN*)&sym);
-
-    if (ulrc != NO_ERROR) {
-        XPCOMGlueUnload();
-        return NS_ERROR_NOT_AVAILABLE;
-    }
-
-    *func = sym;
-
-    return NS_OK;
-}
-
-void
-XPCOMGlueUnload()
-{
-    while (sTop) {
-        DosFreeModule(sTop->libHandle);
-
-        DependentLib *temp = sTop;
-        sTop = sTop->next;
-
-        delete temp;
-    }
-
-    if (sXULLibrary) {
-        DosFreeModule(sXULLibrary);
-        sXULLibrary = nullptr;
-    }
-}
-
-nsresult
-XPCOMGlueLoadXULFunctions(const nsDynamicFunctionLoad *symbols)
-{
-    ULONG ulrc = NO_ERROR;
-
-    if (!sXULLibrary)
-        return NS_ERROR_NOT_INITIALIZED;
-
-    nsresult rv = NS_OK;
-    while (symbols->functionName) {
-        char buffer[512];
-        snprintf(buffer, sizeof(buffer), "_%s", symbols->functionName);
-        ulrc = DosQueryProcAddr(sXULLibrary, 0, buffer, (PFN*)symbols->function);
-
-        if (ulrc != NO_ERROR)
-            rv = NS_ERROR_LOSS_OF_SIGNIFICANT_DATA;
-
-        ++symbols;
-    }
-
-    return rv;
-}
deleted file mode 100644
--- a/xpcom/glue/standalone/nsGlueLinkingOSX.cpp
+++ /dev/null
@@ -1,124 +0,0 @@
-/* -*- Mode: C++; tab-width: 6; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "nsGlueLinking.h"
-#include "nsXPCOMGlue.h"
-#include "mozilla/FileUtils.h"
-
-#include <mach-o/dyld.h>
-#include <sys/param.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/mman.h>
-#include <sys/stat.h>
-#include <limits.h>
-
-static const mach_header* sXULLibImage;
-
-static void
-ReadDependentCB(const char *aDependentLib, bool do_preload)
-{
-    if (do_preload)
-        mozilla::ReadAheadLib(aDependentLib);
-    (void) NSAddImage(aDependentLib,
-                      NSADDIMAGE_OPTION_RETURN_ON_ERROR |
-                      NSADDIMAGE_OPTION_MATCH_FILENAME_BY_INSTALLNAME);
-}
-
-static void*
-LookupSymbol(const mach_header* aLib, const char* aSymbolName)
-{
-    // Try to use |NSLookupSymbolInImage| since it is faster than searching
-    // the global symbol table.  If we couldn't get a mach_header pointer
-    // for the XPCOM dylib, then use |NSLookupAndBindSymbol| to search the
-    // global symbol table (this shouldn't normally happen, unless the user
-    // has called XPCOMGlueStartup(".") and relies on libxpcom.dylib
-    // already being loaded).
-    NSSymbol sym = nullptr;
-    if (aLib) {
-        sym = NSLookupSymbolInImage(aLib, aSymbolName,
-                                 NSLOOKUPSYMBOLINIMAGE_OPTION_BIND |
-                                 NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR);
-    } else {
-        if (NSIsSymbolNameDefined(aSymbolName))
-            sym = NSLookupAndBindSymbol(aSymbolName);
-    }
-    if (!sym)
-        return nullptr;
-
-    return NSAddressOfSymbol(sym);
-}
-
-nsresult
-XPCOMGlueLoad(const char *xpcomFile, GetFrozenFunctionsFunc *func)
-{
-    const mach_header* lib = nullptr;
-
-    if (xpcomFile[0] != '.' || xpcomFile[1] != '\0') {
-        char xpcomDir[PATH_MAX];
-        if (realpath(xpcomFile, xpcomDir)) {
-            char *lastSlash = strrchr(xpcomDir, '/');
-            if (lastSlash) {
-                *lastSlash = '\0';
-
-                XPCOMGlueLoadDependentLibs(xpcomDir, ReadDependentCB);
-
-                snprintf(lastSlash, PATH_MAX - strlen(xpcomDir), "/" XUL_DLL);
-
-                sXULLibImage = NSAddImage(xpcomDir,
-                              NSADDIMAGE_OPTION_RETURN_ON_ERROR |
-                              NSADDIMAGE_OPTION_WITH_SEARCHING |
-                              NSADDIMAGE_OPTION_MATCH_FILENAME_BY_INSTALLNAME);
-            }
-        }
-
-        lib = NSAddImage(xpcomFile,
-                         NSADDIMAGE_OPTION_RETURN_ON_ERROR |
-                         NSADDIMAGE_OPTION_WITH_SEARCHING |
-                         NSADDIMAGE_OPTION_MATCH_FILENAME_BY_INSTALLNAME);
-
-        if (!lib) {
-            NSLinkEditErrors linkEditError;
-            int errorNum;
-            const char *errorString;
-            const char *fileName;
-            NSLinkEditError(&linkEditError, &errorNum, &fileName, &errorString);
-            fprintf(stderr, "XPCOMGlueLoad error %d:%d for file %s:\n%s\n",
-                    linkEditError, errorNum, fileName, errorString);
-        }
-    }
-
-    *func = (GetFrozenFunctionsFunc) LookupSymbol(lib, "_NS_GetFrozenFunctions");
-
-    return *func ? NS_OK : NS_ERROR_NOT_AVAILABLE;
-}
-
-void
-XPCOMGlueUnload()
-{
-  // nothing to do, since we cannot unload dylibs on OS X
-}
-
-nsresult
-XPCOMGlueLoadXULFunctions(const nsDynamicFunctionLoad *symbols)
-{
-    nsresult rv = NS_OK;
-    while (symbols->functionName) {
-        char buffer[512];
-        snprintf(buffer, sizeof(buffer), "_%s", symbols->functionName);
-
-        *symbols->function = (NSFuncPtr) LookupSymbol(sXULLibImage, buffer);
-        if (!*symbols->function)
-            rv = NS_ERROR_LOSS_OF_SIGNIFICANT_DATA;
-
-        ++symbols;
-    }
-
-    return rv;
-}
deleted file mode 100644
--- a/xpcom/glue/standalone/nsGlueLinkingWin.cpp
+++ /dev/null
@@ -1,216 +0,0 @@
-/* -*- Mode: C++; tab-width: 6; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "nsGlueLinking.h"
-#include "nsXPCOMGlue.h"
-#include "mozilla/FileUtils.h"
-
-#include "nsStringAPI.h"
-#include <windows.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <tchar.h>
-
-#define MOZ_LOADLIBRARY_FLAGS LOAD_WITH_ALTERED_SEARCH_PATH
-
-struct DependentLib
-{
-    HINSTANCE     libHandle;
-    DependentLib *next;
-};
-
-static DependentLib *sTop;
-HINSTANCE sXULLibrary;
-
-static void
-AppendDependentLib(HINSTANCE libHandle)
-{
-    DependentLib *d = new DependentLib;
-    if (!d)
-        return;
-
-    d->next = sTop;
-    d->libHandle = libHandle;
-
-    sTop = d;
-}
-
-static void
-ReadDependentCB(const char *aDependentLib, bool do_preload)
-{
-    wchar_t wideDependentLib[MAX_PATH];
-    MultiByteToWideChar(CP_UTF8, 0, aDependentLib, -1, wideDependentLib, MAX_PATH);
-
-    if (do_preload)
-        mozilla::ReadAheadLib(wideDependentLib);
-
-    HINSTANCE h =
-        LoadLibraryExW(wideDependentLib, NULL, MOZ_LOADLIBRARY_FLAGS);
-
-    if (!h)
-        return;
-
-    AppendDependentLib(h);
-}
-
-// like strpbrk but finds the *last* char, not the first
-static wchar_t*
-ns_wcspbrk(wchar_t *string, const wchar_t *strCharSet)
-{
-    wchar_t *found = NULL;
-    for (; *string; ++string) {
-        for (const wchar_t *search = strCharSet; *search; ++search) {
-            if (*search == *string) {
-                found = string;
-                // Since we're looking for the last char, we save "found"
-                // until we're at the end of the string.
-            }
-        }
-    }
-
-    return found;
-}
-
-bool ns_isRelPath(wchar_t* path)
-{
-    return !(path[1] == ':');
-}
-
-nsresult
-XPCOMGlueLoad(const char *aXpcomFile, GetFrozenFunctionsFunc *func)
-{
-    wchar_t xpcomFile[MAXPATHLEN];
-    MultiByteToWideChar(CP_UTF8, 0, aXpcomFile,-1,
-                        xpcomFile, MAXPATHLEN);
-   
-    
-    if (xpcomFile[0] == '.' && xpcomFile[1] == '\0') {
-        wcscpy(xpcomFile, LXPCOM_DLL);
-    }
-    else {
-        wchar_t xpcomDir[MAXPATHLEN];
-        
-        if (ns_isRelPath(xpcomFile))
-        {
-            _wfullpath(xpcomDir, xpcomFile, sizeof(xpcomDir)/sizeof(wchar_t));
-        } 
-        else 
-        {
-            wcscpy(xpcomDir, xpcomFile);
-        }
-        wchar_t *lastSlash = ns_wcspbrk(xpcomDir, L"/\\");
-        if (lastSlash) {
-            *lastSlash = '\0';
-            char xpcomDir_narrow[MAXPATHLEN];
-            WideCharToMultiByte(CP_UTF8, 0, xpcomDir,-1,
-                                xpcomDir_narrow, MAX_PATH, NULL, NULL);
-
-            XPCOMGlueLoadDependentLibs(xpcomDir_narrow, ReadDependentCB);
-            
-            _snwprintf(lastSlash, MAXPATHLEN - wcslen(xpcomDir), L"\\" LXUL_DLL);
-            sXULLibrary =
-                LoadLibraryExW(xpcomDir, NULL, MOZ_LOADLIBRARY_FLAGS);
-
-            if (!sXULLibrary) 
-            {
-                DWORD err = GetLastError();
-#ifdef DEBUG
-                LPVOID lpMsgBuf;
-                FormatMessage(
-                              FORMAT_MESSAGE_ALLOCATE_BUFFER |
-                              FORMAT_MESSAGE_FROM_SYSTEM |
-                              FORMAT_MESSAGE_IGNORE_INSERTS,
-                              NULL,
-                              GetLastError(),
-                              MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
-                              (LPTSTR) &lpMsgBuf,
-                              0,
-                              NULL
-                              );
-                wprintf(L"Error loading %s: %s\n", xpcomDir, lpMsgBuf);
-                LocalFree(lpMsgBuf);
-#endif //DEBUG
-                return (err == ERROR_NOT_ENOUGH_MEMORY || err == ERROR_OUTOFMEMORY)
-                    ? NS_ERROR_OUT_OF_MEMORY : NS_ERROR_FAILURE;
-            }
-        }
-    }
-    HINSTANCE h =
-        LoadLibraryExW(xpcomFile, NULL, MOZ_LOADLIBRARY_FLAGS);
-
-    if (!h) 
-    {
-        DWORD err = GetLastError();
-#ifdef DEBUG
-        LPVOID lpMsgBuf;
-        FormatMessage(
-                      FORMAT_MESSAGE_ALLOCATE_BUFFER |
-                      FORMAT_MESSAGE_FROM_SYSTEM |
-                      FORMAT_MESSAGE_IGNORE_INSERTS,
-                      NULL,
-                      err,
-                      MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
-                      (LPTSTR) &lpMsgBuf,
-                      0,
-                      NULL
-                      );
-        wprintf(L"Error loading %s: %s\n", xpcomFile, lpMsgBuf);
-        LocalFree(lpMsgBuf);
-#endif        
-        return (err == ERROR_NOT_ENOUGH_MEMORY || err == ERROR_OUTOFMEMORY)
-            ? NS_ERROR_OUT_OF_MEMORY : NS_ERROR_FAILURE;
-    }
-
-    AppendDependentLib(h);
-
-    GetFrozenFunctionsFunc sym =
-        (GetFrozenFunctionsFunc) GetProcAddress(h, "NS_GetFrozenFunctions");
-
-    if (!sym) { // No symbol found.
-        XPCOMGlueUnload();
-        return NS_ERROR_NOT_AVAILABLE;
-    }
-
-    *func = sym;
-
-    return NS_OK;
-}
-
-void
-XPCOMGlueUnload()
-{
-    while (sTop) {
-        FreeLibrary(sTop->libHandle);
-
-        DependentLib *temp = sTop;
-        sTop = sTop->next;
-
-        delete temp;
-    }
-
-    if (sXULLibrary) {
-        FreeLibrary(sXULLibrary);
-        sXULLibrary = nullptr;
-    }
-}
-
-nsresult
-XPCOMGlueLoadXULFunctions(const nsDynamicFunctionLoad *symbols)
-{
-    if (!sXULLibrary)
-        return NS_ERROR_NOT_INITIALIZED;
-
-    nsresult rv = NS_OK;
-    while (symbols->functionName) {
-        *symbols->function = 
-            (NSFuncPtr) GetProcAddress(sXULLibrary, symbols->functionName);
-        if (!*symbols->function)
-            rv = NS_ERROR_LOSS_OF_SIGNIFICANT_DATA;
-
-        ++symbols;
-    }
-
-    return rv;
-}
--- a/xpcom/glue/standalone/nsXPCOMGlue.cpp
+++ b/xpcom/glue/standalone/nsXPCOMGlue.cpp
@@ -1,117 +1,525 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* vim:set ts=4 sw=4 et cindent: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsXPCOMGlue.h"
-#include "nsGlueLinking.h"
 
 #include "nspr.h"
 #include "nsDebug.h"
 #include "nsIServiceManager.h"
 #include "nsXPCOMPrivate.h"
 #include "nsCOMPtr.h"
 #include <stdlib.h>
 #include <stdio.h>
 
-#ifdef XP_WIN
-#include <windows.h>
-#include <mbstring.h>
-#include <malloc.h>
-#define snprintf _snprintf
-#endif
+#include "mozilla/FileUtils.h"
+
+using namespace mozilla;
+
+#define XPCOM_DEPENDENT_LIBS_LIST "dependentlibs.list"
 
 static XPCOMFunctions xpcomFunctions;
 static bool do_preload = false;
 
-extern "C"
-void XPCOMGlueEnablePreload()
-{
-    do_preload = true;
-}
-
-extern "C"
-nsresult XPCOMGlueStartup(const char* xpcomFile)
-{
-    xpcomFunctions.version = XPCOM_GLUE_VERSION;
-    xpcomFunctions.size    = sizeof(XPCOMFunctions);
-
-    GetFrozenFunctionsFunc func = nullptr;
-
-    if (!xpcomFile)
-        xpcomFile = XPCOM_DLL;
-    
-    nsresult rv = XPCOMGlueLoad(xpcomFile, &func);
-    if (NS_FAILED(rv))
-        return rv;
-
-    rv = (*func)(&xpcomFunctions, nullptr);
-    if (NS_FAILED(rv)) {
-        XPCOMGlueUnload();
-        return rv;
-    }
-
-    return NS_OK;
-}
-
 #if defined(XP_WIN)
 #define READ_TEXTMODE L"rt"
 #elif defined(XP_OS2)
 #define READ_TEXTMODE "rt"
 #else
 #define READ_TEXTMODE "r"
 #endif
 
+#if defined(SUNOS4) || defined(NEXTSTEP) || \
+    defined(XP_DARWIN) || defined(XP_OS2) || \
+    (defined(OPENBSD) || defined(NETBSD)) && !defined(__ELF__)
+#define LEADING_UNDERSCORE "_"
+#else
+#define LEADING_UNDERSCORE
+#endif
+
+#if defined(XP_WIN)
+#include <windows.h>
+#include <mbstring.h>
+#define snprintf _snprintf
+
+typedef HINSTANCE LibHandleType;
+
+static LibHandleType
+GetLibHandle(pathstr_t aDependentLib)
+{
+    LibHandleType libHandle =
+        LoadLibraryExW(aDependentLib, nullptr, LOAD_WITH_ALTERED_SEARCH_PATH);
+
+    if (!libHandle) {
+        DWORD err = GetLastError();
+#ifdef DEBUG
+        LPVOID lpMsgBuf;
+        FormatMessage(
+                      FORMAT_MESSAGE_ALLOCATE_BUFFER |
+                      FORMAT_MESSAGE_FROM_SYSTEM |
+                      FORMAT_MESSAGE_IGNORE_INSERTS,
+                      nullptr,
+                      err,
+                      MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+                      (LPTSTR) &lpMsgBuf,
+                      0,
+                      nullptr
+                      );
+        wprintf(L"Error loading %ls: %s\n", aDependentLib, lpMsgBuf);
+        LocalFree(lpMsgBuf);
+#endif
+    }
+
+    return libHandle;
+}
+
+static NSFuncPtr
+GetSymbol(LibHandleType aLibHandle, const char *aSymbol)
+{
+    return (NSFuncPtr) GetProcAddress(aLibHandle, aSymbol);
+}
+
+static void
+CloseLibHandle(LibHandleType aLibHandle)
+{
+    FreeLibrary(aLibHandle);
+}
+
+#elif defined(XP_OS2)
+#define INCL_DOS
+#define INCL_DOSERRORS
+#include <os2.h>
+
+typedef HMODULE LibHandleType;
+
+static LibHandleType
+GetLibHandle(pathstr_t aDependentLib)
+{
+    CHAR pszError[_MAX_PATH];
+    ULONG ulrc = NO_ERROR;
+    LibHandleType libHandle;
+    ulrc = DosLoadModule(pszError, _MAX_PATH, aDependentLib, &libHandle);
+    return (ulrc == NO_ERROR) ? libHandle : nullptr;
+}
+
+static NSFuncPtr
+GetSymbol(LibHandleType aLibHandle, const char *aSymbol)
+{
+    ULONG ulrc = NO_ERROR;
+    GetFrozenFunctionsFunc sym;
+    ulrc = DosQueryProcAddr(aLibHandle, 0, aSymbol, (PFN*)&sym);
+    return (ulrc == NO_ERROR) ? sym : nullptr;
+}
+
+static void
+CloseLibHandle(LibHandleType aLibHandle)
+{
+    DosFreeModule(aLibHandle);
+}
+
+#elif defined(XP_MACOSX)
+#include <mach-o/dyld.h>
+
+typedef const mach_header *LibHandleType;
+
+static LibHandleType
+GetLibHandle(pathstr_t aDependentLib)
+{
+    LibHandleType libHandle = NSAddImage(aDependentLib,
+                                         NSADDIMAGE_OPTION_RETURN_ON_ERROR |
+                                         NSADDIMAGE_OPTION_MATCH_FILENAME_BY_INSTALLNAME);
+    if (!libHandle) {
+        NSLinkEditErrors linkEditError;
+        int errorNum;
+        const char *errorString;
+        const char *fileName;
+        NSLinkEditError(&linkEditError, &errorNum, &fileName, &errorString);
+        fprintf(stderr, "XPCOMGlueLoad error %d:%d for file %s:\n%s\n",
+                linkEditError, errorNum, fileName, errorString);
+    }
+    return libHandle;
+}
+
+static NSFuncPtr
+GetSymbol(LibHandleType aLibHandle, const char *aSymbol)
+{
+    // Try to use |NSLookupSymbolInImage| since it is faster than searching
+    // the global symbol table.  If we couldn't get a mach_header pointer
+    // for the XPCOM dylib, then use |NSLookupAndBindSymbol| to search the
+    // global symbol table (this shouldn't normally happen, unless the user
+    // has called XPCOMGlueStartup(".") and relies on libxpcom.dylib
+    // already being loaded).
+    NSSymbol sym = nullptr;
+    if (aLibHandle) {
+        sym = NSLookupSymbolInImage(aLibHandle, aSymbol,
+                                 NSLOOKUPSYMBOLINIMAGE_OPTION_BIND |
+                                 NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR);
+    } else {
+        if (NSIsSymbolNameDefined(aSymbol))
+            sym = NSLookupAndBindSymbol(aSymbol);
+    }
+    if (!sym)
+        return nullptr;
+
+    return (NSFuncPtr) NSAddressOfSymbol(sym);
+}
+
+static void
+CloseLibHandle(LibHandleType aLibHandle)
+{
+    // we cannot unload dylibs on OS X
+}
+
+#else
+#include <dlfcn.h>
+
+#if defined(MOZ_LINKER) && !defined(ANDROID)
+extern "C" {
+NS_HIDDEN __typeof(dlopen) __wrap_dlopen;
+NS_HIDDEN __typeof(dlsym) __wrap_dlsym;
+NS_HIDDEN __typeof(dlclose) __wrap_dlclose;
+}
+
+#define dlopen __wrap_dlopen
+#define dlsym __wrap_dlsym
+#define dlclose __wrap_dlclose
+#endif
+
+#ifdef NS_TRACE_MALLOC
+extern "C" {
+NS_EXPORT_(__ptr_t) __libc_malloc(size_t);
+NS_EXPORT_(__ptr_t) __libc_calloc(size_t, size_t);
+NS_EXPORT_(__ptr_t) __libc_realloc(__ptr_t, size_t);
+NS_EXPORT_(void)    __libc_free(__ptr_t);
+NS_EXPORT_(__ptr_t) __libc_memalign(size_t, size_t);
+NS_EXPORT_(__ptr_t) __libc_valloc(size_t);
+}
+
+static __ptr_t (*_malloc)(size_t) = __libc_malloc;
+static __ptr_t (*_calloc)(size_t, size_t) = __libc_calloc;
+static __ptr_t (*_realloc)(__ptr_t, size_t) = __libc_realloc;
+static void (*_free)(__ptr_t) = __libc_free;
+static __ptr_t (*_memalign)(size_t, size_t) = __libc_memalign;
+static __ptr_t (*_valloc)(size_t) = __libc_valloc;
+
+NS_EXPORT_(__ptr_t) malloc(size_t size)
+{
+    return _malloc(size);
+}
+
+NS_EXPORT_(__ptr_t) calloc(size_t nmemb, size_t size)
+{
+    return _calloc(nmemb, size);
+}
+
+NS_EXPORT_(__ptr_t) realloc(__ptr_t ptr, size_t size)
+{
+    return _realloc(ptr, size);
+}
+
+NS_EXPORT_(void) free(__ptr_t ptr)
+{
+    _free(ptr);
+}
+
+NS_EXPORT_(void) cfree(__ptr_t ptr)
+{
+    _free(ptr);
+}
+
+NS_EXPORT_(__ptr_t) memalign(size_t boundary, size_t size)
+{
+    return _memalign(boundary, size);
+}
+
+NS_EXPORT_(int)
+posix_memalign(void **memptr, size_t alignment, size_t size)
+{
+    __ptr_t ptr = _memalign(alignment, size);
+    if (!ptr)
+        return ENOMEM;
+    *memptr = ptr;
+    return 0;
+}
+
+NS_EXPORT_(__ptr_t) valloc(size_t size)
+{
+    return _valloc(size);
+}
+#endif /* NS_TRACE_MALLOC */
+
+typedef void *LibHandleType;
+
+static LibHandleType
+GetLibHandle(pathstr_t aDependentLib)
+{
+    LibHandleType libHandle = dlopen(aDependentLib, RTLD_GLOBAL | RTLD_LAZY);
+    if (!libHandle) {
+        fprintf(stderr, "XPCOMGlueLoad error for file %s:\n%s\n", aDependentLib, dlerror());
+    }
+    return libHandle;
+}
+
+static NSFuncPtr
+GetSymbol(LibHandleType aLibHandle, const char *aSymbol)
+{
+    return (NSFuncPtr) dlsym(aLibHandle, aSymbol);
+}
+
+static void
+CloseLibHandle(LibHandleType aLibHandle)
+{
+    dlclose(aLibHandle);
+}
+#endif
+
+struct DependentLib
+{
+    LibHandleType libHandle;
+    DependentLib *next;
+};
+
+static DependentLib *sTop;
+
+static void
+AppendDependentLib(LibHandleType libHandle)
+{
+    DependentLib *d = new DependentLib;
+    if (!d)
+        return;
+
+    d->next = sTop;
+    d->libHandle = libHandle;
+
+    sTop = d;
+}
+
+static bool
+ReadDependentCB(pathstr_t aDependentLib, bool do_preload)
+{
+    if (do_preload) {
+        ReadAheadLib(aDependentLib);
+    }
+    LibHandleType libHandle = GetLibHandle(aDependentLib);
+    if (libHandle) {
+        AppendDependentLib(libHandle);
+    }
+
+    return libHandle;
+}
+
 #ifdef XP_WIN
+static bool
+ReadDependentCB(const char *aDependentLib, bool do_preload)
+{
+    wchar_t wideDependentLib[MAX_PATH];
+    MultiByteToWideChar(CP_UTF8, 0, aDependentLib, -1, wideDependentLib, MAX_PATH);
+    return ReadDependentCB(wideDependentLib, do_preload);
+}
+
 inline FILE *TS_tfopen (const char *path, const wchar_t *mode)
 {
     wchar_t wPath[MAX_PATH];
     MultiByteToWideChar(CP_UTF8, 0, path, -1, wPath, MAX_PATH);
     return _wfopen(wPath, mode);
 }
 #else
 inline FILE *TS_tfopen (const char *path, const char *mode)
 {
     return fopen(path, mode);
 }
 #endif
 
-void
-XPCOMGlueLoadDependentLibs(const char *xpcomDir, DependentLibsCallback cb)
+/* RAII wrapper for FILE descriptors */
+struct ScopedCloseFileTraits
+{
+    typedef FILE *type;
+    static type empty() { return nullptr; }
+    static void release(type f) {
+        if (f) {
+            fclose(f);
+        }
+    }
+};
+typedef Scoped<ScopedCloseFileTraits> ScopedCloseFile;
+
+static void
+XPCOMGlueUnload()
+{
+#if !defined(XP_WIN) && !defined(XP_OS2) && !defined(XP_MACOSX) \
+  && defined(NS_TRACE_MALLOC)
+    if (sTop) {
+        _malloc = __libc_malloc;
+        _calloc = __libc_calloc;
+        _realloc = __libc_realloc;
+        _free = __libc_free;
+        _memalign = __libc_memalign;
+        _valloc = __libc_valloc;
+    }
+#endif
+
+    while (sTop) {
+        CloseLibHandle(sTop->libHandle);
+
+        DependentLib *temp = sTop;
+        sTop = sTop->next;
+
+        delete temp;
+    }
+}
+
+#if defined(XP_WIN) || defined(XP_OS2)
+// like strpbrk but finds the *last* char, not the first
+static const char*
+ns_strrpbrk(const char *string, const char *strCharSet)
 {
+    const char *found = nullptr;
+    for (; *string; ++string) {
+        for (const char *search = strCharSet; *search; ++search) {
+            if (*search == *string) {
+                found = string;
+                // Since we're looking for the last char, we save "found"
+                // until we're at the end of the string.
+            }
+        }
+    }
+
+    return found;
+}
+#endif
+
+static GetFrozenFunctionsFunc
+XPCOMGlueLoad(const char *xpcomFile)
+{
+    char xpcomDir[MAXPATHLEN];
+#if defined(XP_WIN) || defined(XP_OS2)
+    const char *lastSlash = ns_strrpbrk(xpcomFile, "/\\");
+#else
+    const char *lastSlash = strrchr(xpcomFile, '/');
+#endif
+    char *cursor;
+    if (lastSlash) {
+        size_t len = size_t(lastSlash - xpcomFile);
+
+        if (len > MAXPATHLEN - sizeof(XPCOM_FILE_PATH_SEPARATOR
+                                      XPCOM_DEPENDENT_LIBS_LIST)) {
+            return nullptr;
+        }
+        memcpy(xpcomDir, xpcomFile, len);
+        strcpy(xpcomDir + len, XPCOM_FILE_PATH_SEPARATOR
+                               XPCOM_DEPENDENT_LIBS_LIST);
+        cursor = xpcomDir + len + 1;
+    } else {
+        strcpy(xpcomDir, XPCOM_DEPENDENT_LIBS_LIST);
+        cursor = xpcomDir;
+    }
+
+    ScopedCloseFile flist;
+    flist = TS_tfopen(xpcomDir, READ_TEXTMODE);
+    if (!flist) {
+        return nullptr;
+    }
+
+    *cursor = '\0';
+
     char buffer[MAXPATHLEN];
-    sprintf(buffer, "%s" XPCOM_FILE_PATH_SEPARATOR XPCOM_DEPENDENT_LIBS_LIST,
-            xpcomDir);
-
-    FILE *flist = TS_tfopen(buffer, READ_TEXTMODE);
-    if (!flist)
-        return;
 
     while (fgets(buffer, sizeof(buffer), flist)) {
         int l = strlen(buffer);
 
         // ignore empty lines and comments
-        if (l == 0 || *buffer == '#')
+        if (l == 0 || *buffer == '#') {
             continue;
+        }
 
         // cut the trailing newline, if present
         if (buffer[l - 1] == '\n')
             buffer[l - 1] = '\0';
 
-        char buffer2[MAXPATHLEN];
-        snprintf(buffer2, sizeof(buffer2),
-                 "%s" XPCOM_FILE_PATH_SEPARATOR "%s",
-                 xpcomDir, buffer);
-        cb(buffer2, do_preload);
+        if (l + size_t(cursor - xpcomDir) > MAXPATHLEN) {
+            return nullptr;
+        }
+
+        strcpy(cursor, buffer);
+        if (!ReadDependentCB(xpcomDir, do_preload)) {
+            XPCOMGlueUnload();
+            return nullptr;
+        }
+    }
+
+    GetFrozenFunctionsFunc sym =
+        (GetFrozenFunctionsFunc) GetSymbol(sTop->libHandle, LEADING_UNDERSCORE "NS_GetFrozenFunctions");
+
+    if (!sym) { // No symbol found.
+        XPCOMGlueUnload();
+        return nullptr;
     }
 
-    fclose(flist);
+#if !defined(XP_WIN) && !defined(XP_OS2) && !defined(XP_MACOSX) \
+  && defined(NS_TRACE_MALLOC)
+    _malloc = (__ptr_t(*)(size_t)) GetSymbol(sTop->libHandle, "malloc");
+    _calloc = (__ptr_t(*)(size_t, size_t)) GetSymbol(sTop->libHandle, "calloc");
+    _realloc = (__ptr_t(*)(__ptr_t, size_t)) GetSymbol(sTop->libHandle, "realloc");
+    _free = (void(*)(__ptr_t)) GetSymbol(sTop->libHandle, "free");
+    _memalign = (__ptr_t(*)(size_t, size_t)) GetSymbol(sTop->libHandle, "memalign");
+    _valloc = (__ptr_t(*)(size_t)) GetSymbol(sTop->libHandle, "valloc");
+#endif
+
+    return sym;
+}
+
+nsresult
+XPCOMGlueLoadXULFunctions(const nsDynamicFunctionLoad *symbols)
+{
+    // We don't null-check sXULLibHandle because this might work even
+    // if it is null (same as RTLD_DEFAULT)
+
+    nsresult rv = NS_OK;
+    while (symbols->functionName) {
+        char buffer[512];
+        snprintf(buffer, sizeof(buffer),
+                 LEADING_UNDERSCORE "%s", symbols->functionName);
+
+        *symbols->function = (NSFuncPtr) GetSymbol(sTop->libHandle, buffer);
+        if (!*symbols->function)
+            rv = NS_ERROR_LOSS_OF_SIGNIFICANT_DATA;
+
+        ++symbols;
+    }
+    return rv;
+}
+
+void XPCOMGlueEnablePreload()
+{
+    do_preload = true;
+}
+
+nsresult XPCOMGlueStartup(const char* xpcomFile)
+{
+    xpcomFunctions.version = XPCOM_GLUE_VERSION;
+    xpcomFunctions.size    = sizeof(XPCOMFunctions);
+
+    if (!xpcomFile)
+        xpcomFile = XPCOM_DLL;
+
+    GetFrozenFunctionsFunc func = XPCOMGlueLoad(xpcomFile);
+    if (!func)
+        return NS_ERROR_NOT_AVAILABLE;
+
+    nsresult rv = (*func)(&xpcomFunctions, nullptr);
+    if (NS_FAILED(rv)) {
+        XPCOMGlueUnload();
+        return rv;
+    }
+
+    return NS_OK;
 }
 
 XPCOM_API(nsresult)
 NS_InitXPCOM2(nsIServiceManager* *result, 
               nsIFile* binDirectory,
               nsIDirectoryServiceProvider* appFileLocationProvider)
 {
     if (!xpcomFunctions.init)
--- a/xpcom/glue/standalone/staticruntime/Makefile.in
+++ b/xpcom/glue/standalone/staticruntime/Makefile.in
@@ -14,44 +14,20 @@ EXTRA_DEPS += $(srcdir)/../../objs.mk
 
 LIBRARY_NAME	= xpcomglue_staticruntime
 DIST_INSTALL	= 1
 
 LOCAL_INCLUDES	= \
 	-I$(srcdir)/../../../build \
 	$(NULL)
 
-ifeq (Darwin,$(OS_ARCH))
-ifeq (uikit,$(MOZ_WIDGET_TOOLKIT))
-LINKSRC = nsGlueLinkingDlopen.cpp
-else
-LINKSRC = nsGlueLinkingOSX.cpp
-endif
-endif
-
-ifeq ($(OS_ARCH),WINNT)
-LINKSRC = nsGlueLinkingWin.cpp
-endif
-ifneq (,$(filter AIX DragonFly FreeBSD GNU GNU_% Linux NetBSD OpenBSD SunOS,$(OS_ARCH)))
-LINKSRC = nsGlueLinkingDlopen.cpp
-endif
-ifeq (OS2,$(OS_ARCH))
-LINKSRC = nsGlueLinkingOS2.cpp
-endif
-
-ifndef LINKSRC
-LINKSRC = nsGlueLinkingNull.cpp
-$(warning TinderboxPrint:<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=298044">Error: XPCOM Glue</a>)
-endif
-
 CPPSRCS		= \
 	$(XPCOM_GLUE_SRC_LCPPSRCS)   \
 	nsXPCOMGlue.cpp              \
 	nsStringAPI.cpp              \
-	$(LINKSRC)                   \
 	$(NULL)
 
 SDK_LIBRARY     	= \
 	$(LIB_PREFIX)xpcomglue_staticruntime.$(LIB_SUFFIX) \
 	$(NULL)
 
 # create a static lib
 FORCE_STATIC_LIB = 1
@@ -70,19 +46,19 @@ include $(topsrcdir)/config/rules.mk
 
 ifdef _MSC_VER
 # Don't include directives in obj files about which CRT to use
 OS_COMPILE_CXXFLAGS += -Zl
 OS_COMPILE_CFLAGS += -Zl
 DEFINES += -D_USE_ANSI_CPP
 endif
 
-export:: $(XPCOM_GLUE_SRC_CPPSRCS) $(topsrcdir)/xpcom/glue/nsStringAPI.cpp ../nsXPCOMGlue.cpp ../nsGlueLinking.h ../$(LINKSRC)
+export:: $(XPCOM_GLUE_SRC_CPPSRCS) $(topsrcdir)/xpcom/glue/nsStringAPI.cpp ../nsXPCOMGlue.cpp
 	$(INSTALL) $^ .
 
-GARBAGE += nsStringAPI.cpp nsXPCOMGlue.cpp nsGlueLinking.h $(LINKSRC)
+GARBAGE += nsStringAPI.cpp nsXPCOMGlue.cpp
 
 DEFINES		+= -DXPCOM_GLUE
 
 ifdef TARGET_XPCOM_ABI
 DEFINES += -DTARGET_XPCOM_ABI=\"$(TARGET_XPCOM_ABI)\"
 endif
 
--- a/xpcom/reflect/xptcall/public/xptcall.h
+++ b/xpcom/reflect/xptcall/public/xptcall.h
@@ -3,22 +3,16 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* Public declarations for xptcall. */
 
 #ifndef xptcall_h___
 #define xptcall_h___
 
-#ifdef MOZILLA_INTERNAL_API
-# define NS_GetXPTCallStub     NS_GetXPTCallStub_P
-# define NS_DestroyXPTCallStub NS_DestroyXPTCallStub_P
-# define NS_InvokeByIndex      NS_InvokeByIndex_P
-#endif
-
 #include "nscore.h"
 #include "nsISupports.h"
 #include "xpt_struct.h"
 #include "xptinfo.h"
 #include "jsapi.h"
 
 struct nsXPTCMiniVariant
 {
--- a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_alpha_openbsd.cpp
+++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_alpha_openbsd.cpp
@@ -56,30 +56,30 @@ invoke_copy_to_stack(uint64_t* d, uint32
             *d = (uint64_t)s->val.p;
             break;
         }
     }
 }
 
 /*
  * EXPORT_XPCOM_API(nsresult)
- * NS_InvokeByIndex_P(nsISupports* that, uint32_t methodIndex,
+ * NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
  *                  uint32_t paramCount, nsXPTCVariant* params)
  */
 __asm__(
-    "#### NS_InvokeByIndex_P ####\n"
+    "#### NS_InvokeByIndex ####\n"
 ".text\n\t"
     ".align 5\n\t"
-    ".globl NS_InvokeByIndex_P\n\t"
-    ".ent NS_InvokeByIndex_P\n"
-"NS_InvokeByIndex_P:\n\t"
+    ".globl NS_InvokeByIndex\n\t"
+    ".ent NS_InvokeByIndex\n"
+"NS_InvokeByIndex:\n\t"
     ".frame $15,32,$26,0\n\t"
     ".mask 0x4008000,-32\n\t"
     "ldgp $29,0($27)\n"
-"$NS_InvokeByIndex_P..ng:\n\t"
+"$NS_InvokeByIndex..ng:\n\t"
     "subq $30,32,$30\n\t"
     "stq $26,0($30)\n\t"
     "stq $15,8($30)\n\t"
     "bis $30,$30,$15\n\t"
     ".prologue 1\n\t"
 
     /*
      * Allocate enough stack space to hold the greater of 6 or "paramCount"+1
@@ -135,10 +135,10 @@ invoke_copy_to_stack(uint64_t* d, uint32
     "jsr $26,($27),0\n\t"   /* call virtual function */
     "ldgp $29,0($26)\n\t"
 
     "bis $15,$15,$30\n\t"
     "ldq $26,0($30)\n\t"
     "ldq $15,8($30)\n\t"
     "addq $30,32,$30\n\t"
     "ret $31,($26),1\n\t"
-    ".end NS_InvokeByIndex_P"
+    ".end NS_InvokeByIndex"
     );
--- a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_amd64_openbsd.cpp
+++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_amd64_openbsd.cpp
@@ -95,17 +95,17 @@ invoke_copy_to_stack(uint64_t * d, uint3
                 gpregs[nr_gpr++] = value;
             else
                 *d++ = value;
         }
     }
 }
 
 EXPORT_XPCOM_API(nsresult)
-NS_InvokeByIndex_P(nsISupports * that, uint32_t methodIndex,
+NS_InvokeByIndex(nsISupports * that, uint32_t methodIndex,
                  uint32_t paramCount, nsXPTCVariant * params)
 {
     uint32_t nr_gpr, nr_fpr, nr_stack;
     invoke_count_words(paramCount, params, nr_gpr, nr_fpr, nr_stack);
     
     // Stack, if used, must be 16-bytes aligned
     if (nr_stack)
         nr_stack = (nr_stack + 1) & ~1;
--- a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ipf32.s
+++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ipf32.s
@@ -2,34 +2,34 @@
 // Select C numeric constant
         .radix  C
 // for 64 bit mode, use .psr abi64
         .psr    abi32
 // big endian
         .psr    msb
 // Section has executable code
         .section .text, "ax","progbits"
-// procedure named 'NS_InvokeByIndex_P'
-        .proc   NS_InvokeByIndex_P
+// procedure named 'NS_InvokeByIndex'
+        .proc   NS_InvokeByIndex
 // manual bundling
         .explicit
 
 // extern "C" uint32_t
 // invoke_copy_to_stack(uint64_t* d,
 //   const uint32_t paramCount, nsXPTCVariant* s)
         .global invoke_copy_to_stack
 //      .exclass  invoke_copy_to_stack, @fullyvisible
         .type   invoke_copy_to_stack,@function
 
-//      .exclass  NS_InvokeByIndex_P, @fullyvisible
-        .type   NS_InvokeByIndex_P,@function
+//      .exclass  NS_InvokeByIndex, @fullyvisible
+        .type   NS_InvokeByIndex,@function
 
-// NS_InvokeByIndex_P(nsISupports* that, uint32_t methodIndex,
+// NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
 //   uint32_t paramCount, nsXPTCVariant* params);
-NS_InvokeByIndex_P::
+NS_InvokeByIndex::
         .prologue
         .save ar.pfs, r37
 // allocate 4 input args, 6 local args, and 8 output args
         alloc           r37 = ar.pfs, 4, 6, 8, 0   // M
         nop.i           0                       ;; // I
 
 // unwind table already knows gp, no need to specify anything
         add             r39 = 0, gp                // A
--- a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ipf64.s
+++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ipf64.s
@@ -2,34 +2,34 @@
 // Select C numeric constant
         .radix  C
 // for 64 bit mode, use .psr abi64
         .psr    abi64
 // little endian
         .psr    lsb
 // Section has executable code
         .section .text, "ax","progbits"
-// procedure named 'NS_InvokeByIndex_P'
-        .proc   NS_InvokeByIndex_P
+// procedure named 'NS_InvokeByIndex'
+        .proc   NS_InvokeByIndex
 // manual bundling
         .explicit
 
 // extern "C" uint32_t
 // invoke_copy_to_stack(uint64_t* d,
 //   const uint32_t paramCount, nsXPTCVariant* s)
         .global invoke_copy_to_stack
 //      .exclass  invoke_copy_to_stack, @fullyvisible
         .type   invoke_copy_to_stack,@function
 
-//      .exclass  NS_InvokeByIndex_P, @fullyvisible
-        .type   NS_InvokeByIndex_P,@function
+//      .exclass  NS_InvokeByIndex, @fullyvisible
+        .type   NS_InvokeByIndex,@function
 
 // XPTC_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
 //   uint32_t paramCount, nsXPTCVariant* params);
-NS_InvokeByIndex_P::
+NS_InvokeByIndex::
         .prologue
         .save ar.pfs, r37
 // allocate 4 input args, 6 local args, and 8 output args
         alloc           r37 = ar.pfs, 4, 6, 8, 0   // M
         nop.i           0                       ;; // I
 
 // unwind table already knows gp, no need to specify anything
         add             r39 = 0, gp                // A
--- a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_mips.s
+++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_mips.s
@@ -33,25 +33,25 @@
 #define A0OFF (FRAMESZ + (0*SZREG))
 #define A1OFF (FRAMESZ + (1*SZREG))
 #define A2OFF (FRAMESZ + (2*SZREG))
 #define A3OFF (FRAMESZ + (3*SZREG))
 
 	.text
 
 #	
-# _NS_InvokeByIndex_P(that, methodIndex, paramCount, params)
+# _NS_InvokeByIndex(that, methodIndex, paramCount, params)
 #                      a0       a1          a2         a3
 
-	.globl	_NS_InvokeByIndex_P
+	.globl	_NS_InvokeByIndex
 	.align	2
-	.type	_NS_InvokeByIndex_P,@function
-	.ent	_NS_InvokeByIndex_P,0
+	.type	_NS_InvokeByIndex,@function
+	.ent	_NS_InvokeByIndex,0
 	.frame	fp, FRAMESZ, ra
-_NS_InvokeByIndex_P:
+_NS_InvokeByIndex:
 	SETUP_GP
 	subu	sp, FRAMESZ
 
 	# specify the save register mask for gp, fp, ra, a3 - a0
 	.mask 0xD00000F0, RAOFF-FRAMESZ
 
 	sw	ra, RAOFF(sp)
 	sw	fp, FPOFF(sp)
@@ -126,9 +126,9 @@ 1:	subu	sp, v0
 	# leave variable stack frame
 	move	sp, fp
 
 	lw	ra, RAOFF(sp)
 	lw	fp, FPOFF(sp)
 
 	addiu	sp, FRAMESZ
 	j	ra
-END(_NS_InvokeByIndex_P)
+END(_NS_InvokeByIndex)
--- a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_mips64.s
+++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_mips64.s
@@ -16,22 +16,22 @@ RAOFF=FRAMESZ-(1*SZREG)
 A0OFF=FRAMESZ-(2*SZREG)
 A1OFF=FRAMESZ-(3*SZREG)
 A2OFF=FRAMESZ-(4*SZREG)
 A3OFF=FRAMESZ-(5*SZREG)
 S0OFF=FRAMESZ-(6*SZREG)
 GPOFF=FRAMESZ-(7*SZREG)
 
 #
-# _NS_InvokeByIndex_P(that, methodIndex, paramCount, params)
+# _NS_InvokeByIndex(that, methodIndex, paramCount, params)
 #                      a0       a1          a2         a3
 
-NESTED(_NS_InvokeByIndex_P, FRAMESZ, ra)
+NESTED(_NS_InvokeByIndex, FRAMESZ, ra)
     PTR_SUBU sp, FRAMESZ
-    SETUP_GP64(GPOFF, _NS_InvokeByIndex_P)
+    SETUP_GP64(GPOFF, _NS_InvokeByIndex)
 
     REG_S    ra, RAOFF(sp)
     REG_S    a0, A0OFF(sp)
     REG_S    a1, A1OFF(sp)
     REG_S    a2, A2OFF(sp)
     REG_S    a3, A3OFF(sp)
     REG_S    s0, S0OFF(sp)
 
@@ -114,9 +114,9 @@ NESTED(_NS_InvokeByIndex_P, FRAMESZ, ra)
 
     move     sp, s0
 
     RESTORE_GP64
     REG_L    ra, RAOFF(sp)
     REG_L    s0, S0OFF(sp)
     PTR_ADDU sp, FRAMESZ
     j    ra
-.end _NS_InvokeByIndex_P
+.end _NS_InvokeByIndex
--- a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_parisc_linux.s
+++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_parisc_linux.s
@@ -7,21 +7,21 @@
 
   .LEVEL 1.1
   .text
   .align 4
 
 framesz:
   .equ 128
 
-.globl NS_InvokeByIndex_P
-  .type NS_InvokeByIndex_P, @function
+.globl NS_InvokeByIndex
+  .type NS_InvokeByIndex, @function
 
 
-NS_InvokeByIndex_P:
+NS_InvokeByIndex:
   .PROC
   .CALLINFO FRAME=72, CALLER,SAVE_RP, SAVE_SP, ENTRY_GR=3
   .ENTRY
 
 ; frame marker takes 48 bytes,
 ; register spill area takes 8 bytes,
 ; local stack area takes 72 bytes result in 128 bytes total
 
@@ -99,10 +99,10 @@ NS_InvokeByIndex_P:
         COPY    %r3,%r30              ; restore saved stack ptr
 
         LDW          -148(%sp),%rp
         LDWM       -128(%sp),%r3
         BV,N             (%rp)
         NOP
   .EXIT
   .PROCEND  ;in=23,24,25,26;
-  .SIZE NS_InvokeByIndex_P, .-NS_InvokeByIndex_P
+  .SIZE NS_InvokeByIndex, .-NS_InvokeByIndex
 
--- a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc64_linux.s
+++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc64_linux.s
@@ -14,31 +14,31 @@
 .set f10,10; .set f11,11; .set f12,12; .set f13,13; .set f14,14
 .set f15,15; .set f16,16; .set f17,17; .set f18,18; .set f19,19
 .set f20,20; .set f21,21; .set f22,22; .set f23,23; .set f24,24
 .set f25,25; .set f26,26; .set f27,27; .set f28,28; .set f29,29
 .set f30,30; .set f31,31
 
 
 #
-# NS_InvokeByIndex_P(nsISupports* that, uint32_t methodIndex,
+# NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
 #                    uint32_t paramCount, nsXPTCVariant* params)
 #
 
         .section ".toc","aw"
         .section ".text"
         .align 2
-        .globl  NS_InvokeByIndex_P
+        .globl  NS_InvokeByIndex
         .section ".opd","aw"
         .align 3
-NS_InvokeByIndex_P:
-        .quad   .NS_InvokeByIndex_P,.TOC.@tocbase
+NS_InvokeByIndex:
+        .quad   .NS_InvokeByIndex,.TOC.@tocbase
         .previous
-        .type   NS_InvokeByIndex_P,@function
-.NS_InvokeByIndex_P:
+        .type   NS_InvokeByIndex,@function
+.NS_InvokeByIndex:
         mflr    0
         std     0,16(r1)
 
         std     r29,-24(r1)
         std     r30,-16(r1)
         std     r31,-8(r1)
 
         mr      r29,r3                  # Save 'that' in r29
@@ -121,12 +121,12 @@ NS_InvokeByIndex_P:
         ld      r1,0(r1)                # Revert stack frame
         ld      0,16(r1)                # Reload lr
         ld      29,-24(r1)              # Restore NVGPRS
         ld      30,-16(r1)
         ld      31,-8(r1)
         mtlr    0
         blr
 
-        .size   NS_InvokeByIndex_P,.-.NS_InvokeByIndex_P
+        .size   NS_InvokeByIndex,.-.NS_InvokeByIndex
 
         # Magic indicating no need for an executable stack
         .section .note.GNU-stack, "", @progbits ; .previous
--- a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_aix.s
+++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_aix.s
@@ -20,34 +20,34 @@
 .set f25,25; .set f26,26; .set f27,27; .set f28,28; .set f29,29
 .set f30,30; .set f31,31
 .set BO_IF,12
 .set CR0_EQ,2
 
 
 
         .rename H.10.NO_SYMBOL{PR},""
-        .rename H.18.NS_InvokeByIndex_P{TC},"NS_InvokeByIndex_P"
+        .rename H.18.NS_InvokeByIndex{TC},"NS_InvokeByIndex"
 
 
 # .text section
 
         .csect  H.10.NO_SYMBOL{PR}
-        .globl  .NS_InvokeByIndex_P
-        .globl  NS_InvokeByIndex_P{DS}
+        .globl  .NS_InvokeByIndex
+        .globl  NS_InvokeByIndex{DS}
         .extern .invoke_copy_to_stack
         .extern ._ptrgl{PR}
 
 
 #
-#   NS_InvokeByIndex_P(nsISupports* that, uint32_t methodIndex,
+#   NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
 #                   uint32_t paramCount, nsXPTCVariant* params)
 #
 
-.NS_InvokeByIndex_P:
+.NS_InvokeByIndex:
 		mflr	r0
 		stw	r31,-4(sp)
 #
 # save off the incoming values in the caller's parameter area
 #		
 		stw	r3,24(sp)		# that
 		stw	r4,28(sp)		# methodIndex
 		stw	r5,32(sp)		# paramCount
@@ -112,18 +112,18 @@
 		mtlr    r0
 		lwz     r31,-4(sp)
 	        blr
 
 
 # .data section
 
         .toc                            # 0x00000038
-T.18.NS_InvokeByIndex_P:
-        .tc     H.18.NS_InvokeByIndex_P{TC},NS_InvokeByIndex_P{DS}
+T.18.NS_InvokeByIndex:
+        .tc     H.18.NS_InvokeByIndex{TC},NS_InvokeByIndex{DS}
 
-        .csect  NS_InvokeByIndex_P{DS}
-        .long   .NS_InvokeByIndex_P     # "\0\0\0\0"
+        .csect  NS_InvokeByIndex{DS}
+        .long   .NS_InvokeByIndex     # "\0\0\0\0"
         .long   TOC{TC0}                # "\0\0\0008"
         .long   0x00000000              # "\0\0\0\0"
-# End   csect   NS_InvokeByIndex_P{DS}
+# End   csect   NS_InvokeByIndex{DS}
 
 # .bss section	
--- a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_aix64.s
+++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_aix64.s
@@ -15,33 +15,33 @@
 .set f15,15; .set f16,16; .set f17,17; .set f18,18; .set f19,19
 .set f20,20; .set f21,21; .set f22,22; .set f23,23; .set f24,24
 .set f25,25; .set f26,26; .set f27,27; .set f28,28; .set f29,29
 .set f30,30; .set f31,31
 .set BO_IF,12
 .set CR0_EQ,2
 
         .rename H.10.NO_SYMBOL{PR},""
-        .rename H.18.NS_InvokeByIndex_P{TC},"NS_InvokeByIndex_P"
+        .rename H.18.NS_InvokeByIndex{TC},"NS_InvokeByIndex"
 
 
 # .text section
 
         .csect  H.10.NO_SYMBOL{PR}
-        .globl  .NS_InvokeByIndex_P
-        .globl  NS_InvokeByIndex_P{DS}
+        .globl  .NS_InvokeByIndex
+        .globl  NS_InvokeByIndex{DS}
         .extern .invoke_copy_to_stack
         .extern ._ptrgl{PR}
 
 #
-#   NS_InvokeByIndex_P(nsISupports* that, uint32_t methodIndex,
+#   NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
 #                      uint32_t paramCount, nsXPTCVariant* params)
 #
 
-.NS_InvokeByIndex_P:
+.NS_InvokeByIndex:
         mflr    r0
         std     r31,-8(sp)
 #
 # save off the incoming values in the caller's parameter area
 #		
         std     r3,48(sp)       # that
         std     r4,56(sp)       # methodIndex
         std     r5,64(sp)       # paramCount
@@ -111,18 +111,18 @@
         addi    sp,sp,168
         mtlr    r0
         ld      r31,-8(sp)
         blr
 
 # .data section
 
         .toc                            # 0x00000038
-T.18.NS_InvokeByIndex_P:
-        .tc     H.18.NS_InvokeByIndex_P{TC},NS_InvokeByIndex_P{DS}
+T.18.NS_InvokeByIndex:
+        .tc     H.18.NS_InvokeByIndex{TC},NS_InvokeByIndex{DS}
 
-        .csect  NS_InvokeByIndex_P{DS}
-        .llong  .NS_InvokeByIndex_P     # "\0\0\0\0"
+        .csect  NS_InvokeByIndex{DS}
+        .llong  .NS_InvokeByIndex     # "\0\0\0\0"
         .llong  TOC{TC0}                # "\0\0\0008"
         .llong  0x00000000              # "\0\0\0\0"
-# End   csect   NS_InvokeByIndex_P{DS}
+# End   csect   NS_InvokeByIndex{DS}
 
 # .bss section
--- a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_ibmobj_aix.s
+++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_ibmobj_aix.s
@@ -20,34 +20,34 @@
 .set f25,25; .set f26,26; .set f27,27; .set f28,28; .set f29,29
 .set f30,30; .set f31,31
 .set BO_IF,12
 .set CR0_EQ,2
 
 
 
         .rename H.10.NO_SYMBOL{PR},""
-        .rename H.18.NS_InvokeByIndex_P{TC},"NS_InvokeByIndex_P"
+        .rename H.18.NS_InvokeByIndex{TC},"NS_InvokeByIndex"
 
 
 # .text section
 
         .csect  H.10.NO_SYMBOL{PR}
-        .globl  .NS_InvokeByIndex_P
-        .globl  NS_InvokeByIndex_P{DS}
+        .globl  .NS_InvokeByIndex
+        .globl  NS_InvokeByIndex{DS}
         .extern .invoke_copy_to_stack
         .extern ._ptrgl{PR}
 
 
 #
-#   NS_InvokeByIndex_P(nsISupports* that, uint32_t methodIndex,
+#   NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
 #                   uint32_t paramCount, nsXPTCVariant* params)
 #
 
-.NS_InvokeByIndex_P:
+.NS_InvokeByIndex:
 		mflr	r0
 		stw	r31,-4(sp)
 #
 # save off the incoming values in the caller's parameter area
 #		
 		stw	r3,24(sp)		# that
 		stw	r4,28(sp)		# methodIndex
 		stw	r5,32(sp)		# paramCount
@@ -107,18 +107,18 @@
 		mtlr    r0
 		lwz     r31,-4(sp)
 	        blr
 
 
 # .data section
 
         .toc                            # 0x00000038
-T.18.NS_InvokeByIndex_P:
-        .tc     H.18.NS_InvokeByIndex_P{TC},NS_InvokeByIndex_P{DS}
+T.18.NS_InvokeByIndex:
+        .tc     H.18.NS_InvokeByIndex{TC},NS_InvokeByIndex{DS}
 
-        .csect  NS_InvokeByIndex_P{DS}
-        .long   .NS_InvokeByIndex_P     # "\0\0\0\0"
+        .csect  NS_InvokeByIndex{DS}
+        .long   .NS_InvokeByIndex     # "\0\0\0\0"
         .long   TOC{TC0}                # "\0\0\0008"
         .long   0x00000000              # "\0\0\0\0"
-# End   csect   NS_InvokeByIndex_P{DS}
+# End   csect   NS_InvokeByIndex{DS}
 
 # .bss section	
--- a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_linux.s
+++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_linux.s
@@ -16,25 +16,25 @@
 .set f10,10; .set f11,11; .set f12,12; .set f13,13; .set f14,14
 .set f15,15; .set f16,16; .set f17,17; .set f18,18; .set f19,19
 .set f20,20; .set f21,21; .set f22,22; .set f23,23; .set f24,24
 .set f25,25; .set f26,26; .set f27,27; .set f28,28; .set f29,29
 .set f30,30; .set f31,31
 		      
         .section ".text"
 	.align 2
-	.globl NS_InvokeByIndex_P
-	.type  NS_InvokeByIndex_P,@function
+	.globl NS_InvokeByIndex
+	.type  NS_InvokeByIndex,@function
 
 //
-// NS_InvokeByIndex_P(nsISupports* that, uint32_t methodIndex,
+// NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
 //                  uint32_t paramCount, nsXPTCVariant* params)
 //
 
-NS_InvokeByIndex_P:
+NS_InvokeByIndex:
 	stwu    sp,-32(sp)			// setup standard stack frame
 	mflr    r0				// save LR
 	stw     r3,8(sp)			// r3 <= that
 	stw     r4,12(sp)			// r4 <= methodIndex
 	stw     r30,16(sp)
 	stw     r31,20(sp)
 
 	stw     r0,36(sp)			// store LR backchain
--- a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_openbsd.s
+++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_openbsd.s
@@ -16,25 +16,25 @@
 .set f10,10; .set f11,11; .set f12,12; .set f13,13; .set f14,14
 .set f15,15; .set f16,16; .set f17,17; .set f18,18; .set f19,19
 .set f20,20; .set f21,21; .set f22,22; .set f23,23; .set f24,24
 .set f25,25; .set f26,26; .set f27,27; .set f28,28; .set f29,29
 .set f30,30; .set f31,31
 
 	.section ".text"
 	.align 2
-	.globl NS_InvokeByIndex_P
-	.type  NS_InvokeByIndex_P,@function
+	.globl NS_InvokeByIndex
+	.type  NS_InvokeByIndex,@function
 
 //
-// NS_InvokeByIndex_P(nsISupports* that, uint32_t methodIndex,
+// NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
 //                    uint32_t paramCount, nsXPTCVariant* params)
 //
 
-NS_InvokeByIndex_P:
+NS_InvokeByIndex:
 	stwu	sp,-32(sp)			// setup standard stack frame
 	mflr	r0				// save LR
 	stw	r3,8(sp)			// r3 <= that
 	stw	r4,12(sp)			// r4 <= methodIndex
 	stw	r30,16(sp)
 	stw	r31,20(sp)
 
 	stw	r0,36(sp)			// store LR backchain
--- a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_rhapsody.s
+++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_rhapsody.s
@@ -9,22 +9,22 @@
 # ** Assumed vtable layout (obtained by disassembling with gdb):
 # ** 4 bytes per vtable entry, skip 0th and 1st entries, so the mapping
 # ** from index to entry is (4 * index) + 8.
 #
 
 .text
 	.align 2
 #
-#   NS_InvokeByIndex_P(nsISupports* that, uint32_t methodIndex,
+#   NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
 #                    uint32_t paramCount, nsXPTCVariant* params)
 #
 
-.globl __NS_InvokeByIndex_P	
-__NS_InvokeByIndex_P:
+.globl __NS_InvokeByIndex	
+__NS_InvokeByIndex:
 	mflr	r0
 	stw	r31,-4(r1)
 #
 # save off the incoming values in the callers parameter area
 #		
 	stw	r3,24(r1)               ; that
 	stw	r4,28(r1)               ; methodIndex
 	stw	r5,32(r1)               ; paramCount
--- a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc64_openbsd.s
+++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc64_openbsd.s
@@ -9,25 +9,25 @@
     for sparcv9 Solaris.
 
     See the SPARC Compliance Definition (SCD) Chapter 3
     for more information about what is going on here, including
     the use of BIAS (0x7ff).
     The SCD is available from http://www.sparc.com/.
 */
 
-        .global NS_InvokeByIndex_P
-        .type   NS_InvokeByIndex_P, #function
+        .global NS_InvokeByIndex
+        .type   NS_InvokeByIndex, #function
 
 /*
-    NS_InvokeByIndex_P(nsISupports* that, uint32_t methodIndex,
+    NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
                      uint32_t paramCount, nsXPTCVariant* params);
     
 */
-NS_InvokeByIndex_P:
+NS_InvokeByIndex:
         save    %sp,-(128 + 64),%sp ! room for the register window and
                                     ! struct pointer, rounded up to 0 % 64
         sll     %i2,4,%l0           ! assume the worst case
                                     ! paramCount * 2 * 8 bytes
         cmp     %l0, 0              ! are there any args? If not,
         be      .invoke             ! no need to copy args to stack
         nop
 
@@ -78,9 +78,9 @@ NS_InvokeByIndex_P:
 
         jmpl    %l0,%o7             ! call the routine
         mov     %i0,%o0             ! move 'this' pointer to out register
 
         mov     %o0,%i0             ! propagate return value
         ret
         restore
 
-        .size    NS_InvokeByIndex_P, .-NS_InvokeByIndex
+        .size    NS_InvokeByIndex, .-NS_InvokeByIndex
--- a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc_linux_GCC3.s
+++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc_linux_GCC3.s
@@ -3,23 +3,23 @@
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /*
  * Platform specific code to invoke XPCOM methods on native objects for
  * Linux/Sparc with gcc 3 ABI.
  */
-        .global NS_InvokeByIndex_P
+        .global NS_InvokeByIndex
 /*
  *  NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
  *                 uint32_t paramCount, nsXPTCVariant* params);
  *   
  */
-NS_InvokeByIndex_P:
+NS_InvokeByIndex:
         save    %sp,-(64 + 16),%sp   ! room for the register window and
                                     ! struct pointer, rounded up to 0 % 16
         mov     %i2,%o0             ! paramCount
         call    invoke_count_words  ! returns the required stack size in %o0
         mov     %i3,%o1             ! params
         
 	sll     %o0,2,%l0           ! number of bytes
         sub     %sp,%l0,%sp         ! create the additional stack space
--- a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc_solaris_GCC3.s
+++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc_solaris_GCC3.s
@@ -3,22 +3,22 @@
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /*
  * Platform specific code to invoke XPCOM methods on native objects for
  * solaris/sparc with gcc 3 ABI.
  */
-        .global NS_InvokeByIndex_P
+        .global NS_InvokeByIndex
 /*
- *  NS_InvokeByIndex_P(nsISupports* that, uint32_t methodIndex,
+ *  NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
  *                   uint32_t paramCount, nsXPTCVariant* params);
  */
-NS_InvokeByIndex_P:
+NS_InvokeByIndex:
         save    %sp,-(64 + 32),%sp  ! room for the register window and
                                     ! struct pointer, rounded up to 0 % 32
         mov     %i2,%o0             ! paramCount
         call    invoke_count_words  ! returns the required stack size in %o0
         mov     %i3,%o1             ! params
         
         sll     %o0,2,%l0           ! number of bytes
         sub     %sp,%l0,%sp         ! create the additional stack space
--- a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc_solaris_SUNW.s
+++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc_solaris_SUNW.s
@@ -1,24 +1,24 @@
 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  *
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* Platform specific code to invoke XPCOM methods on native objects */
 
-        .global NS_InvokeByIndex_P
-        .type   NS_InvokeByIndex_P, #function
+        .global NS_InvokeByIndex
+        .type   NS_InvokeByIndex, #function
 /*
-    NS_InvokeByIndex_P(nsISupports* that, uint32_t methodIndex,
+    NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
                      uint32_t paramCount, nsXPTCVariant* params);
     
 */
-NS_InvokeByIndex_P:
+NS_InvokeByIndex:
         save    %sp,-(64 + 32),%sp  ! room for the register window and
                                     ! struct pointer, rounded up to 0 % 32
         sll     %i2,3,%l0           ! assume the worst case
                                     ! paramCount * 2 * 4 bytes
         cmp     %l0, 0              ! are there any args? If not,
         be      .invoke             ! no need to copy args to stack
 
         sub     %sp,%l0,%sp         ! create the additional stack space
@@ -48,9 +48,9 @@ NS_InvokeByIndex_P:
 
         jmpl    %l0,%o7             ! call the routine
         mov     %i0,%o0             ! move 'this' pointer to out register
 
         mov     %o0,%i0             ! propagate return value
         ret
         restore
 
-        .size    NS_InvokeByIndex_P, .-NS_InvokeByIndex_P
+        .size    NS_InvokeByIndex, .-NS_InvokeByIndex
--- a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparcv9_solaris_SUNW.s
+++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparcv9_solaris_SUNW.s
@@ -9,25 +9,25 @@
     for sparcv9 Solaris.
 
     See the SPARC Compliance Definition (SCD) Chapter 3
     for more information about what is going on here, including
     the use of BIAS (0x7ff).
     The SCD is available from http://www.sparc.com/.
 */
 
-        .global NS_InvokeByIndex_P
-        .type   NS_InvokeByIndex_P, #function
+        .global NS_InvokeByIndex
+        .type   NS_InvokeByIndex, #function
 
 /*
-    NS_InvokeByIndex_P(nsISupports* that, uint32_t methodIndex,
+    NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
                      uint32_t paramCount, nsXPTCVariant* params);
     
 */
-NS_InvokeByIndex_P:
+NS_InvokeByIndex:
         save    %sp,-(128 + 64),%sp ! room for the register window and
                                     ! struct pointer, rounded up to 0 % 64
         sll     %i2,4,%l0           ! assume the worst case
                                     ! paramCount * 2 * 8 bytes
         cmp     %l0, 0              ! are there any args? If not,
         be      .invoke             ! no need to copy args to stack
 
         sub     %sp,%l0,%sp         ! create the additional stack space
@@ -77,9 +77,9 @@ NS_InvokeByIndex_P:
 
         jmpl    %l0,%o7             ! call the routine
         mov     %i0,%o0             ! move 'this' pointer to out register
 
         mov     %o0,%i0             ! propagate return value
         ret
         restore
 
-        .size    NS_InvokeByIndex_P, .-NS_InvokeByIndex_P
+        .size    NS_InvokeByIndex, .-NS_InvokeByIndex
--- a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_x86_solaris_SUNW.s
+++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_x86_solaris_SUNW.s
@@ -1,11 +1,11 @@
-	.globl NS_InvokeByIndex_P
-	.type NS_InvokeByIndex_P, @function
-NS_InvokeByIndex_P:
+	.globl NS_InvokeByIndex
+	.type NS_InvokeByIndex, @function
+NS_InvokeByIndex:
 	push       %ebp
 	movl       %esp,%ebp
 	push       %ebx
 	call       .CG0.66
 .CG0.66:
 	pop        %ebx
 	addl       $_GLOBAL_OFFSET_TABLE_+0x1,%ebx
 	push       20(%ebp)
@@ -46,10 +46,10 @@ NS_InvokeByIndex_P:
 	popl	%esi
 	popl	%ebx
 	/ INLINE_END
 	addl       $16,%esp
 	pop        %ebx
 	movl       %ebp,%esp
 	pop        %ebp
 	ret        
-	.size NS_InvokeByIndex_P, . - NS_InvokeByIndex_P
+	.size NS_InvokeByIndex, . - NS_InvokeByIndex
 
--- a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_gcc_x86_unix.cpp
+++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_gcc_x86_unix.cpp
@@ -28,17 +28,17 @@ invoke_copy_to_stack(uint32_t paramCount
         default                  : *((void**)d)    = s->val.p;           break;
         }
     }
 }
 } // extern "C"
 
 /*
   EXPORT_XPCOM_API(nsresult)
-  NS_InvokeByIndex_P(nsISupports* that, uint32_t methodIndex,
+  NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
                    uint32_t paramCount, nsXPTCVariant* params);
 
   Each param takes at most two 4-byte words.
   It doesn't matter if we push too many words, and calculating the exact
   amount takes time.
 
   that        = ebp + 0x08
   methodIndex = ebp + 0x0c
@@ -47,21 +47,21 @@ invoke_copy_to_stack(uint32_t paramCount
 
 */
 
 __asm__ (
 	".text\n\t"
 /* alignment here seems unimportant here; this was 16, now it's 2 which
    is what xptcstubs uses. */
 	".align 2\n\t"
-	".globl " SYMBOL_UNDERSCORE "NS_InvokeByIndex_P\n\t"
+	".globl " SYMBOL_UNDERSCORE "NS_InvokeByIndex\n\t"
 #ifndef XP_MACOSX
-	".type  " SYMBOL_UNDERSCORE "NS_InvokeByIndex_P,@function\n"
+	".type  " SYMBOL_UNDERSCORE "NS_InvokeByIndex,@function\n"
 #endif
-	SYMBOL_UNDERSCORE "NS_InvokeByIndex_P:\n\t"
+	SYMBOL_UNDERSCORE "NS_InvokeByIndex:\n\t"
 	"pushl %ebp\n\t"
 	"movl  %esp, %ebp\n\t"
 	"movl  0x10(%ebp), %eax\n\t"
 	"leal  0(,%eax,8),%edx\n\t"
 
         /* set up call frame for method. */
 	"subl  %edx, %esp\n\t"       /* make room for params. */
 /* Align to maximum x86 data size: 128 bits == 16 bytes == XMM register size.
@@ -87,11 +87,11 @@ invoke_copy_to_stack(uint32_t paramCount
 	"movl  (%ecx), %edx\n\t"
 	"movl  0x0c(%ebp), %eax\n\t"    /* function index */
 	"leal  (%edx,%eax,4), %edx\n\t"
 	"call  *(%edx)\n\t"
 	"movl  %ebp, %esp\n\t"
 	"popl  %ebp\n\t"
 	"ret\n"
 #ifndef XP_MACOSX
-	".size " SYMBOL_UNDERSCORE "NS_InvokeByIndex_P, . -" SYMBOL_UNDERSCORE "NS_InvokeByIndex_P\n\t"
+	".size " SYMBOL_UNDERSCORE "NS_InvokeByIndex, . -" SYMBOL_UNDERSCORE "NS_InvokeByIndex\n\t"
 #endif
 );
--- a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_linux_alpha.cpp
+++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_linux_alpha.cpp
@@ -56,30 +56,30 @@ invoke_copy_to_stack(uint64_t* d, uint32
             *d = (uint64_t)s->val.p;
             break;
         }
     }
 }
 
 /*
  * EXPORT_XPCOM_API(nsresult)
- * NS_InvokeByIndex_P(nsISupports* that, uint32_t methodIndex,
+ * NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
  *                  uint32_t paramCount, nsXPTCVariant* params)
  */
 __asm__(
-    "#### NS_InvokeByIndex_P ####\n"
+    "#### NS_InvokeByIndex ####\n"
 ".text\n\t"
     ".align 5\n\t"
-    ".globl NS_InvokeByIndex_P\n\t"
-    ".ent NS_InvokeByIndex_P\n"
-"NS_InvokeByIndex_P:\n\t"
+    ".globl NS_InvokeByIndex\n\t"
+    ".ent NS_InvokeByIndex\n"
+"NS_InvokeByIndex:\n\t"
     ".frame $15,32,$26,0\n\t"
     ".mask 0x4008000,-32\n\t"
     "ldgp $29,0($27)\n"
-"$NS_InvokeByIndex_P..ng:\n\t"
+"$NS_InvokeByIndex..ng:\n\t"
     "subq $30,32,$30\n\t"
     "stq $26,0($30)\n\t"
     "stq $15,8($30)\n\t"
     "bis $30,$30,$15\n\t"
     ".prologue 1\n\t"
 
     /*
      * Allocate enough stack space to hold the greater of 6 or "paramCount"+1
@@ -135,10 +135,10 @@ invoke_copy_to_stack(uint64_t* d, uint32
     "jsr $26,($27),0\n\t"   /* call virtual function */
     "ldgp $29,0($26)\n\t"
 
     "bis $15,$15,$30\n\t"
     "ldq $26,0($30)\n\t"
     "ldq $15,8($30)\n\t"
     "addq $30,32,$30\n\t"
     "ret $31,($26),1\n\t"
-    ".end NS_InvokeByIndex_P"
+    ".end NS_InvokeByIndex"
     );
--- a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_linux_m68k.cpp
+++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_linux_m68k.cpp
@@ -92,17 +92,17 @@ extern "C" {
                 *((void**)d) = s->val.p;
                 break;
             }
         }
     }
 }
 
 EXPORT_XPCOM_API(nsresult)
-NS_InvokeByIndex_P(nsISupports* that, uint32_t methodIndex,
+NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
                    uint32_t paramCount, nsXPTCVariant* params)
 {
     uint32_t result, n;
 
     n = invoke_count_words(paramCount, params) * 4;
 
  __asm__ __volatile__(
     "subl  %5, %%sp\n\t"      /* make room for params */
--- a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_mips.cpp
+++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_mips.cpp
@@ -82,18 +82,18 @@ invoke_copy_to_stack(uint32_t* d, uint32
         case nsXPTType::T_WCHAR  : *d = (wchar_t) s->val.wc;    break;
         default:
             *((void**)d) = s->val.p;
             break;
         }
     }
 }
 
-extern "C" nsresult _NS_InvokeByIndex_P(nsISupports* that, uint32_t methodIndex,
+extern "C" nsresult _NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
                                         uint32_t paramCount,
                                         nsXPTCVariant* params);
 
 EXPORT_XPCOM_API(nsresult)
-NS_InvokeByIndex_P(nsISupports* that, uint32_t methodIndex,
+NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
                    uint32_t paramCount, nsXPTCVariant* params)
 {
-    return _NS_InvokeByIndex_P(that, methodIndex, paramCount, params);
+    return _NS_InvokeByIndex(that, methodIndex, paramCount, params);
 }
--- a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_mips64.cpp
+++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_mips64.cpp
@@ -123,18 +123,18 @@ invoke_copy_to_stack(uint64_t* d, uint32
                 regs[i] = (uint64_t)s->val.p;
             else
                *d++ = (uint64_t)s->val.p;
             break;
         }
     }
 }
 
-extern "C" nsresult _NS_InvokeByIndex_P(nsISupports* that, uint32_t methodIndex,
+extern "C" nsresult _NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
                                         uint32_t paramCount,
                                         nsXPTCVariant* params);
 
 EXPORT_XPCOM_API(nsresult)
-NS_InvokeByIndex_P(nsISupports* that, uint32_t methodIndex,
+NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
                    uint32_t paramCount, nsXPTCVariant* params)
 {
-    return _NS_InvokeByIndex_P(that, methodIndex, paramCount, params);
+    return _NS_InvokeByIndex(that, methodIndex, paramCount, params);
 }
--- a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc64_linux.cpp
+++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc64_linux.cpp
@@ -1,18 +1,18 @@
 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 // Platform specific code to invoke XPCOM methods on native objects
 
-// The purpose of NS_InvokeByIndex_P() is to map a platform
+// The purpose of NS_InvokeByIndex() is to map a platform
 // independent call to the platform ABI. To do that,
-// NS_InvokeByIndex_P() has to determine the method to call via vtable
+// NS_InvokeByIndex() has to determine the method to call via vtable
 // access. The parameters for the method are read from the
 // nsXPTCVariant* and prepared for the native ABI.
 
 // The PowerPC64 platform ABI can be found here:
 // http://www.freestandards.org/spec/ELF/ppc64/
 // and in particular:
 // http://www.freestandards.org/spec/ELF/ppc64/PPC-elf64abi-1.9.html#FUNC-CALL
 
@@ -85,11 +85,11 @@ invoke_copy_to_stack(uint64_t* gpregs,
                 *d = tempu64;
         }
         if (i >= 7)
             d++;
     }
 }
 
 EXPORT_XPCOM_API(nsresult)
-NS_InvokeByIndex_P(nsISupports* that, uint32_t methodIndex,
+NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
                    uint32_t paramCount, nsXPTCVariant* params);
 
--- a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_linux.cpp
+++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_linux.cpp
@@ -1,18 +1,18 @@
 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 // Platform specific code to invoke XPCOM methods on native objects
 
-// The purpose of NS_InvokeByIndex_P() is to map a platform
+// The purpose of NS_InvokeByIndex() is to map a platform
 // indepenpent call to the platform ABI. To do that,
-// NS_InvokeByIndex_P() has to determine the method to call via vtable
+// NS_InvokeByIndex() has to determine the method to call via vtable
 // access. The parameters for the method are read from the
 // nsXPTCVariant* and prepared for th native ABI.  For the Linux/PPC
 // ABI this means that the first 8 integral and floating point
 // parameters are passed in registers.
 
 #include "xptcprivate.h"
 
 // 8 integral parameters are passed in registers
@@ -115,10 +115,10 @@ invoke_copy_to_stack(uint32_t* d,
                 *d++          = tempu32;
         }
         
     }
 }
 
 extern "C"
 EXPORT_XPCOM_API(nsresult)
-NS_InvokeByIndex_P(nsISupports* that, uint32_t methodIndex,
+NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
                  uint32_t paramCount, nsXPTCVariant* params);
--- a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_openbsd.cpp
+++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_openbsd.cpp
@@ -1,18 +1,18 @@
 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 // Platform specific code to invoke XPCOM methods on native objects
 
-// The purpose of NS_InvokeByIndex_P() is to map a platform
+// The purpose of NS_InvokeByIndex() is to map a platform
 // indepenpent call to the platform ABI. To do that,
-// NS_InvokeByIndex_P() has to determine the method to call via vtable
+// NS_InvokeByIndex() has to determine the method to call via vtable
 // access. The parameters for the method are read from the
 // nsXPTCVariant* and prepared for th native ABI.  For the Linux/PPC
 // ABI this means that the first 8 integral and floating point
 // parameters are passed in registers.
 
 #include "xptcprivate.h"
 
 // 8 integral parameters are passed in registers
@@ -97,10 +97,10 @@ invoke_copy_to_stack(uint32_t* d,
                 *d++          = tempu32;
         }
         
     }
 }
 
 extern "C"
 EXPORT_XPCOM_API(nsresult)
-NS_InvokeByIndex_P(nsISupports* that, uint32_t methodIndex,
+NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
                  uint32_t paramCount, nsXPTCVariant* params);
--- a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_rhapsody.cpp
+++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_rhapsody.cpp
@@ -96,18 +96,18 @@ invoke_copy_to_stack(uint32_t* d, uint32
         default:
             // all the others are plain pointer types
             *((void**)d) = s->val.p;
             break;
         }
     }
 }
 
-extern "C" nsresult _NS_InvokeByIndex_P(nsISupports* that, uint32_t methodIndex,
+extern "C" nsresult _NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
                                       uint32_t paramCount, 
                                       nsXPTCVariant* params);
 
 EXPORT_XPCOM_API(nsresult)
-NS_InvokeByIndex_P(nsISupports* that, uint32_t methodIndex,
+NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
                  uint32_t paramCount, nsXPTCVariant* params)
 {
-    return _NS_InvokeByIndex_P(that, methodIndex, paramCount, params);
+    return _NS_InvokeByIndex(that, methodIndex, paramCount, params);
 }    
--- a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_x86_64_solaris.cpp
+++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_x86_64_solaris.cpp
@@ -96,17 +96,17 @@ invoke_copy_to_stack(uint64_t * d, uint3
                 gpregs[nr_gpr++] = value;
             else
                 *d++ = value;
         }
     }
 }
 
 EXPORT_XPCOM_API(nsresult)
-NS_InvokeByIndex_P(nsISupports * that, uint32_t methodIndex,
+NS_InvokeByIndex(nsISupports * that, uint32_t methodIndex,
                  uint32_t paramCount, nsXPTCVariant * params)
 {
     uint32_t nr_gpr, nr_fpr, nr_stack;
     invoke_count_words(paramCount, params, nr_gpr, nr_fpr, nr_stack);
     
     // Stack, if used, must be 16-bytes aligned
     if (nr_stack)
         nr_stack = (nr_stack + 1) & ~1;
--- a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_x86_64_unix.cpp
+++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_x86_64_unix.cpp
@@ -97,17 +97,17 @@ invoke_copy_to_stack(uint64_t * d, uint3
                 gpregs[nr_gpr++] = value;
             else
                 *d++ = value;
         }
     }
 }
 
 EXPORT_XPCOM_API(nsresult)
-NS_InvokeByIndex_P(nsISupports * that, uint32_t methodIndex,
+NS_InvokeByIndex(nsISupports * that, uint32_t methodIndex,
                  uint32_t paramCount, nsXPTCVariant * params)
 {
     uint32_t nr_stack;
     invoke_count_words(paramCount, params, nr_stack);
     
     // Stack, if used, must be 16-bytes aligned
     if (nr_stack)
         nr_stack = (nr_stack + 1) & ~1;
--- a/xpcom/reflect/xptcall/src/md/win32/xptcinvoke.cpp
+++ b/xpcom/reflect/xptcall/src/md/win32/xptcinvoke.cpp
@@ -44,17 +44,17 @@ invoke_copy_to_stack(uint32_t* d, uint32
     }
 }
 
 #pragma warning(disable : 4035) // OK to have no return value
 // Tell the PDB file this function has a standard frame pointer, and not to use
 // a custom FPO program.
 #pragma optimize( "y", off )
 extern "C" NS_EXPORT nsresult NS_FROZENCALL
-NS_InvokeByIndex_P(nsISupports* that, uint32_t methodIndex,
+NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
                  uint32_t paramCount, nsXPTCVariant* params)
 {
     __asm {
         mov     edx,paramCount      // Save paramCount for later
         test    edx,edx             // maybe we don't have any params to copy
         jz      noparams
         mov     eax,edx             
         shl     eax,3               // *= 8 (max possible param size)
--- a/xpcom/reflect/xptcall/src/md/win32/xptcinvoke_x86_64.cpp
+++ b/xpcom/reflect/xptcall/src/md/win32/xptcinvoke_x86_64.cpp
@@ -46,14 +46,14 @@ invoke_copy_to_stack(uint64_t* d, uint32
 }
 
 extern "C" nsresult
 XPTC__InvokebyIndex(nsISupports* that, uint32_t methodIndex,
                     uint32_t paramCount, nsXPTCVariant* params);
 
 extern "C"
 EXPORT_XPCOM_API(nsresult)
-NS_InvokeByIndex_P(nsISupports* that, uint32_t methodIndex,
+NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
                    uint32_t paramCount, nsXPTCVariant* params)
 {
     return XPTC__InvokebyIndex(that, methodIndex, paramCount, params);
 }
 
--- a/xpcom/reflect/xptcall/src/md/win32/xptcinvoke_x86_gnu.cpp
+++ b/xpcom/reflect/xptcall/src/md/win32/xptcinvoke_x86_gnu.cpp
@@ -40,17 +40,17 @@ invoke_copy_to_stack(uint32_t paramCount
             break;
         }
     }
 }
 } // extern "C"
 
 /*
   EXPORT_XPCOM_API(nsresult)
-  NS_InvokeByIndex_P(nsISupports* that, uint32_t methodIndex,
+  NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
                    uint32_t paramCount, nsXPTCVariant* params);
 
   Each param takes at most two 4-byte words.
   It doesn't matter if we push too many words, and calculating the exact
   amount takes time.
 
   that        = ebp + 0x08
   methodIndex = ebp + 0x0c
@@ -59,18 +59,18 @@ invoke_copy_to_stack(uint32_t paramCount
 
 */
 
 __asm__ (
 	".text\n\t"
 /* alignment here seems unimportant here; this was 16, now it's 2 which
    is what xptcstubs uses. */
 	".align 2\n\t"
-	".globl _NS_InvokeByIndex_P\n\t"
-	"_NS_InvokeByIndex_P:\n\t"
+	".globl _NS_InvokeByIndex\n\t"
+	"_NS_InvokeByIndex:\n\t"
 	"pushl %ebp\n\t"
 	"movl  %esp, %ebp\n\t"
 	"movl  0x10(%ebp), %eax\n\t"
 	"leal  0(,%eax,8),%edx\n\t"
 
         /* set up call frame for method. */
 	"subl  %edx, %esp\n\t"       /* make room for params. */
 /* Align to maximum x86 data size: 128 bits == 16 bytes == XMM register size.
@@ -96,11 +96,11 @@ invoke_copy_to_stack(uint32_t paramCount
 	"movl  (%ecx), %edx\n\t"
 	"movl  0x0c(%ebp), %eax\n\t"    /* function index */
 	"leal  (%edx,%eax,4), %edx\n\t"
 	"call  *(%edx)\n\t"
 	"movl  %ebp, %esp\n\t"
 	"popl  %ebp\n\t"
 	"ret\n"
 	".section .drectve\n\t"
-	".ascii \" -export:NS_InvokeByIndex_P\"\n\t"
+	".ascii \" -export:NS_InvokeByIndex\"\n\t"
 	".text\n\t"
 );
--- a/xpcom/string/public/nsXPCOMStrings.h
+++ b/xpcom/string/public/nsXPCOMStrings.h
@@ -13,44 +13,16 @@
 /**
  * nsXPCOMStrings.h
  *
  * This file describes a minimal API for working with XPCOM's abstract
  * string classes.  It divorces the consumer from having any run-time
  * dependency on the implementation details of the abstract string types.
  */
 
-// Map frozen functions to private symbol names if not using strict API.
-#ifdef MOZILLA_INTERNAL_API
-# define NS_StringContainerInit           NS_StringContainerInit_P
-# define NS_StringContainerInit2          NS_StringContainerInit2_P
-# define NS_StringContainerFinish         NS_StringContainerFinish_P
-# define NS_StringGetData                 NS_StringGetData_P
-# define NS_StringGetMutableData          NS_StringGetMutableData_P
-# define NS_StringCloneData               NS_StringCloneData_P
-# define NS_StringSetData                 NS_StringSetData_P
-# define NS_StringSetDataRange            NS_StringSetDataRange_P
-# define NS_StringCopy                    NS_StringCopy_P
-# define NS_StringSetIsVoid               NS_StringSetIsVoid_P
-# define NS_StringGetIsVoid               NS_StringGetIsVoid_P
-# define NS_CStringContainerInit          NS_CStringContainerInit_P
-# define NS_CStringContainerInit2         NS_CStringContainerInit2_P
-# define NS_CStringContainerFinish        NS_CStringContainerFinish_P
-# define NS_CStringGetData                NS_CStringGetData_P
-# define NS_CStringGetMutableData         NS_CStringGetMutableData_P
-# define NS_CStringCloneData              NS_CStringCloneData_P
-# define NS_CStringSetData                NS_CStringSetData_P
-# define NS_CStringSetDataRange           NS_CStringSetDataRange_P
-# define NS_CStringCopy                   NS_CStringCopy_P
-# define NS_CStringSetIsVoid              NS_CStringSetIsVoid_P
-# define NS_CStringGetIsVoid              NS_CStringGetIsVoid_P
-# define NS_CStringToUTF16                NS_CStringToUTF16_P
-# define NS_UTF16ToCString                NS_UTF16ToCString_P
-#endif
-
 #include "nscore.h"
 
 /* The base string types */
 class nsAString;
 class nsACString;
 
 /* ------------------------------------------------------------------------- */
 
deleted file mode 100644
--- a/xpcom/stub/Makefile.in
+++ /dev/null
@@ -1,58 +0,0 @@
-# vim:set ts=8 sw=8 sts=8 noet:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DEPTH		= @DEPTH@
-topsrcdir	= @top_srcdir@
-srcdir		= @srcdir@
-VPATH		= @srcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-LIBRARY_NAME	= xpcom
-
-# The XPCOM glue uses realpath() on libxpcom.so to resolve any symlinks. We
-# want it to find dist/bin and not xpcom/stub so we copy instead of symlinking.
-NSDISTMODE = copy
-
-# Do not set EXPORT_LIBRARY as we do not want xpcom in the static libs list
-#EXPORT_LIBRARY = 1
-MOZILLA_INTERNAL_API = 1
-
-
-LOCAL_INCLUDES	= -I$(srcdir)/../build
-
-CPPSRCS		= nsXPComStub.cpp
-
-# If we have an import library, then copy that to the SDK.  Otherwise,
-# copy the shared library.
-ifneq (,$(filter OS2 WINNT,$(OS_ARCH)))
-SDK_LIBRARY = $(IMPORT_LIBRARY)
-else
-SDK_LIBRARY = $(SHARED_LIBRARY)
-endif
-
-
-FORCE_SHARED_LIB = 1
-
-EXTRA_DSO_LDOPTS = $(LIBS_DIR)
-
-ifeq (bundle,$(MOZ_FS_LAYOUT))
-EXTRA_DSO_LDOPTS += $(DIST)/bin/XUL
-else
-EXTRA_DSO_LIBS = xul
-endif
-
-EXTRA_DSO_LDOPTS +=				\
-	$(EXTRA_DSO_LIBS)			\
-	$(NSPR_LIBS)				\
-	$(MOZALLOC_LIB)				\
-	$(NULL)
-
-include $(topsrcdir)/config/rules.mk
-
-libs:: $(FINAL_TARGET)/dependentlibs.list
-
-$(FINAL_TARGET)/dependentlibs.list: dependentlibs.py $(SHARED_LIBRARY) $(wildcard $(if $(wildcard $(FINAL_TARGET)/dependentlibs.list),$(addprefix $(FINAL_TARGET)/,$(shell cat $(FINAL_TARGET)/dependentlibs.list))))
-	$(PYTHON) $< $(SHARED_LIBRARY) -L $(FINAL_TARGET) $(if $(TOOLCHAIN_PREFIX),$(addprefix -p ,$(TOOLCHAIN_PREFIX))) > $@
deleted file mode 100644
--- a/xpcom/stub/moz.build
+++ /dev/null
@@ -1,7 +0,0 @@
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-MODULE = 'xpcom'
-