Bug 1365194 - Remove MOZ_JEMALLOC_API from _malloc_options and _malloc_message. r?njn
MOZ_JEMALLOC_API makes those symbols exported, but we're going to make
MOZ_JEMALLOC_API include `extern "C"`, which GCC warns about in this
case (can't use extern on a variable that is initialized).
While we could get around this in some way, there is not much use for
those variables being exported altogether: the only reason they are is
to allow an override when linking mozjemalloc into executables, but
doing that in Firefox requires patching the build system or passing some
specific LDFLAGS. People who really need to do that might as well apply
a patch.
They also allow run-time override through LD_PRELOAD, but one might as
well use the MALLOC_OPTIONS environment variable for _malloc_options.
As for _malloc_message, it doesn't seem very useful to override, and
probably noone ever overrode it at runtime.
Note, we may want to remove them in a followup.
--- a/memory/mozjemalloc/jemalloc.c
+++ b/memory/mozjemalloc/jemalloc.c
@@ -1072,17 +1072,16 @@ static malloc_spinlock_t arenas_lock; /*
static __thread arena_t *arenas_map;
#endif
#endif
/*******************************/
/*
* Runtime configuration options.
*/
-MOZ_JEMALLOC_API
const char *_malloc_options = MOZ_MALLOC_OPTIONS;
#ifndef MALLOC_PRODUCTION
static bool opt_abort = true;
static bool opt_junk = true;
static bool opt_poison = true;
static bool opt_zero = false;
#else
@@ -1269,17 +1268,16 @@ wrtmessage(const char *p1, const char *p
if (_write(STDERR_FILENO, p2, (unsigned int) strlen(p2)) < 0)
return;
if (_write(STDERR_FILENO, p3, (unsigned int) strlen(p3)) < 0)
return;
if (_write(STDERR_FILENO, p4, (unsigned int) strlen(p4)) < 0)
return;
}
-MOZ_JEMALLOC_API
void (*_malloc_message)(const char *p1, const char *p2, const char *p3,
const char *p4) = wrtmessage;
#include "mozilla/Assertions.h"
#include "mozilla/Attributes.h"
#include "mozilla/TaggedAnonymousMemory.h"
// Note: MozTaggedAnonymousMmap() could call an LD_PRELOADed mmap
// instead of the one defined here; use only MozTagAnonymousMemory().