Bug 940208 - Unbreak mingw after bug 938437. r=glandium
authorJacek Caban <jacek@codeweavers.com>
Wed, 27 Aug 2014 16:16:49 +0200
changeset 223609 d504471b2b1ecdc60d00dff3b84437b4302a7714
parent 223608 32ef143d0c9b3802521a2056cdaa0600899294d6
child 223610 9a12ddb46882bb90823ddd2b854fca5f05eff5ef
push id3979
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 16:35:44 +0000
treeherdermozilla-beta@30f2cc610691 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs940208, 938437
milestone34.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 940208 - Unbreak mingw after bug 938437. r=glandium
toolkit/library/libxul.mk
xpcom/components/Module.h
--- a/toolkit/library/libxul.mk
+++ b/toolkit/library/libxul.mk
@@ -40,24 +40,26 @@ endif
 # 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.
 ifneq (OpenBSD,$(OS_TARGET))
+ifneq (WINNT,$(OS_TARGET))
 ifdef LD_IS_BFD
 OS_LDFLAGS += $(topsrcdir)/toolkit/library/StaticXULComponents.ld
 endif
 endif
+endif
 
-ifeq (WINNT,$(OS_TARGET))
+ifdef _MSC_VER
 get_first_and_last = dumpbin -exports $1 | grep _NSModule@@ | sort -k 3 | sed -n 's/^.*?\([^@]*\)@@.*$$/\1/;1p;$$p'
 else
-get_first_and_last = $(TOOLCHAIN_PREFIX)nm -g $1 | grep _NSModule$$ | sort | sed -n 's/^.* _*\([^ ]*\)$$/\1/;1p;$$p'
+get_first_and_last = $(TOOLCHAIN_PREFIX)nm -g $1 | grep _NSModule$$ | grep -vw refptr | sort | sed -n 's/^.* _*\([^ ]*\)$$/\1/;1p;$$p'
 endif
 
 LOCAL_CHECKS = test "$$($(get_first_and_last) | xargs echo)" != "start_kPStaticModules_NSModule end_kPStaticModules_NSModule" && echo "NSModules are not ordered appropriately" && exit 1 || exit 0
 
 ifeq (Linux,$(OS_ARCH))
 LOCAL_CHECKS += ; test "$$($(TOOLCHAIN_PREFIX)readelf -l $1 | awk '$1 == "LOAD" { t += 1 } END { print t }')" -le 1 && echo "Only one PT_LOAD segment" && exit 1 || exit 0
 endif
--- a/xpcom/components/Module.h
+++ b/xpcom/components/Module.h
@@ -122,16 +122,18 @@ struct Module
 #    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("protected")))
 #    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
 #  define NSMODULE_DEFN(_name) extern NSMODULE_SECTION mozilla::Module const *const NSMODULE_NAME(_name)
 #else
 #  define NSMODULE_NAME(_name) NSModule