Bug 1299159 - Stop exporting *_NSModule from xul.dll, r?glandium
MozReview-Commit-ID: HXxC5Ogquxn
--- 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