Bug 1481633 Resolve kPStaticModules undefined symbols in MinGW Clang r=glandium

clang can handle MSVC-like codepaths generally, so we want to use those
when building with clang for Windows. So we switch _MSC_VER over to _WIN32
to pick up those codepaths when compiling for Windows with clang.

Additionally, we relax the ordering of sections for the same scenario.

Note that we do need to tell clang to use -fms-extensions with the MSVC code,
we do that in the mingw clang build job patch.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Tom Ritter 2018-09-11 03:20:06 +00:00
Родитель 0f09d86a83
Коммит 26dbd4d795
3 изменённых файлов: 7 добавлений и 4 удалений

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

@ -222,8 +222,11 @@ def check_nsmodules(target, binary):
# MSVC linker, when doing incremental linking, adds padding when # MSVC linker, when doing incremental linking, adds padding when
# merging sections. Allow there to be more space between the NSModule # merging sections. Allow there to be more space between the NSModule
# symbols, as long as they are in the right order. # symbols, as long as they are in the right order.
if buildconfig.substs.get('_MSC_VER') and \ test_msvc = (buildconfig.substs.get('_MSC_VER') and \
buildconfig.substs.get('DEVELOPER_OPTIONS'): 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 sym_cmp = lambda guessed, actual: guessed <= actual
else: else:
sym_cmp = lambda guessed, actual: guessed == actual sym_cmp = lambda guessed, actual: guessed == actual

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

@ -133,7 +133,7 @@ struct Module
#if defined(MOZILLA_INTERNAL_API) #if defined(MOZILLA_INTERNAL_API)
# define NSMODULE_NAME(_name) _name##_NSModule # define NSMODULE_NAME(_name) _name##_NSModule
# if defined(_MSC_VER) # if defined(_MSC_VER) || (defined(__clang__) && defined(__MINGW32__))
# pragma section(".kPStaticModules$M", read) # pragma section(".kPStaticModules$M", read)
# pragma comment(linker, "/merge:.kPStaticModules=.rdata") # pragma comment(linker, "/merge:.kPStaticModules=.rdata")
# define NSMODULE_SECTION __declspec(allocate(".kPStaticModules$M"), dllexport) # define NSMODULE_SECTION __declspec(allocate(".kPStaticModules$M"), dllexport)

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

@ -280,7 +280,7 @@ static nsTArray<const mozilla::Module*>* sExtraStaticModules;
// Dummy class to define a range-iterator for the static modules. // Dummy class to define a range-iterator for the static modules.
class AllStaticModules {}; class AllStaticModules {};
#if defined(_MSC_VER) #if defined(_MSC_VER) || (defined(__clang__) && defined(__MINGW32__))
# pragma section(".kPStaticModules$A", read) # pragma section(".kPStaticModules$A", read)
NSMODULE_ASAN_BLACKLIST __declspec(allocate(".kPStaticModules$A"), dllexport) NSMODULE_ASAN_BLACKLIST __declspec(allocate(".kPStaticModules$A"), dllexport)