Bug 852950 - Kill libxpcom. r=bsmedberg

Also refactored the xpcom standalone glue to reside in a single file and
removed its use of realpath().

--HG--
rename : xpcom/stub/dependentlibs.py => toolkit/library/dependentlibs.py
rename : xpcom/stub/nsXPComStub.cpp => xpcom/build/FrozenFunctions.cpp
This commit is contained in:
Mike Hommey 2013-03-20 14:56:41 +01:00
Родитель 8376bad5eb
Коммит 347a7c2d09
64 изменённых файлов: 768 добавлений и 1721 удалений

Просмотреть файл

@ -54,7 +54,6 @@
@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@

Просмотреть файл

@ -20,3 +20,4 @@ components/dom_sms.xpt
@DLL_PREFIX@nssutil3@DLL_SUFFIX@
@DLL_PREFIX@mozsqlite3@DLL_SUFFIX@
#endif
@DLL_PREFIX@xpcom@DLL_SUFFIX@

Просмотреть файл

@ -69,7 +69,6 @@
@BINPATH@/@DLL_PREFIX@plds4@DLL_SUFFIX@
#endif
#endif
@BINPATH@/@DLL_PREFIX@xpcom@DLL_SUFFIX@
#ifdef XP_MACOSX
@BINPATH@/XUL
#else

Просмотреть файл

@ -26,6 +26,7 @@
@DLL_PREFIX@nssutil3@DLL_SUFFIX@
@DLL_PREFIX@mozsqlite3@DLL_SUFFIX@
#endif
@DLL_PREFIX@xpcom@DLL_SUFFIX@
LICENSE
browserconfig.properties
chrome/US.jar

Просмотреть файл

@ -1019,10 +1019,10 @@ 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)'
@ -2116,8 +2116,8 @@ ia64*-hpux*)
# 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
@ -2182,9 +2182,9 @@ ia64*-hpux*)
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
@ -2360,8 +2360,8 @@ ia64*-hpux*)
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
@ -4596,7 +4596,8 @@ cairo-cocoa)
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
@ -4611,7 +4612,8 @@ cairo-uikit)
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
;;

Просмотреть файл

@ -40,7 +40,6 @@
@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@

Просмотреть файл

@ -224,11 +224,9 @@ loadGeckoLibs(const char *apkName)
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

Просмотреть файл

@ -689,3 +689,8 @@ 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))) > $@

Просмотреть файл

@ -3,7 +3,7 @@
# 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
@ -92,7 +92,7 @@ def dependentlibs_otool(lib):
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 = []
@ -129,7 +129,7 @@ def main():
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()

Просмотреть файл

@ -207,7 +207,6 @@ 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')

Просмотреть файл

@ -0,0 +1,131 @@
/* 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 "nsXPCOM.h"
#include "nsXPCOMPrivate.h"
#include "nsXPCOMStrings.h"
#include "xptcall.h"
#include <string.h>
/**
* Private Method to register an exit routine. This method
* used to allow you to setup a callback that will be called from
* the NS_ShutdownXPCOM function after all services and
* components have gone away. It was fatally flawed in that the component
* DLL could be released before the exit function was called; it is now a
* stub implementation that does nothing.
*/
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,
&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,
&NS_GetTraceRefcnt,
// these functions were added post 1.6
&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,
&NS_Realloc,
&NS_Free,
&NS_StringContainerInit2,
&NS_CStringContainerInit2,
&NS_StringGetMutableData,
&NS_CStringGetMutableData,
NULL,
// these functions were added post 1.8
&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,
&NS_StringGetIsVoid,
&NS_CStringSetIsVoid,
&NS_CStringGetIsVoid,
// these functions were added post 1.9
&NS_CycleCollectorSuspect2,
&NS_CycleCollectorForget2
};
EXPORT_XPCOM_API(nsresult)
NS_GetFrozenFunctions(XPCOMFunctions *functions, const char* /* libraryPath */)
{
if (!functions)
return NS_ERROR_OUT_OF_MEMORY;
if (functions->version != XPCOM_GLUE_VERSION)
return NS_ERROR_FAILURE;
uint32_t size = functions->size;
if (size > sizeof(XPCOMFunctions))
size = sizeof(XPCOMFunctions);
size -= offsetof(XPCOMFunctions, init);
memcpy(&functions->init, &kFrozenFunctions.init, size);
return NS_OK;
}
/*
* 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;
}

Просмотреть файл

@ -37,6 +37,7 @@ CPPSRCS = \
Services.cpp \
Omnijar.cpp \
FileLocation.cpp \
FrozenFunctions.cpp \
$(NULL)
ifeq (Darwin, $(OS_ARCH))

Просмотреть файл

@ -6,34 +6,6 @@
#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"

Просмотреть файл

@ -217,15 +217,15 @@ void LogTerm();
#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

Просмотреть файл

@ -9,7 +9,6 @@
#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)

Просмотреть файл

@ -19,23 +19,6 @@
#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.

Просмотреть файл

@ -20,29 +20,6 @@ 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 \

Просмотреть файл

@ -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__

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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()
{
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -5,7 +5,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsXPCOMGlue.h"
#include "nsGlueLinking.h"
#include "nspr.h"
#include "nsDebug.h"
@ -15,46 +14,15 @@
#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)
@ -63,7 +31,294 @@ nsresult XPCOMGlueStartup(const char* xpcomFile)
#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];
@ -77,36 +332,189 @@ inline FILE *TS_tfopen (const char *path, const char *mode)
}
#endif
void
XPCOMGlueLoadDependentLibs(const char *xpcomDir, DependentLibsCallback cb)
/* RAII wrapper for FILE descriptors */
struct ScopedCloseFileTraits
{
char buffer[MAXPATHLEN];
sprintf(buffer, "%s" XPCOM_FILE_PATH_SEPARATOR XPCOM_DEPENDENT_LIBS_LIST,
xpcomDir);
typedef FILE *type;
static type empty() { return nullptr; }
static void release(type f) {
if (f) {
fclose(f);
}
}
};
typedef Scoped<ScopedCloseFileTraits> ScopedCloseFile;
FILE *flist = TS_tfopen(buffer, READ_TEXTMODE);
if (!flist)
return;
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];
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;
}
}
fclose(flist);
GetFrozenFunctionsFunc sym =
(GetFrozenFunctionsFunc) GetSymbol(sTop->libHandle, LEADING_UNDERSCORE "NS_GetFrozenFunctions");
if (!sym) { // No symbol found.
XPCOMGlueUnload();
return nullptr;
}
#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)

Просмотреть файл

@ -19,34 +19,10 @@ 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 = \
@ -75,10 +51,10 @@ 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

Просмотреть файл

@ -8,12 +8,6 @@
#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"

Просмотреть файл

@ -61,20 +61,20 @@ invoke_copy_to_stack(uint64_t* d, uint32_t paramCount, nsXPTCVariant* s)
/*
* 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"
@ -140,5 +140,5 @@ __asm__(
"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"
);

Просмотреть файл

@ -100,7 +100,7 @@ invoke_copy_to_stack(uint64_t * d, uint32_t paramCount, nsXPTCVariant * s,
}
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;

Просмотреть файл

@ -7,8 +7,8 @@
.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
@ -19,12 +19,12 @@
// .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

Просмотреть файл

@ -7,8 +7,8 @@
.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
@ -19,12 +19,12 @@
// .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

Просмотреть файл

@ -38,15 +38,15 @@
.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
@ -131,4 +131,4 @@ _NS_InvokeByIndex_P:
addiu sp, FRAMESZ
j ra
END(_NS_InvokeByIndex_P)
END(_NS_InvokeByIndex)

Просмотреть файл

@ -21,12 +21,12 @@ 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)
@ -119,4 +119,4 @@ NESTED(_NS_InvokeByIndex_P, FRAMESZ, ra)
REG_L s0, S0OFF(sp)
PTR_ADDU sp, FRAMESZ
j ra
.end _NS_InvokeByIndex_P
.end _NS_InvokeByIndex

Просмотреть файл

@ -12,11 +12,11 @@
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
@ -104,5 +104,5 @@ NS_InvokeByIndex_P:
NOP
.EXIT
.PROCEND ;in=23,24,25,26;
.SIZE NS_InvokeByIndex_P, .-NS_InvokeByIndex_P
.SIZE NS_InvokeByIndex, .-NS_InvokeByIndex

Просмотреть файл

@ -19,21 +19,21 @@
#
# 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)
@ -126,7 +126,7 @@ NS_InvokeByIndex_P:
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

Просмотреть файл

@ -25,24 +25,24 @@
.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)
#
@ -117,13 +117,13 @@
# .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

Просмотреть файл

@ -20,23 +20,23 @@
.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)
#
@ -116,13 +116,13 @@
# .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

Просмотреть файл

@ -25,24 +25,24 @@
.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)
#
@ -112,13 +112,13 @@
# .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

Просмотреть файл

@ -21,15 +21,15 @@
.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

Просмотреть файл

@ -21,15 +21,15 @@
.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

Просмотреть файл

@ -14,12 +14,12 @@
.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)
#

Просмотреть файл

@ -14,15 +14,15 @@
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
@ -83,4 +83,4 @@ NS_InvokeByIndex_P:
ret
restore
.size NS_InvokeByIndex_P, .-NS_InvokeByIndex
.size NS_InvokeByIndex, .-NS_InvokeByIndex

Просмотреть файл

@ -8,13 +8,13 @@
* 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

Просмотреть файл

@ -8,12 +8,12 @@
* 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

Просмотреть файл

@ -6,14 +6,14 @@
/* 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
@ -53,4 +53,4 @@ NS_InvokeByIndex_P:
ret
restore
.size NS_InvokeByIndex_P, .-NS_InvokeByIndex_P
.size NS_InvokeByIndex, .-NS_InvokeByIndex

Просмотреть файл

@ -14,15 +14,15 @@
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
@ -82,4 +82,4 @@ NS_InvokeByIndex_P:
ret
restore
.size NS_InvokeByIndex_P, .-NS_InvokeByIndex_P
.size NS_InvokeByIndex, .-NS_InvokeByIndex

Просмотреть файл

@ -1,6 +1,6 @@
.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
@ -51,5 +51,5 @@ NS_InvokeByIndex_P:
movl %ebp,%esp
pop %ebp
ret
.size NS_InvokeByIndex_P, . - NS_InvokeByIndex_P
.size NS_InvokeByIndex, . - NS_InvokeByIndex

Просмотреть файл

@ -33,7 +33,7 @@ invoke_copy_to_stack(uint32_t paramCount, nsXPTCVariant* s, uint32_t* 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);
Each param takes at most two 4-byte words.
@ -52,11 +52,11 @@ __asm__ (
/* 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"
@ -92,6 +92,6 @@ __asm__ (
"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
);

Просмотреть файл

@ -61,20 +61,20 @@ invoke_copy_to_stack(uint64_t* d, uint32_t paramCount, nsXPTCVariant* s)
/*
* 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"
@ -140,5 +140,5 @@ __asm__(
"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"
);

Просмотреть файл

@ -97,7 +97,7 @@ 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)
{
uint32_t result, n;

Просмотреть файл

@ -87,13 +87,13 @@ invoke_copy_to_stack(uint32_t* d, uint32_t paramCount,
}
}
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);
}

Просмотреть файл

@ -128,13 +128,13 @@ invoke_copy_to_stack(uint64_t* d, uint32_t paramCount,
}
}
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);
}

Просмотреть файл

@ -5,9 +5,9 @@
// 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.
@ -90,6 +90,6 @@ invoke_copy_to_stack(uint64_t* gpregs,
}
EXPORT_XPCOM_API(nsresult)
NS_InvokeByIndex_P(nsISupports* that, uint32_t methodIndex,
NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
uint32_t paramCount, nsXPTCVariant* params);

Просмотреть файл

@ -5,9 +5,9 @@
// 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
@ -120,5 +120,5 @@ invoke_copy_to_stack(uint32_t* d,
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);

Просмотреть файл

@ -5,9 +5,9 @@
// 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
@ -102,5 +102,5 @@ invoke_copy_to_stack(uint32_t* d,
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);

Просмотреть файл

@ -101,13 +101,13 @@ invoke_copy_to_stack(uint32_t* d, uint32_t paramCount, nsXPTCVariant* s, double
}
}
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);
}

Просмотреть файл

@ -101,7 +101,7 @@ invoke_copy_to_stack(uint64_t * d, uint32_t paramCount, nsXPTCVariant * s,
}
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;

Просмотреть файл

@ -102,7 +102,7 @@ invoke_copy_to_stack(uint64_t * d, uint32_t paramCount, nsXPTCVariant * s,
}
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;

Просмотреть файл

@ -49,7 +49,7 @@ invoke_copy_to_stack(uint32_t* d, uint32_t paramCount, nsXPTCVariant* s)
// 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 {

Просмотреть файл

@ -51,7 +51,7 @@ XPTC__InvokebyIndex(nsISupports* that, uint32_t methodIndex,
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);

Просмотреть файл

@ -45,7 +45,7 @@ invoke_copy_to_stack(uint32_t paramCount, nsXPTCVariant* s, uint32_t* 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);
Each param takes at most two 4-byte words.
@ -64,8 +64,8 @@ __asm__ (
/* 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"
@ -101,6 +101,6 @@ __asm__ (
"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"
);

Просмотреть файл

@ -18,34 +18,6 @@
* 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 */

Просмотреть файл

@ -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))) > $@

Просмотреть файл

@ -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'

Просмотреть файл

@ -1,514 +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/. */
#include "nsXPCOM.h"
#include "nsXPCOMPrivate.h"
#include "nsXPCOMStrings.h"
#include "xptcall.h"
#include <string.h>
/**
* Private Method to register an exit routine. This method
* used to allow you to setup a callback that will be called from
* the NS_ShutdownXPCOM function after all services and
* components have gone away. It was fatally flawed in that the component
* DLL could be released before the exit function was called; it is now a
* stub implementation that does nothing.
*/
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_RegisterXPCOMExitRoutine,
&NS_UnregisterXPCOMExitRoutine,
// these functions were added post 1.4
&NS_GetDebug_P,
&NS_GetTraceRefcnt_P,
// 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,
// 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,
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,
nullptr,
nullptr,
&NS_StringSetIsVoid_P,
&NS_StringGetIsVoid_P,
&NS_CStringSetIsVoid_P,
&NS_CStringGetIsVoid_P,
// these functions were added post 1.9
&NS_CycleCollectorSuspect2_P,
&NS_CycleCollectorForget2_P
};
EXPORT_XPCOM_API(nsresult)
NS_GetFrozenFunctions(XPCOMFunctions *functions, const char* /* libraryPath */)
{
if (!functions)
return NS_ERROR_OUT_OF_MEMORY;
if (functions->version != XPCOM_GLUE_VERSION)
return NS_ERROR_FAILURE;
uint32_t size = functions->size;
if (size > sizeof(XPCOMFunctions))
size = sizeof(XPCOMFunctions);
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);
}