mozilla-jemalloc-symbols.patch
author Wolfgang Rosenauer <wr@rosenauer.org>
Wed, 24 Nov 2010 17:35:37 +0100
changeset 200 ade149166873
permissions -rw-r--r--
export jemalloc symbols from xulrunner stub to make them available in libxul
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
200
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     1
# HG changeset patch
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     2
# User Mike Hommey
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     3
# Parent 4510a9c913731464c0bc3636cd03d3f7fdb27186
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     4
Bug 611405 - Export jemalloc symbols when linking with the xpcom standalone glue and avoid crash if symbols are not available for any reason
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     5
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     6
diff --git a/build/unix/gnu-ld-scripts/jemalloc-standalone-linkage-version-script b/build/unix/gnu-ld-scripts/jemalloc-standalone-linkage-version-script
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     7
new file mode 100644
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     8
--- /dev/null
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     9
+++ b/build/unix/gnu-ld-scripts/jemalloc-standalone-linkage-version-script
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    10
@@ -0,0 +1,19 @@
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    11
+{
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    12
+   global:
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    13
+		_malloc_postfork;
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    14
+		_malloc_prefork;
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    15
+		jemalloc_stats;
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    16
+		malloc_usable_size;
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    17
+		posix_memalign;
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    18
+		free;
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    19
+		realloc;
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    20
+		calloc;
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    21
+		malloc;
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    22
+		memalign;
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    23
+		valloc;
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    24
+		__free_hook;
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    25
+		__malloc_hook;
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    26
+		__realloc_hook;
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    27
+		__memalign_hook;
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    28
+   local: *;
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    29
+};
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    30
diff --git a/config/autoconf.mk.in b/config/autoconf.mk.in
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    31
--- a/config/autoconf.mk.in
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    32
+++ b/config/autoconf.mk.in
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    33
@@ -187,16 +187,17 @@ MAKENSISU=@MAKENSISU@
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    34
 RM = rm -f
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    35
 
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    36
 # The MOZ_UI_LOCALE var is used to build a particular locale. Do *not*
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    37
 # use the var to change any binary files. Do *not* use this var unless you
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    38
 # write rules for the "clean-locale" and "locale" targets.
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    39
 MOZ_UI_LOCALE = @MOZ_UI_LOCALE@
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    40
 
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    41
 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS = @MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS@
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    42
+MOZ_JEMALLOC_STANDALONE_GLUE_LDOPTS = @MOZ_JEMALLOC_STANDALONE_GLUE_LDOPTS@
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    43
 MOZ_COMPONENT_NSPR_LIBS=@MOZ_COMPONENT_NSPR_LIBS@
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    44
 
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    45
 MOZ_FIX_LINK_PATHS=@MOZ_FIX_LINK_PATHS@
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    46
 
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    47
 XPCOM_FROZEN_LDOPTS=@XPCOM_FROZEN_LDOPTS@
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    48
 XPCOM_LIBS=@XPCOM_LIBS@
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    49
 LIBXUL_LIBS=@LIBXUL_LIBS@
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    50
 MOZ_TIMELINE=@MOZ_TIMELINE@
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    51
diff --git a/config/config.mk b/config/config.mk
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    52
--- a/config/config.mk
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    53
+++ b/config/config.mk
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    54
@@ -157,16 +157,21 @@ FINAL_LINK_COMPS = $(DEPTH)/config/final
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    55
 FINAL_LINK_COMP_NAMES = $(DEPTH)/config/final-link-comp-names
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    56
 
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    57
 MOZ_UNICHARUTIL_LIBS = $(LIBXUL_DIST)/lib/$(LIB_PREFIX)unicharutil_s.$(LIB_SUFFIX)
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    58
 MOZ_WIDGET_SUPPORT_LIBS    = $(DIST)/lib/$(LIB_PREFIX)widgetsupport_s.$(LIB_SUFFIX)
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    59
 
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    60
 ifdef MOZ_MEMORY
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    61
 ifneq (,$(filter-out WINNT WINCE,$(OS_ARCH)))
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    62
 JEMALLOC_LIBS = $(MKSHLIB_FORCE_ALL) $(call EXPAND_MOZLIBNAME,jemalloc) $(MKSHLIB_UNFORCE_ALL)
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    63
+# If we are linking jemalloc into a program, we want the jemalloc symbols
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    64
+# to be exported
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    65
+ifneq (,$(SIMPLE_PROGRAMS)$(PROGRAM))
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    66
+JEMALLOC_LIBS += $(MOZ_JEMALLOC_STANDALONE_GLUE_LDOPTS)
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    67
+endif
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    68
 endif
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    69
 endif
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    70
 
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    71
 CC := $(CC_WRAPPER) $(CC)
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    72
 CXX := $(CXX_WRAPPER) $(CXX)
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    73
 
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    74
 # determine debug-related options
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    75
 _DEBUG_CFLAGS :=
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    76
diff --git a/configure.in b/configure.in
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    77
--- a/configure.in
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    78
+++ b/configure.in
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    79
@@ -2892,21 +2892,23 @@ case "$target" in
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    80
     if test -z "$GNU_CC"; then
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    81
         NO_LD_ARCHIVE_FLAGS=
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    82
     fi
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    83
     ;;
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    84
 esac
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    85
 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    86
 
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    87
 dnl ========================================================
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    88
-dnl = Flags to strip unused symbols from .so components
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    89
+dnl = Flags to strip unused symbols from .so components and
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    90
+dnl = to export jemalloc symbols when linking a program
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    91
 dnl ========================================================
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    92
 case "$target" in
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    93
     *-linux*|*-kfreebsd*-gnu|*-gnu*)
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    94
         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    95
+        MOZ_JEMALLOC_STANDALONE_GLUE_LDOPTS='-rdynamic -Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/jemalloc-standalone-linkage-version-script'
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    96
         ;;
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    97
     *-solaris*)
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    98
         if test -z "$GNU_CC"; then
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    99
          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   100
         else
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   101
          if test -z "$GCC_USE_GNU_LD"; then
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   102
           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   103
          else
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   104
@@ -8909,16 +8911,17 @@ AC_SUBST(MOZ_USER_DIR)
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   105
 AC_SUBST(MOZ_CRASHREPORTER)
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   106
 AC_SUBST(MOZ_UPDATER)
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   107
 
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   108
 AC_SUBST(ENABLE_STRIP)
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   109
 AC_SUBST(PKG_SKIP_STRIP)
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   110
 AC_SUBST(USE_ELF_DYNSTR_GC)
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   111
 AC_SUBST(INCREMENTAL_LINKER)
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   112
 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   113
+AC_SUBST(MOZ_JEMALLOC_STANDALONE_GLUE_LDOPTS)
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   114
 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   115
 
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   116
 AC_SUBST(MOZ_FIX_LINK_PATHS)
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   117
 AC_SUBST(XPCOM_LIBS)
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   118
 AC_SUBST(XPCOM_FROZEN_LDOPTS)
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   119
 AC_SUBST(XPCOM_GLUE_LDOPTS)
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   120
 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   121
 
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   122
diff --git a/xpcom/base/nsMemoryReporterManager.cpp b/xpcom/base/nsMemoryReporterManager.cpp
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   123
--- a/xpcom/base/nsMemoryReporterManager.cpp
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   124
+++ b/xpcom/base/nsMemoryReporterManager.cpp
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   125
@@ -54,20 +54,16 @@
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   126
 #    include "jemalloc.h"
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   127
 #  elif defined(XP_LINUX)
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   128
 #    define HAVE_JEMALLOC_STATS 1
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   129
 #    include "jemalloc_types.h"
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   130
 // jemalloc is directly linked into firefox-bin; libxul doesn't link
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   131
 // with it.  So if we tried to use jemalloc_stats directly here, it
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   132
 // wouldn't be defined.  Instead, we don't include the jemalloc header
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   133
 // and weakly link against jemalloc_stats.
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   134
-//
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   135
-// NB: we don't null-check this symbol at runtime because we expect it
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   136
-// to have been resolved.  If it hasn't, the crash jumping to NULL
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   137
-// will indicate the bug.
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   138
 extern "C" {
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   139
 extern void jemalloc_stats(jemalloc_stats_t* stats)
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   140
   NS_VISIBILITY_DEFAULT __attribute__((weak));
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   141
 }
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   142
 #  endif  // XP_LINUX
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   143
 #endif  // MOZ_MEMORY
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   144
 
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   145
 #if HAVE_JEMALLOC_STATS
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   146
@@ -214,16 +210,20 @@ NS_MEMORY_REPORTER_IMPLEMENT(Win32Privat
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   147
  ** nsMemoryReporterManager implementation
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   148
  **/
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   149
 
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   150
 NS_IMPL_ISUPPORTS1(nsMemoryReporterManager, nsIMemoryReporterManager)
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   151
 
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   152
 NS_IMETHODIMP
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   153
 nsMemoryReporterManager::Init()
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   154
 {
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   155
+#if HAVE_JEMALLOC_STATS && defined(XP_LINUX)
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   156
+    if (!jemalloc_stats)
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   157
+        return NS_ERROR_FAILURE;
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   158
+#endif
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   159
     /*
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   160
      * Register our core reporters
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   161
      */
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   162
 #define REGISTER(_x)  RegisterReporter(new NS_MEMORY_REPORTER_NAME(_x))
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   163
 
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   164
     /*
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   165
      * Register our core jemalloc/malloc reporters
ade149166873 export jemalloc symbols from xulrunner stub to make them available in libxul
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   166
      */