Bug 1541792 - Replace linker magic with manual component registration. r=froydnj

Before bug 938437, we had a rather large and error-prone
nsStaticXULComponents.cpp used to register all modules. That was
replaced with clever use of the linker, which allowed to avoid the mess
that maintaining that file was.

Fast forward to now, where after bug 1524687 and other work that
preceded it, we have a much smaller number of remaining static xpcom
components, registered via this linker hack, and don't expect to add
any new ones. The list should eventually go down to zero.

Within that context, it seems to be the right time to get rid of the
magic, and with it the problems it causes on its own.

Some of those components could probably be trivially be converted to
static registration via .conf files, but I didn't want to deal with the
possible need to increase the number of dummy modules in XPCOMInit.cpp.
They can still be converted as a followup.

Differential Revision: https://phabricator.services.mozilla.com/D26076

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Mike Hommey 2019-04-05 02:30:56 +00:00
Родитель e4a2cb3ab3
Коммит 071a2fe984
29 изменённых файлов: 108 добавлений и 307 удалений

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

@ -38,7 +38,7 @@ static const mozilla::Module::CategoryEntry kCategories[] = {
ANDROIDSPEECHSERVICE_CONTRACTID},
{nullptr}};
static const mozilla::Module kModule = {
extern const mozilla::Module kSpeechSynthModule = {
mozilla::Module::kVersion,
kCIDs,
kContracts,
@ -47,5 +47,3 @@ static const mozilla::Module kModule = {
nullptr,
nullptr,
};
NSMODULE_DEFN(androidspeechsynth) = &kModule;

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

@ -46,12 +46,11 @@ static void UnloadOSXSpeechSynthesizerModule() {
OSXSpeechSynthesizerService::Shutdown();
}
static const mozilla::Module kModule = {mozilla::Module::kVersion,
kCIDs,
kContracts,
kCategories,
nullptr,
nullptr,
UnloadOSXSpeechSynthesizerModule};
NSMODULE_DEFN(osxsynth) = &kModule;
extern const mozilla::Module kSpeechSynthModule = {
mozilla::Module::kVersion,
kCIDs,
kContracts,
kCategories,
nullptr,
nullptr,
UnloadOSXSpeechSynthesizerModule};

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

@ -39,8 +39,6 @@ static const mozilla::Module::CategoryEntry kCategories[] = {
static void UnloadSapiModule() { SapiService::Shutdown(); }
static const mozilla::Module kModule = {
extern const mozilla::Module kSpeechSynthModule = {
mozilla::Module::kVersion, kCIDs, kContracts, kCategories, nullptr, nullptr,
UnloadSapiModule};
NSMODULE_DEFN(synthsapi) = &kModule;

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

@ -173,7 +173,7 @@ static const mozilla::Module::ContractIDEntry kPowerManagerContracts[] = {
// We mark the power module as being available in the GPU process because the
// appshell depends on the power manager service.
static const mozilla::Module kPowerManagerModule = {
extern const mozilla::Module kPowerManagerModule = {
mozilla::Module::kVersion,
kPowerManagerCIDs,
kPowerManagerContracts,
@ -182,5 +182,3 @@ static const mozilla::Module kPowerManagerModule = {
nullptr,
nullptr,
mozilla::Module::ALLOW_IN_GPU_AND_SOCKET_PROCESS};
NSMODULE_DEFN(nsPowerManagerModule) = &kPowerManagerModule;

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

@ -270,12 +270,10 @@ void nsLayoutModuleDtor() {
xpcModuleDtor();
}
static const mozilla::Module kLayoutModule = {mozilla::Module::kVersion,
extern const mozilla::Module kLayoutModule = {mozilla::Module::kVersion,
nullptr,
nullptr,
kLayoutCategories,
nullptr,
nullptr,
nullptr};
NSMODULE_DEFN(nsLayoutModule) = &kLayoutModule;

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

@ -35,8 +35,6 @@ static const mozilla::Module::CategoryEntry kLayoutDebugCategories[] = {
"@mozilla.org/commandlinehandler/general-startup;1?type=layoutdebug"},
{nullptr}};
static const mozilla::Module kLayoutDebugModule = {
extern const mozilla::Module kLayoutDebugModule = {
mozilla::Module::kVersion, kLayoutDebugCIDs, kLayoutDebugContracts,
kLayoutDebugCategories};
NSMODULE_DEFN(nsLayoutDebugModule) = &kLayoutDebugModule;

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

@ -47,7 +47,5 @@ static const mozilla::Module::ContractIDEntry kBrowserContracts[] = {
#endif
{nullptr}};
static const mozilla::Module kBrowserModule = {mozilla::Module::kVersion,
extern const mozilla::Module kBrowserModule = {mozilla::Module::kVersion,
kBrowserCIDs, kBrowserContracts};
NSMODULE_DEFN(nsBrowserCompsModule) = &kBrowserModule;

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

@ -349,7 +349,7 @@ void nsNetShutdown() {
gDataSniffers = nullptr;
}
static const mozilla::Module kNeckoModule = {
extern const mozilla::Module kNeckoModule = {
mozilla::Module::kVersion,
nullptr,
nullptr,
@ -358,5 +358,3 @@ static const mozilla::Module kNeckoModule = {
nullptr,
nullptr,
mozilla::Module::ALLOW_IN_SOCKET_PROCESS};
NSMODULE_DEFN(necko) = &kNeckoModule;

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

@ -31,12 +31,10 @@ static nsresult Initialize() {
static void Shutdown() { nsHTMLTags::ReleaseTable(); }
static mozilla::Module kParserModule = {mozilla::Module::kVersion,
kParserCIDs,
nullptr,
nullptr,
nullptr,
Initialize,
Shutdown};
NSMODULE_DEFN(nsParserModule) = &kParserModule;
extern const mozilla::Module kParserModule = {mozilla::Module::kVersion,
kParserCIDs,
nullptr,
nullptr,
nullptr,
Initialize,
Shutdown};

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

@ -214,73 +214,6 @@ def is_libxul(binary):
return 'xul' in basename
def check_nsmodules(target, binary):
if target is HOST or not is_libxul(binary):
raise Skip()
symbols = []
for sym in iter_symbols(binary):
if sym['addr'] == 0:
continue
name = sym['name']
# NSModules symbols end with _NSModule or _NSModuleE when C++-mangled.
if name.endswith(('_NSModule', '_NSModuleE')):
# We don't have a valid size in the symbol list for macho and coff.
# Use our guesstimate.
size = sym['size'] or GUESSED_NSMODULE_SIZE
symbols.append((sym['addr'], size, name))
elif name in ('__start_kPStaticModules', '__stop_kPStaticModules'):
# For coff, these symbols have a size.
if get_type(binary) not in (ELF, MACHO):
size = GUESSED_NSMODULE_SIZE
else:
size = 0
symbols.append((sym['addr'], size, name))
if not symbols:
raise RuntimeError('Could not find NSModules')
def print_symbols(symbols):
for addr, size, sym in symbols:
print('%x %d %s' % (addr, size, sym))
symbols = sorted(symbols)
next_addr = None
# MSVC linker, when doing incremental linking, adds padding when
# merging sections. Allow there to be more space between the NSModule
# symbols, as long as they are in the right order.
test_msvc = (buildconfig.substs.get('CC_TYPE') == 'clang-cl' and \
buildconfig.substs.get('DEVELOPER_OPTIONS'))
test_clang = (buildconfig.substs.get('CC_TYPE') == 'clang' and \
buildconfig.substs.get('OS_ARCH') == 'WINNT')
if test_msvc or test_clang:
sym_cmp = lambda guessed, actual: guessed <= actual
else:
sym_cmp = lambda guessed, actual: guessed == actual
for addr, size, sym in symbols:
if next_addr is not None and not sym_cmp(next_addr, addr):
print_symbols(symbols)
raise RuntimeError('NSModules are not adjacent')
next_addr = addr + size
# The mac linker doesn't emit the start/stop symbols in the symbol table.
# We'll just assume it did the job correctly.
if get_type(binary) == MACHO:
return
first = symbols[0][2]
last = symbols[-1][2]
# On some platforms, there are extra underscores on symbol names.
if first.lstrip('_') != 'start_kPStaticModules' or \
last.lstrip('_') != 'stop_kPStaticModules':
print_symbols(symbols)
syms = set(sym for add, size, sym in symbols)
if 'start_kPStaticModules' not in syms:
raise RuntimeError('Could not find start_kPStaticModules symbol')
if 'stop_kPStaticModules' not in syms:
raise RuntimeError('Could not find stop_kPStaticModules symbol')
raise RuntimeError('NSModules are not ordered appropriately')
def check_pt_load(target, binary):
if target is HOST or get_type(binary) != ELF or not is_libxul(binary):
raise Skip()
@ -371,8 +304,6 @@ def checks(target, binary):
checks.append(check_pt_load)
checks.append(check_mozglue_order)
checks.append(check_nsmodules)
retcode = 0
basename = os.path.basename(binary)
for c in checks:

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

@ -468,9 +468,7 @@ static const Module::CIDEntry kLocalCertServiceCIDs[] = {
static const Module::ContractIDEntry kLocalCertServiceContracts[] = {
{LOCALCERTSERVICE_CONTRACTID, &kLOCALCERTSERVICE_CID}, {nullptr}};
static const Module kLocalCertServiceModule = {
extern const Module kLocalCertServiceModule = {
Module::kVersion, kLocalCertServiceCIDs, kLocalCertServiceContracts};
NSMODULE_DEFN(LocalCertServiceModule) = &kLocalCertServiceModule;
} // namespace mozilla

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

@ -22,7 +22,5 @@ const mozilla::Module::CIDEntry kKeyValueCIDs[] = {
const mozilla::Module::ContractIDEntry kKeyValueContracts[] = {
{NS_KEY_VALUE_SERVICE_CONTRACTID, &kNS_KEY_VALUE_SERVICE_CID}, {nullptr}};
const mozilla::Module kKeyValueModule = {
extern const mozilla::Module kKeyValueModule = {
mozilla::Module::kVersion, kKeyValueCIDs, kKeyValueContracts, nullptr};
NSMODULE_DEFN(nsKeyValueModule) = &kKeyValueModule;

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

@ -1,7 +0,0 @@
SECTIONS {
.data.rel.ro : {
PROVIDE_HIDDEN(__start_kPStaticModules = .);
*(kPStaticModules)
PROVIDE_HIDDEN(__stop_kPStaticModules = .);
}
}

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

@ -58,17 +58,6 @@ def Libxul(name, output_category=None):
# and config/version.mk would lift the $(srcdir)
RCINCLUDE = '$(DEPTH)/toolkit/library/xulrunner.rc'
# BFD ld doesn't create multiple PT_LOADs as usual when an unknown section
# exists. Using an implicit linker script to make it fold that section in
# .data.rel.ro makes it create multiple PT_LOADs. That implicit linker
# script however makes gold misbehave, first because it doesn't like that
# the linker script is given after crtbegin.o, and even past that, replaces
# the default section rules with those from the script instead of
# supplementing them. Which leads to a lib with a huge load of sections.
if CONFIG['OS_TARGET'] not in ('OpenBSD', 'WINNT') and \
CONFIG['LINKER_KIND'] == 'bfd':
LDFLAGS += [TOPSRCDIR + '/toolkit/library/StaticXULComponents.ld']
Libxul_defines()
if CONFIG['MOZ_NEEDS_LIBATOMIC']:

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

@ -72,7 +72,5 @@ static const mozilla::Module::ContractIDEntry kSysProxyContracts[] = {
{NS_SYSTEMPROXYSETTINGS_CONTRACTID, &kNS_ANDROIDSYSTEMPROXYSERVICE_CID},
{nullptr}};
static const mozilla::Module kSysProxyModule = {
extern const mozilla::Module kSysProxyModule = {
mozilla::Module::kVersion, kSysProxyCIDs, kSysProxyContracts};
NSMODULE_DEFN(nsAndroidProxyModule) = &kSysProxyModule;

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

@ -288,7 +288,5 @@ static const mozilla::Module::CIDEntry kOSXSysProxyCIDs[] = {
static const mozilla::Module::ContractIDEntry kOSXSysProxyContracts[] = {
{NS_SYSTEMPROXYSETTINGS_CONTRACTID, &kNS_OSXSYSTEMPROXYSERVICE_CID}, {NULL}};
static const mozilla::Module kOSXSysProxyModule = {mozilla::Module::kVersion, kOSXSysProxyCIDs,
kOSXSysProxyContracts};
NSMODULE_DEFN(nsOSXProxyModule) = &kOSXSysProxyModule;
extern const mozilla::Module kSysProxyModule = {mozilla::Module::kVersion, kOSXSysProxyCIDs,
kOSXSysProxyContracts};

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

@ -92,11 +92,9 @@ static const mozilla::Module::CIDEntry kSysDHCPClientCIDs[] = {
static const mozilla::Module::ContractIDEntry kSysDHCPClientContracts[] = {
{NS_DHCPCLIENT_CONTRACTID, &kNS_WINDOWSDHCPCLIENTSERVICE_CID}, {nullptr}};
static const mozilla::Module kSysDHCPClientModule = {
extern const mozilla::Module kSysDHCPClientModule = {
mozilla::Module::kVersion, kSysDHCPClientCIDs, kSysDHCPClientContracts};
NSMODULE_DEFN(nsDHCPClientModule) = &kSysDHCPClientModule;
} // namespace windowsDHCPClient
} // namespace system
} // namespace toolkit

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

@ -267,7 +267,5 @@ static const mozilla::Module::ContractIDEntry kSysProxyContracts[] = {
{NS_SYSTEMPROXYSETTINGS_CONTRACTID, &kNS_WINDOWSSYSTEMPROXYSERVICE_CID},
{nullptr}};
static const mozilla::Module kSysProxyModule = {
extern const mozilla::Module kSysProxyModule = {
mozilla::Module::kVersion, kSysProxyCIDs, kSysProxyContracts};
NSMODULE_DEFN(nsWindowsProxyModule) = &kSysProxyModule;

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

@ -1283,11 +1283,9 @@ static const mozilla::Module::ContractIDEntry kXREContracts[] = {
{NS_PROFILESERVICE_CONTRACTID, &kProfileServiceCID},
{nullptr}};
static const mozilla::Module kXREModule = {mozilla::Module::kVersion, kXRECIDs,
extern const mozilla::Module kXREModule = {mozilla::Module::kVersion, kXRECIDs,
kXREContracts};
NSMODULE_DEFN(Apprunner) = &kXREModule;
nsresult ScopedXPCOMStartup::Initialize() {
NS_ASSERTION(gDirServiceProvider, "Should not get here!");

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

@ -39,7 +39,5 @@ static const mozilla::Module::ContractIDEntry kEmbeddingContracts[] = {
#endif
{nullptr}};
static const mozilla::Module kEmbeddingModule = {
extern const mozilla::Module kEmbeddingModule = {
mozilla::Module::kVersion, kEmbeddingCIDs, kEmbeddingContracts};
NSMODULE_DEFN(embedcomponents) = &kEmbeddingModule;

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

@ -18,7 +18,5 @@ static const mozilla::Module::CIDEntry kCodeCoverageCIDs[] = {
static const mozilla::Module::ContractIDEntry kCodeCoverageContracts[] = {
{"@mozilla.org/tools/code-coverage;1", &kNS_CODECOVERAGE_CID}, {nullptr}};
static const mozilla::Module kCodeCoverageModule = {
extern const mozilla::Module kCodeCoverageModule = {
mozilla::Module::kVersion, kCodeCoverageCIDs, kCodeCoverageContracts};
NSMODULE_DEFN(nsCodeCoverageModule) = &kCodeCoverageModule;

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

@ -122,12 +122,10 @@ static void nsWidgetAndroidModuleDtor() {
nsAppShellShutdown();
}
static const mozilla::Module kWidgetModule = {mozilla::Module::kVersion,
extern const mozilla::Module kWidgetModule = {mozilla::Module::kVersion,
kWidgetCIDs,
kWidgetContracts,
nullptr,
nullptr,
nsAppShellInit,
nsWidgetAndroidModuleDtor};
NSMODULE_DEFN(nsWidgetAndroidModule) = &kWidgetModule;

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

@ -200,7 +200,7 @@ static void nsWidgetCocoaModuleDtor() {
nsAppShellShutdown();
}
static const mozilla::Module kWidgetModule = {mozilla::Module::kVersion,
extern const mozilla::Module kWidgetModule = {mozilla::Module::kVersion,
kWidgetCIDs,
kWidgetContracts,
NULL,
@ -208,5 +208,3 @@ static const mozilla::Module kWidgetModule = {mozilla::Module::kVersion,
nsAppShellInit,
nsWidgetCocoaModuleDtor,
mozilla::Module::ALLOW_IN_GPU_VR_AND_SOCKET_PROCESS};
NSMODULE_DEFN(nsWidgetMacModule) = &kWidgetModule;

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

@ -61,7 +61,5 @@ static const mozilla::Module::ContractIDEntry kWidgetContracts[] = {
Module::CONTENT_PROCESS_ONLY},
{nullptr}};
static const mozilla::Module kWidgetModule = {mozilla::Module::kVersion,
kWidgetCIDs, kWidgetContracts};
NSMODULE_DEFN(nsContentProcessWidgetModule) = &kWidgetModule;
extern const mozilla::Module kContentProcessWidgetModule = {
mozilla::Module::kVersion, kWidgetCIDs, kWidgetContracts};

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

@ -46,8 +46,6 @@ static void nsWidgetUIKitModuleDtor() {
nsAppShellShutdown();
}
static const mozilla::Module kWidgetModule = {
extern const mozilla::Module kWidgetModule = {
mozilla::Module::kVersion, kWidgetCIDs, kWidgetContracts, nullptr, nullptr, nsAppShellInit,
nsWidgetUIKitModuleDtor};
NSMODULE_DEFN(nsWidgetUIKitModule) = &kWidgetModule;

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

@ -175,26 +175,6 @@ const mozilla::Module kXPCOMModule = {
nullptr,
Module::ALLOW_IN_GPU_VR_AND_SOCKET_PROCESS};
// FIXME: Dummy modules to avoid Windows PGO bustage when we have too few
// modules registered.
static const mozilla::Module kDummy1 = {mozilla::Module::kVersion};
static const mozilla::Module kDummy2 = {mozilla::Module::kVersion};
static const mozilla::Module kDummy3 = {mozilla::Module::kVersion};
static const mozilla::Module kDummy4 = {mozilla::Module::kVersion};
static const mozilla::Module kDummy5 = {mozilla::Module::kVersion};
static const mozilla::Module kDummy6 = {mozilla::Module::kVersion};
static const mozilla::Module kDummy7 = {mozilla::Module::kVersion};
static const mozilla::Module kDummy8 = {mozilla::Module::kVersion};
NSMODULE_DEFN(Dummy1) = &kDummy1;
NSMODULE_DEFN(Dummy2) = &kDummy2;
NSMODULE_DEFN(Dummy3) = &kDummy3;
NSMODULE_DEFN(Dummy4) = &kDummy4;
NSMODULE_DEFN(Dummy5) = &kDummy5;
NSMODULE_DEFN(Dummy6) = &kDummy6;
NSMODULE_DEFN(Dummy7) = &kDummy7;
NSMODULE_DEFN(Dummy8) = &kDummy8;
// gDebug will be freed during shutdown.
static nsIDebug2* gDebug = nullptr;

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

@ -11,7 +11,6 @@
#include "nsID.h"
#include "nsIFactory.h"
#include "nsCOMPtr.h" // for already_AddRefed
#include "mozilla/Attributes.h"
namespace mozilla {
@ -137,39 +136,4 @@ struct Module {
} // namespace mozilla
#if defined(MOZILLA_INTERNAL_API)
# define NSMODULE_NAME(_name) _name##_NSModule
# if defined(_MSC_VER) || (defined(__clang__) && defined(__MINGW32__))
# pragma section(".kPStaticModules$M", read)
# pragma comment(linker, "/merge:.kPStaticModules=.rdata")
# define NSMODULE_SECTION \
__declspec(allocate(".kPStaticModules$M"), dllexport)
# elif defined(__GNUC__)
# if defined(__ELF__)
# define NSMODULE_SECTION \
__attribute__((section("kPStaticModules"), visibility("default")))
# elif defined(__MACH__)
# define NSMODULE_SECTION \
__attribute__( \
(section("__DATA, .kPStaticModules"), visibility("default")))
# elif defined(_WIN32)
# define NSMODULE_SECTION \
__attribute__((section("kPStaticModules"), dllexport))
# endif
# endif
# if !defined(NSMODULE_SECTION)
# error Do not know how to define sections.
# endif
# if defined(MOZ_HAVE_ASAN_BLACKLIST)
# define NSMODULE_ASAN_BLACKLIST __attribute__((no_sanitize_address))
# else
# define NSMODULE_ASAN_BLACKLIST
# endif
# define NSMODULE_DEFN(_name) \
extern NSMODULE_SECTION NSMODULE_ASAN_BLACKLIST \
mozilla::Module const* const NSMODULE_NAME(_name)
#else
# error Building binary XPCOM components is not supported anymore.
#endif
#endif // mozilla_Module_h

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

@ -76,4 +76,7 @@ LOCAL_INCLUDES += [
if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
CXXFLAGS += CONFIG['TK_CFLAGS']
if CONFIG['MOZ_LAYOUT_DEBUGGER']:
DEFINES['MOZ_LAYOUT_DEBUGGER'] = True
include('/ipc/chromium/chromium-config.mozbuild')

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

@ -346,87 +346,48 @@ nsComponentManagerImpl::nsComponentManagerImpl()
mLock("nsComponentManagerImpl.mLock"),
mStatus(NOT_INITIALIZED) {}
static nsTArray<const mozilla::Module*>* sExtraStaticModules;
/* NSMODULE_DEFN places NSModules in specific sections, as per Module.h.
* The linker will group them all together, and we use tricks below to
* find the start and end of the grouped list of NSModules.
*
* On Windows, all the symbols in the .kPStaticModules* sections are
* grouped together, by lexical order of the section names. The NSModules
* themselves are in .kPStaticModules$M. We use the section name
* .kPStaticModules$A to add an empty entry that will be the first,
* and the section name .kPStaticModules$Z for another empty entry that
* will be the last. We make both null pointers, and skip them in the
* AllStaticModules range-iterator.
*
* On ELF (Linux, BSDs, ...), as well as Mingw builds, the linker itself
* provides symbols for the beginning and end of the consolidated section,
* but it only does so for sections that can be represented as C identifiers,
* so the section is named `kPStaticModules` rather than `.kPStaticModules`.
*
* We also use a linker script with BFD ld so that the sections end up
* folded into the .data.rel.ro section, but that actually breaks the above
* described behavior, so the linker script contains an additional trick
* to still provide the __start and __stop symbols (the linker script
* doesn't work with gold or lld).
*
* On Darwin, a similar setup is available through the use of some
* synthesized symbols (section$...).
*
* On all platforms, the __stop_kPStaticModules symbol is past all NSModule
* pointers.
* On Windows, the __start_kPStaticModules symbol points to an empty pointer
* preceding the first NSModule pointer. On other platforms, it points to the
* first NSModule pointer.
*/
// Dummy class to define a range-iterator for the static modules.
class AllStaticModules {};
#if defined(_MSC_VER) || (defined(__clang__) && defined(__MINGW32__))
# pragma section(".kPStaticModules$A", read)
NSMODULE_ASAN_BLACKLIST __declspec(allocate(".kPStaticModules$A"),
dllexport) extern mozilla::Module
const* const __start_kPStaticModules = nullptr;
mozilla::Module const* const* begin(AllStaticModules& _) {
return &__start_kPStaticModules + 1;
extern const mozilla::Module kNeckoModule;
extern const mozilla::Module kParserModule;
#if defined(XP_WIN) || defined(MOZ_WIDGET_COCOA) || defined(MOZ_WIDGET_ANDROID)
extern const mozilla::Module kSpeechSynthModule;
#endif
extern const mozilla::Module kPowerManagerModule;
extern const mozilla::Module kContentProcessWidgetModule;
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_COCOA) || defined(MOZ_WIDGET_UIKIT)
extern const mozilla::Module kWidgetModule;
#endif
extern const mozilla::Module kLayoutModule;
namespace mozilla {
extern const mozilla::Module kLocalCertServiceModule;
}
# pragma section(".kPStaticModules$Z", read)
NSMODULE_ASAN_BLACKLIST __declspec(allocate(".kPStaticModules$Z"),
dllexport) extern mozilla::Module
const* const __stop_kPStaticModules = nullptr;
#else
# if defined(__ELF__) || (defined(_WIN32) && defined(__GNUC__))
extern "C" mozilla::Module const* const __start_kPStaticModules;
extern "C" mozilla::Module const* const __stop_kPStaticModules;
# elif defined(__MACH__)
extern mozilla::Module const* const __start_kPStaticModules __asm(
"section$start$__DATA$.kPStaticModules");
extern mozilla::Module const* const __stop_kPStaticModules __asm(
"section$end$__DATA$.kPStaticModules");
# else
# error Do not know how to find NSModules.
# endif
static mozilla::Module const* const* begin(AllStaticModules& _) {
return &__start_kPStaticModules;
extern const mozilla::Module kKeyValueModule;
extern const mozilla::Module kXREModule;
extern const mozilla::Module kEmbeddingModule;
#if defined(XP_WIN) || defined(MOZ_WIDGET_COCOA) || defined(MOZ_WIDGET_ANDROID)
extern const mozilla::Module kSysProxyModule;
#endif
#if defined(XP_WIN)
namespace mozilla {
namespace toolkit {
namespace system {
namespace windowsDHCPClient {
extern const mozilla::Module kSysDHCPClientModule;
}
} // namespace system
} // namespace toolkit
} // namespace mozilla
#endif
#if defined(MOZ_WIDGET_ANDROID)
extern const mozilla::Module kBrowserModule;
#endif
#if defined(MOZ_LAYOUT_DEBUGGER) && !defined(MOZ_WIDGET_ANDROID)
extern const mozilla::Module kLayoutDebugModule;
#endif
#if defined(MOZ_CODE_COVERAGE)
extern const mozilla::Module kCodeCoverageModule;
#endif
static mozilla::Module const* const* end(AllStaticModules& _) {
return &__stop_kPStaticModules;
}
static nsTArray<const mozilla::Module*>* sExtraStaticModules;
/* static */
void nsComponentManagerImpl::InitializeStaticModules() {
@ -486,13 +447,36 @@ nsresult nsComponentManagerImpl::Init() {
nsCategoryManager::GetSingleton()->SuppressNotifications(true);
RegisterModule(&kXPCOMModule);
for (auto module : AllStaticModules()) {
if (module) { // On local Windows builds, the list may contain null
// pointers from padding.
RegisterModule(module);
}
}
RegisterModule(&kNeckoModule);
RegisterModule(&kParserModule);
#if defined(XP_WIN) || defined(MOZ_WIDGET_COCOA) || defined(MOZ_WIDGET_ANDROID)
RegisterModule(&kSpeechSynthModule);
#endif
RegisterModule(&kPowerManagerModule);
RegisterModule(&kContentProcessWidgetModule);
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_COCOA) || defined(MOZ_WIDGET_UIKIT)
RegisterModule(&kWidgetModule);
#endif
RegisterModule(&kLayoutModule);
RegisterModule(&mozilla::kLocalCertServiceModule);
RegisterModule(&kKeyValueModule);
RegisterModule(&kXREModule);
RegisterModule(&kEmbeddingModule);
#if defined(XP_WIN) || defined(MOZ_WIDGET_COCOA) || defined(MOZ_WIDGET_ANDROID)
RegisterModule(&kSysProxyModule);
#endif
#if defined(XP_WIN)
RegisterModule(&mozilla::toolkit::system::windowsDHCPClient::kSysDHCPClientModule);
#endif
#if defined(MOZ_WIDGET_ANDROID)
RegisterModule(&kBrowserModule);
#endif
#if defined(MOZ_LAYOUT_DEBUGGER) && !defined(MOZ_WIDGET_ANDROID)
RegisterModule(&kLayoutDebugModule);
#endif
#if defined(MOZ_CODE_COVERAGE)
RegisterModule(&kCodeCoverageModule);
#endif
for (uint32_t i = 0; i < sExtraStaticModules->Length(); ++i) {
RegisterModule((*sExtraStaticModules)[i]);