Bug 1139357 - Make jemalloc3's --without-export actually work. r=njn
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 05 Mar 2015 17:45:54 +0900
changeset 232577 56f1a3605429c9b4f8a6e54d720eb3f6aa499829
parent 232576 beed1c584a2264aab11aa41484083ba49ba4c0ab
child 232578 d8e71284931bbbb03d81d66fc21f69a3f7fd1dc6
push id56611
push usermh@glandium.org
push dateTue, 10 Mar 2015 01:02:34 +0000
treeherdermozilla-inbound@f1902c4276e1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnjn
bugs1139357
milestone39.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 1139357 - Make jemalloc3's --without-export actually work. r=njn
memory/jemalloc/0008-Make-without-export-actually-work.patch
memory/jemalloc/src/include/jemalloc/internal/jemalloc_internal_defs.h.in
memory/jemalloc/src/include/jemalloc/jemalloc_macros.h.in
memory/jemalloc/update.sh
new file mode 100644
--- /dev/null
+++ b/memory/jemalloc/0008-Make-without-export-actually-work.patch
@@ -0,0 +1,60 @@
+From 7c46fd59cce6afb14cdc6c819f662b6e81638f84 Mon Sep 17 00:00:00 2001
+From: Mike Hommey <mh@glandium.org>
+Date: Wed, 4 Mar 2015 21:48:01 +0900
+Subject: [PATCH] Make --without-export actually work
+
+9906660 added a --without-export configure option to avoid exporting
+jemalloc symbols, but the option didn't actually work.
+---
+ include/jemalloc/internal/jemalloc_internal_defs.h.in |  6 ++++++
+ include/jemalloc/jemalloc_macros.h.in                 | 14 +++++++++-----
+ 2 files changed, 15 insertions(+), 5 deletions(-)
+
+diff --git a/include/jemalloc/internal/jemalloc_internal_defs.h.in b/include/jemalloc/internal/jemalloc_internal_defs.h.in
+index 0f0db8a..191abc5 100644
+--- a/include/jemalloc/internal/jemalloc_internal_defs.h.in
++++ b/include/jemalloc/internal/jemalloc_internal_defs.h.in
+@@ -232,4 +232,10 @@
+ /* Adaptive mutex support in pthreads. */
+ #undef JEMALLOC_HAVE_PTHREAD_MUTEX_ADAPTIVE_NP
+ 
++/*
++ * If defined, jemalloc symbols are not exported (doesn't work when
++ * JEMALLOC_PREFIX is not defined).
++ */
++#undef JEMALLOC_EXPORT
++
+ #endif /* JEMALLOC_INTERNAL_DEFS_H_ */
+diff --git a/include/jemalloc/jemalloc_macros.h.in b/include/jemalloc/jemalloc_macros.h.in
+index 7d1dcf4..72f2a08 100644
+--- a/include/jemalloc/jemalloc_macros.h.in
++++ b/include/jemalloc/jemalloc_macros.h.in
+@@ -32,16 +32,20 @@
+ 
+ #ifdef JEMALLOC_HAVE_ATTR
+ #  define JEMALLOC_ATTR(s) __attribute__((s))
+-#  define JEMALLOC_EXPORT JEMALLOC_ATTR(visibility("default"))
++#  ifndef JEMALLOC_EXPORT
++#    define JEMALLOC_EXPORT JEMALLOC_ATTR(visibility("default"))
++#  endif
+ #  define JEMALLOC_ALIGNED(s) JEMALLOC_ATTR(aligned(s))
+ #  define JEMALLOC_SECTION(s) JEMALLOC_ATTR(section(s))
+ #  define JEMALLOC_NOINLINE JEMALLOC_ATTR(noinline)
+ #elif _MSC_VER
+ #  define JEMALLOC_ATTR(s)
+-#  ifdef DLLEXPORT
+-#    define JEMALLOC_EXPORT __declspec(dllexport)
+-#  else
+-#    define JEMALLOC_EXPORT __declspec(dllimport)
++#  ifndef JEMALLOC_EXPORT
++#    ifdef DLLEXPORT
++#      define JEMALLOC_EXPORT __declspec(dllexport)
++#    else
++#      define JEMALLOC_EXPORT __declspec(dllimport)
++#    endif
+ #  endif
+ #  define JEMALLOC_ALIGNED(s) __declspec(align(s))
+ #  define JEMALLOC_SECTION(s) __declspec(allocate(s))
+-- 
+2.3.0.4.g34b1174
+
--- a/memory/jemalloc/src/include/jemalloc/internal/jemalloc_internal_defs.h.in
+++ b/memory/jemalloc/src/include/jemalloc/internal/jemalloc_internal_defs.h.in
@@ -233,9 +233,15 @@
 #undef JEMALLOC_GLIBC_MALLOC_HOOK
 
 /* glibc memalign hook. */
 #undef JEMALLOC_GLIBC_MEMALIGN_HOOK
 
 /* Adaptive mutex support in pthreads. */
 #undef JEMALLOC_HAVE_PTHREAD_MUTEX_ADAPTIVE_NP
 
+/*
+ * If defined, jemalloc symbols are not exported (doesn't work when
+ * JEMALLOC_PREFIX is not defined).
+ */
+#undef JEMALLOC_EXPORT
+
 #endif /* JEMALLOC_INTERNAL_DEFS_H_ */
--- a/memory/jemalloc/src/include/jemalloc/jemalloc_macros.h.in
+++ b/memory/jemalloc/src/include/jemalloc/jemalloc_macros.h.in
@@ -19,26 +19,30 @@
 	 ((a < (size_t)INT_MAX) ? ffs(a)-1 : ffs(a>>32)+31)
 #  endif
 #  define MALLOCX_ZERO	((int)0x40)
 /* Bias arena index bits so that 0 encodes "MALLOCX_ARENA() unspecified". */
 #  define MALLOCX_ARENA(a)	((int)(((a)+1) << 8))
 
 #ifdef JEMALLOC_HAVE_ATTR
 #  define JEMALLOC_ATTR(s) __attribute__((s))
-#  define JEMALLOC_EXPORT JEMALLOC_ATTR(visibility("default"))
+#  ifndef JEMALLOC_EXPORT
+#    define JEMALLOC_EXPORT JEMALLOC_ATTR(visibility("default"))
+#  endif
 #  define JEMALLOC_ALIGNED(s) JEMALLOC_ATTR(aligned(s))
 #  define JEMALLOC_SECTION(s) JEMALLOC_ATTR(section(s))
 #  define JEMALLOC_NOINLINE JEMALLOC_ATTR(noinline)
 #elif _MSC_VER
 #  define JEMALLOC_ATTR(s)
-#  ifdef DLLEXPORT
-#    define JEMALLOC_EXPORT __declspec(dllexport)
-#  else
-#    define JEMALLOC_EXPORT __declspec(dllimport)
+#  ifndef JEMALLOC_EXPORT
+#    ifdef DLLEXPORT
+#      define JEMALLOC_EXPORT __declspec(dllexport)
+#    else
+#      define JEMALLOC_EXPORT __declspec(dllimport)
+#    endif
 #  endif
 #  define JEMALLOC_ALIGNED(s) __declspec(align(s))
 #  define JEMALLOC_SECTION(s) __declspec(allocate(s))
 #  define JEMALLOC_NOINLINE __declspec(noinline)
 #else
 #  define JEMALLOC_ATTR(s)
 #  define JEMALLOC_EXPORT
 #  define JEMALLOC_ALIGNED(s)
--- a/memory/jemalloc/update.sh
+++ b/memory/jemalloc/update.sh
@@ -16,13 +16,14 @@ rm -rf .git .gitignore .gitattributes au
 
 patch -p1 < ../0001-Dont-overwrite-VERSION-on-a-git-repository.patch
 patch -p1 < ../0002-Move-variable-declaration-to-the-top-its-block-for-M.patch
 patch -p1 < ../0003-Add-a-isblank-definition-for-MSVC-2013.patch
 patch -p1 < ../0004-Implement-stats.bookkeeping.patch
 patch -p1 < ../0005-Bug-1121314-Avoid-needing-the-arena-in-chunk_alloc_d.patch
 patch -p1 < ../0006-Make-opt.lg_dirty_mult-work-as-documented.patch
 patch -p1 < ../0007-Preserve-LastError-when-calling-TlsGetValue.patch
+patch -p1 < ../0008-Make-without-export-actually-work.patch
 
 cd ..
 hg addremove -q src
 
 echo "jemalloc has now been updated.  Don't forget to run hg commit!"