Bug 1299159 - Stop exporting *_NSModule from xul.dll, r=glandium
☠☠ backed out by 9b827786ca68 ☠ ☠
authorBenjamin Smedberg <benjamin@smedbergs.us>
Wed, 31 Aug 2016 12:48:52 -0400
changeset 312349 58b07057fe252182816957e68fa23267d43dcadd
parent 312348 74cc0bbb8928ee39dc9a99202eee91afa7ede8a5
child 312350 c4d0a934472960be184bee8048a99c9c8c1d65a1
push id20447
push userkwierso@gmail.com
push dateFri, 02 Sep 2016 20:36:44 +0000
treeherderfx-team@969397f22187 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1299159
milestone51.0a1
Bug 1299159 - Stop exporting *_NSModule from xul.dll, r=glandium MozReview-Commit-ID: HXxC5Ogquxn
toolkit/library/libxul.mk
xpcom/components/Module.h
--- a/toolkit/library/libxul.mk
+++ b/toolkit/library/libxul.mk
@@ -48,17 +48,17 @@ ifneq (OpenBSD,$(OS_TARGET))
 ifneq (WINNT,$(OS_TARGET))
 ifdef LD_IS_BFD
 OS_LDFLAGS += $(topsrcdir)/toolkit/library/StaticXULComponents.ld
 endif
 endif
 endif
 
 ifdef _MSC_VER
-get_first_and_last = dumpbin -exports $1 | grep _NSModule@@ | sort -k 3 | sed -n 's/^.*?\([^@]*\)@@.*$$/\1/;1p;$$p'
+get_first_and_last = dumpbin -section:rodata -map $1 | grep _NSModule@@ | sort -k 2 | sed -n 's/^.*?\([^@]*\)@@.*$$/\1/;1p;$$p'
 else
 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
--- a/xpcom/components/Module.h
+++ b/xpcom/components/Module.h
@@ -130,24 +130,24 @@ struct Module
 
 } // namespace mozilla
 
 #if defined(MOZILLA_INTERNAL_API)
 #  define NSMODULE_NAME(_name) _name##_NSModule
 #  if defined(_MSC_VER)
 #    pragma section(".kPStaticModules$M", read)
 #    pragma comment(linker, "/merge:.kPStaticModules=.rdata")
-#    define NSMODULE_SECTION __declspec(allocate(".kPStaticModules$M"), dllexport)
+#    define NSMODULE_SECTION __declspec(allocate(".kPStaticModules$M"))
 #  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))
+#      define NSMODULE_SECTION __attribute__((section(".kPStaticModules")))
 #    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